Fixed problems on systems using newer GLIB and GCC (2.96) which no

longer allow the -Wp,-lang-c-c++-comments directive.  Also cleaned
up getloadavg support that had problems on Solaris and RedHat 7.1.
Removed unused variables in a number of functions as a result of
warnings when compiled with --enable-debug config option.
This commit is contained in:
ppokorny
2001-05-15 01:55:59 +00:00
parent 3e4ce08d43
commit 3fff6381b0
17 changed files with 110 additions and 60 deletions
+15 -2
View File
@@ -4,9 +4,22 @@
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <sys/time.h>
#include "../../shared/sockets.h" #ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#include "shared/sockets.h"
#include "main.h" #include "main.h"
#include "mode.h" #include "mode.h"
+16 -7
View File
@@ -4,16 +4,26 @@
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include "../../shared/sockets.h" #ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#if defined( HAVE_GETLOADAVG ) && defined( HAVE_SYS_LOADAVG_H )
# define USE_GETLOADAVG
#else
# undef USE_GETLOADAVG
#endif
#include "shared/sockets.h"
#include "main.h" #include "main.h"
#include "mode.h" #include "mode.h"
#include "load.h" #include "load.h"
#ifdef HAVE_GETLOADAVG #ifdef USE_GETLOADAVG
# include <sys/loadavg.h> # include <sys/loadavg.h>
#endif #endif
int loadavg_fd = 0; int loadavg_fd = 0;
static double get_loadavg (void); static double get_loadavg (void);
@@ -22,11 +32,11 @@ static double
get_loadavg (void) get_loadavg (void)
{ {
double load; double load;
#ifdef HAVE_GETLOADAVG #ifdef USE_GETLOADAVG
double loadavg[LOADAVG_NSTATS]; double loadavg[LOADAVG_NSTATS];
#endif #endif
#ifndef HAVE_GETLOADAVG #ifndef USE_GETLOADAVG
reread (loadavg_fd, "get_load:"); reread (loadavg_fd, "get_load:");
sscanf (buffer, "%lf", &load); sscanf (buffer, "%lf", &load);
#else #else
@@ -39,7 +49,7 @@ get_loadavg (void)
int int
load_init () load_init ()
{ {
#ifndef SOLARIS #ifndef USE_GETLOADAVG
if (!loadavg_fd) if (!loadavg_fd)
loadavg_fd = open ("/proc/loadavg", O_RDONLY); loadavg_fd = open ("/proc/loadavg", O_RDONLY);
#endif #endif
@@ -49,12 +59,11 @@ load_init ()
int int
load_close () load_close ()
{ {
#ifndef SOLARIS #ifndef USE_GETLOADAVG
if (loadavg_fd) if (loadavg_fd)
close (loadavg_fd); close (loadavg_fd);
loadavg_fd = 0; loadavg_fd = 0;
#endif #endif
return 0; return 0;
} }
+2 -3
View File
@@ -2,7 +2,6 @@
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/time.h>
#include <termios.h> #include <termios.h>
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
@@ -15,8 +14,8 @@
#include "main.h" #include "main.h"
#include "mode.h" #include "mode.h"
#include "../../shared/sockets.h" #include "shared/sockets.h"
#include "../../shared/debug.h" #include "shared/debug.h"
// TODO: Commenting... Everything! // TODO: Commenting... Everything!
-2
View File
@@ -34,8 +34,6 @@ static void get_mem_info (struct meminfo *result);
static void static void
get_mem_info (struct meminfo *result) get_mem_info (struct meminfo *result)
{ {
// int i, res; char *bufptr;
int pagesize,page;
#ifndef SOLARIS #ifndef SOLARIS
reread (meminfo_fd, "get_meminfo:"); reread (meminfo_fd, "get_meminfo:");
+10 -11
View File
@@ -6,17 +6,20 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#ifdef IRIX
#include <strings.h>
#endif
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <time.h>
#include <sys/time.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include "../../shared/sockets.h" #include <string.h>
#if defined( IRIX ) || defined( SOLARIS )
# include <strings.h>
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "shared/sockets.h"
#include "mode.h" #include "mode.h"
#include "main.h" #include "main.h"
@@ -29,10 +32,6 @@
#include "load.h" #include "load.h"
#include "mem.h" #include "mem.h"
#ifdef SOLARIS
#include <strings.h>
#endif
int ELLIPSIS = '-'; int ELLIPSIS = '-';
// TODO: Clean this up... Support multiple display sizes.. // TODO: Clean this up... Support multiple display sizes..
+2 -2
View File
@@ -27,7 +27,7 @@ if test $debug = "yes"; then
else else
CFLAGS="-Wno-unused -O6" CFLAGS="-Wno-unused -O6"
fi fi
CFLAGS="-Wall -Wp,-lang-c-c++-comments $CFLAGS" CFLAGS="-Wall $CFLAGS"
export CFLAGS export CFLAGS
dnl Checks for programs. dnl Checks for programs.
@@ -48,7 +48,7 @@ AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect)])
AC_CHECK_FUNC(inet_aton,,[AC_CHECK_LIB(resolv,inet_aton)]) AC_CHECK_FUNC(inet_aton,,[AC_CHECK_LIB(resolv,inet_aton)])
AC_CHECK_LIB(kstat, kstat_open) AC_CHECK_LIB(kstat, kstat_open)
AC_CHECK_FUNCS(getloadavg swapctl) AC_CHECK_FUNCS(getloadavg swapctl)
AC_CHECK_HEADERS(procfs.h sys/procfs.h, break) AC_CHECK_HEADERS(procfs.h sys/procfs.h sys/loadavg.h)
dnl Some versions of Solaris require -lelf for -lkvm dnl Some versions of Solaris require -lelf for -lkvm
AC_CHECK_LIB(kvm, kvm_open,[ AC_CHECK_LIB(kvm, kvm_open,[
+14 -2
View File
@@ -11,12 +11,24 @@
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <sys/errno.h> #include <sys/errno.h>
#include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#include "lcd.h" #include "lcd.h"
#include "bayrad.h" #include "bayrad.h"
#include "drv_base.h" #include "drv_base.h"
#include "../../shared/str.h" #include "shared/str.h"
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////////////////////// Base "class" to derive from /////////////////////// ////////////////////// Base "class" to derive from ///////////////////////
+1 -1
View File
@@ -37,7 +37,7 @@ curses_drv_init (struct lcd_logical_driver *driver, char *args)
{ {
char *argv[64]; char *argv[64];
int argc; int argc;
int i, j; int i;
argc = get_args (argv, args, 64); argc = get_args (argv, args, 64);
+14 -1
View File
@@ -5,10 +5,23 @@
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <sys/errno.h> #include <sys/errno.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#if TIME_WITH_SYS_TIME
# include <sys/time.h> # include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#include "lcd.h" #include "lcd.h"
#include "../../shared/str.h" #include "shared/str.h"
#include "glk.h" #include "glk.h"
#include "glkproto.h" #include "glkproto.h"
+1 -1
View File
@@ -57,6 +57,6 @@ int glkgetc( GLKDisplay * fd );
int glkpoll( GLKDisplay * fd, int timeout ); int glkpoll( GLKDisplay * fd, int timeout );
int glkflow( GLKDisplay * fd, int full, int empty ); int glkflow( GLKDisplay * fd, int full, int empty );
static int glkunget( GLKDisplay * fd, int c ); int glkunget( GLKDisplay * fd, int c );
#endif #endif
+14 -3
View File
@@ -37,6 +37,9 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <sys/perm.h> #include <sys/perm.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
// Uncomment one of the lines below to select your desired delay generation // Uncomment one of the lines below to select your desired delay generation
// mechanism. If both defines are commented, the original I/O read timing // mechanism. If both defines are commented, the original I/O read timing
@@ -45,8 +48,17 @@
#define DELAY_NANOSLEEP #define DELAY_NANOSLEEP
#if defined DELAY_GETTIMEOFDAY #if defined DELAY_GETTIMEOFDAY
# if TIME_WITH_SYS_TIME
# include <sys/time.h> # include <sys/time.h>
#include <unistd.h> # include <time.h>
# else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
# endif
// Only one alternate delay method at a time, please ;-) // Only one alternate delay method at a time, please ;-)
# undef DELAY_NANOSLEEP # undef DELAY_NANOSLEEP
#elif defined DELAY_NANOSLEEP #elif defined DELAY_NANOSLEEP
@@ -178,7 +190,6 @@ HD44780_init (lcd_logical_driver * driver, char *args)
connIdx = j; connIdx = j;
++i; ++i;
} else if (0 == strcmp (argv[i], "-v") || 0 == strcmp (argv[i], "--vspan")) { } else if (0 == strcmp (argv[i], "-v") || 0 == strcmp (argv[i], "--vspan")) {
int j = 0;
if (i + 1 >= argc) { if (i + 1 >= argc) {
fprintf (stderr, "HD44780_init: %s requires an argument\n", argv[i]); fprintf (stderr, "HD44780_init: %s requires an argument\n", argv[i]);
return -1; return -1;
@@ -810,7 +821,7 @@ parse_span_list (int *spanListArray[], int *spLsize, int *dispOffsets[], int *dO
for (++j; spanlist[j] < '1' || spanlist[j] > '9'; ++j); for (++j; spanlist[j] < '1' || spanlist[j] > '9'; ++j);
} else { } else {
fprintf (stderr, "Error reallocing for span list\n"); fprintf (stderr, "Error reallocing for span list\n");
retVal - 1; retVal = -1;
} }
} else { } else {
fprintf (stderr, "Error reading spansize\n"); fprintf (stderr, "Error reading spansize\n");
+1 -3
View File
@@ -8,8 +8,6 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/types.h> #include <sys/types.h>
#define __u32 unsigned int
#define __u8 unsigned char
#include <linux/joystick.h> #include <linux/joystick.h>
#include "../../shared/debug.h" #include "../../shared/debug.h"
@@ -50,7 +48,7 @@ joy_init (struct lcd_logical_driver *driver, char *args)
{ {
char device[256]; char device[256];
char *argv[64]; char *argv[64];
int argc, i, j; int argc, i;
joy = driver; joy = driver;
+2 -2
View File
@@ -70,10 +70,9 @@ main (int argc, char **argv)
{ {
// TODO: Use a config file! // TODO: Use a config file!
//char cfgfile[256] = "/etc/LCDd.cf"; //char cfgfile[256] = "/etc/LCDd.cf";
int i, err, tmp; int i, err;
int daemon_mode = 1; int daemon_mode = 1;
int disable_server_screen = 1; int disable_server_screen = 1;
int child;
screen *s = NULL; screen *s = NULL;
char *str, *ing; // strings for commandline handling char *str, *ing; // strings for commandline handling
// screen_size *size = &sizes[0]; // No longer needed // screen_size *size = &sizes[0]; // No longer needed
@@ -100,6 +99,7 @@ main (int argc, char **argv)
// Now, go into daemon mode... // Now, go into daemon mode...
#ifndef DEBUG #ifndef DEBUG
if (daemon_mode) { if (daemon_mode) {
int child;
if ((child = fork ()) != 0) { if ((child = fork ()) != 0) {
usleep (1500000); // Wait for child to initialize usleep (1500000); // Wait for child to initialize
exit (0); /* PARENT EXITS */ exit (0); /* PARENT EXITS */
-1
View File
@@ -28,7 +28,6 @@
#include "menu.h" #include "menu.h"
// FIXME: Implement this where it is supposed to be... // FIXME: Implement this where it is supposed to be...
#include <time.h>
void void
framedelay () framedelay ()
{ {
+10 -10
View File
@@ -1,13 +1,12 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <time.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#include "../shared/debug.h" #include "shared/debug.h"
#include "drivers/lcd.h" #include "drivers/lcd.h"
@@ -152,20 +151,21 @@ no_screen_screen (int timer)
int int
goodbye_screen () goodbye_screen ()
{ {
char char *b20 = " ";
*b20 = " ", *t20 = " Thanks for using ", char *t20 = " Thanks for using ";
#ifdef LINUX #ifdef LINUX
*l20 = " LCDproc and Linux! ", char *l20 = " LCDproc and Linux! ";
#else #else
*l20 = " LCDproc! ", char *l20 = " LCDproc! ";
#endif #endif
*b16 = " ", *t16 = "Thanks for using",
char *b16 = " ";
char *t16 = "Thanks for using";
#ifdef LINUX #ifdef LINUX
*l16 = " LCDproc+Linux! ", char *l16 = " LCDproc+Linux! ";
#else #else
*l16 = " LCDproc! ", char *l16 = " LCDproc! ";
#endif #endif
*nil = "";
lcd.clear (); lcd.clear ();
+2 -2
View File
@@ -13,10 +13,10 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <fcntl.h> #include <fcntl.h>
#include "../shared/sockets.h" #include "shared/sockets.h"
#include "sock.h" #include "sock.h"
#include "clients.h" #include "clients.h"
#include "../shared/debug.h" #include "shared/debug.h"
/************************************************** /**************************************************
LCDproc sockets code... LCDproc sockets code...
-1
View File
@@ -5,7 +5,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
#include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>