[lcd4linux @ 2006-08-17 19:11:40 by harbaum]

Small plugin_kvv bugfixes and new abbreviate option

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@699 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
This commit is contained in:
harbaum
2006-08-17 19:11:41 +00:00
parent c732a81a4b
commit bf149d6092
5 changed files with 3498 additions and 4934 deletions

View File

@@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am. # Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -16,6 +16,8 @@
# Process this file with automake to produce Makefile.in # Process this file with automake to produce Makefile.in
SOURCES = $(lcd4linux_SOURCES) $(EXTRA_lcd4linux_SOURCES)
srcdir = @srcdir@ srcdir = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
@@ -44,9 +46,9 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
TODO config.guess config.sub depcomp install-sh missing \ TODO config.guess config.sub depcomp install-sh missing \
mkinstalldirs mkinstalldirs
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/curses.m4 $(top_srcdir)/python.m4 \ am__aclocal_m4_deps = $(top_srcdir)/curses.m4 $(top_srcdir)/curses.m4 \
$(top_srcdir)/drivers.m4 $(top_srcdir)/plugins.m4 \ $(top_srcdir)/python.m4 $(top_srcdir)/drivers.m4 \
$(top_srcdir)/configure.in $(top_srcdir)/plugins.m4 $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -116,7 +118,6 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@ ECHO_T = @ECHO_T@
EGREP = @EGREP@ EGREP = @EGREP@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -142,12 +143,12 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@ SHELL = @SHELL@
STRIP = @STRIP@ STRIP = @STRIP@
VERSION = @VERSION@ VERSION = @VERSION@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@ X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@ X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_CC = @ac_ct_CC@ ac_ct_CC = @ac_ct_CC@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@ am__include = @am__include@
@@ -158,26 +159,19 @@ am__untar = @am__untar@
bindir = @bindir@ bindir = @bindir@
build_alias = @build_alias@ build_alias = @build_alias@
datadir = @datadir@ datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
host_alias = @host_alias@ host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@ includedir = @includedir@
infodir = @infodir@ infodir = @infodir@
install_sh = @install_sh@ install_sh = @install_sh@
libdir = @libdir@ libdir = @libdir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@ localstatedir = @localstatedir@
mandir = @mandir@ mandir = @mandir@
mkdir_p = @mkdir_p@ mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@ oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@ sysconfdir = @sysconfdir@

5
aclocal.m4 vendored
View File

@@ -1,4 +1,4 @@
# generated automatically by aclocal 1.9.6 -*- Autoconf -*- # generated automatically by aclocal 1.9.5 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005 Free Software Foundation, Inc. # 2005 Free Software Foundation, Inc.
@@ -28,7 +28,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
# Call AM_AUTOMAKE_VERSION so it can be traced. # Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.9.6])]) [AM_AUTOMAKE_VERSION([1.9.5])])
# AM_AUX_DIR_EXPAND -*- Autoconf -*- # AM_AUX_DIR_EXPAND -*- Autoconf -*-
@@ -888,3 +888,4 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar]) AC_SUBST([am__untar])
]) # _AM_PROG_TAR ]) # _AM_PROG_TAR
m4_include([curses.m4])

View File

