Moved configfile.c and .h to shared/
Made reporting more general by making syslog appname settable.
This commit is contained in:
@@ -92,6 +92,13 @@ UpKey=Up
|
||||
DownKey=Down
|
||||
|
||||
|
||||
[lcdexec]
|
||||
menucommand="Do a df,df"
|
||||
menucommand="inet open,inet open"
|
||||
menucommand="inet close,inet close"
|
||||
|
||||
|
||||
|
||||
# Driver sections are below this line, in alphabetical order
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
SUBDIRS=drivers commands
|
||||
sbin_PROGRAMS=LCDd
|
||||
LCDd_SOURCES= client.c client.h clients.c clients.h input.c input.h main.c main.h menuitem.c menuitem.h menu.c menu.h menuscreens.c menuscreens.h parse.c parse.h render.c render.h screen.c screen.h screenlist.c screenlist.h serverscreens.c serverscreens.h sock.c sock.h widget.c widget.h configfile.c configfile.h drivers.c drivers.h driver.c driver.h
|
||||
LCDd_SOURCES= client.c client.h clients.c clients.h input.c input.h main.c main.h menuitem.c menuitem.h menu.c menu.h menuscreens.c menuscreens.h parse.c parse.h render.c render.h screen.c screen.h screenlist.c screenlist.h serverscreens.c serverscreens.h sock.c sock.h widget.c widget.h drivers.c drivers.h driver.c driver.h
|
||||
LCDd_LDADD = ../shared/libLCDstuff.a commands/libLCDcommands.a
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@
|
||||
#include "screenlist.h" /* for timer */
|
||||
|
||||
#include "shared/report.h"
|
||||
#include "configfile.h"
|
||||
#include "shared/configfile.h"
|
||||
|
||||
#include "widget.h"
|
||||
#include "driver.h"
|
||||
|
||||
+2
-1
@@ -24,11 +24,12 @@
|
||||
|
||||
#include "shared/LL.h"
|
||||
#include "shared/report.h"
|
||||
#include "configfile.h"
|
||||
#include "shared/configfile.h"
|
||||
|
||||
#include "drivers.h"
|
||||
#include "driver.h"
|
||||
#include "drivers/lcd.h"
|
||||
#include "widget.h"
|
||||
/* lcd.h is used for the driver API definition */
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -48,7 +48,7 @@ extern int optind, optopt, opterr;
|
||||
#include "serverscreens.h"
|
||||
#include "menuscreens.h"
|
||||
#include "input.h"
|
||||
#include "configfile.h"
|
||||
#include "shared/configfile.h"
|
||||
#include "drivers.h"
|
||||
#include "main.h"
|
||||
|
||||
@@ -189,7 +189,7 @@ main (int argc, char **argv)
|
||||
|
||||
/* Set reporting values*/
|
||||
/*debug_level = reportLevel; */
|
||||
ESSENTIAL( set_reporting( reportLevel, (reportToSyslog?RPT_DEST_SYSLOG:RPT_DEST_STDERR) ) );
|
||||
ESSENTIAL( set_reporting( "LCDd", reportLevel, (reportToSyslog?RPT_DEST_SYSLOG:RPT_DEST_STDERR) ) );
|
||||
report( RPT_NOTICE, "Set report level to %d, output to %s", reportLevel, (reportToSyslog?"syslog":"stderr") );
|
||||
|
||||
/* Startup the server*/
|
||||
@@ -782,7 +782,7 @@ exit_program (int val)
|
||||
reportLevel = DEFAULT_REPORTLEVEL;
|
||||
if( reportToSyslog == UNSET_INT )
|
||||
reportLevel = DEFAULT_REPORTLEVEL;
|
||||
set_reporting( reportLevel, (reportToSyslog?RPT_DEST_SYSLOG:RPT_DEST_STDERR) );
|
||||
set_reporting( "LCDd", reportLevel, (reportToSyslog?RPT_DEST_SYSLOG:RPT_DEST_STDERR) );
|
||||
|
||||
goodbye_screen (); /* display goodbye screen on LCD display */
|
||||
drivers_unload_all (); /* release driver memory and file descriptors */
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "screen.h"
|
||||
#include "screenlist.h"
|
||||
#include "menuscreens.h"
|
||||
#include "configfile.h"
|
||||
#include "shared/configfile.h"
|
||||
#include "shared/report.h"
|
||||
#include "input.h"
|
||||
#include "driver.h"
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "widget.h"
|
||||
#include "screenlist.h"
|
||||
#include "screen.h"
|
||||
#include "menuscreens.h"
|
||||
#include "main.h"
|
||||
#include "render.h"
|
||||
|
||||
|
||||
+3
-2
@@ -9,6 +9,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "screen.h"
|
||||
/* These headers are placed here on purpose ! (circular references) */
|
||||
|
||||
#ifndef WIDGET_H
|
||||
#define WIDGET_H
|
||||
|
||||
@@ -41,8 +44,6 @@ typedef struct Widget {
|
||||
//LinkedList *kids; /* Frames can contain more widgets...*/
|
||||
} Widget;
|
||||
|
||||
#include "screen.h"
|
||||
|
||||
#define WID_MAX_DIR 4
|
||||
|
||||
/* Create new widget */
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
noinst_LIBRARIES = libLCDstuff.a
|
||||
libLCDstuff_a_SOURCES = LL.c LL.h sockets.c sockets.h str.c str.h debug.h report.c report.h snprintf.c snprintf.h
|
||||
libLCDstuff_a_SOURCES = LL.c LL.h sockets.c sockets.h str.c str.h configfile.c configfile.h debug.h report.c report.h snprintf.c snprintf.h
|
||||
|
||||
+2
-3
@@ -48,7 +48,6 @@ void report( const int level, const char *format, .../*args*/ )
|
||||
va_list ap;
|
||||
va_start(ap, format); /* measure the required size (the number of elements of format) */
|
||||
|
||||
|
||||
switch( report_dest ) {
|
||||
case RPT_DEST_STDERR:
|
||||
vfprintf( stderr, format, ap );
|
||||
@@ -68,7 +67,7 @@ void report( const int level, const char *format, .../*args*/ )
|
||||
}
|
||||
|
||||
|
||||
int set_reporting( int new_level, int new_dest )
|
||||
int set_reporting( char *application_name, int new_level, int new_dest )
|
||||
{
|
||||
if( new_level < RPT_CRIT || new_level > RPT_DEBUG ) {
|
||||
report( RPT_ERR, "debug level invalid: %d", new_level );
|
||||
@@ -76,7 +75,7 @@ int set_reporting( int new_level, int new_dest )
|
||||
}
|
||||
|
||||
if( report_dest != RPT_DEST_SYSLOG && new_dest == RPT_DEST_SYSLOG ) {
|
||||
openlog( "LCDd", 0, LOG_USER );
|
||||
openlog( application_name, 0, LOG_USER );
|
||||
}
|
||||
else if( report_dest == RPT_DEST_SYSLOG && new_dest != RPT_DEST_SYSLOG ) {
|
||||
closelog();
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@
|
||||
extern int report_level;
|
||||
extern int report_dest;
|
||||
|
||||
int set_reporting( int new_level, int new_dest );
|
||||
int set_reporting( char *application_name, int new_level, int new_dest );
|
||||
// Sets reporting level and message destination.
|
||||
|
||||
void report( const int level, const char *format, .../*args*/ );
|
||||
|
||||
Reference in New Issue
Block a user