1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-28 21:19:10 +00:00

cpp-ify read_tcp.c

This commit is contained in:
Nikolas Garofil 2010-02-09 02:02:00 +01:00
parent d0646bc4bb
commit 9544239a19
3 changed files with 8 additions and 16 deletions

View File

@ -36,7 +36,7 @@ endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/build.h)
set(conky_sources colours.cc combine.cc common.cc conky.cc core.cc
diskio.cc entropy.cc exec.cc fs.cc mail.cc mixer.cc net_stat.cc template.cc
mboxscan.cc read_tcp.c scroll.cc specials.cc tailhead.cc
mboxscan.cc read_tcp.cc scroll.cc specials.cc tailhead.cc
temphelper.cc text_object.c timeinfo.c top.cc algebra.c prioqueue.c proc.c
user.c)

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*
@ -33,7 +33,7 @@
#include "text_object.h"
#include <netdb.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unistd.h>
#include <netinet/in.h>
@ -46,10 +46,10 @@ void parse_read_tcp_arg(struct text_object *obj, const char *arg, void *free_at_
{
struct read_tcp_data *rtd;
rtd = malloc(sizeof(struct read_tcp_data));
rtd = (struct read_tcp_data *) malloc(sizeof(struct read_tcp_data));
memset(rtd, 0, sizeof(struct read_tcp_data));
rtd->host = malloc(text_buffer_size);
rtd->host = (char *) malloc(text_buffer_size);
sscanf(arg, "%s", rtd->host);
sscanf(arg+strlen(rtd->host), "%u", &(rtd->port));
if(rtd->port == 0) {
@ -70,7 +70,7 @@ void print_read_tcp(struct text_object *obj, char *p, int p_max_size)
struct hostent* he;
fd_set readfds;
struct timeval tv;
struct read_tcp_data *rtd = obj->data.opaque;
struct read_tcp_data *rtd = (struct read_tcp_data *) obj->data.opaque;
if (!rtd)
return;
@ -104,7 +104,7 @@ void print_read_tcp(struct text_object *obj, char *p, int p_max_size)
void free_read_tcp(struct text_object *obj)
{
struct read_tcp_data *rtd = obj->data.opaque;
struct read_tcp_data *rtd = (struct read_tcp_data *) obj->data.opaque;
if (!rtd)
return;

View File

@ -31,16 +31,8 @@
#ifndef _READ_TCP_H
#define _READ_TCP_H
#ifdef __cplusplus
extern "C" {
#endif
void parse_read_tcp_arg(struct text_object *, const char *, void *);
void print_read_tcp(struct text_object *, char *, int);
void free_read_tcp(struct text_object *);
#ifdef __cplusplus
}
#endif
#endif /* _READ_TCP_H */