@@ -470,18 +470,15 @@
#undef inline #undef inline
#endif #endif
/* Define to `long int' if <sys/types.h> does not define. */ /* Define to `long' if <sys/types.h> does not define. */
#undef off_t #undef off_t
/* Define to `int' if <sys/types.h> does not define. */ /* Define to `int' if <sys/types.h> does not define. */
#undef pid_t #undef pid_t
/* Define to `unsigned int' if <sys/types.h> does not define. */ /* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t #undef size_t
/* Define to `int' if <sys/types.h> does not define. */
#undef ssize_t
/* Define to `int' if <sys/types.h> doesn't define. */ /* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t #undef uid_t

8347
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* $Id: plugin_kvv.c,v 1.5 2006/08/16 14:18:14 reinelt Exp $ /* $Id: plugin_kvv.c,v 1.6 2006/08/17 19:11:41 harbaum Exp $
* *
* plugin kvv (karlsruher verkehrsverbund) * plugin kvv (karlsruher verkehrsverbund)
* *
@@ -23,6 +23,9 @@
* *
* *
* $Log: plugin_kvv.c,v $ * $Log: plugin_kvv.c,v $
* Revision 1.6 2006/08/17 19:11:41 harbaum
* Small plugin_kvv bugfixes and new abbreviate option
*
* Revision 1.5 2006/08/16 14:18:14 reinelt * Revision 1.5 2006/08/16 14:18:14 reinelt
* T6963 enhancements: soft timing, DualScan, Cell size * T6963 enhancements: soft timing, DualScan, Cell size
* *
@@ -89,7 +92,7 @@
/* total max values to calculate shm size */ /* total max values to calculate shm size */
#define MAX_LINES 4 #define MAX_LINES 4
#define MAX_LINE_LENGTH 8 #define MAX_LINE_LENGTH 8
#define MAX_STATION_LENGTH 32 #define MAX_STATION_LENGTH 40
typedef struct { typedef struct {
char line[MAX_LINE_LENGTH + 1]; char line[MAX_LINE_LENGTH + 1];
@@ -107,6 +110,7 @@ static char *proxy_name = NULL;
static int port = 80; static int port = 80;
static pid_t pid = -1; static pid_t pid = -1;
static int refresh = 60; static int refresh = 60;
static int abbreviate = 0;
static int initialized = 0; static int initialized = 0;
static int mutex = 0; static int mutex = 0;
@@ -127,6 +131,7 @@ static int get_element(char *input, char *name, char **data)
// search entire string // search entire string
while (*input) { while (*input) {
if (skip == 0) { if (skip == 0) {
switch (state) { switch (state) {
case 0: case 0:
@@ -150,7 +155,7 @@ static int get_element(char *input, char *name, char **data)
case 2: case 2:
if (*input == ' ') { if (*input == ' ') {
*data = ++input; *data = ++input;
while (*input++ != '>') while (*input && (*input++ != '>'))
len++; len++;
return len; return len;
@@ -163,6 +168,7 @@ static int get_element(char *input, char *name, char **data)
input++; input++;
} }
return -1; return -1;
} }
@@ -343,15 +349,18 @@ static void process_station_string(char *str)
} }
*q++ = 0; *q++ = 0;
/* replace certain (long) words with e.g. abbreviations */ /* replace certain (long) words with e.g. abbreviations if enabled */
for (i = 0; i < (int) (sizeof(repl) / (2 * sizeof(char *))); i++) { if (abbreviate) {
if ((p = strstr(str, repl[2 * i])) != NULL) {
/* move new string */ for (i = 0; i < (int) (sizeof(repl) / (2 * sizeof(char *))); i++) {
memcpy(p, repl[2 * i + 1], strlen(repl[2 * i + 1])); if ((p = strstr(str, repl[2 * i])) != NULL) {
/* move rest of string down */
memmove(p + strlen(repl[2 * i + 1]), /* move new string */
p + strlen(repl[2 * i]), strlen(str) - (p - str) - strlen(repl[2 * i]) + 1); memcpy(p, repl[2 * i + 1], strlen(repl[2 * i + 1]));
/* move rest of string down */
memmove(p + strlen(repl[2 * i + 1]),
p + strlen(repl[2 * i]), strlen(str) - (p - str) - strlen(repl[2 * i]) + 1);
}
} }
} }
} }
@@ -359,7 +368,7 @@ static void process_station_string(char *str)
static void kvv_client( __attribute__ ((unused)) static void kvv_client( __attribute__ ((unused))
void *dummy) void *dummy)
{ {
char ibuffer[4096]; char ibuffer[8192];
char obuffer[1024]; char obuffer[1024];
int count, i, sock; int count, i, sock;
@@ -385,7 +394,7 @@ static void kvv_client( __attribute__ ((unused))
if (snprintf(obuffer, sizeof(obuffer), if (snprintf(obuffer, sizeof(obuffer),
"GET http://%s" HTTP_REQUEST " HTTP/1.1\n" "GET http://%s" HTTP_REQUEST " HTTP/1.1\n"
"Host: %s\n" "User-Agent: " USER_AGENT "\n\n", server_name, station_id, "Host: %s\n" "User-Agent: " USER_AGENT "\n\n", server_name, station_id,
server_name) >= sizeof(obuffer)) { server_name) >= (int) sizeof(obuffer)) {
info("[KVV] Warning, request has been truncated!"); info("[KVV] Warning, request has been truncated!");
} }
@@ -420,6 +429,9 @@ static void kvv_client( __attribute__ ((unused))
ibuffer[count] = 0; // terminate string ibuffer[count] = 0; // terminate string
close(sock); close(sock);
if (!count)
info("[KVV] empty/no reply");
if (count > 0) { if (count > 0) {
char *input, *cookie, *name, *value; char *input, *cookie, *name, *value;
int input_len, cookie_len, name_len, value_len; int input_len, cookie_len, name_len, value_len;
@@ -485,7 +497,7 @@ static void kvv_client( __attribute__ ((unused))
"Content-Length: %d\n" "Content-Length: %d\n"
"\n%s=%s", "\n%s=%s",
server_name, station_id, server_name, cookie, name_len + value_enc_len + 1, name, server_name, station_id, server_name, cookie, name_len + value_enc_len + 1, name,
value_enc) >= sizeof(obuffer)) { value_enc) >= (int) sizeof(obuffer)) {
info("[KVV] Warning, request has been truncated!"); info("[KVV] Warning, request has been truncated!");
} }
@@ -514,11 +526,14 @@ static void kvv_client( __attribute__ ((unused))
ibuffer[count] = 0; ibuffer[count] = 0;
// printf("Result (%d):\n%s\n", count, ibuffer); // printf("Result (%d):\n%s\n", count, ibuffer);
/* close connection */ /* close connection */
close(sock); close(sock);
if (!count)
info("[KVV] empty/no reply");
if (count > 0) { if (count > 0) {
int last_was_stop = 0; int last_was_stop = 0;
char *td = ibuffer; char *td = ibuffer;
@@ -533,6 +548,7 @@ static void kvv_client( __attribute__ ((unused))
if (strstr(ibuffer, "Die Daten konnten nicht abgefragt werden.") != NULL) { if (strstr(ibuffer, "Die Daten konnten nicht abgefragt werden.") != NULL) {
info("[KVV] Server returned error!"); info("[KVV] Server returned error!");
// printf("%s\n", ibuffer);
shm->error = 1; shm->error = 1;
} else } else
shm->error = 0; shm->error = 0;
@@ -768,6 +784,13 @@ int plugin_init_kvv(void)
info("[KVV] Using default refresh interval of %d seconds", refresh); info("[KVV] Using default refresh interval of %d seconds", refresh);
} }
if (cfg_number(SECTION, "Abbreviate", 0, 0, 65535, &val) > 0) {
abbreviate = val;
info("[KVV] Abbreviation enabled: %s", abbreviate ? "on" : "off");
} else {
info("[KVV] Default abbreviation setting: %s", abbreviate ? "on" : "off");
}
return 0; return 0;
} }