aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-01-06 22:33:14 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-01-06 22:33:14 +0000
commitcb237ec8bae76a6f621fc0ec704e87f9163274cd (patch)
tree79a366df2c0214f969015352166e78dfb6f4d9fe
parent28c2ce96d4b42524200e7ceced98a505f9a166ea (diff)
downloadlcd4linux-cb237ec8bae76a6f621fc0ec704e87f9163274cd.tar.gz
[lcd4linux @ 2004-01-06 22:33:13 by reinelt]
Copyright statements cleaned up git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@293 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--AUTHORS17
-rw-r--r--HD44780.c14
-rw-r--r--MilfordInstruments.c10
-rw-r--r--USBLCD.c7
-rw-r--r--XWindow.c7
-rw-r--r--battery.c7
-rw-r--r--battery.h7
-rw-r--r--debian/copyright17
-rwxr-xr-ximon.c839
-rwxr-xr-ximon.h61
-rw-r--r--plugin_xmms.c7
-rw-r--r--seti.c7
-rw-r--r--wifi.c7
-rw-r--r--wifi.h7
14 files changed, 542 insertions, 472 deletions
diff --git a/AUTHORS b/AUTHORS
index 228750e..082b5eb 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,5 +1,18 @@
LCD4Linux development team:
Michael Reinelt <reinelt@eunet.at>
-Herbert Rosmanith <herp@wildsau.idv-edu.uni-linz.ac.at>
-Leo Tötsch <lt@toetsch.at>
+Herbert Rosmanith <herp@wildsau.idv.uni-linz.ac.at>
+Leopold Tötsch <lt@toetsch.at>
+Axel Ehnert <axel@ehnert.net>
+Andrew Ip <aip@cwlinux.com>
+Robin Adams, Adams IT Services <info@usblcd.de>
+Xavier Vello <xavier66@free.fr>
+Martin Hejl (martin@hejl.de)
+Jesse Brook Kovach <jkovach@wam.umd.edu>
+Nico Wallmeier <nico.wallmeier@post.rwth-aachen.de>
+Luis F. Correia <luis.f.correia@seg-social.pt>
+Patrick Schemitz <schemitz@ekp.physik.uni-karlsruhe.de>
+Andy Baxter <andy@earthsong.free-online.co.uk>
+Thomas Siedentopf <thom-s@gmx.net>
+Markus Keil <markus_keil@t-online.de>
+Samuel Mimram <samuel.mimram@ens-lyon.fr>
diff --git a/HD44780.c b/HD44780.c
index 23b8c9b..09c3086 100644
--- a/HD44780.c
+++ b/HD44780.c
@@ -1,17 +1,16 @@
-/* $Id: HD44780.c,v 1.47 2003/11/12 05:42:35 reinelt Exp $
+/* $Id: HD44780.c,v 1.48 2004/01/06 22:33:13 reinelt Exp $
*
* driver for display modules based on the HD44780 chip
*
- * Copyright 1999, 2000 Michael Reinelt <reinelt@eunet.at>
- *
- * This file is part of LCD4Linux.
+ * Copyright 1999-2004 Michael Reinelt <reinelt@eunet.at>
*
* Modification for 4-Bit mode
- * 2003 Martin Hejl (martin@hejl.de)
+ * Copyright 2003 Martin Hejl (martin@hejl.de)
*
* Modification for 2nd controller support
- * 2003 Jesse Brook Kovach <jkovach@wam.umd.edu>
+ * Copyright 2003 Jesse Brook Kovach <jkovach@wam.umd.edu>
*
+ * This file is part of LCD4Linux.
*
* LCD4Linux is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,6 +28,9 @@
*
*
* $Log: HD44780.c,v $
+ * Revision 1.48 2004/01/06 22:33:13 reinelt
+ * Copyright statements cleaned up
+ *
* Revision 1.47 2003/11/12 05:42:35 reinelt
* small changes to the 16x4 handling
*
diff --git a/MilfordInstruments.c b/MilfordInstruments.c
index 2818e26..6ef5558 100644
--- a/MilfordInstruments.c
+++ b/MilfordInstruments.c
@@ -1,11 +1,12 @@
-/* $Id: MilfordInstruments.c,v 1.3 2003/10/08 13:39:53 andy-b Exp $
+/* $Id: MilfordInstruments.c,v 1.4 2004/01/06 22:33:13 reinelt Exp $
*
* driver for Milford Instruments 'BPK' piggy-back serial interface board
* for standard Hitachi 44780 compatible lcd modules.
*
- * Written 2003 by Andy Baxter <andy@earthsong.free-online.co.uk>
+ * Copyright 2003 Andy Baxter <andy@earthsong.free-online.co.uk>
*
- * based on the MatrixOrbital driver by M. Reinelt
+ * based on the MatrixOrbital driver which is
+ * Copyright 1999, 2000 Michael Reinelt <reinelt@eunet.at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,6 +24,9 @@
*
*
* $Log: MilfordInstruments.c,v $
+ * Revision 1.4 2004/01/06 22:33:13 reinelt
+ * Copyright statements cleaned up
+ *
* Revision 1.3 2003/10/08 13:39:53 andy-b
* Cleaned up code in MilfordInstruments.c, and added descriptions for other display sizes (untested)
*
diff --git a/USBLCD.c b/USBLCD.c
index 9d4e598..56b22b2 100644
--- a/USBLCD.c
+++ b/USBLCD.c
@@ -1,11 +1,11 @@
-/* $Id: USBLCD.c,v 1.18 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: USBLCD.c,v 1.19 2004/01/06 22:33:14 reinelt Exp $
*
* Driver for USBLCD (see http://www.usblcd.de)
*
* Copyright 2002 Robin Adams, Adams IT Services <info@usblcd.de>
*
* This driver is based on HD44780.c, which is
- * Copyright 1999, 2000 by Michael Reinelt <reinelt@eunet.at>
+ * Copyright 1999, 2000 Michael Reinelt <reinelt@eunet.at>
*
* This file is part of LCD4Linux.
*
@@ -25,6 +25,9 @@
*
*
* $Log: USBLCD.c,v $
+ * Revision 1.19 2004/01/06 22:33:14 reinelt
+ * Copyright statements cleaned up
+ *
* Revision 1.18 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
diff --git a/XWindow.c b/XWindow.c
index d186964..fdcaf89 100644
--- a/XWindow.c
+++ b/XWindow.c
@@ -1,8 +1,8 @@
-/* $Id: XWindow.c,v 1.36 2003/10/22 04:32:25 reinelt Exp $
+/* $Id: XWindow.c,v 1.37 2004/01/06 22:33:14 reinelt Exp $
*
* X11 Driver for LCD4Linux
*
- * Copyright 2000 Herbert Rosmanith <herp@widsau.idv.uni-linz.ac.at>
+ * Copyright 2000 Herbert Rosmanith <herp@wildsau.idv.uni-linz.ac.at>
*
* This file is part of LCD4Linux.
*
@@ -22,6 +22,9 @@
*
*
* $Log: XWindow.c,v $
+ * Revision 1.37 2004/01/06 22:33:14 reinelt
+ * Copyright statements cleaned up
+ *
* Revision 1.36 2003/10/22 04:32:25 reinelt
* fixed icon bug found by Rob van Nieuwkerk
*
diff --git a/battery.c b/battery.c
index 93975be..6688b5e 100644
--- a/battery.c
+++ b/battery.c
@@ -1,8 +1,8 @@
-/* $Id: battery.c,v 1.4 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: battery.c,v 1.5 2004/01/06 22:33:14 reinelt Exp $
*
* APM and ACPI specific functions
*
- * Copyright 2001 Leo Tötsch <lt@toetsch.at>
+ * Copyright 2001 Leopold Tötsch <lt@toetsch.at>
*
* This file is part of LCD4Linux.
*
@@ -22,6 +22,9 @@
*
*
* $Log: battery.c,v $
+ * Revision 1.5 2004/01/06 22:33:14 reinelt
+ * Copyright statements cleaned up
+ *
* Revision 1.4 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
diff --git a/battery.h b/battery.h
index 53148d1..6b2e055 100644
--- a/battery.h
+++ b/battery.h
@@ -1,8 +1,8 @@
-/* $Id: battery.h,v 1.3 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: battery.h,v 1.4 2004/01/06 22:33:14 reinelt Exp $
*
* APM and ACPI specific functions
*
- * Copyright 2001 Leo Tötsch <lt@toetsch.at>
+ * Copyright 2001 Leopold Tötsch <lt@toetsch.at>
*
* This file is part of LCD4Linux.
*
@@ -22,6 +22,9 @@
*
*
* $Log: battery.h,v $
+ * Revision 1.4 2004/01/06 22:33:14 reinelt
+ * Copyright statements cleaned up
+ *
* Revision 1.3 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
diff --git a/debian/copyright b/debian/copyright
index c723157..93dca9e 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -6,7 +6,24 @@ It was downloaded from http://lcd4linux.sourceforge.net/
Upstream Author: Michael Reinelt <reinelt@eunet.at>
Copyright: 1999-2004
+The LCD4Linux Development Team <lcd4linux-devel@lists.sourceforge.net>
Michael Reinelt <reinelt@eunet.at>
+Herbert Rosmanith <herp@wildsau.idv.uni-linz.ac.at>
+Leopold Tötsch <lt@toetsch.at>
+Axel Ehnert <axel@ehnert.net>
+Andrew Ip <aip@cwlinux.com>
+Robin Adams, Adams IT Services <info@usblcd.de>
+Xavier Vello <xavier66@free.fr>
+Martin Hejl (martin@hejl.de)
+Jesse Brook Kovach <jkovach@wam.umd.edu>
+Nico Wallmeier <nico.wallmeier@post.rwth-aachen.de>
+Luis F. Correia <luis.f.correia@seg-social.pt>
+Patrick Schemitz <schemitz@ekp.physik.uni-karlsruhe.de>
+Andy Baxter <andy@earthsong.free-online.co.uk>
+Thomas Siedentopf <thom-s@gmx.net>
+Markus Keil <markus_keil@t-online.de>
+Samuel Mimram <samuel.mimram@ens-lyon.fr>
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/imon.c b/imon.c
index 4f70ac0..1f34766 100755
--- a/imon.c
+++ b/imon.c
@@ -1,7 +1,9 @@
-/* $Id: imon.c,v 1.1 2003/10/12 06:08:28 nicowallmeier Exp $
+/* $Id: imon.c,v 1.2 2004/01/06 22:33:14 reinelt Exp $
*
* imond/telmond data processing
*
+ * Copyright 2003 Nico Wallmeier <nico.wallmeier@post.rwth-aachen.de>
+ *
* This file is part of LCD4Linux.
*
* LCD4Linux is free software; you can redistribute it and/or modify
@@ -20,423 +22,426 @@
*
*
* $Log: imon.c,v $
+ * Revision 1.2 2004/01/06 22:33:14 reinelt
+ * Copyright statements cleaned up
+ *
* Revision 1.1 2003/10/12 06:08:28 nicowallmeier
* imond/telmond support
*
*/
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <linux/errno.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <time.h>
-
-#include <netdb.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h> /* decl of inet_addr() */
-#include <sys/socket.h>
-
-#include "cfg.h"
-#include "debug.h"
-#include "parser.h"
-#include "imon.h"
-
-#define TRUE 1
-#define FALSE 0
-
-static int fd;
-
- /*----------------------------------------------------------------------------
- * service_connect (host_name, port) - connect to tcp-service
- *----------------------------------------------------------------------------
- */
-static int
-service_connect (char * host_name, int port)
-{
- struct sockaddr_in addr;
- struct hostent * host_p;
- int fd;
- int opt = 1;
-
- (void) memset ((char *) &addr, 0, sizeof (addr));
-
- if ((addr.sin_addr.s_addr = inet_addr ((char *) host_name)) == INADDR_NONE)
- {
- host_p = gethostbyname (host_name);
-
- if (! host_p)
- {
- error ("%s: host not found\n", host_name);
- return (-1);
- }
-
- (void) memcpy ((char *) (&addr.sin_addr), host_p->h_addr,
- host_p->h_length);
- }
-
- addr.sin_family = AF_INET;
- addr.sin_port = htons ((unsigned short) port);
-
- if ((fd = socket (AF_INET, SOCK_STREAM, 0)) < 0)
- { /* open socket */
- perror ("socket");
- return (-1);
- }
-
- (void) setsockopt (fd, IPPROTO_TCP, TCP_NODELAY,
- (char *) &opt, sizeof (opt));
-
- if (connect (fd, (struct sockaddr *) &addr, sizeof (addr)) != 0)
- {
- (void) close (fd);
- perror (host_name);
- return (-1);
- }
-
- return (fd);
-} /* service_connect (char * host_name, int port) */
-
-
-/*----------------------------------------------------------------------------
- * send_command (int fd, char * str) - send command to imond
- *----------------------------------------------------------------------------
- */
-static void
-send_command (int fd, char * str)
-{
- char buf[256];
- int len = strlen (str);
-
- sprintf (buf, "%s\r\n", str);
- write (fd, buf, len + 2);
-
- return;
-} /* send_command (int fd, char * str) */
-
-
-/*----------------------------------------------------------------------------
- * get_answer (int fd) - get answer from imond
- *----------------------------------------------------------------------------
- */
-static char *
-get_answer (int fd)
-{
- static char buf[8192];
- int len;
-
- len = read (fd, buf, 8192);
-
- if (len <= 0)
- {
- return ((char *) NULL);
- }
-
- while (len > 1 && (buf[len - 1] == '\n' || buf[len - 1] == '\r'))
- {
- buf[len - 1] = '\0';
- len--;
- }
-
- if (! strncmp (buf, "OK ", 3)) /* OK xxxx */
- {
- return (buf + 3);
- }
- else if (len > 2 && ! strcmp (buf + len - 2, "OK"))
- {
- *(buf + len - 2) = '\0';
- return (buf);
- }
- else if (len == 2 && ! strcmp (buf + len - 2, "OK"))
- {
- return (buf);
- }
-
- return ((char *) NULL); /* ERR xxxx */
-} /* get_answer (int fd) */
-
-
-/*----------------------------------------------------------------------------
- * get_numerical_value (char * cmd) - send cmd, get numval
- *----------------------------------------------------------------------------
- */
-static int
-get_numerical_value (char * cmd)
-{
- char * answer;
- int rtc;
-
- send_command (fd, cmd);
-
- answer = get_answer (fd);
-
- if (answer)
- {
- rtc = atoi (answer);
- }
- else
- {
- rtc = -1;
- }
- return (rtc);
-} /* get_numerical_value (char * cmd, int arg) */
-
-
-/*----------------------------------------------------------------------------
- * get_value (char * cmd) - send command, get value
- *----------------------------------------------------------------------------
- */
-static char *
-get_value (char * cmd)
-{
- char * answer;
-
- send_command (fd, cmd);
-
- answer = get_answer (fd);
-
- if (answer)
- {
- return (answer);
- }
-
- return ("");
-} /* get_value (char * cmd, int arg) */
-
-
-int init(){
- char *s, *host;
- int port;
- int connect;
-
- host=cfg_get ("Imon_Host","127.0.0.1");
- if (*host=='\0') {
- error ("Imon: no 'Imon_Host' entry in %s", cfg_source());
- return -1;
- }
-
- if (cfg_number("Imon_Port",5000,1,65536,&port)<0){
- return -1;
- }
-
- connect=service_connect(host,port);
-
- s=cfg_get ("Imon_Pass",NULL);
- if ((s!=NULL) && (*s!='\0')) { // Passwort senden
- char buf[40];
- sprintf(buf,"pass %s",s);
- send_command(connect,buf);
- s=get_answer(connect);
- }
-
- return connect;
-}
-
-int ImonCh(int index, struct imonchannel *ch, int token_usage[]) {
- static int err[CHANNELS+1];
- char *s;
- char buf[40];
- int result=0;
-
- if (err[index]) return -1;
- if ((fd==0) && ((fd=init())<0)) return -1;
-
- if ((*ch).max_in == 0){ // not initializied
- sprintf(buf, "Imon_%d_Dev", index);
- s=cfg_get(buf,NULL);
- if (s==NULL) {
- error ("Imon: no 'Imon_%i_Dev' entry in %s", index, cfg_source());
- err[index]=1;
- return -1;
- }
- strcpy((*ch).dev,s);
-
- sprintf(buf, "Imon_%d_MaxIn", index);
- cfg_number(buf,768,1,65536,&(*ch).max_in);
-
- sprintf(buf, "Imon_%d_MaxOut", index);
- cfg_number(buf,128,1,65536,&(*ch).max_out);
- }
-
- sprintf(buf, "status %s", (*ch).dev);
- s=get_value(buf);
- strcpy((*ch).status,s);
-
- if ((1<<index) & token_usage[T_IMON_CHARGE]) {
- sprintf(buf, "charge %s", (*ch).dev);
- s=get_value(buf);
- strcpy((*ch).charge,s);
- }
-
-
- if (strcmp("Online",(*ch).status)==0){
- if ((1<<index) & token_usage[T_IMON_PHONE]) {
- sprintf(buf, "phone %s", (*ch).dev);
- s=get_value(buf);
- strcpy((*ch).phone,s);
- }
-
- if (((1<<index) & token_usage[T_IMON_RIN]) ||
- ((1<<index) & token_usage[T_IMON_ROUT])) {
- sprintf(buf, "rate %s", (*ch).dev);
- s=get_value(buf);
- if (sscanf(s,"%d %d",&((*ch).rate_in), &((*ch).rate_out))!=2) result--;
- }
-
- if ((1<<index) & token_usage[T_IMON_IP]) {
- sprintf(buf, "ip %s", (*ch).dev);
- s=get_value(buf);
- strcpy((*ch).ip,s);
- }
-
- if ((1<<index) & token_usage[T_IMON_OTIME]) {
- sprintf(buf, "online-time %s", (*ch).dev);
- s=get_value(buf);
- strcpy((*ch).otime,s);
- }
- } else {
- if (strcmp("Dialing",(*ch).status)==0){
- if ((1<<index) & token_usage[T_IMON_PHONE]) {
- sprintf(buf, "phone %s", (*ch).dev);
- s=get_value(buf);
- strcpy((*ch).phone,s);
- }
- } else {
- if ((1<<index) & token_usage[T_IMON_PHONE]) (*ch).phone[0]='\0';
- }
- if ((1<<index) & token_usage[T_IMON_IP]) (*ch).ip[0]='\0';
- if ((1<<index) & token_usage[T_IMON_OTIME]) (*ch).otime[0]='\0';
- if (((1<<index) & token_usage[T_IMON_RIN]) ||
- ((1<<index) & token_usage[T_IMON_ROUT])) {
- (*ch).rate_in=0;
- (*ch).rate_out=0;
- }
- }
- return result;
-}
-
-
-int Imon(struct imon *i, int cpu, int datetime){
- static int hb;
- static int tick;
- char *s;
- char day[4];
- char d[13];
-
- if (tick++ % 5 != 0) return 0;
-
- if ((fd==0) && ((fd=init())<0)) return -1;
-
- if (cpu) (*i).cpu = get_numerical_value("cpu");
-
- if (datetime){
- s = get_value ("date");
- sscanf (s, "%s %s %s", day, d, (*i).time);
- strncpy ((*i).date, d, 6);
- strcpy ((*i).date + 6, d + 8);
- (*i).date[2]='.';
- (*i).date[5]='.';
- if (hb) (*i).time[5] =' ';
- hb=!hb;
- }
- return 0;
-}
-
-char* ImonVer(){
- static char buffer[32]="";
-
- if (*buffer=='\0') {
- char *s;
- if ((fd==0) && ((fd=init())<0)) return "";
- s=get_value("version");
- for (;;){ // interne Versionsnummer killen
- if (s[0]==' '){
- s=s+1;
- break;
- }
- s=s+1;
- }
- strcpy(buffer,s);
- }
- return buffer;
-}
-
-void phonebook(char *number){
- FILE * fp;
- char line[256];
-
- fp = fopen (cfg_get ("Telmon_Phonebook","/etc/phonebook"), "r");
-
- if (! fp) return;
-
- while (fgets (line, 128, fp)){
- if (*line == '#') continue;
- if (!strncmp(line,number,strlen(number))){
- char *komma=strchr(line,',');
- char *beginn=strchr(line,'=');
- if (!beginn) return;
- while (strrchr(line,'\r')) strrchr(line,'\r')[0]='\0';
- while (strrchr(line,'\n')) strrchr(line,'\n')[0]='\0';
- if (komma) komma[0]='\0';
- strcpy(number,beginn+1);
- break;
- }
- }
-
- fclose(fp);
-}
-
-int Telmon(struct telmon *t){
- static int tick;
- static int telmond_fd=-2;
- static char oldanswer[128];
- static char host[256];
- static int port;
-
- if (tick++ % 50 != 0) return 0;
-
- if (telmond_fd == -2){ //not initializied
- char *s=cfg_get ("Telmon_Host","127.0.0.1");
- if (*s=='\0') {
- error ("Telmon: no 'Telmon_Host' entry in %s", cfg_source());
- telmond_fd=-1;
- return -1;
- }
- strcpy(host,s);
-
- if (cfg_number("Telmon_Port",5000,1,65536,&port)<0){
- telmond_fd=-1;
- return -1;
- }
- }
-
- if (telmond_fd != -1){
- char telbuf[128];
-
- telmond_fd = service_connect (host, port);
- if (telmond_fd >= 0){
- int l = read (telmond_fd, telbuf, 127);
- if ((l > 0) && (strcmp(telbuf,oldanswer))){
- char date[11];
- sscanf(telbuf,"%s %s %s %s",date,(*t).time,(*t).number,(*t).msn);
- date[4]='\0';
- date[7]='\0';
- sprintf((*t).date,"%s.%s.%s",date+8,date+5,date);
- phonebook((*t).number);
- phonebook((*t).msn);
- }
- close (telmond_fd);
- strcpy(oldanswer,telbuf);
- }
- }
- return 0;
-}
-
-
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <linux/errno.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <time.h>
+
+#include <netdb.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h> /* decl of inet_addr() */
+#include <sys/socket.h>
+
+#include "cfg.h"
+#include "debug.h"
+#include "parser.h"
+#include "imon.h"
+
+#define TRUE 1
+#define FALSE 0
+
+static int fd;
+
+ /*----------------------------------------------------------------------------
+ * service_connect (host_name, port) - connect to tcp-service
+ *----------------------------------------------------------------------------
+ */
+static int
+service_connect (char * host_name, int port)
+{
+ struct sockaddr_in addr;
+ struct hostent * host_p;
+ int fd;
+ int opt = 1;
+
+ (void) memset ((char *) &addr, 0, sizeof (addr));
+
+ if ((addr.sin_addr.s_addr = inet_addr ((char *) host_name)) == INADDR_NONE)
+ {
+ host_p = gethostbyname (host_name);
+
+ if (! host_p)
+ {
+ error ("%s: host not found\n", host_name);
+ return (-1);
+ }
+
+ (void) memcpy ((char *) (&addr.sin_addr), host_p->h_addr,
+ host_p->h_length);
+ }
+
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons ((unsigned short) port);
+
+ if ((fd = socket (AF_INET, SOCK_STREAM, 0)) < 0)
+ { /* open socket */
+ perror ("socket");
+ return (-1);
+ }
+
+ (void) setsockopt (fd, IPPROTO_TCP, TCP_NODELAY,
+ (char *) &opt, sizeof (opt));
+
+ if (connect (fd, (struct sockaddr *) &addr, sizeof (addr)) != 0)
+ {
+ (void) close (fd);
+ perror (host_name);
+ return (-1);
+ }
+
+ return (fd);
+} /* service_connect (char * host_name, int port) */
+
+
+/*----------------------------------------------------------------------------
+ * send_command (int fd, char * str) - send command to imond
+ *----------------------------------------------------------------------------
+ */
+static void
+send_command (int fd, char * str)
+{
+ char buf[256];
+ int len = strlen (str);
+
+ sprintf (buf, "%s\r\n", str);
+ write (fd, buf, len + 2);
+
+ return;
+} /* send_command (int fd, char * str) */
+
+
+/*----------------------------------------------------------------------------
+ * get_answer (int fd) - get answer from imond
+ *----------------------------------------------------------------------------
+ */
+static char *
+get_answer (int fd)
+{
+ static char buf[8192];
+ int len;
+
+ len = read (fd, buf, 8192);
+
+ if (len <= 0)
+ {
+ return ((char *) NULL);
+ }
+
+ while (len > 1 && (buf[len - 1] == '\n' || buf[len - 1] == '\r'))
+ {
+ buf[len - 1] = '\0';
+ len--;
+ }
+
+ if (! strncmp (buf, "OK ", 3)) /* OK xxxx */
+ {
+ return (buf + 3);
+ }
+ else if (len > 2 && ! strcmp (buf + len - 2, "OK"))
+ {
+ *(buf + len - 2) = '\0';
+ return (buf);
+ }
+ else if (len == 2 && ! strcmp (buf + len - 2, "OK"))
+ {
+ return (buf);
+ }
+
+ return ((char *) NULL); /* ERR xxxx */
+} /* get_answer (int fd) */
+
+
+/*----------------------------------------------------------------------------
+ * get_numerical_value (char * cmd) - send cmd, get numval
+ *----------------------------------------------------------------------------
+ */
+static int
+get_numerical_value (char * cmd)
+{
+ char * answer;
+ int rtc;
+
+ send_command (fd, cmd);
+
+ answer = get_answer (fd);
+
+ if (answer)
+ {
+ rtc = atoi (answer);
+ }
+ else
+ {
+ rtc = -1;
+ }
+ return (rtc);
+} /* get_numerical_value (char * cmd, int arg) */
+
+
+/*----------------------------------------------------------------------------
+ * get_value (char * cmd) - send command, get value
+ *----------------------------------------------------------------------------
+ */
+static char *
+get_value (char * cmd)
+{
+ char * answer;
+
+ send_command (fd, cmd);
+
+ answer = get_answer (fd);
+
+ if (answer)
+ {
+ return (answer);
+ }
+
+ return ("");
+} /* get_value (char * cmd, int arg) */
+
+
+int init(){
+ char *s, *host;
+ int port;
+ int connect;
+
+ host=cfg_get ("Imon_Host","127.0.0.1");
+ if (*host=='\0') {
+ error ("Imon: no 'Imon_Host' entry in %s", cfg_source());
+ return -1;
+ }
+
+ if (cfg_number("Imon_Port",5000,1,65536,&port)<0){
+ return -1;
+ }
+
+ connect=service_connect(host,port);
+
+ s=cfg_get ("Imon_Pass",NULL);
+ if ((s!=NULL) && (*s!='\0')) { // Passwort senden
+ char buf[40];
+ sprintf(buf,"pass %s",s);
+ send_command(connect,buf);
+ s=get_answer(connect);
+ }
+
+ return connect;
+}
+
+int ImonCh(int index, struct imonchannel *ch, int token_usage[]) {
+ static int err[CHANNELS+1];
+ char *s;
+ char buf[40];
+ int result=0;
+
+ if (err[index]) return -1;
+ if ((fd==0) && ((fd=init())<0)) return -1;
+
+ if ((*ch).max_in == 0){ // not initializied
+ sprintf(buf, "Imon_%d_Dev", index);
+ s=cfg_get(buf,NULL);
+ if (s==NULL) {
+ error ("Imon: no 'Imon_%i_Dev' entry in %s", index, cfg_source());
+ err[index]=1;
+ return -1;
+ }
+ strcpy((*ch).dev,s);
+
+ sprintf(buf, "Imon_%d_MaxIn", index);
+ cfg_number(buf,768,1,65536,&(*ch).max_in);
+
+ sprintf(buf, "Imon_%d_MaxOut", index);
+ cfg_number(buf,128,1,65536,&(*ch).max_out);
+ }
+
+ sprintf(buf, "status %s", (*ch).dev);
+ s=get_value(buf);
+ strcpy((*ch).status,s);
+
+ if ((1<<index) & token_usage[T_IMON_CHARGE]) {
+ sprintf(buf, "charge %s", (*ch).dev);
+ s=get_value(buf);
+ strcpy((*ch).charge,s);
+ }
+
+
+ if (strcmp("Online",(*ch).status)==0){
+ if ((1<<index) & token_usage[T_IMON_PHONE]) {
+ sprintf(buf, "phone %s", (*ch).dev);
+ s=get_value(buf);
+ strcpy((*ch).phone,s);
+ }
+
+ if (((1<<index) & token_usage[T_IMON_RIN]) ||
+ ((1<<index) & token_usage[T_IMON_ROUT])) {
+ sprintf(buf, "rate %s", (*ch).dev);
+ s=get_value(buf);
+ if (sscanf(s,"%d %d",&((*ch).rate_in), &((*ch).rate_out))!=2) result--;
+ }
+
+ if ((1<<index) & token_usage[T_IMON_IP]) {
+ sprintf(buf, "ip %s", (*ch).dev);
+ s=get_value(buf);
+ strcpy((*ch).ip,s);
+ }
+
+ if ((1<<index) & token_usage[T_IMON_OTIME]) {
+ sprintf(buf, "online-time %s", (*ch).dev);
+ s=get_value(buf);
+ strcpy((*ch).otime,s);
+ }
+ } else {
+ if (strcmp("Dialing",(*ch).status)==0){
+ if ((1<<index) & token_usage[T_IMON_PHONE]) {
+ sprintf(buf, "phone %s", (*ch).dev);
+ s=get_value(buf);
+ strcpy((*ch).phone,s);
+ }
+ } else {
+ if ((1<<index) & token_usage[T_IMON_PHONE]) (*ch).phone[0]='\0';
+ }
+ if ((1<<index) & token_usage[T_IMON_IP]) (*ch).ip[0]='\0';
+ if ((1<<index) & token_usage[T_IMON_OTIME]) (*ch).otime[0]='\0';
+ if (((1<<index) & token_usage[T_IMON_RIN]) ||
+ ((1<<index) & token_usage[T_IMON_ROUT])) {
+ (*ch).rate_in=0;
+ (*ch).rate_out=0;
+ }
+ }
+ return result;
+}
+
+
+int Imon(struct imon *i, int cpu, int datetime){
+ static int hb;
+ static int tick;
+ char *s;
+ char day[4];
+ char d[13];
+
+ if (tick++ % 5 != 0) return 0;
+
+ if ((fd==0) && ((fd=init())<0)) return -1;
+
+ if (cpu) (*i).cpu = get_numerical_value("cpu");
+
+ if (datetime){
+ s = get_value ("date");
+ sscanf (s, "%s %s %s", day, d, (*i).time);
+ strncpy ((*i).date, d, 6);
+ strcpy ((*i).date + 6, d + 8);
+ (*i).date[2]='.';
+ (*i).date[5]='.';
+ if (hb) (*i).time[5] =' ';
+ hb=!hb;
+ }
+ return 0;
+}
+
+char* ImonVer(){
+ static char buffer[32]="";
+
+ if (*buffer=='\0') {
+ char *s;
+ if ((fd==0) && ((fd=init())<0)) return "";
+ s=get_value("version");
+ for (;;){ // interne Versionsnummer killen
+ if (s[0]==' '){
+ s=s+1;
+ break;
+ }
+ s=s+1;
+ }
+ strcpy(buffer,s);
+ }
+ return buffer;
+}
+
+void phonebook(char *number){
+ FILE * fp;
+ char line[256];
+
+ fp = fopen (cfg_get ("Telmon_Phonebook","/etc/phonebook"), "r");
+
+ if (! fp) return;
+
+ while (fgets (line, 128, fp)){
+ if (*line == '#') continue;
+ if (!strncmp(line,number,strlen(number))){
+ char *komma=strchr(line,',');
+ char *beginn=strchr(line,'=');
+ if (!beginn) return;
+ while (strrchr(line,'\r')) strrchr(line,'\r')[0]='\0';
+ while (strrchr(line,'\n')) strrchr(line,'\n')[0]='\0';
+ if (komma) komma[0]='\0';
+ strcpy(number,beginn+1);
+ break;
+ }
+ }
+
+ fclose(fp);
+}
+
+int Telmon(struct telmon *t){
+ static int tick;
+ static int telmond_fd=-2;
+ static char oldanswer[128];
+ static char host[256];
+ static int port;
+
+ if (tick++ % 50 != 0) return 0;
+
+ if (telmond_fd == -2){ //not initializied
+ char *s=cfg_get ("Telmon_Host","127.0.0.1");
+ if (*s=='\0') {
+ error ("Telmon: no 'Telmon_Host' entry in %s", cfg_source());
+ telmond_fd=-1;
+ return -1;
+ }
+ strcpy(host,s);
+
+ if (cfg_number("Telmon_Port",5000,1,65536,&port)<0){
+ telmond_fd=-1;
+ return -1;
+ }
+ }
+
+ if (telmond_fd != -1){
+ char telbuf[128];
+
+ telmond_fd = service_connect (host, port);
+ if (telmond_fd >= 0){
+ int l = read (telmond_fd, telbuf, 127);
+ if ((l > 0) && (strcmp(telbuf,oldanswer))){
+ char date[11];
+ sscanf(telbuf,"%s %s %s %s",date,(*t).time,(*t).number,(*t).msn);
+ date[4]='\0';
+ date[7]='\0';
+ sprintf((*t).date,"%s.%s.%s",date+8,date+5,date);
+ phonebook((*t).number);
+ phonebook((*t).msn);
+ }
+ close (telmond_fd);
+ strcpy(oldanswer,telbuf);
+ }
+ }
+ return 0;
+}
+
+
diff --git a/imon.h b/imon.h
index 1252e9d..8e63ca0 100755
--- a/imon.h
+++ b/imon.h
@@ -1,7 +1,9 @@
-/* $Id: imon.h,v 1.1 2003/10/12 06:08:28 nicowallmeier Exp $
+/* $Id: imon.h,v 1.2 2004/01/06 22:33:14 reinelt Exp $
*
* imond/telmond data processing
*
+ * Copyright 2003 Nico Wallmeier <nico.wallmeier@post.rwth-aachen.de>
+ *
* This file is part of LCD4Linux.
*
* LCD4Linux is free software; you can redistribute it and/or modify
@@ -20,34 +22,37 @@
*
*
* $Log: imon.h,v $
+ * Revision 1.2 2004/01/06 22:33:14 reinelt
+ * Copyright statements cleaned up
+ *
* Revision 1.1 2003/10/12 06:08:28 nicowallmeier
* imond/telmond support
*
*/
-
-#ifndef _IMON_H_
-#define _IMON_H_
-
-#define CHANNELS 9
-
-struct imonchannel {
- int rate_in, rate_out, max_in, max_out;
- char status[8], phone[17], ip[16], otime[11], charge[10], dev[6];
-};
-
-struct imon {
- int cpu;
- char date[11], time[9];
-};
-
-struct telmon {
- char number[256], msn[256], time[9], date[11];
-};
-
-int Imon(struct imon *i, int cpu, int datetime);
-int ImonCh(int index, struct imonchannel *ch, int token_usage[]);
-char* ImonVer();
-
-int Telmon(struct telmon *t);
-
-#endif
+
+#ifndef _IMON_H_
+#define _IMON_H_
+
+#define CHANNELS 9
+
+struct imonchannel {
+ int rate_in, rate_out, max_in, max_out;
+ char status[8], phone[17], ip[16], otime[11], charge[10], dev[6];
+};
+
+struct imon {
+ int cpu;
+ char date[11], time[9];
+};
+
+struct telmon {
+ char number[256], msn[256], time[9], date[11];
+};
+
+int Imon(struct imon *i, int cpu, int datetime);
+int ImonCh(int index, struct imonchannel *ch, int token_usage[]);
+char* ImonVer();
+
+int Telmon(struct telmon *t);
+
+#endif
diff --git a/plugin_xmms.c b/plugin_xmms.c
index 72d2438..c01081a 100644
--- a/plugin_xmms.c
+++ b/plugin_xmms.c
@@ -1,7 +1,7 @@
-/* $Id: plugin_xmms.c,v 1.1 2003/12/19 06:27:33 reinelt Exp $
+/* $Id: plugin_xmms.c,v 1.2 2004/01/06 22:33:14 reinelt Exp $
*
* XMMS-Plugin for LCD4Linux
- * written by Markus Keil <markus_keil@t-online.de>
+ * Copyright 2003 Markus Keil <markus_keil@t-online.de>
*
* This file is part of LCD4Linux.
*
@@ -21,6 +21,9 @@
*
*
* $Log: plugin_xmms.c,v $
+ * Revision 1.2 2004/01/06 22:33:14 reinelt
+ * Copyright statements cleaned up
+ *
* Revision 1.1 2003/12/19 06:27:33 reinelt
* added XMMS plugin from Markus Keil
*
diff --git a/seti.c b/seti.c
index 938e796..c387a52 100644
--- a/seti.c
+++ b/seti.c
@@ -1,8 +1,8 @@
-/* $Id: seti.c,v 1.10 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: seti.c,v 1.11 2004/01/06 22:33:14 reinelt Exp $
*
* seti@home specific functions
*
- * Copyright 2001 Axel Ehnert <Axel@Ehnert.net>
+ * Copyright 2001 Axel Ehnert <axel@ehnert.net>
*
* This file is part of LCD4Linux.
*
@@ -22,6 +22,9 @@
*
*
* $Log: seti.c,v $
+ * Revision 1.11 2004/01/06 22:33:14 reinelt
+ * Copyright statements cleaned up
+ *
* Revision 1.10 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
diff --git a/wifi.c b/wifi.c
index 1d1116e..5984504 100644
--- a/wifi.c
+++ b/wifi.c
@@ -1,11 +1,11 @@
-/* $Id: wifi.c,v 1.3 2003/12/01 07:08:51 reinelt Exp $
+/* $Id: wifi.c,v 1.4 2004/01/06 22:33:14 reinelt Exp $
*
* WIFI specific functions
*
* Copyright 2003 Xavier Vello <xavier66@free.fr>
*
* based on lcd4linux/isdn.c which is
- * Copyright 1999, 2000 by Michael Reinelt (reinelt@eunet.at)
+ * Copyright 1999, 2000 Michael Reinelt <reinelt@eunet.at>
*
* This file is part of LCD4Linux.
*
@@ -25,6 +25,9 @@
*
*
* $Log: wifi.c,v $
+ * Revision 1.4 2004/01/06 22:33:14 reinelt
+ * Copyright statements cleaned up
+ *
* Revision 1.3 2003/12/01 07:08:51 reinelt
*
* Patches from Xavier:
diff --git a/wifi.h b/wifi.h
index 871a44b..a1b4a1f 100644
--- a/wifi.h
+++ b/wifi.h
@@ -1,11 +1,11 @@
-/* $Id: wifi.h,v 1.1 2003/11/14 05:59:37 reinelt Exp $
+/* $Id: wifi.h,v 1.2 2004/01/06 22:33:14 reinelt Exp $
*
* WIFI specific functions
*
* Copyright 2003 Xavier Vello <xavier66@free.fr>
*
* based on lcd4linux/isdn.c which is
- * Copyright 1999, 2000 by Michael Reinelt <reinelt@eunet.at>
+ * Copyright 1999, 2000 Michael Reinelt <reinelt@eunet.at>
*
* This file is part of LCD4Linux.
*
@@ -25,6 +25,9 @@
*
*
* $Log: wifi.h,v $
+ * Revision 1.2 2004/01/06 22:33:14 reinelt
+ * Copyright statements cleaned up
+ *
* Revision 1.1 2003/11/14 05:59:37 reinelt
* added wifi.c wifi.h which have been forgotten at the last checkin
*