clean up lcdproc client and add menu support (to be enabled at compile time) -

based upon patch by Andrew Foss
This commit is contained in:
marschap
2006-02-18 19:50:50 +00:00
parent d77ada0bde
commit 6bc60a92fe
20 changed files with 224 additions and 510 deletions
+1 -12
View File
@@ -71,24 +71,13 @@ battery_status(int status)
// +--------------------+ // +--------------------+
// //
int int
#ifdef LCDPROC_MENUS battery_screen (int rep, int display, int *flags_ptr)
battery_screen (int rep, int display, int * flags_ptr)
#else
battery_screen (int rep, int display)
#endif
{ {
int acstat = 0, battstat = 0, percent = 0; int acstat = 0, battstat = 0, percent = 0;
int gauge_wid = lcd_wid - 2; int gauge_wid = lcd_wid - 2;
#ifdef LCDPROC_MENUS
if ((*flags_ptr & INITIALIZED) == 0) { if ((*flags_ptr & INITIALIZED) == 0) {
*flags_ptr |= INITIALIZED; *flags_ptr |= INITIALIZED;
#else
static int first = TRUE;
if (first) {
first = FALSE;
#endif
sock_send_string (sock, "screen_add B\n"); sock_send_string (sock, "screen_add B\n");
sprintf (buffer, "screen_set B -name {APM stats: %s}\n", get_hostname()); sprintf (buffer, "screen_set B -name {APM stats: %s}\n", get_hostname());
+1 -5
View File
@@ -1,10 +1,6 @@
#ifndef BATT_H #ifndef BATT_H
#define BATT_H #define BATT_H
#ifdef LCDPROC_MENUS int battery_screen (int rep, int display, int *flags_ptr);
int battery_screen (int rep, int display, int * flags_ptr);
#else
int battery_screen (int rep, int display);
#endif
#endif #endif
+11 -66
View File
@@ -96,11 +96,7 @@ static char *shortmonths[] = {
//+--------------------+ //+--------------------+
// //
int int
#ifdef LCDPROC_MENUS time_screen (int rep, int display, int *flags_ptr)
time_screen (int rep, int display, int * flags_ptr)
#else
time_screen (int rep, int display)
#endif
{ {
char now[20]; char now[20];
char day[16], month[16]; char day[16], month[16];
@@ -111,16 +107,9 @@ time_screen (int rep, int display)
time_t thetime; time_t thetime;
struct tm *rtime; struct tm *rtime;
double uptime, idle; double uptime, idle;
#ifdef LCDPROC_MENUS
if ((*flags_ptr & INITIALIZED) == 0) { if ((*flags_ptr & INITIALIZED) == 0) {
*flags_ptr |= INITIALIZED; *flags_ptr |= INITIALIZED;
#else
static int first = TRUE;
if (first) {
first = FALSE;
#endif
sock_send_string (sock, "screen_add T\n"); sock_send_string (sock, "screen_add T\n");
sprintf (buffer, "screen_set T -name {Time Screen: %s}\n", get_hostname()); sprintf (buffer, "screen_set T -name {Time Screen: %s}\n", get_hostname());
@@ -222,11 +211,7 @@ time_screen (int rep, int display)
//+--------------------+ //+--------------------+
// //
int int
#ifdef LCDPROC_MENUS clock_screen (int rep, int display, int *flags_ptr)
clock_screen (int rep, int display, int * flags_ptr)
#else
clock_screen (int rep, int display)
#endif
{ {
char now[20]; char now[20];
char day[16], month[16]; char day[16], month[16];
@@ -235,16 +220,9 @@ clock_screen (int rep, int display)
static char colon[] = {':', ' '}; static char colon[] = {':', ' '};
time_t thetime; time_t thetime;
struct tm *rtime; struct tm *rtime;
#ifdef LCDPROC_MENUS
if ((*flags_ptr & INITIALIZED) == 0) { if ((*flags_ptr & INITIALIZED) == 0) {
*flags_ptr |= INITIALIZED; *flags_ptr |= INITIALIZED;
#else
static int first = TRUE;
if (first) {
first = FALSE;
#endif
sock_send_string (sock, "screen_add O\n"); sock_send_string (sock, "screen_add O\n");
sprintf (buffer, "screen_set O -name {Old Clock Screen: %s}\n", get_hostname()); sprintf (buffer, "screen_set O -name {Old Clock Screen: %s}\n", get_hostname());
@@ -326,27 +304,16 @@ clock_screen (int rep, int display)
//+--------------------+ //+--------------------+
// //
int int
#ifdef LCDPROC_MENUS uptime_screen (int rep, int display, int *flags_ptr)
uptime_screen (int rep, int display, int * flags_ptr)
#else
uptime_screen (int rep, int display)
#endif
{ {
int xoffs; int xoffs;
int days, hour, min, sec; int days, hour, min, sec;
double uptime, idle; double uptime, idle;
static int heartbeat = 0; static int heartbeat = 0;
static char colon[] = {':', ' '}; static char colon[] = {':', ' '};
#ifdef LCDPROC_MENUS
if ((*flags_ptr & INITIALIZED) == 0) { if ((*flags_ptr & INITIALIZED) == 0) {
*flags_ptr |= INITIALIZED; *flags_ptr |= INITIALIZED;
#else
static int first = TRUE;
if (first) {
first = FALSE;
#endif
sock_send_string (sock, "screen_add U\n"); sock_send_string (sock, "screen_add U\n");
sprintf (buffer, "screen_set U -name {Uptime Screen: %s}\n", get_hostname()); sprintf (buffer, "screen_set U -name {Uptime Screen: %s}\n", get_hostname());
@@ -413,11 +380,7 @@ uptime_screen (int rep, int display)
// +--------------------+ // +--------------------+
// //
int int
#ifdef LCDPROC_MENUS big_clock_screen (int rep, int display, int *flags_ptr)
big_clock_screen (int rep, int display, int * flags_ptr)
#else
big_clock_screen (int rep, int display)
#endif
{ {
time_t thetime; time_t thetime;
struct tm *rtime; struct tm *rtime;
@@ -432,16 +395,9 @@ big_clock_screen (int rep, int display)
// toggle colon display // toggle colon display
heartbeat ^= 1; heartbeat ^= 1;
#ifdef LCDPROC_MENUS
if ((*flags_ptr & INITIALIZED) == 0) { if ((*flags_ptr & INITIALIZED) == 0) {
*flags_ptr |= INITIALIZED; *flags_ptr |= INITIALIZED;
#else
static int first = TRUE;
if (first) {
first = FALSE;
#endif
sock_send_string (sock, "screen_add K\n"); sock_send_string (sock, "screen_add K\n");
sock_send_string (sock, "screen_set K -name {Big Clock Screen} -heartbeat off\n"); sock_send_string (sock, "screen_set K -name {Big Clock Screen} -heartbeat off\n");
@@ -490,7 +446,7 @@ big_clock_screen (int rep, int display)
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Essential Clock Screen displays the current time with hours & minutes only // Mini Clock Screen displays the current time with hours & minutes only
// //
//+--------------------+ +--------------------+ //+--------------------+ +--------------------+
//| | | 11:32 | //| | | 11:32 |
@@ -500,38 +456,27 @@ big_clock_screen (int rep, int display)
//+--------------------+ //+--------------------+
// //
int int
#ifdef LCDPROC_MENUS mini_clock_screen (int rep, int display, int *flags_ptr)
essential_clock_screen (int rep, int display, int * flags_ptr)
#else
essential_clock_screen (int rep, int display)
#endif
{ {
struct tm *rtime; struct tm *rtime;
struct timeval ttime; struct timeval ttime;
static char colon[] = {':', ' '}; static char colon[] = {':', ' '};
#ifdef LCDPROC_MENUS
if ((*flags_ptr & INITIALIZED) == 0) { if ((*flags_ptr & INITIALIZED) == 0) {
*flags_ptr |= INITIALIZED; *flags_ptr |= INITIALIZED;
#else
static int first = TRUE;
if (first) { sock_send_string (sock, "screen_add N\n");
first = FALSE; sock_send_string (sock, "screen_set N -name {Essential Clock Screen} -heartbeat off\n");
#endif sock_send_string (sock, "widget_add N one string\n");
sock_send_string (sock, "screen_add E\n");
sock_send_string (sock, "screen_set E -name {Essential Clock Screen} -heartbeat off\n");
sock_send_string (sock, "widget_add E one string\n");
} }
gettimeofday(&ttime, NULL); gettimeofday(&ttime, NULL);
rtime = localtime (&ttime.tv_sec); rtime = localtime (&ttime.tv_sec);
sprintf(tmp, "%02d%c%02d", rtime->tm_hour, colon[(ttime.tv_usec / 500000) & 1], rtime->tm_min); sprintf(tmp, "%02d%c%02d", rtime->tm_hour, colon[(ttime.tv_usec / 500000) & 1], rtime->tm_min);
sprintf(buffer, "widget_set E one %d %d {%s}\n", sprintf(buffer, "widget_set N one %d %d {%s}\n",
((lcd_wid - 5) / 2) + 1, (lcd_hgt / 2), tmp); ((lcd_wid - 5) / 2) + 1, (lcd_hgt / 2), tmp);
sock_send_string (sock, buffer); sock_send_string (sock, buffer);
return 0; return 0;
} // End essential_clock_screen() } // End mini_clock_screen()
+5 -13
View File
@@ -1,18 +1,10 @@
#ifndef CHRONO_H #ifndef CHRONO_H
#define CHRONO_H #define CHRONO_H
#ifdef LCDPROC_MENUS int clock_screen (int rep, int display, int *flags_ptr);
int clock_screen (int rep, int display, int * flags_ptr); int uptime_screen (int rep, int display, int *flags_ptr);
int uptime_screen (int rep, int display, int * flags_ptr); int time_screen (int rep, int display, int *flags_ptr);
int time_screen (int rep, int display, int * flags_ptr); int big_clock_screen (int rep, int display, int *flags_ptr);
int big_clock_screen (int rep, int display, int * flags_ptr); int mini_clock_screen (int rep, int display, int *flags_ptr);
int essential_clock_screen (int rep, int display, int * flags_ptr);
#else
int clock_screen (int rep, int display);
int uptime_screen (int rep, int display);
int time_screen (int rep, int display);
int big_clock_screen (int rep, int display);
int essential_clock_screen (int rep, int display);
#endif
#endif #endif
+2 -23
View File
@@ -29,11 +29,7 @@
// +--------------------+ // +--------------------+
// //
int int
#ifdef LCDPROC_MENUS cpu_screen(int rep, int display, int *flags_ptr)
cpu_screen(int rep, int display, int * flags_ptr)
#else
cpu_screen(int rep, int display)
#endif
{ {
#undef CPU_BUF_SIZE #undef CPU_BUF_SIZE
#define CPU_BUF_SIZE 4 #define CPU_BUF_SIZE 4
@@ -44,16 +40,9 @@ cpu_screen(int rep, int display)
int i, j, n; int i, j, n;
double value; double value;
load_type load; load_type load;
#ifdef LCDPROC_MENUS
if ((*flags_ptr & INITIALIZED) == 0) { if ((*flags_ptr & INITIALIZED) == 0) {
*flags_ptr |= INITIALIZED; *flags_ptr |= INITIALIZED;
#else
static int first = TRUE;
if (first) {
first = FALSE;
#endif
sock_send_string(sock, "screen_add C\n"); sock_send_string(sock, "screen_add C\n");
sprintf(buffer, "screen_set C -name {CPU Use: %s}\n", get_hostname()); sprintf(buffer, "screen_set C -name {CPU Use: %s}\n", get_hostname());
@@ -218,11 +207,7 @@ cpu_screen(int rep, int display)
// +--------------------+ // +--------------------+
// //
int int
#ifdef LCDPROC_MENUS cpu_graph_screen(int rep, int display, int *flags_ptr)
cpu_graph_screen(int rep, int display, int * flags_ptr)
#else
cpu_graph_screen(int rep, int display)
#endif
{ {
#undef CPU_BUF_SIZE #undef CPU_BUF_SIZE
#define CPU_BUF_SIZE 2 #define CPU_BUF_SIZE 2
@@ -233,16 +218,10 @@ cpu_graph_screen(int rep, int display)
int i, n = 0; int i, n = 0;
double value ; double value ;
load_type load; load_type load;
#ifdef LCDPROC_MENUS
if ((*flags_ptr & INITIALIZED) == 0) { if ((*flags_ptr & INITIALIZED) == 0) {
*flags_ptr |= INITIALIZED; *flags_ptr |= INITIALIZED;
#else
static int first = TRUE;
if (first) {
first = FALSE;
#endif
gauge_hgt = (lcd_hgt > 2) ? (lcd_hgt - 1) : lcd_hgt; gauge_hgt = (lcd_hgt > 2) ? (lcd_hgt - 1) : lcd_hgt;
sock_send_string(sock, "screen_add G\n"); sock_send_string(sock, "screen_add G\n");
+2 -7
View File
@@ -1,12 +1,7 @@
#ifndef CPU_H #ifndef CPU_H
#define CPU_H #define CPU_H
#ifdef LCDPROC_MENUS int cpu_screen (int rep, int display, int *flags_ptr);
int cpu_screen (int rep, int display, int * flags_ptr); int cpu_graph_screen (int rep, int display, int *flags_ptr);
int cpu_graph_screen (int rep, int display, int * flags_ptr);
#else
int cpu_screen (int rep, int display);
int cpu_graph_screen (int rep, int display);
#endif
#endif #endif
+1 -12
View File
@@ -65,11 +65,7 @@ static char *numnames[MAX_CPUS] = { "one", "two", "three", "four", "five", "six"
// CPU screen shows info about percentage of the CPU being used // CPU screen shows info about percentage of the CPU being used
// //
int int
#ifdef LCDPROC_MENUS cpu_smp_screen (int rep, int display, int *flags_ptr)
cpu_smp_screen (int rep, int display, int * flags_ptr)
#else
cpu_smp_screen (int rep, int display)
#endif
{ {
#undef CPU_BUF_SIZE #undef CPU_BUF_SIZE
#define CPU_BUF_SIZE 4 #define CPU_BUF_SIZE 4
@@ -80,16 +76,9 @@ cpu_smp_screen (int rep, int display)
int numprocs; int numprocs;
char buf[256]; char buf[256];
char *graphsize; char *graphsize;
#ifdef LCDPROC_MENUS
if ((*flags_ptr & INITIALIZED) == 0) { if ((*flags_ptr & INITIALIZED) == 0) {
*flags_ptr |= INITIALIZED; *flags_ptr |= INITIALIZED;
#else
static int first = TRUE;
if (first) {
first = FALSE;
#endif
machine_get_smpload (load, &numprocs); machine_get_smpload (load, &numprocs);
+1 -5
View File
@@ -1,10 +1,6 @@
#ifndef CPU_SMP_H #ifndef CPU_SMP_H
#define CPU_SMP_H #define CPU_SMP_H
#ifdef LCDPROC_MENUS int cpu_smp_screen (int rep, int display, int *flags_ptr);
int cpu_smp_screen (int rep, int display, int * flags_ptr);
#else
int cpu_smp_screen (int rep, int display);
#endif
#endif #endif
+1 -11
View File
@@ -32,11 +32,7 @@
// //
// TODO: Disk screen! Requires virtual pages in the server, though... // TODO: Disk screen! Requires virtual pages in the server, though...
int int
#ifdef LCDPROC_MENUS disk_screen (int rep, int display, int *flags_ptr)
disk_screen (int rep, int display, int * flags_ptr)
#else
disk_screen (int rep, int display)
#endif
{ {
static mounts_type mnt[256]; static mounts_type mnt[256];
static int count = 0; static int count = 0;
@@ -54,16 +50,10 @@ disk_screen (int rep, int display)
#define huge long long int #define huge long long int
huge size; huge size;
#ifdef LCDPROC_MENUS
if ((*flags_ptr & INITIALIZED) == 0) { if ((*flags_ptr & INITIALIZED) == 0) {
*flags_ptr |= INITIALIZED; *flags_ptr |= INITIALIZED;
#else
static int first = TRUE;
if (first) {
first = FALSE;
#endif
dev_wid = (lcd_wid >= 20) ? (lcd_wid - 8) / 2 : (lcd_wid / 2) - 1; dev_wid = (lcd_wid >= 20) ? (lcd_wid - 8) / 2 : (lcd_wid / 2) - 1;
gauge_wid = (lcd_wid >= 20) ? (lcd_wid - dev_wid - 10) : (lcd_wid - dev_wid - 3); gauge_wid = (lcd_wid >= 20) ? (lcd_wid - dev_wid - 10) : (lcd_wid - dev_wid - 3);
+1 -5
View File
@@ -1,10 +1,6 @@
#ifndef DISK_H #ifndef DISK_H
#define DISK_H #define DISK_H
#ifdef LCDPROC_MENUS int disk_screen (int rep, int display, int *flags_ptr);
int disk_screen (int rep, int display, int * flags_ptr);
#else
int disk_screen (int rep, int display);
#endif
#endif #endif
+1 -11
View File
@@ -26,27 +26,17 @@
// +--------------------+ // +--------------------+
// //
int int
#ifdef LCDPROC_MENUS xload_screen (int rep, int display, int *flags_ptr)
xload_screen (int rep, int display, int * flags_ptr)
#else
xload_screen (int rep, int display)
#endif
{ {
static int gauge_hgt = 0; static int gauge_hgt = 0;
static double loads[LCD_MAX_WIDTH]; static double loads[LCD_MAX_WIDTH];
int loadtop, i; int loadtop, i;
double loadmax = 0, factor; double loadmax = 0, factor;
int status = 0; int status = 0;
#ifdef LCDPROC_MENUS
if ((*flags_ptr & INITIALIZED) == 0) { if ((*flags_ptr & INITIALIZED) == 0) {
*flags_ptr |= INITIALIZED; *flags_ptr |= INITIALIZED;
#else
static int first = TRUE;
if (first) {
first = FALSE;
#endif
gauge_hgt = (lcd_hgt > 2) ? (lcd_hgt - 1) : lcd_hgt; gauge_hgt = (lcd_hgt > 2) ? (lcd_hgt - 1) : lcd_hgt;
memset (loads, '\0', sizeof (double) * LCD_MAX_WIDTH); memset (loads, '\0', sizeof (double) * LCD_MAX_WIDTH);
+1 -5
View File
@@ -8,10 +8,6 @@
#define LOAD_MIN 0.5 #define LOAD_MIN 0.5
#endif #endif
#ifdef LCDPROC_MENUS int xload_screen (int rep, int display, int *flags_ptr);
int xload_screen (int rep, int display, int * flags_ptr);
#else
int xload_screen (int rep, int display);
#endif
#endif #endif
+94 -185
View File
@@ -41,7 +41,7 @@ static struct utsname unamebuf;
See below... (default_sequence[]) See below... (default_sequence[])
*/ */
static void HelpScreen(); static void HelpScreen(int exit_state);
static void exit_program(int val); static void exit_program(int val);
static void main_loop(); static void main_loop();
@@ -51,48 +51,27 @@ static int islow = -1;
#define TIME_UNIT 125000 #define TIME_UNIT 125000
/* list of modes to run */ /* list of modes to run */
#ifdef LCDPROC_MENUS
mode sequence[] = mode sequence[] =
{ {
// flags default ACTIVE will run by default // flags default ACTIVE will run by default
// longname which on off inv timer flags // longname which on off inv timer flags
{ "CPU", 'C', 1, 2, 0, 0xffff, ACTIVE,}, // [C]PU { "CPU", 'C', 1, 2, 0, 0xffff, ACTIVE,}, // [C]PU
{ "Memory", 'M', 4, 16, 0, 0xffff, ACTIVE,}, // [M]emory { "Memory", 'M', 4, 16, 0, 0xffff, ACTIVE,}, // [M]emory
{ "Load", 'X', 64, 128, 1, 0xffff, ACTIVE,}, // [X]-load (load histogram) { "Load", 'L', 64, 128, 1, 0xffff, ACTIVE,}, // [L]oad (load histogram)
{ "TimeDate", 'T', 4, 64, 0, 0xffff, ACTIVE,}, // [T]ime/Date { "TimeDate", 'T', 4, 64, 0, 0xffff, ACTIVE,}, // [T]ime/Date
{ "About", 'A', 999, 9999, 0, 0xffff, ACTIVE,}, // [A]bout (credits) { "About", 'A', 999, 9999, 0, 0xffff, ACTIVE,}, // [A]bout (credits)
#else
mode *sequence = NULL;
mode default_sequence[] =
{
// longname which on off inv timer visible/flags
{ "CPU", 'C', 1, 2, 0, 0xffff, 0,}, // [C]PU
{ "Memory", 'M', 4, 16, 0, 0xffff, 0,}, // [M]emory
{ "Load", 'X', 64, 128, 1, 0xffff, 0,}, // [X]-load (load histogram)
{ "TimeDate", 'T', 4, 64, 0, 0xffff, 0,}, // [T]ime/Date
{ "About", 'A', 999, 9999, 0, 0xffff, 0,}, // [A]bout (credits)
{ NULL, 1, 0, 0, 0, 0, 0,}, // Modes after this line will not be run by default...
// ... all non-default modes must be in here!
// ... they will not show up otherwise.
#endif
{ "SMP-CPU", 'P', 1, 2, 0, 0xffff, 0,}, // CPU_SM[P] { "SMP-CPU", 'P', 1, 2, 0, 0xffff, 0,}, // CPU_SM[P]
{ "OldTime", 'O', 4, 64, 0, 0xffff, 0,}, // [O]ld Timescreen { "OldTime", 'O', 4, 64, 0, 0xffff, 0,}, // [O]ld Timescreen
{ "BigClock", 'K', 4, 64, 0, 0xffff, 0,}, // big cloc[K] { "BigClock", 'K', 4, 64, 0, 0xffff, 0,}, // big cloc[K]
{ "Uptime", 'U', 4, 128, 0, 0xffff, 0,}, // Old [U]ptime Screen { "Uptime", 'U', 4, 128, 0, 0xffff, 0,}, // Old [U]ptime Screen
{ "Battery", 'B', 32, 256, 1, 0xffff, 0,}, // [B]attery Status { "Battery", 'B', 32, 256, 1, 0xffff, 0,}, // [B]attery Status
{ "CPUGraph", 'G', 1, 2, 0, 0xffff, 0,}, // CPU histogram [G]raph { "CPUGraph", 'G', 1, 2, 0, 0xffff, 0,}, // CPU histogram [G]raph
{ "ProcSize", 'S', 16, 256, 1, 0xffff, 0,}, // [S]ize of biggest programs { "ProcSize", 'S', 16, 256, 1, 0xffff, 0,}, // [S]ize of biggest processes
{ "Disk", 'D', 256, 256, 1, 0xffff, 0,}, // [D]isk stats { "Disk", 'D', 256, 256, 1, 0xffff, 0,}, // [D]isk stats
{ "MiniClock", 'E', 4, 64, 0, 0xffff, 0,}, // [E]ssential clock { "MiniClock", 'N', 4, 64, 0, 0xffff, 0,}, // Mi[n]i clock
{ NULL, 0, 0, 0, 0, 0,}, // No more.. all done. { NULL, 0, 0, 0, 0, 0,}, // No more.. all done.
}; };
#ifdef LCDPROC_MENUS
int seqlen = sizeof(sequence) / sizeof(mode);
#else
int seqlen = sizeof(default_sequence) / sizeof(mode);
#endif //LCDPROC_MENUS
// TODO: Config file; not just command line // TODO: Config file; not just command line
@@ -112,18 +91,18 @@ const char *get_sysrelease()
return(unamebuf.release); return(unamebuf.release);
} }
#ifdef LCDPROC_MENUS //set_mode function int set_mode(int shortname, char *longname, int state)
int set_mode(int shortname, char * longname, int state)
{ {
int k; int k;
/* ignore already selected modes */ /* ignore already selected modes */
for (k = 0; (k < seqlen) && (sequence[k].which != 0); k++) { for (k = 0; sequence[k].which != 0; k++) {
if (((sequence[k].longname != NULL) && if (((sequence[k].longname != NULL) &&
(0 == strcasecmp(longname, sequence[k].longname))) || (0 == strcasecmp(longname, sequence[k].longname))) ||
(shortname == sequence[k].which)) { (toupper(shortname) == sequence[k].which)) {
if (!state) { if (!state) {
sequence[k].flags &= (~ACTIVE & ~INITIALIZED); /* both the active and inititialized bits */ /* clean both the active and inititialized bits since we delete the screen */
sequence[k].flags &= (~ACTIVE & ~INITIALIZED);
sprintf (buffer, "screen_del %c\n", shortname ); sprintf (buffer, "screen_del %c\n", shortname );
sock_send_string (sock, buffer); sock_send_string (sock, buffer);
} else } else
@@ -138,11 +117,10 @@ void clear_modes()
{ {
int k; int k;
/* ignore already selected modes */ /* ignore already selected modes */
for (k = 0; (k < seqlen) && (sequence[k].which != 0); k++) { for (k = 0; sequence[k].which != 0; k++) {
sequence[k].flags &= (~ACTIVE); sequence[k].flags &= (~ACTIVE);
} }
} }
#endif //LCDPROC_MENUS
int int
main(int argc, char **argv) main(int argc, char **argv)
@@ -159,23 +137,6 @@ main(int argc, char **argv)
return(EXIT_FAILURE); return(EXIT_FAILURE);
} }
#ifdef LCDPROC_MENUS
// sequence = default_sequence;
#else
/* allocate sequence */
sequence = (mode *) malloc(seqlen * sizeof(mode));
if (sequence == NULL) {
perror("sequence malloc");
return(EXIT_FAILURE);
}
/* copy default_sequence[] to sequence */
for (i = 0; i < seqlen; i++) {
//sequence[i] = default_sequence[i];
memcpy(&sequence[i], &default_sequence[i], sizeof(mode));
}
#endif //LCDPROC_MENUS
/* setup error handlers */ /* setup error handlers */
signal(SIGINT, exit_program); // Ctrl-C signal(SIGINT, exit_program); // Ctrl-C
signal(SIGTERM, exit_program); // "regular" kill signal(SIGTERM, exit_program); // "regular" kill
@@ -186,7 +147,7 @@ main(int argc, char **argv)
opterr = 0; opterr = 0;
/* get options */ /* get options */
while ((c = getopt( argc, argv, "s:p:e:d")) > 0) { while ((c = getopt( argc, argv, "s:p:e:dhv")) > 0) {
switch (c) { switch (c) {
// s is for server // s is for server
case 's': case 's':
@@ -209,59 +170,29 @@ main(int argc, char **argv)
case 'd': case 'd':
daemonize = TRUE; daemonize = TRUE;
break; break;
case 'h':
HelpScreen(EXIT_SUCCESS);
break;
case 'v':
fprintf(stderr, "LCDproc %s\n", version);
exit(EXIT_SUCCESS);
break;
// otherwise... Get help! // otherwise... Get help!
case '?': // unknown option or missing argument case '?': // unknown option or missing argument
default: default:
HelpScreen(); HelpScreen(EXIT_FAILURE);
break; break;
} }
} }
#ifdef LCDPROC_MENUS
/* parse arguments */ /* parse arguments */
if (argc > 1 ) //user specified some modes, so clear all defaults if (argc > optind) //user specified some modes, so clear all defaults
clear_modes(); clear_modes();
for (i = (optind > 0) ? optind : 1; i < argc; i++) {
for (i = max(optind, 1); i < argc; i++) {
int shortname = (strlen(argv[i]) == 1) ? toupper(argv[i][0]) : '\0'; int shortname = (strlen(argv[i]) == 1) ? toupper(argv[i][0]) : '\0';
int found = set_mode(shortname, argv[i], 1); int found = set_mode(shortname, argv[i], 1);
#else
/* parse arguments */
for (i = (optind > 0) ? optind : 1, j = 0; i < argc; i++) {
int shortname = (strlen(argv[i]) == 1) ? toupper(argv[i][0]) : '\0';
int k, found = FALSE;
/* skip this round if we used all allocated slots */
if (j >= seqlen)
continue;
/* ignore already selected modes */
for (k = 0; (k < j) && (sequence[k].which != 0); k++) {
if (((sequence[k].longname != NULL) &&
(0 == strcasecmp(argv[i], sequence[k].longname))) ||
(shortname == sequence[k].which)) {
found = TRUE;
}
}
if (found) {
fprintf(stderr, "Warning: ignoring duplicate mode\n");
continue;
}
// try to find the mode from the mode list
for (k = 0; k < seqlen; k++) {
if (((default_sequence[k].longname != NULL) &&
(0 == strcasecmp(argv[i], default_sequence[k].longname))) ||
(shortname == default_sequence[k].which)) {
//sequence[j] = default_sequence[k];
memcpy(&sequence[j], &default_sequence[k], sizeof(mode));
j++;
//sequence[j] = default_sequence[seqlen-1];
memcpy(&sequence[j], &default_sequence[seqlen-1], sizeof(mode));
found = TRUE;
break;
}
}
#endif
if (!found) { if (!found) {
fprintf(stderr, "Invalid Mode: %c, ignoring\n", argv[i][0]); fprintf(stderr, "Invalid Mode: %c, ignoring\n", argv[i][0]);
return(EXIT_FAILURE); return(EXIT_FAILURE);
@@ -310,22 +241,38 @@ main(int argc, char **argv)
} }
void void
HelpScreen () HelpScreen (int exit_state)
{ {
printf("LCDproc, %s\n", version); fprintf(stderr,
printf("Usage: lcdproc [-s server] [-p port] [-e islow] [-d] [modelist]\n"); "Usage: lcdproc [<options>] [<modes> ...]\n"
printf("\tOptions in []'s are optional.\n"); " where <options> are\n"
printf("\tmodelist is \"mode [mode mode ...]\"\n"); " -s <host> connect to LCDd daemon on <host>\n"
printf ("\tMode letters:\t[C]pu [G]raph [T]ime [M]emory [X]load [D]isk [B]attery\n" " -p <port> connect to LCDd daemon using <port>\n"
"\t\t\tproc_[S]izes [O]ld_time big_cloc[K] [E]ssential_clock\n" " -d daemonize\n"
"\t\t\t[U]ptime CPU_SM[P] [A]bout\n"); " -e <delay> slow down initial announcement of modes (in 1/100s)\n"
printf("\n"); " -h show this help screen\n"
printf("\tislow is to slow down initial announcement of modes (in 1/100 sec)\n"); " -v display program version\n"
printf("\tUse \"man lcdproc\" for more info.\n"); " and <modes> are\n"
printf("Example:\n"); " C CPU detailed CPU usage\n"
printf("\tlcdproc -s my.lcdproc.server.com C M X -p 13666\n"); " P SMP-CPU CPU usage overview (one line per CPU)\n"
printf("\n"); " G CPUGraph CPU usage histogram\n"
exit(EXIT_FAILURE); " L Load load histogram\n"
" M Memory memory & swap usage\n"
" S ProcSize biggest processes size\n"
" D Disk disk usage\n"
" B Battery battery status\n"
" T TimeDate time & date information\n"
" O OldTime old time screen\n"
" U Uptime old uptime screen\n"
" K BigClock big clock\n"
" N MiniClock minimal clock\n"
" A About credits page\n"
"\n"
"Example:\n"
" lcdproc -s my.lcdproc.server.com p 13666 C M X\n"
);
exit(exit_state);
} }
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
@@ -338,13 +285,10 @@ exit_program(int val)
Quit = 1; Quit = 1;
sock_close(sock); sock_close(sock);
mode_close(); mode_close();
#ifndef LCDPROC_MENUS
free(sequence);
#endif
exit(val); exit(val);
} }
#ifdef LCDPROC_MENUS //menus_init #ifdef LCDPROC_MENUS
int int
menus_init () menus_init ()
{ {
@@ -352,12 +296,14 @@ menus_init ()
for (k = 0; sequence[k].which ; k++) { for (k = 0; sequence[k].which ; k++) {
if (sequence[k].longname) { if (sequence[k].longname) {
sprintf (buffer, "menu_add_item {} %c checkbox {%s} -value %s\n", sequence[k].which, sequence[k].longname, sequence[k].flags & ACTIVE ? "on" : "off"); sprintf (buffer, "menu_add_item {} %c checkbox {%s} -value %s\n",
sequence[k].which, sequence[k].longname,
(sequence[k].flags & ACTIVE) ? "on" : "off");
sock_send_string (sock, buffer); sock_send_string (sock, buffer);
} }
} }
#ifdef TESTMENUS #ifdef LCDPROC_CLIENT_TESTMENUS
// # to be entered on escape from test_menu (but overwritten // # to be entered on escape from test_menu (but overwritten
// # for test_{checkbox,ring} // # for test_{checkbox,ring}
sock_send_string (sock, "menu_add_item {} ask menu {Leave menus?} -is_hidden true\n"); sock_send_string (sock, "menu_add_item {} ask menu {Leave menus?} -is_hidden true\n");
@@ -386,11 +332,13 @@ menus_init ()
sock_send_string (sock, "menu_set_item {test} test_alpha -next {test_ip} -prev {test_numeric}\n"); sock_send_string (sock, "menu_set_item {test} test_alpha -next {test_ip} -prev {test_numeric}\n");
sock_send_string (sock, "menu_set_item {test} test_ip -next {test_menu} -prev {test_alpha}\n"); sock_send_string (sock, "menu_set_item {test} test_ip -next {test_menu} -prev {test_alpha}\n");
sock_send_string (sock, "menu_set_item {test} test_menu_action -next {_close_}\n"); sock_send_string (sock, "menu_set_item {test} test_menu_action -next {_close_}\n");
#endif //TESTMENUS #endif //LCDPROC_CLIENT_TESTMENUS
return 0; return 0;
} }
#endif //LCDPROC_MENUS #endif //LCDPROC_MENUS
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
// Main program loop... // Main program loop...
// //
@@ -406,22 +354,19 @@ main_loop()
// Main loop // Main loop
// Run whatever screen we want, then wait. Woo-hoo! // Run whatever screen we want, then wait. Woo-hoo!
while (!Quit) while (!Quit) {
{
// Check for server input... // Check for server input...
len = sock_recv(sock, buf, 8000); len = sock_recv(sock, buf, 8000);
// Handle server input... // Handle server input...
while (len > 0) while (len > 0) {
{
// Now split the string into tokens... // Now split the string into tokens...
//for (i=0; i<argc; i++) argv[i]=NULL; // Get rid of old tokens //for (i=0; i<argc; i++) argv[i]=NULL; // Get rid of old tokens
argc = 0; argc = 0;
newtoken = 1; newtoken = 1;
for (i = 0; i < len; i++)
{ for (i = 0; i < len; i++) {
switch (buf[i]) switch (buf[i]) {
{
case ' ': case ' ':
newtoken = 1; newtoken = 1;
buf[i] = 0; buf[i] = 0;
@@ -434,61 +379,40 @@ main_loop()
case '\0': case '\0':
case '\n': case '\n':
buf[i] = 0; buf[i] = 0;
if (argc > 0) if (argc > 0) {
{
//printf("%s %s\n", argv[0], argv[1]); //printf("%s %s\n", argv[0], argv[1]);
if (0 == strcmp(argv[0], "listen")) if (0 == strcmp(argv[0], "listen")) {
{ for (j = 0; sequence[j].which; j++) {
for (j = 0; sequence[j].which; j++) if (sequence[j].which == argv[1][0]) {
{
if (sequence[j].which == argv[1][0])
{
#ifdef LCDPROC_MENUS
sequence[j].flags |= VISIBLE; sequence[j].flags |= VISIBLE;
#else
sequence[j].visible = 1;
#endif
//debug("Listen %s\n", argv[1]); //debug("Listen %s\n", argv[1]);
} }
} }
} }
else if (0 == strcmp(argv[0], "ignore")) else if (0 == strcmp(argv[0], "ignore")) {
{ for (j = 0; sequence[j].which; j++) {
for (j = 0; sequence[j].which; j++) if (sequence[j].which == argv[1][0]) {
{
if (sequence[j].which == argv[1][0])
{
#ifdef LCDPROC_MENUS
sequence[j].flags &= ~VISIBLE; sequence[j].flags &= ~VISIBLE;
#else
sequence[j].visible = 0;
#endif
//debug("Ignore %s\n", argv[1]); //debug("Ignore %s\n", argv[1]);
} }
} }
} }
else if (0 == strcmp(argv[0], "key")) else if (0 == strcmp(argv[0], "key")) {
{
debug("Key %s\n", argv[1]); debug("Key %s\n", argv[1]);
} }
#ifdef LCDPROC_MENUS #ifdef LCDPROC_MENUS
else if (0 == strcmp(argv[0], "menuevent")) else if (0 == strcmp(argv[0], "menuevent")) {
{ if (argc == 4 && (0 == strcmp(argv[1], "update"))) {
if (argc == 4 && (0 == strcmp(argv[1], "update")))
{
set_mode(argv[2][0],"", strcmp(argv[3],"off")); set_mode(argv[2][0],"", strcmp(argv[3],"off"));
} }
} }
#else #else
else if (0 == strcmp(argv[0], "menu")) else if (0 == strcmp(argv[0], "menu")) {
{
} }
#endif #endif
else if (0 == strcmp(argv[0], "connect")) else if (0 == strcmp(argv[0], "connect")) {
{
int a; int a;
for (a = 1; a < argc; a++) for (a = 1; a < argc; a++) {
{
if (0 == strcmp(argv[a], "wid")) if (0 == strcmp(argv[a], "wid"))
lcd_wid = atoi(argv[++a]); lcd_wid = atoi(argv[++a]);
else if (0 == strcmp(argv[a], "hgt")) else if (0 == strcmp(argv[a], "hgt"))
@@ -499,25 +423,18 @@ main_loop()
lcd_cellhgt = atoi(argv[++a]); lcd_cellhgt = atoi(argv[++a]);
} }
connected = 1; connected = 1;
{ sock_printf(sock, "client_set -name {LCDproc %s}\n", get_hostname());
char buffer[8192];
snprintf(buffer, sizeof(buffer), "client_set -name {LCDproc %s}\n", get_hostname());
sock_send_string(sock, buffer);
}
#ifdef LCDPROC_MENUS #ifdef LCDPROC_MENUS
menus_init(); menus_init();
#endif #endif
} }
else if (0 == strcmp(argv[0], "bye")) else if (0 == strcmp(argv[0], "bye")) {
{
//printf("Exiting LCDproc\n"); //printf("Exiting LCDproc\n");
exit_program(EXIT_SUCCESS); exit_program(EXIT_SUCCESS);
} }
else if (0 == strcmp(argv[0], "success")) else if (0 == strcmp(argv[0], "success")) {
{
} }
else else {
{
//int j; //int j;
//for (j = 0; j < argc; j++) //for (j = 0; j < argc; j++)
// printf("%s ", argv[j]); // printf("%s ", argv[j]);
@@ -538,30 +455,22 @@ main_loop()
// Gather stats... // Gather stats...
// Update screens... // Update screens...
if (connected) if (connected) {
{ for (i = 0; sequence[i].which > 0; i++) {
for (i = 0; sequence[i].which > 0; i++)
{
sequence[i].timer++; sequence[i].timer++;
#ifdef LCDPROC_MENUS
if ((sequence[i].flags & ACTIVE) == 0 ) if (!(sequence[i].flags & ACTIVE))
continue; continue;
if (sequence[i].flags & VISIBLE)
#else if (sequence[i].flags & VISIBLE) {
if (sequence[i].visible) if (sequence[i].timer >= sequence[i].on_time) {
#endif
{
if (sequence[i].timer >= sequence[i].on_time)
{
sequence[i].timer = 0; sequence[i].timer = 0;
// Now, update the screen... // Now, update the screen...
update_screen(&sequence[i], 1); update_screen(&sequence[i], 1);
} }
} }
else else {
{ if (sequence[i].timer >= sequence[i].off_time) {
if (sequence[i].timer >= sequence[i].off_time)
{
sequence[i].timer = 0; sequence[i].timer = 0;
// Now, update the screen... // Now, update the screen...
update_screen(&sequence[i], sequence[i].show_invisible); update_screen(&sequence[i], sequence[i].show_invisible);
+11 -14
View File
@@ -32,22 +32,19 @@ extern int lcd_cellhgt;
typedef struct mode typedef struct mode
{ {
char *longname; // Which screen is it? char *longname; // Which screen is it?
char which; // Which screen is it? char which; // Which screen is it?
int on_time; // How often to update while visible? int on_time; // How often to update while visible?
int off_time; // How often to get stats while not visible? int off_time; // How often to get stats while not visible?
int show_invisible; // Send stats while not visible? int show_invisible; // Send stats while not visible?
int timer; // Time since last update int timer; // Time since last update
#ifdef LCDPROC_MENUS //struct mode flags int flags; // bit 1 visible, bit 2 selected for display, bit 3 first
int flags; //bit 1 visible, bit 2 selected for display, bit 3 first
#else
int visible; // Can we be seen right now?
#endif //LCDPROC_MENUS
} mode; } mode;
//mode flags //mode flags
#define VISIBLE 0x00000001 //currently visible #define VISIBLE 0x00000001 //currently visible
#define ACTIVE 0x00000002 //selected for display #define ACTIVE 0x00000002 //selected for display
#define INITIALIZED 0x00000004 //replaces the first variable to indicate whether the update screens are initialized #define INITIALIZED 0x00000004 //replaces the first variable to indicate whether the update screens are initialized
#define BLINK_ON 0x10 #define BLINK_ON 0x10
#define BLINK_OFF 0x11 #define BLINK_OFF 0x11
+2 -24
View File
@@ -29,26 +29,15 @@
// +--------------------+ // +--------------------+
// //
int int
#ifdef LCDPROC_MENUS mem_screen (int rep, int display, int *flags_ptr)
mem_screen (int rep, int display, int * flags_ptr)
#else
mem_screen (int rep, int display)
#endif
{ {
static int which_title = 0; static int which_title = 0;
static int gauge_wid = 0; static int gauge_wid = 0;
static int gauge_offs = 0; static int gauge_offs = 0;
meminfo_type mem[2]; meminfo_type mem[2];
#ifdef LCDPROC_MENUS
if ((*flags_ptr & INITIALIZED) == 0) { if ((*flags_ptr & INITIALIZED) == 0) {
*flags_ptr |= INITIALIZED; *flags_ptr |= INITIALIZED;
#else
static int first = TRUE;
if (first) {
first = FALSE;
#endif
sock_send_string(sock, "screen_add M\n"); sock_send_string(sock, "screen_add M\n");
sprintf(buffer, "screen_set M -name {Memory & Swap: %s}\n", get_hostname()); sprintf(buffer, "screen_set M -name {Memory & Swap: %s}\n", get_hostname());
@@ -248,24 +237,13 @@ sort_procs (void *a, void *b)
// +--------------------+ // +--------------------+
// //
int int
#ifdef LCDPROC_MENUS mem_top_screen (int rep, int display, int *flags_ptr)
mem_top_screen (int rep, int display, int * flags_ptr)
#else
mem_top_screen (int rep, int display)
#endif
{ {
LinkedList *procs; LinkedList *procs;
int i; int i;
#ifdef LCDPROC_MENUS
if ((*flags_ptr & INITIALIZED) == 0) { if ((*flags_ptr & INITIALIZED) == 0) {
*flags_ptr |= INITIALIZED; *flags_ptr |= INITIALIZED;
#else
static int first = TRUE;
if (first) {
first = FALSE;
#endif
sock_send_string(sock, "screen_add S\n"); sock_send_string(sock, "screen_add S\n");
sprintf(buffer, "screen_set S -name {Top Memory Use: %s}\n", get_hostname()); sprintf(buffer, "screen_set S -name {Top Memory Use: %s}\n", get_hostname());
+2 -7
View File
@@ -1,12 +1,7 @@
#ifndef MEM_H #ifndef MEM_H
#define MEM_H #define MEM_H
#ifdef LCDPROC_MENUS int mem_screen (int rep, int display, int *flags_ptr);
int mem_screen (int rep, int display, int * flags_ptr); int mem_top_screen (int rep, int display, int *flags_ptr);
int mem_top_screen (int rep, int display, int * flags_ptr);
#else
int mem_screen (int rep, int display);
int mem_top_screen (int rep, int display);
#endif
#endif #endif
+12 -82
View File
@@ -36,14 +36,12 @@ char *buffer = NULL;
int int
mode_init() mode_init()
{ {
if ((buffer = malloc(1024)) == NULL) if ((buffer = malloc(1024)) == NULL) {
{
perror("malloc buffer"); perror("malloc buffer");
return(0); return(0);
} }
if ((tmp = malloc(1024)) == NULL) if ((tmp = malloc(1024)) == NULL) {
{
perror("malloc tmp"); perror("malloc tmp");
return(0); return(0);
} }
@@ -58,14 +56,12 @@ mode_close()
{ {
machine_close(); machine_close();
if (tmp != NULL) if (tmp != NULL) {
{
free(tmp); free(tmp);
tmp = NULL; tmp = NULL;
} }
if (buffer != NULL) if (buffer != NULL) {
{
free(buffer); free(buffer);
buffer = NULL; buffer = NULL;
} }
@@ -81,7 +77,6 @@ update_screen(mode *m, int display)
{ {
switch(m->which) switch(m->which)
{ {
#ifdef LCDPROC_MENUS
case 'g': case 'g':
case 'G': case 'G':
status = cpu_graph_screen(m->timer, display, &(m->flags)); status = cpu_graph_screen(m->timer, display, &(m->flags));
@@ -118,8 +113,8 @@ update_screen(mode *m, int display)
case 'D': case 'D':
status = disk_screen(m->timer, display, &(m->flags)); status = disk_screen(m->timer, display, &(m->flags));
break; break;
case 'x': case 'l':
case 'X': case 'L':
status = xload_screen(m->timer, display, &(m->flags)); status = xload_screen(m->timer, display, &(m->flags));
break; break;
case 'b': case 'b':
@@ -134,68 +129,10 @@ update_screen(mode *m, int display)
case 'P': case 'P':
status = cpu_smp_screen(m->timer, display, &(m->flags)); status = cpu_smp_screen(m->timer, display, &(m->flags));
break; break;
case 'e': case 'n':
case 'E': case 'N':
status = essential_clock_screen(m->timer, display, &(m->flags)); status = mini_clock_screen(m->timer, display, &(m->flags));
break; break;
#else
case 'g':
case 'G':
status = cpu_graph_screen(m->timer, display);
break;
case 'c':
case 'C':
status = cpu_screen(m->timer, display);
break;
case 'o':
case 'O':
status = clock_screen(m->timer, display);
break;
case 'k':
case 'K':
status = big_clock_screen(m->timer, display);
break;
case 'm':
case 'M':
status = mem_screen(m->timer, display);
break;
case 's':
case 'S':
status = mem_top_screen(m->timer, display);
break;
case 'u':
case 'U':
status = uptime_screen(m->timer, display);
break;
case 't':
case 'T':
status = time_screen(m->timer, display);
break;
case 'd':
case 'D':
status = disk_screen(m->timer, display);
break;
case 'x':
case 'X':
status = xload_screen(m->timer, display);
break;
case 'b':
case 'B':
status = battery_screen(m->timer, display);
break;
case 'a':
case 'A':
status = credit_screen(m->timer, display);
break;
case 'p':
case 'P':
status = cpu_smp_screen(m->timer, display);
break;
case 'e':
case 'E':
status = essential_clock_screen(m->timer, display);
break;
#endif
default: default:
break; break;
} }
@@ -223,17 +160,10 @@ update_screen(mode *m, int display)
// Credit Screen shows who wrote this... // Credit Screen shows who wrote this...
// //
int int
#ifdef LCDPROC_MENUS credit_screen(int rep, int display, int *flags_ptr)
credit_screen(int rep, int display, int * flags_ptr)
#else
credit_screen(int rep, int display)
#endif
{ {
static int first = 1; if ((*flags_ptr & INITIALIZED) == 0) {
*flags_ptr |= INITIALIZED;
if (first)
{
first = 0;
sock_send_string(sock, "screen_add A\n"); sock_send_string(sock, "screen_add A\n");
sock_send_string(sock, "screen_set A -name {Credits for LCDproc}\n"); sock_send_string(sock, "screen_set A -name {Credits for LCDproc}\n");
+1 -5
View File
@@ -11,10 +11,6 @@ int mode_init ();
void mode_close (); void mode_close ();
int update_screen (mode * m, int display); int update_screen (mode * m, int display);
#ifdef LCDPROC_MENUS int credit_screen (int rep, int display, int *flags_ptr);
int credit_screen (int rep, int display, int * flags_ptr);
#else
int credit_screen (int rep, int display);
#endif
#endif #endif
+7
View File
@@ -539,6 +539,13 @@ AC_ARG_ENABLE(permissive_menu_goto,
fi, fi,
) )
AC_ARG_ENABLE(lcdproc-menus,
[ --enable-lcdproc-menus enable menu support in lcdproc client],
if [[[ "$enableval" = "yes" ]]]; then
AC_DEFINE(LCDPROC_MENUS,[1],[Define to 1 to enable menu support in lcdproc client])
fi,
)
# check for doxygen # check for doxygen
BB_ENABLE_DOXYGEN BB_ENABLE_DOXYGEN
+67 -18
View File
@@ -1,53 +1,102 @@
.TH lcdproc 1 "1-aug-01" "LCDproc" .TH lcdproc 1 "1-aug-01" "LCDproc"
.SH NAME .SH NAME
lcdproc - displays system status on LCDproc server (LCDd(8)) lcdproc - displays system status on LCDproc server (LCDd(8))
.SH SYNOPSIS .SH SYNOPSIS
.B lcdproc .B lcdproc
[\-s \fIserver\fP] [\-p \fIport\fP] [\-d] [\fImode\fP [\fImode\fP ...]] [\-s \fIserver\fP] [\-p \fIport\fP] [\-e \fIdelay\fP] [\-d] [\-h] [\-v] [\fImode\fP [\fImode\fP ...]]
.SH DESCRIPTION .SH DESCRIPTION
lcdproc connects to the LCDproc server to display status information about the system. lcdproc connects to the LCDproc server to display status information about the system.
.PP .PP
Currently, only Linux, xBSD and Solaris are supported with not all features being available on all platforms. Currently, only Linux, xBSD and Solaris are supported with not all features being available on all platforms.
.SH OPTIONS .SH OPTIONS
.I lcdproc .I lcdproc
understands these options: understands these options:
.TP 8 .TP 8
.B \-s \fIserver\fP .B \-s \fIserver\fP
Set the hostname which LCDproc is running on, assumed to be localhost unless otherwise set Set the hostname which LCDproc is running on, assumed to be localhost unless otherwise set.
.TP 8 .TP 8
.B \-p \fIport\fP .B \-p \fIport\fP
Set the port which LCDproc is accepting connections on, assumed to be 13666 unless otherwise set Set the port which LCDproc is accepting connections on, assumed to be 13666 unless otherwise set.
.TP 8 .TP 8
.B \-d .B \-d
Daemonize right after startup Daemonize right after startup.
.TP 8
.B \-e \fIdelay\fP
xxx
.TP 8
.B \-h
Show help screen.
.TP 8
.B \-v
Print the version of the program and exit.
.TP 8 .TP 8
.B \fImode\fP .B \fImode\fP
Where mode is one of the following letters: is one of the following:
.RS .TP 16
[C]pu [G]raph [T]ime [M]emory [X]load [D]isk [B]attery proc_[S]izes [O]ld_time big_cloc[K] [E]ssential_clock [U]ptime CPU_SM[P] [A]bout .B C CPU
.RE show detailed CPU usage
.TP 16
.B P SMP-CPU
CPU usage overview (one line per CPU)
.TP 16
.B G CPUGraph
CPU histogram
.TP 16
.B L Load
Load histogram
.TP 16
.B M Memory
memory & swap usage
.TP 16
.B S ProcSize
show memory usage of 5 biggest processes
.TP 16
.B D Disk
disk usage
.TP 16
.B B Battery
battery status
.TP 16
.B T TimeDate
time & date information
.TP 16
.B O OldTime
old time screen
.TP 16
.B U Uptime
old uptime screen
.TP 16
.B K BigClock
big clock
.TP 16
.B N MiniClock
essential clock
.TP 16
.B A About
credits page
.PP .PP
.SH EXAMPLES .SH EXAMPLES
lcdproc C M D X lcdproc C M D L
.TP 8 .TP 8
connects to the LCDproc server and specifies the following modes: connects to the LCDproc server running on the default port 13666 on the local machine and specifies the following modes:
.RS .RS
- CPU Usage - detailed CPU Usage
.PP .PP
- Memory usage - Memory & swap usage
.PP .PP
- Uptime - Disk usage
.PP .PP
- Date and Time - Load histogram
.PP
- X-Load average over time
.RE .RE
.PP .PP
.Sh SEE ALSO .SH SEE ALSO
.Xr LCDd 8 .Xr LCDd 8
.SH AUTHOR .SH AUTHOR
LCDproc was originally written by William Ferrell (wwf@splatwerks.org) and Scott Scriven (scriven@cs.colostate.edu). LCDproc was originally written by William Ferrell (wwf@splatwerks.org) and Scott Scriven (scriven@cs.colostate.edu).
@@ -56,7 +105,7 @@ Since that time various people have contributed to LCDproc.
The newest version of LCDproc should be available from here: The newest version of LCDproc should be available from here:
http://lcdproc.omnipotent.net/ http://www.lcdproc.org/
.SH LEGAL STUFF .SH LEGAL STUFF
LCDproc is released as "WorksForMe-Ware". In other words, it is free, kinda neat, and we don't guarantee that it will do anything in particular on any machine except the ones it was developed on. LCDproc is released as "WorksForMe-Ware". In other words, it is free, kinda neat, and we don't guarantee that it will do anything in particular on any machine except the ones it was developed on.