cleanup: remove unnecessary (=invisible) leading spaces
This commit is contained in:
@@ -122,7 +122,7 @@ Rene Wagner <reenoo@gmx.de>:
|
||||
|
||||
Andre Breiler:
|
||||
- Matrix Orbital driver
|
||||
|
||||
|
||||
Joris Robijn:
|
||||
- HD44780 driver maintenance and enhancement
|
||||
- Config file stuff
|
||||
|
||||
@@ -29,7 +29,7 @@ restart LCDproc...
|
||||
Another bonus is that LCDproc will come with a client which can, for
|
||||
example, start up a "client" driver to send "keypresses" from the
|
||||
command line. Or,
|
||||
|
||||
|
||||
lcdtool -key A
|
||||
|
||||
would have the same result as pressing a key on the keypad.
|
||||
|
||||
+38
-38
@@ -69,37 +69,37 @@ for driver in $selectdrivers ; do
|
||||
;;
|
||||
curses)
|
||||
AC_CHECK_HEADERS(ncurses.h curses.h)
|
||||
AC_CHECK_LIB(ncurses, main, [
|
||||
AC_CHECK_HEADER(ncurses.h, [
|
||||
dnl We have ncurses.h and libncurses, add driver.
|
||||
AC_CHECK_LIB(ncurses, main, [
|
||||
AC_CHECK_HEADER(ncurses.h, [
|
||||
dnl We have ncurses.h and libncurses, add driver.
|
||||
LIBCURSES="-lncurses"
|
||||
DRIVERS="$DRIVERS curses${SO}"
|
||||
actdrivers=["$actdrivers curses"]
|
||||
],[
|
||||
DRIVERS="$DRIVERS curses${SO}"
|
||||
actdrivers=["$actdrivers curses"]
|
||||
],[
|
||||
dnl else
|
||||
AC_MSG_WARN([Could not find ncurses.h])],
|
||||
[])
|
||||
],[
|
||||
],[
|
||||
dnl else
|
||||
AC_CHECK_LIB(curses, main, [
|
||||
AC_CHECK_HEADER(curses.h, [
|
||||
dnl We have curses.h and libcurses, add driver.
|
||||
LIBCURSES="-lcurses"
|
||||
DRIVERS="$DRIVERS curses${SO}"
|
||||
actdrivers=["$actdrivers curses"]
|
||||
],[
|
||||
AC_CHECK_LIB(curses, main, [
|
||||
AC_CHECK_HEADER(curses.h, [
|
||||
dnl We have curses.h and libcurses, add driver.
|
||||
LIBCURSES="-lcurses"
|
||||
DRIVERS="$DRIVERS curses${SO}"
|
||||
actdrivers=["$actdrivers curses"]
|
||||
],[
|
||||
dnl else
|
||||
AC_MSG_WARN([Could not find curses.h])],
|
||||
[])
|
||||
],[
|
||||
],[
|
||||
dnl else
|
||||
AC_MSG_WARN([The curses driver needs the curses (or ncurses) library.])],
|
||||
[])
|
||||
])
|
||||
AC_MSG_WARN([The curses driver needs the curses (or ncurses) library.])],
|
||||
[])
|
||||
])
|
||||
|
||||
AC_CURSES_ACS_ARRAY
|
||||
AC_CURSES_ACS_ARRAY
|
||||
|
||||
AC_CACHE_CHECK([for redrawwin() in curses], ac_cv_curses_redrawwin,
|
||||
AC_CACHE_CHECK([for redrawwin() in curses], ac_cv_curses_redrawwin,
|
||||
[oldlibs="$LIBS"
|
||||
LIBS="$LIBS $LIBCURSES"
|
||||
AC_TRY_LINK_FUNC(redrawwin, ac_cv_curses_redrawwin=yes, ac_cv_curses_redrawwin=no)
|
||||
@@ -152,10 +152,10 @@ dnl else
|
||||
if test "$enable_libusb" = yes ; then
|
||||
HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-bwct-usb.o"
|
||||
fi
|
||||
AC_CHECK_HEADER(linux/i2c-dev.h,
|
||||
HD44780_DRIVERS="$HD44780_DRIVERS hd44780-i2c.o"
|
||||
AC_DEFINE(HAVE_I2C,[1],[Define to 1 if you have the i2c headers])
|
||||
)
|
||||
AC_CHECK_HEADER(linux/i2c-dev.h,
|
||||
HD44780_DRIVERS="$HD44780_DRIVERS hd44780-i2c.o"
|
||||
AC_DEFINE(HAVE_I2C,[1],[Define to 1 if you have the i2c headers])
|
||||
)
|
||||
DRIVERS="$DRIVERS hd44780${SO}"
|
||||
actdrivers=["$actdrivers hd44780"]
|
||||
;;
|
||||
@@ -168,22 +168,22 @@ dnl else
|
||||
actdrivers=["$actdrivers imon"]
|
||||
;;
|
||||
IOWarrior)
|
||||
if test "$enable_libusb" = yes ; then
|
||||
if test "$enable_libusb" = yes ; then
|
||||
DRIVERS="$DRIVERS IOWarrior${SO}"
|
||||
actdrivers=["$actdrivers IOWarrior"]
|
||||
else
|
||||
AC_MSG_WARN([The IOWarrior driver needs the libusb library.])
|
||||
AC_MSG_WARN([The IOWarrior driver needs the libusb library.])
|
||||
fi
|
||||
;;
|
||||
irman)
|
||||
AC_CHECK_LIB(irman, main,[
|
||||
LIBIRMAN="-lirman"
|
||||
DRIVERS="$DRIVERS irman${SO}"
|
||||
actdrivers=["$actdrivers irman"]
|
||||
],[
|
||||
AC_CHECK_LIB(irman, main,[
|
||||
LIBIRMAN="-lirman"
|
||||
DRIVERS="$DRIVERS irman${SO}"
|
||||
actdrivers=["$actdrivers irman"]
|
||||
],[
|
||||
dnl else
|
||||
AC_MSG_WARN([The irman driver needs the irman library.])
|
||||
])
|
||||
AC_MSG_WARN([The irman driver needs the irman library.])
|
||||
])
|
||||
;;
|
||||
joy)
|
||||
AC_CHECK_HEADER(linux/joystick.h, [
|
||||
@@ -191,8 +191,8 @@ dnl else
|
||||
actdrivers=["$actdrivers joy"]
|
||||
],[
|
||||
dnl else
|
||||
AC_MSG_WARN([The joy driver needs header file linux/joystick.h.])
|
||||
])
|
||||
AC_MSG_WARN([The joy driver needs header file linux/joystick.h.])
|
||||
])
|
||||
;;
|
||||
lb216)
|
||||
DRIVERS="$DRIVERS lb216${SO}"
|
||||
@@ -277,7 +277,7 @@ dnl else
|
||||
LIBSVGA="-lvga -lvgagl"
|
||||
DRIVERS="$DRIVERS svga${SO}"
|
||||
actdrivers=["$actdrivers svga"]
|
||||
],[
|
||||
],[
|
||||
dnl else
|
||||
AC_MSG_WARN([The svga driver needs the vga library])
|
||||
])
|
||||
@@ -309,7 +309,7 @@ dnl else
|
||||
LIBFTDI="-lusb -lftdi"
|
||||
DRIVERS="$DRIVERS ula200${SO}"
|
||||
actdrivers=["$actdrivers ula200"]
|
||||
],[
|
||||
],[
|
||||
dnl else
|
||||
AC_MSG_WARN([The ula200 driver needs the ftdi library])
|
||||
])
|
||||
@@ -324,7 +324,7 @@ dnl else
|
||||
LIBXOSD=`xosd-config --libs`
|
||||
DRIVERS="$DRIVERS xosd${SO}"
|
||||
actdrivers=["$actdrivers xosd"]
|
||||
],[
|
||||
],[
|
||||
dnl else
|
||||
AC_MSG_WARN([The xosd driver needs the xosd library])
|
||||
])
|
||||
|
||||
@@ -147,7 +147,7 @@ if ($twentyfour > 0) {
|
||||
if ($time[2] > 11) {
|
||||
$ampmstring = "PM";
|
||||
}
|
||||
|
||||
|
||||
if ($time[2] > 12) {
|
||||
$time[2] = $time[2] - 12;
|
||||
}
|
||||
@@ -197,9 +197,9 @@ $i = 0;
|
||||
my $flag = 0;
|
||||
while (defined($line = <SOCK>)) {
|
||||
$i++;
|
||||
|
||||
|
||||
if ($line =~ /^%%/) { $i = 1; $flag = 1; }
|
||||
|
||||
|
||||
if ($flag > 0) {
|
||||
if ($i == 2) {
|
||||
chop($line);
|
||||
@@ -229,10 +229,10 @@ close(TMPFILE);
|
||||
# compare tmpfile with current menufile and possibly update it.
|
||||
if (-e $menufile) {
|
||||
my ($tmpline, $menuline, $linecount);
|
||||
|
||||
|
||||
open(MENUFILE, $menufile);
|
||||
open(TMPFILE, $tmpfile);
|
||||
|
||||
|
||||
# read in the first 'headline' menu entry from each file.
|
||||
if ($frontpage eq "top") {
|
||||
$linecount = 3;
|
||||
@@ -243,7 +243,7 @@ if (-e $menufile) {
|
||||
for ($i = 0; $i < $linecount; $i++) {
|
||||
if (eof(TMPFILE)) {
|
||||
if ($forceupdate == 0) {
|
||||
|
||||
|
||||
close(MENUFILE);
|
||||
close(TMPFILE);
|
||||
unlink($tmpfile);
|
||||
@@ -258,12 +258,12 @@ if (-e $menufile) {
|
||||
$menuline = <MENUFILE>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (($forceupdate == 0) && (($tmpline =~ /^"$sitename Headlines/) || ($tmpline =~ /^"$sitename Frontpage/) || ($tmpline eq $menuline))) {
|
||||
close(MENUFILE);
|
||||
close(TMPFILE);
|
||||
unlink($tmpfile);
|
||||
|
||||
|
||||
exit();
|
||||
}
|
||||
}
|
||||
@@ -280,11 +280,11 @@ sub wmdie {
|
||||
if ($string ne "") {
|
||||
print "$string\n";
|
||||
}
|
||||
|
||||
|
||||
close(SOCK);
|
||||
close(TMPFILE);
|
||||
unlink($tmpfile);
|
||||
|
||||
|
||||
if ($string eq "") {
|
||||
exit(0);
|
||||
} else {
|
||||
|
||||
@@ -34,7 +34,7 @@ ac_status(int status)
|
||||
for (i = 0; ac_table[i].name != NULL; i++)
|
||||
if (status == ac_table[i].status)
|
||||
return ac_table[i].name;
|
||||
|
||||
|
||||
return ac_table[LCDP_AC_UNKNOWN].name;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ battery_status(int status)
|
||||
for (i = 0; batt_table[i].name != NULL; i++)
|
||||
if (status == batt_table[i].status)
|
||||
return batt_table[i].name;
|
||||
|
||||
|
||||
return batt_table[LCDP_AC_UNKNOWN].name;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ time_screen (int rep, int display, int *flags_ptr)
|
||||
hour = ((int) uptime % 86400) / 60 / 60;
|
||||
min = (((int) uptime % 86400) % 3600) / 60;
|
||||
sec = ((int) uptime % 60);
|
||||
|
||||
|
||||
if (lcd_wid >= 20)
|
||||
sprintf (tmp, "Up %3d day%s %02d%c%02d%c%02d",
|
||||
days, ((days != 1) ? "s" : ""), hour, colon[heartbeat], min, colon[heartbeat], sec);
|
||||
@@ -175,7 +175,7 @@ time_screen (int rep, int display, int *flags_ptr)
|
||||
sprintf (buffer, "widget_set T two %i 3 {%s}\n", xoffs, tmp);
|
||||
if (display)
|
||||
sock_send_string (sock, buffer);
|
||||
|
||||
|
||||
// display the time & idle time...
|
||||
sprintf (tmp, "%s %3i%% idle", now, (int) idle);
|
||||
xoffs = (lcd_wid > strlen(tmp)) ? ((lcd_wid - strlen(tmp)) / 2) + 1 : 1;
|
||||
@@ -233,7 +233,7 @@ clock_screen (int rep, int display, int *flags_ptr)
|
||||
|
||||
sprintf (buffer, "widget_set O title {DATE & TIME}\n");
|
||||
sock_send_string (sock, buffer);
|
||||
|
||||
|
||||
sprintf (tmp, "%s", get_hostname());
|
||||
xoffs = (lcd_wid > strlen(tmp)) ? (((lcd_wid - strlen(tmp)) / 2) + 1) : 1;
|
||||
sprintf (buffer, "widget_set O one %i 2 {%s}\n", xoffs, tmp);
|
||||
@@ -323,7 +323,7 @@ uptime_screen (int rep, int display, int *flags_ptr)
|
||||
sock_send_string (sock, "widget_add U three string\n");
|
||||
|
||||
sock_send_string (sock, "widget_set U title {SYSTEM UPTIME}\n");
|
||||
|
||||
|
||||
sprintf (tmp, "%s", get_hostname());
|
||||
xoffs = (lcd_wid > strlen(tmp)) ? (((lcd_wid - strlen(tmp)) / 2) + 1) : 1;
|
||||
sprintf (buffer, "widget_set U one %i 2 {%s}\n", xoffs, tmp);
|
||||
@@ -335,7 +335,7 @@ uptime_screen (int rep, int display, int *flags_ptr)
|
||||
sock_send_string (sock, buffer);
|
||||
} else {
|
||||
sock_send_string (sock, "widget_add U one string\n");
|
||||
|
||||
|
||||
sprintf (tmp, "widget_set U title {%s %s: %s}\n", get_sysname(), get_sysrelease(), get_hostname());
|
||||
sock_send_string (sock, tmp);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ cpu_screen(int rep, int display, int *flags_ptr)
|
||||
sock_send_string(sock, buffer);
|
||||
if (lcd_hgt >= 4) {
|
||||
gauge_wid = lcd_wid - 6; // room between 0%...100%
|
||||
|
||||
|
||||
sock_send_string(sock, "widget_add C title title\n");
|
||||
sock_send_string(sock, "widget_set C title {CPU LOAD}\n");
|
||||
sock_send_string(sock, "widget_add C one string\n");
|
||||
@@ -105,14 +105,14 @@ cpu_screen(int rep, int display, int *flags_ptr)
|
||||
// Read new data
|
||||
if (load.total > 0L) {
|
||||
cpu[CPU_BUF_SIZE - 1][0] = 100.0 * ((double) load.user / (double) load.total);
|
||||
cpu[CPU_BUF_SIZE - 1][1] = 100.0 * ((double) load.system / (double) load.total);
|
||||
cpu[CPU_BUF_SIZE - 1][1] = 100.0 * ((double) load.system / (double) load.total);
|
||||
cpu[CPU_BUF_SIZE - 1][2] = 100.0 * ((double) load.nice / (double) load.total);
|
||||
cpu[CPU_BUF_SIZE - 1][3] = 100.0 * ((double) load.idle / (double) load.total);
|
||||
cpu[CPU_BUF_SIZE - 1][4] = 100.0 * (((double) load.user + (double) load.system + (double) load.nice) / (double) load.total);
|
||||
}
|
||||
else {
|
||||
cpu[CPU_BUF_SIZE - 1][0] = 0.0;
|
||||
cpu[CPU_BUF_SIZE - 1][1] = 0.0;
|
||||
cpu[CPU_BUF_SIZE - 1][1] = 0.0;
|
||||
cpu[CPU_BUF_SIZE - 1][2] = 0.0;
|
||||
cpu[CPU_BUF_SIZE - 1][3] = 0.0;
|
||||
cpu[CPU_BUF_SIZE - 1][4] = 0.0;
|
||||
|
||||
@@ -101,7 +101,7 @@ disk_screen (int rep, int display, int *flags_ptr)
|
||||
sock_send_string (sock, "widget_set D err2 1 3 {Filesystem Stats}\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Display stuff... (show for two seconds, then scroll once per
|
||||
// second, then hold at the end for two seconds)
|
||||
sprintf (buffer, "widget_set D f 1 2 %i %i %i %i v 12\n", lcd_wid, lcd_hgt, lcd_wid, count);
|
||||
@@ -111,7 +111,7 @@ disk_screen (int rep, int display, int *flags_ptr)
|
||||
for (i = 0; i < count; i++) {
|
||||
if (table[i].dev[0] == '\0')
|
||||
continue;
|
||||
|
||||
|
||||
if (i >= num_disks) { // Make sure we have enough lines...
|
||||
sprintf (tmp, "widget_add D s%i string -in f\n", i);
|
||||
sock_send_string (sock, tmp);
|
||||
|
||||
@@ -72,16 +72,16 @@ int machine_init()
|
||||
/* get the page size with "getpagesize" and calculate pageshift from it */
|
||||
int pagesize = 0;
|
||||
pageshift = 0;
|
||||
|
||||
|
||||
lcdproc_port = mach_host_self();
|
||||
host_page_size(lcdproc_port, &pagesize);
|
||||
|
||||
|
||||
while (pagesize > 1)
|
||||
{
|
||||
pageshift++;
|
||||
pagesize >>= 1;
|
||||
}
|
||||
|
||||
|
||||
/* we only need the amount of log(2)1024 for our conversion */
|
||||
pageshift -= 10;
|
||||
|
||||
@@ -101,11 +101,11 @@ int machine_get_battstat(int *acstat, int *battflag, int *percent)
|
||||
int i;
|
||||
CFDictionaryRef pSource = NULL;
|
||||
const void *psValue;
|
||||
|
||||
|
||||
*acstat = LCDP_AC_ON;
|
||||
*battflag = LCDP_BATT_ABSENT;
|
||||
*percent = 100;
|
||||
|
||||
|
||||
if (CFArrayGetCount(sources) == 0) return(FALSE);
|
||||
|
||||
for (i = 0; i < CFArrayGetCount(sources); i++)
|
||||
@@ -114,11 +114,11 @@ int machine_get_battstat(int *acstat, int *battflag, int *percent)
|
||||
if (!pSource) break;
|
||||
|
||||
psValue = (CFStringRef)CFDictionaryGetValue(pSource, CFSTR(kIOPSNameKey));
|
||||
|
||||
|
||||
if (CFDictionaryGetValueIfPresent(pSource, CFSTR(kIOPSIsPresentKey), &psValue) && (CFBooleanGetValue(psValue) > 0))
|
||||
{
|
||||
psValue = (CFStringRef)CFDictionaryGetValue(pSource, CFSTR(kIOPSPowerSourceStateKey));
|
||||
|
||||
|
||||
if (CFStringCompare(psValue,CFSTR(kIOPSBatteryPowerValue),0)==kCFCompareEqualTo)
|
||||
{
|
||||
/* We are running on a battery power source. */
|
||||
@@ -135,20 +135,20 @@ int machine_get_battstat(int *acstat, int *battflag, int *percent)
|
||||
else
|
||||
*battflag = LCDP_BATT_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
if (*battflag != LCDP_BATT_ABSENT)
|
||||
{
|
||||
int curCapacity = 0;
|
||||
int maxCapacity = 0;
|
||||
|
||||
|
||||
psValue = CFDictionaryGetValue(pSource, CFSTR(kIOPSCurrentCapacityKey));
|
||||
CFNumberGetValue(psValue, kCFNumberSInt32Type, &curCapacity);
|
||||
|
||||
|
||||
psValue = CFDictionaryGetValue(pSource, CFSTR(kIOPSMaxCapacityKey));
|
||||
CFNumberGetValue(psValue, kCFNumberSInt32Type, &maxCapacity);
|
||||
|
||||
|
||||
*percent = (int)((double)curCapacity/(double)maxCapacity * 100);
|
||||
|
||||
|
||||
/* There is a way to check this through the IOKit,
|
||||
but I am not sure what gets for kIOPSLowWarnLevelKey and kIOPSDeadWarnLevelKey, and this is easier.
|
||||
*/
|
||||
@@ -161,14 +161,14 @@ int machine_get_battstat(int *acstat, int *battflag, int *percent)
|
||||
*battflag = LCDP_BATT_CRITICAL;
|
||||
}
|
||||
/* printf ("powerSource %d of %d: percent: %d/%d %d\n", i, CFArrayGetCount(sources), curCapacity, maxCapacity, *percent);*/
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CFRelease(blob);
|
||||
CFRelease(sources);
|
||||
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ int machine_get_fs(mounts_type fs[], int *cnt)
|
||||
statcnt++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*cnt = statcnt;
|
||||
|
||||
return(TRUE);
|
||||
@@ -223,7 +223,7 @@ int machine_get_load(load_type *curr_load)
|
||||
static load_type last_load = { 0, 0, 0, 0, 0 };
|
||||
static load_type last_ret_load;
|
||||
load_type load;
|
||||
|
||||
|
||||
host_cpu_load_info_data_t load_info;
|
||||
mach_msg_type_number_t info_count;
|
||||
|
||||
@@ -233,7 +233,7 @@ int machine_get_load(load_type *curr_load)
|
||||
perror("host_statistics");
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
load.user = (unsigned long) (load_info.cpu_ticks[CPU_STATE_USER]);
|
||||
load.nice = (unsigned long) (load_info.cpu_ticks[CPU_STATE_NICE]);
|
||||
load.system = (unsigned long) (load_info.cpu_ticks[CPU_STATE_SYSTEM]);
|
||||
@@ -277,14 +277,14 @@ int machine_get_meminfo(meminfo_type *result)
|
||||
|
||||
vm_statistics_data_t vm_info;
|
||||
mach_msg_type_number_t info_count;
|
||||
|
||||
|
||||
info_count = HOST_VM_INFO_COUNT;
|
||||
if (host_statistics(lcdproc_port, HOST_VM_INFO, (host_info_t)&vm_info, &info_count))
|
||||
{
|
||||
perror("host_statistics");
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
result[0].total = pagetok(vm_info.active_count + vm_info.inactive_count +
|
||||
vm_info.free_count + vm_info.wire_count);
|
||||
result[0].free = pagetok(vm_info.free_count);
|
||||
@@ -312,7 +312,7 @@ int machine_get_procs(LinkedList *procs)
|
||||
/* FIX ME */
|
||||
/* This needs to be finished. */
|
||||
procinfo_type *p;
|
||||
|
||||
|
||||
processor_set_t *psets, pset;
|
||||
task_t *tasks;
|
||||
|
||||
@@ -331,14 +331,14 @@ int machine_get_procs(LinkedList *procs)
|
||||
perror("host_processor_set_priv");
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
p = malloc(sizeof(procinfo_type));
|
||||
if (!p)
|
||||
{
|
||||
perror("mem_top_malloc");
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
@@ -406,25 +406,25 @@ static int swapmode(int *rettotal, int *retfree)
|
||||
mib[0] = CTL_VM;
|
||||
mib[1] = VM_SWAPUSAGE;
|
||||
size = sizeof(xsu);
|
||||
|
||||
|
||||
*rettotal = 0;
|
||||
*retfree = 0;
|
||||
|
||||
|
||||
if (sysctl(mib, 2, &xsu, &size, NULL, 0) != 0)
|
||||
{
|
||||
perror("sysctl");
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
*rettotal = (xsu.xsu_total/1024);
|
||||
*retfree = ((xsu.xsu_total-xsu.xsu_used)/1024);
|
||||
|
||||
return(TRUE);
|
||||
#endif
|
||||
|
||||
|
||||
*rettotal = 0;
|
||||
*retfree = 0;
|
||||
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ int machine_get_fs(mounts_type fs[], int *cnt)
|
||||
statcnt++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*cnt = statcnt;
|
||||
|
||||
return(TRUE);
|
||||
|
||||
@@ -499,7 +499,7 @@ int machine_get_smpload(load_type *result, int *numcpus)
|
||||
int machine_get_uptime(double *up, double *idle)
|
||||
{
|
||||
double local_up, local_idle;
|
||||
|
||||
|
||||
reread(uptime_fd, "get_uptime:");
|
||||
sscanf(procbuf, "%lf %lf", &local_up, &local_idle);
|
||||
if (up != NULL)
|
||||
|
||||
@@ -92,7 +92,7 @@ int machine_get_battstat(int *acstat, int *battflag, int *percent)
|
||||
{
|
||||
int apmd;
|
||||
struct apm_power_info apmi;
|
||||
|
||||
|
||||
if ((apmd = open("/dev/apm", O_RDONLY)) == -1)
|
||||
{
|
||||
*acstat = LCDP_AC_ON;
|
||||
@@ -100,14 +100,14 @@ int machine_get_battstat(int *acstat, int *battflag, int *percent)
|
||||
*percent = 100;
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
memset(&apmi, 0, sizeof(apmi));
|
||||
if (ioctl(apmd, APM_IOC_GETPOWER, &apmi) == -1)
|
||||
{
|
||||
perror("APM_IOC_GETPOWER failed in get_batt_stat()");
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
switch(apmi.ac_state)
|
||||
{
|
||||
case APM_AC_OFF:
|
||||
@@ -177,7 +177,7 @@ int machine_get_fs(mounts_type fs[], int *cnt)
|
||||
statcnt++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*cnt = statcnt;
|
||||
return(TRUE);
|
||||
}
|
||||
@@ -250,7 +250,7 @@ int machine_get_meminfo(meminfo_type *result)
|
||||
perror("sysctl vm.uvmexp2 failed");
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
/* memory */
|
||||
result[0].total = pagetok(uvmexp.npages);
|
||||
result[0].free = pagetok(uvmexp.free);
|
||||
|
||||
@@ -185,7 +185,7 @@ int machine_get_fs(mounts_type fs[], int *cnt)
|
||||
statcnt++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*cnt = statcnt;
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
@@ -293,11 +293,11 @@ process_command_line(int argc, char **argv)
|
||||
/* parse arguments */
|
||||
if (argc > optind) //user specified some modes, so clear all defaults
|
||||
clear_modes();
|
||||
|
||||
|
||||
for (i = max(optind, 1); i < argc; i++) {
|
||||
int shortname = (strlen(argv[i]) == 1) ? toupper(argv[i][0]) : '\0';
|
||||
int found = set_mode(shortname, argv[i], 1);
|
||||
|
||||
|
||||
if (!found) {
|
||||
fprintf(stderr, "Invalid Mode: %c\n", argv[i][0]);
|
||||
return(EXIT_FAILURE);
|
||||
@@ -491,7 +491,7 @@ main_loop()
|
||||
//for (i=0; i<argc; i++) argv[i]=NULL; // Get rid of old tokens
|
||||
argc = 0;
|
||||
newtoken = 1;
|
||||
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
switch (buf[i]) {
|
||||
case ' ':
|
||||
|
||||
@@ -68,7 +68,7 @@ mem_screen (int rep, int display, int *flags_ptr)
|
||||
} else {
|
||||
gauge_wid = (lcd_wid >= 18) ? max(2, lcd_wid - 18) : 0;
|
||||
gauge_offs = (lcd_wid - gauge_wid) / 2 + 2;
|
||||
|
||||
|
||||
sock_send_string(sock, "widget_add M m string\n");
|
||||
sock_send_string(sock, "widget_add M s string\n");
|
||||
if (gauge_wid > 0) {
|
||||
@@ -244,20 +244,20 @@ mem_top_screen (int rep, int display, int *flags_ptr)
|
||||
|
||||
if ((*flags_ptr & INITIALIZED) == 0) {
|
||||
*flags_ptr |= INITIALIZED;
|
||||
|
||||
|
||||
sock_send_string(sock, "screen_add S\n");
|
||||
sprintf(buffer, "screen_set S -name {Top Memory Use: %s}\n", get_hostname());
|
||||
sock_send_string(sock, buffer);
|
||||
sock_send_string(sock, "widget_add S title title\n");
|
||||
sprintf(buffer, "widget_set S title {TOP MEM: %s}\n", get_hostname());
|
||||
sock_send_string(sock, buffer);
|
||||
|
||||
|
||||
// frame from (2nd line, left) to (last line, right)
|
||||
sock_send_string(sock, "widget_add S f frame\n");
|
||||
sprintf(buffer, "widget_set S f 1 2 %i %i %i 5 v %i\n",
|
||||
lcd_wid, lcd_hgt, lcd_wid, ((lcd_hgt >= 4) ? 8 : 12));
|
||||
sock_send_string(sock, buffer);
|
||||
|
||||
|
||||
// frame contents
|
||||
for (i = 1; i <= 5; i++) {
|
||||
sprintf(buffer, "widget_add S %i string -in f\n", i);
|
||||
|
||||
@@ -52,7 +52,7 @@ sprintf_memory(char *dst, double value, double roundlimit)
|
||||
format = "%.2f%s";
|
||||
if (value < 10)
|
||||
format = "%.3f%s";
|
||||
|
||||
|
||||
sprintf(dst, format, value, units[offs]);
|
||||
}
|
||||
return dst;
|
||||
|
||||
@@ -197,14 +197,14 @@ while (1) {
|
||||
|
||||
# Sanity check
|
||||
die "METAR is too short! Something went wrong." if (length($metar)<1);
|
||||
|
||||
|
||||
# pass the data to the METAR module.
|
||||
# print("$metar\n");
|
||||
$m->metar($metar);
|
||||
|
||||
# ask for the temperature(s)
|
||||
my $temp; my $temp_u; my $dew; my $dew_u; my $wind; my $wind_u; my $wind_dir;
|
||||
|
||||
|
||||
if ($datasystem eq "nautical") {
|
||||
$temp = $m->C_TEMP;
|
||||
$temp_u = "C";
|
||||
@@ -231,18 +231,18 @@ while (1) {
|
||||
$wind_u = "km/h";
|
||||
$wind_dir = $m->WIND_DIR_ENG;
|
||||
}
|
||||
|
||||
|
||||
my $metartime = $m->TIME;
|
||||
my $sky = $m->SKY;
|
||||
my $visibility = $m->VISIBILITY;
|
||||
|
||||
|
||||
print $remote sprintf("widget_set metar title {Weather %s %s}\n", $site_code, $metartime);
|
||||
print $remote sprintf("widget_set metar temp 1 2 {Temp %i%s (%i%s Dew)}\n", $temp, $temp_u, $dew, $dew_u) if ($temp and $dew);
|
||||
print $remote sprintf("widget_set metar wind 1 3 {Wind %i%s, %s}\n", $wind, $wind_u, $wind_dir) if ($wind_dir and $wind);
|
||||
print $remote sprintf("widget_set metar visib 1 %i %i %i h 3 {Visibility %s}\n", $lcdheight, $lcdwidth, $lcdheight, $visibility ) if ($visibility);
|
||||
print $remote sprintf("widget_set metar cloud 1 4 {Sky %s}\n", join(',', @{$m->{sky}}) ) if ($m->{sky} and ($lcdheight>4));
|
||||
} # end else
|
||||
|
||||
|
||||
# eat all input from LCDd
|
||||
while(defined(my $input = <$remote>)) { }
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ char *get_name(char *name, char *p)
|
||||
break;
|
||||
if (*p == ':') { /* could be an alias */
|
||||
char *dot = p++;
|
||||
while (*p && isdigit(*p)) p++;
|
||||
while (*p && isdigit(*p)) p++;
|
||||
if (*p == ':') {
|
||||
/* Yes it is, backup and copy it. */
|
||||
p = dot;
|
||||
|
||||
@@ -12,7 +12,7 @@ char* cutalias(char* name)
|
||||
{
|
||||
int digit = 0;
|
||||
int pos;
|
||||
|
||||
|
||||
for(pos=strlen(name); pos>0; pos--)
|
||||
{
|
||||
if (name[pos-1]==':' && digit)
|
||||
@@ -58,41 +58,41 @@ int nstrcmp(const char *ap, const char *bp)
|
||||
|
||||
if (res != 0)
|
||||
{ free(a); free(b); return res; }
|
||||
|
||||
|
||||
if (aindex > bindex)
|
||||
{ free(a); free(b); return 1; }
|
||||
|
||||
|
||||
if (aindex < bindex)
|
||||
{ free(a); free(b); return -1; }
|
||||
|
||||
|
||||
an = a+aindex;
|
||||
bn = b+bindex;
|
||||
|
||||
|
||||
av = atoi(an);
|
||||
bv = atoi(bn);
|
||||
|
||||
|
||||
if (av < bv)
|
||||
{ free(a); free(b); return -1; }
|
||||
|
||||
|
||||
if (av > bv)
|
||||
{ free(a); free(b); return 1; }
|
||||
|
||||
|
||||
av = -1;
|
||||
if (aalias != NULL)
|
||||
av = atoi(aalias);
|
||||
|
||||
|
||||
bv = -1;
|
||||
if (balias != NULL)
|
||||
bv = atoi(balias);
|
||||
|
||||
|
||||
free(a); free(b);
|
||||
|
||||
|
||||
if (av < bv)
|
||||
return -1;
|
||||
|
||||
|
||||
if (av > bv)
|
||||
return 1;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ int dotest(char* a, char* b, int exp)
|
||||
int main()
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
|
||||
err |= dotest("eth1", "eth1", 0);
|
||||
err |= dotest("eth0:1", "eth0:1", 0);
|
||||
err |= dotest("lan", "lan", 0);
|
||||
@@ -139,7 +139,7 @@ int main()
|
||||
err |= dotest("eth1:10", "eth13:10", -1);
|
||||
err |= dotest("eth1:1", "eth1:13", -1);
|
||||
err |= dotest("a", "a:", -1);
|
||||
|
||||
|
||||
err |= dotest("aa", "a", 1);
|
||||
err |= dotest("eth2", "eth1", 1);
|
||||
err |= dotest("eth13", "eth1", 1);
|
||||
|
||||
@@ -16,7 +16,7 @@ write).
|
||||
And there is something else that is a wrapper to get old functions
|
||||
(port_in, port_out, etc) supported for such drivers that are not
|
||||
modified to use new parallel port functions.
|
||||
|
||||
|
||||
So, if you have an LCD attached to your parallel port (like my hd44780)
|
||||
without keys attached to it, you can apply this patch and just forget
|
||||
the io access to the parallel port :)
|
||||
|
||||
+4
-4
@@ -59,16 +59,16 @@ API_VERSION in the code.
|
||||
//////// Functions to be provided by the driver module
|
||||
|
||||
//// Mandatory functions (necessary for all drivers)
|
||||
|
||||
|
||||
// initialize driver: return >= 0 on success
|
||||
int (*init) (Driver *drvthis);
|
||||
|
||||
|
||||
// close driver
|
||||
void (*close) (Driver *drvthis);
|
||||
|
||||
|
||||
//// Essential output functions (necessary for output drivers)
|
||||
|
||||
|
||||
// get display width & height (in characters)
|
||||
int (*width) (Driver *drvthis);
|
||||
int (*height) (Driver *drvthis);
|
||||
@@ -91,7 +91,7 @@ API_VERSION in the code.
|
||||
// get key from driver: returns a string denoting the key pressed
|
||||
const char *(*get_key) (Driver *drvthis);
|
||||
|
||||
|
||||
|
||||
//// Extended output functions (optional; core provides alternatives)
|
||||
|
||||
// draw a bar from pos (x,y) upward / to the right filling promille of len chars
|
||||
|
||||
@@ -50,14 +50,14 @@ int main(int ac,char **av) {
|
||||
} else {
|
||||
fd=openRawSerialLine(av[1],atoi(av[2]),FLOW_NONE,O_RDWR);
|
||||
}
|
||||
|
||||
|
||||
filein=open(av[3], O_RDWR);
|
||||
|
||||
read(filein, bmpin, 62);
|
||||
|
||||
|
||||
read(filein, bmpin, 512);
|
||||
close(filein);
|
||||
|
||||
|
||||
idx=0;
|
||||
for(j=31;j>-1;j--) {
|
||||
for(i=0;i<16;i++) {
|
||||
@@ -72,9 +72,9 @@ int main(int ac,char **av) {
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sprintf(str,"%cDG", 27);
|
||||
|
||||
|
||||
if(atoi(av[4])==0) {
|
||||
for (idx=0;idx<480;idx++) {
|
||||
gxbits[idx]=gxbits[idx] ^ 255;
|
||||
|
||||
@@ -614,7 +614,7 @@ Send char(0)
|
||||
fanX is a value from 0 to 255, 0 is fan off, 255 is fan full speed.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1.5.1 Keypad
|
||||
------------
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<chapter id="driver-api">
|
||||
<title>The LCDproc driver API</title>
|
||||
|
||||
|
||||
<para>
|
||||
This chapter describes the driver API of v0.5 of LCDproc.
|
||||
At time of this writing, this version is not released and some things might
|
||||
@@ -74,16 +74,16 @@ API_VERSION in the code.
|
||||
//////// Functions to be provided by the driver module
|
||||
|
||||
//// Mandatory functions (necessary for all drivers)
|
||||
|
||||
|
||||
// initialize driver: returns >= 0 on success
|
||||
int (*init) (Driver *drvthis);
|
||||
|
||||
|
||||
// close driver
|
||||
void (*close) (Driver *drvthis);
|
||||
|
||||
|
||||
//// Essential output functions (necessary for output drivers)
|
||||
|
||||
|
||||
// get display width / height (in characters; 1-based)
|
||||
int (*width) (Driver *drvthis);
|
||||
int (*height) (Driver *drvthis);
|
||||
@@ -106,7 +106,7 @@ API_VERSION in the code.
|
||||
// get key from driver: returns a string denoting the key pressed
|
||||
const char *(*get_key) (Driver *drvthis);
|
||||
|
||||
|
||||
|
||||
//// Extended output functions (optional; core provides alternatives)
|
||||
|
||||
// draw a bar from pos (x,y) upward / to the right filling promille of len chars
|
||||
@@ -256,7 +256,7 @@ typedef struct my_driver_private {
|
||||
p->fd = -1;
|
||||
p->cellheight = 8;
|
||||
p->cellwidth = 6;
|
||||
|
||||
|
||||
(... continue with the rest of your init routine)
|
||||
</screen>
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ CFontz633 chipset.
|
||||
<listitem><para>
|
||||
Select the output device to use [default: <filename>/dev/lcd</filename>]
|
||||
may be serial device or USB device in serial emulation mode.
|
||||
|
||||
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ This section covers the joystick input driver for LCDd.
|
||||
<literal>pos</literal> determining the direction.
|
||||
The exact numbering of the axes depends on the hardware used.
|
||||
</para>
|
||||
|
||||
|
||||
<para>
|
||||
<replaceable>KEY</replaceable> can be one of the keys that LCDd recognizes
|
||||
(<literal>Left</literal>, <literal>Right</literal>, <literal>Up</literal>,
|
||||
@@ -68,7 +68,7 @@ This section covers the joystick input driver for LCDd.
|
||||
that represents each button. The exact numbering of the buttons depends on the
|
||||
hardware used.
|
||||
</para>
|
||||
|
||||
|
||||
<para>
|
||||
<replaceable>KEY</replaceable> can be one of the keys that LCDd recognizes
|
||||
(<literal>Left</literal>, <literal>Right</literal>, <literal>Up</literal>,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<!ENTITY license SYSTEM "license.docbook">
|
||||
|
||||
<!ENTITY ppttrouble SYSTEM "drivers/ppttrouble.docbook">
|
||||
|
||||
|
||||
<!ENTITY bayrad SYSTEM "drivers/bayrad.docbook">
|
||||
<!ENTITY CFontz SYSTEM "drivers/CFontz.docbook">
|
||||
<!ENTITY CFontz633 SYSTEM "drivers/CFontz633.docbook">
|
||||
|
||||
@@ -189,8 +189,8 @@ menu_add_item_func (Client * c, int argc, char **argv)
|
||||
item = menuitem_create_ip (item_id, menu_commands_handler, text, c,
|
||||
0, "192.168.1.245");
|
||||
break;
|
||||
default:
|
||||
assert(!"unexpected menuitem type");
|
||||
default:
|
||||
assert(!"unexpected menuitem type");
|
||||
}
|
||||
menu_add_item (menu, item);
|
||||
menuscreen_inform_item_modified (menu);
|
||||
@@ -213,7 +213,7 @@ menu_add_item_func (Client * c, int argc, char **argv)
|
||||
/* skip "text" */
|
||||
if (i == 4 && argv[4][0] != '-')
|
||||
continue;
|
||||
|
||||
|
||||
argv_set[j++] = argv[i];
|
||||
}
|
||||
menu_set_item_func(c, j, argv_set);
|
||||
@@ -670,7 +670,7 @@ menu_set_item_func (Client * c, int argc, char **argv)
|
||||
|
||||
new_buf = malloc(item->data.ip.maxlength + 1 );
|
||||
strncpy( new_buf, item->data.ip.value, item->data.ip.maxlength);
|
||||
|
||||
|
||||
new_buf[item->data.ip.maxlength] = '\0'; /* terminate */
|
||||
free( item->data.ip.value );
|
||||
item->data.ip.value = new_buf;
|
||||
@@ -931,11 +931,11 @@ MenuEventFunc (menu_commands_handler)
|
||||
}
|
||||
}
|
||||
else if (event == MENUEVENT_ENTER
|
||||
|| event == MENUEVENT_LEAVE)
|
||||
|| event == MENUEVENT_LEAVE)
|
||||
{
|
||||
snprintf (buf, sizeof(buf)-1, "menuevent %s %.40s\n",
|
||||
menuitem_eventtype_to_eventtypename(event),
|
||||
item->id);
|
||||
snprintf (buf, sizeof(buf)-1, "menuevent %s %.40s\n",
|
||||
menuitem_eventtype_to_eventtypename(event),
|
||||
item->id);
|
||||
}
|
||||
else {
|
||||
snprintf (buf, sizeof(buf)-1, "menuevent %s %.40s\n",
|
||||
@@ -949,7 +949,7 @@ MenuEventFunc (menu_commands_handler)
|
||||
c = menuitem_get_client(item);
|
||||
if( !c ) {
|
||||
report( RPT_ERR, "%s: Could not find client of item \"%s\"",
|
||||
__FUNCTION__, item->id );
|
||||
__FUNCTION__, item->id );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
/*
|
||||
Different implementations of (n)curses available on:
|
||||
OpenBSD:
|
||||
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libcurses/
|
||||
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libcurses/
|
||||
ncurses
|
||||
NetBSD:
|
||||
http://cvsweb.netbsd.org/bsdweb.cgi/basesrc/lib/libcurses/
|
||||
|
||||
+3
-3
@@ -219,7 +219,7 @@ main(int argc, char **argv)
|
||||
|
||||
/* Set reporting settings (will also flush delayed reports) */
|
||||
set_reporting("LCDd", report_level, report_dest);
|
||||
report(RPT_INFO, "Set report level to %d, output to %s", report_level,
|
||||
report(RPT_INFO, "Set report level to %d, output to %s", report_level,
|
||||
((report_dest == RPT_DEST_SYSLOG) ? "syslog" : "stderr"));
|
||||
CHAIN_END( e, "Critical error while processing settings, abort." );
|
||||
|
||||
@@ -464,7 +464,7 @@ process_configfile(char *configfile)
|
||||
|
||||
if (report_dest == UNSET_INT) {
|
||||
int rs = config_get_bool("server", "reportToSyslog", 0, UNSET_INT);
|
||||
|
||||
|
||||
if (rs != UNSET_INT)
|
||||
report_dest = (rs) ? RPT_DEST_SYSLOG : RPT_DEST_STDERR;
|
||||
}
|
||||
@@ -781,7 +781,7 @@ do_reload(void)
|
||||
|
||||
/* Set reporting values */
|
||||
CHAIN( e, set_reporting("LCDd", report_level, report_dest) );
|
||||
CHAIN( e, ( report(RPT_INFO, "Set report level to %d, output to %s", report_level,
|
||||
CHAIN( e, ( report(RPT_INFO, "Set report level to %d, output to %s", report_level,
|
||||
((report_dest == RPT_DEST_SYSLOG) ? "syslog" : "stderr")), 0 ) );
|
||||
|
||||
/* And restart the drivers */
|
||||
|
||||
+4
-4
@@ -339,7 +339,7 @@ void menu_build_screen (MenuItem *menu, Screen *s)
|
||||
(w->text)[display_props->width-1] = '\0';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
assert(!"unexpected menuitem type");
|
||||
}
|
||||
}
|
||||
@@ -491,7 +491,7 @@ void menu_update_screen (MenuItem *menu, Screen *s)
|
||||
w->type = (menu->data.menu.scroll > 0) ? WID_ICON : WID_NONE;
|
||||
else
|
||||
report (RPT_ERR, "%s: could not find widget: %s", __FUNCTION__, "upscroller");
|
||||
|
||||
|
||||
/* Enable downscroller (if necessary) */
|
||||
w = screen_find_widget (s, "downscroller");
|
||||
if (w != NULL)
|
||||
@@ -629,7 +629,7 @@ MenuResult menu_process_input(Menu *menu, MenuToken token, const char * key, boo
|
||||
case MENUTOKEN_LEFT:
|
||||
if (!extended)
|
||||
return MENURESULT_NONE;
|
||||
|
||||
|
||||
subitem = menu_get_subitem (menu, menu->data.menu.selector_pos);
|
||||
if (subitem == NULL)
|
||||
break;
|
||||
@@ -661,7 +661,7 @@ MenuResult menu_process_input(Menu *menu, MenuToken token, const char * key, boo
|
||||
case MENUTOKEN_RIGHT:
|
||||
if (!extended)
|
||||
return MENURESULT_NONE;
|
||||
|
||||
|
||||
subitem = menu_get_subitem(menu, menu->data.menu.selector_pos);
|
||||
if (subitem == NULL)
|
||||
break;
|
||||
|
||||
+18
-18
@@ -83,7 +83,7 @@ const IpSstringProperties IPinfo[] = {
|
||||
// IPv6: 39 char long ':'-separated sequence of 4-digit hex strings in range 0000 - ffff
|
||||
{ 39, ':', 16, 4, 65535, { 4096, 256, 16, 1, 0 }, "%04x", verify_ipv6, "0:0:0:0:0:0:0:0" }
|
||||
};
|
||||
|
||||
|
||||
|
||||
/******** MENU UTILITY FUNCTIONS ********/
|
||||
|
||||
@@ -207,7 +207,7 @@ MenuItem *menuitem_create (MenuItemType type, char *id, MenuEventFunc(*event_fun
|
||||
// report (RPT_ERR, "%s: illegal id or text", __FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Allocate space and fill struct */
|
||||
new_item = malloc (sizeof(MenuItem));
|
||||
if (!new_item) {
|
||||
@@ -392,7 +392,7 @@ MenuItem *menuitem_create_ip (char *id, MenuEventFunc(*event_func),
|
||||
new_item = menuitem_create (MENUITEM_IP, id, event_func, text, client);
|
||||
new_item->data.ip.v6 = v6;
|
||||
ipinfo = (v6) ? &IPinfo[1] : &IPinfo[0];
|
||||
|
||||
|
||||
new_item->data.ip.maxlength = ipinfo->maxlen;;
|
||||
new_item->data.ip.value = malloc (new_item->data.ip.maxlength + 1);
|
||||
|
||||
@@ -646,7 +646,7 @@ void menuitem_rebuild_screen_slider (MenuItem *item, Screen *s)
|
||||
|
||||
if ((item == NULL) || (s == NULL))
|
||||
return;
|
||||
|
||||
|
||||
if (display_props->height >= 2 ) {
|
||||
/* Only add a title if enough space... */
|
||||
w = widget_create ("text", WID_STRING, s);
|
||||
@@ -699,7 +699,7 @@ void menuitem_rebuild_screen_numeric (MenuItem *item, Screen *s)
|
||||
|
||||
if ((item == NULL) || (s == NULL))
|
||||
return;
|
||||
|
||||
|
||||
if (display_props->height >= 2 ) {
|
||||
/* Only add a title if enough space... */
|
||||
w = widget_create ("text", WID_STRING, s);
|
||||
@@ -735,7 +735,7 @@ void menuitem_rebuild_screen_alpha (MenuItem *item, Screen *s)
|
||||
|
||||
if ((item == NULL) || (s == NULL))
|
||||
return;
|
||||
|
||||
|
||||
if (display_props->height >= 2 ) {
|
||||
/* Only add a title if enough space... */
|
||||
w = widget_create ("text", WID_STRING, s);
|
||||
@@ -771,7 +771,7 @@ void menuitem_rebuild_screen_ip (MenuItem *item, Screen *s)
|
||||
|
||||
if ((item == NULL) || (s == NULL))
|
||||
return;
|
||||
|
||||
|
||||
if (display_props->height >= 2 ) {
|
||||
/* Only add a title if enough space... */
|
||||
w = widget_create ("text", WID_STRING, s);
|
||||
@@ -809,7 +809,7 @@ void menuitem_update_screen (MenuItem *item, Screen *s)
|
||||
|
||||
if ((item == NULL) || (s == NULL))
|
||||
return;
|
||||
|
||||
|
||||
/* Disable the cursor by default */
|
||||
s->cursor = CURSOR_OFF;
|
||||
|
||||
@@ -834,7 +834,7 @@ void menuitem_update_screen_slider (MenuItem *item, Screen *s)
|
||||
|
||||
if ((item == NULL) || (s == NULL))
|
||||
return;
|
||||
|
||||
|
||||
/* Calculate the bar position and length by filling buffers */
|
||||
min_len = strlen (item->data.slider.mintext);
|
||||
max_len = strlen (item->data.slider.maxtext);
|
||||
@@ -876,7 +876,7 @@ void menuitem_update_screen_numeric (MenuItem *item, Screen *s)
|
||||
|
||||
if ((item == NULL) || (s == NULL))
|
||||
return;
|
||||
|
||||
|
||||
w = screen_find_widget (s, "value");
|
||||
strcpy (w->text, item->data.numeric.edit_str + item->data.numeric.edit_offs);
|
||||
|
||||
@@ -902,7 +902,7 @@ void menuitem_update_screen_alpha (MenuItem *item, Screen *s)
|
||||
|
||||
if ((item == NULL) || (s == NULL))
|
||||
return;
|
||||
|
||||
|
||||
w = screen_find_widget (s, "value");
|
||||
if (item->data.alpha.password_char == '\0') {
|
||||
strcpy (w->text, item->data.alpha.edit_str + item->data.alpha.edit_offs);
|
||||
@@ -935,7 +935,7 @@ void menuitem_update_screen_ip (MenuItem *item, Screen *s)
|
||||
|
||||
if ((item == NULL) || (s == NULL))
|
||||
return;
|
||||
|
||||
|
||||
w = screen_find_widget (s, "value");
|
||||
if (w != NULL)
|
||||
strcpy (w->text, item->data.ip.edit_str + item->data.ip.edit_offs);
|
||||
@@ -1350,7 +1350,7 @@ MenuResult menuitem_process_input_ip (MenuItem *item, MenuToken token, const cha
|
||||
char *start = tmp;
|
||||
|
||||
memccpy(tmp, str, '\0', sizeof(tmp));
|
||||
|
||||
|
||||
while (start != NULL) {
|
||||
char *skip = start;
|
||||
|
||||
@@ -1360,7 +1360,7 @@ MenuResult menuitem_process_input_ip (MenuItem *item, MenuToken token, const cha
|
||||
skip = strchr(start, ipinfo->sep);
|
||||
start = (skip != NULL) ? (skip + 1) : NULL;
|
||||
}
|
||||
|
||||
|
||||
// check IP address entered
|
||||
if ((ipinfo->verify != NULL) && (!ipinfo->verify(tmp))) {
|
||||
report(RPT_WARNING, "%s(id=\"%s\") ip address not verified: \"%s\"",
|
||||
@@ -1368,7 +1368,7 @@ MenuResult menuitem_process_input_ip (MenuItem *item, MenuToken token, const cha
|
||||
item->data.ip.error_code = 4;
|
||||
return MENURESULT_NONE;
|
||||
}
|
||||
|
||||
|
||||
// store value
|
||||
strcpy (item->data.ip.value, tmp);
|
||||
|
||||
@@ -1464,7 +1464,7 @@ LinkedList * tablist2linkedlist (char *strings)
|
||||
if (strings != NULL) {
|
||||
char *p = strings;
|
||||
char *tabptr, *new_s;
|
||||
|
||||
|
||||
while ((tabptr = strchr(p, '\t')) != NULL) {
|
||||
int len = (int)(tabptr - p);
|
||||
|
||||
@@ -1490,7 +1490,7 @@ MenuItemType menuitem_typename_to_type (char *name)
|
||||
{
|
||||
if (name != NULL) {
|
||||
MenuItemType type;
|
||||
|
||||
|
||||
for (type = 0; type < NUM_ITEMTYPES; type ++) {
|
||||
if (strcmp (menuitemtypenames[type], name) == 0) {
|
||||
return type;
|
||||
@@ -1511,7 +1511,7 @@ MenuEventType menuitem_eventtypename_to_eventtype (char *name)
|
||||
{
|
||||
if (name != NULL) {
|
||||
MenuEventType type;
|
||||
|
||||
|
||||
for (type = 0; type < NUM_EVENTTYPES; type ++) {
|
||||
if (strcmp (menueventtypenames[type], name) == 0) {
|
||||
return type;
|
||||
|
||||
+11
-11
@@ -90,8 +90,8 @@ int menuscreens_init()
|
||||
tmp = config_get_string ("menu", "RightKey", 0, NULL);
|
||||
if (tmp)
|
||||
right_key = strdup(tmp);
|
||||
|
||||
|
||||
|
||||
|
||||
/* Now reserve keys */
|
||||
input_reserve_key (menu_key, true, NULL);
|
||||
input_reserve_key (enter_key, false, NULL);
|
||||
@@ -202,8 +202,8 @@ void menuscreen_switch_item (MenuItem * new_menuitem)
|
||||
MenuItem * old_menuitem = active_menuitem;
|
||||
|
||||
debug (RPT_DEBUG, "%s( item=[%s] ) from active_menuitem=[%s]", __FUNCTION__,
|
||||
((new_menuitem != NULL) ? new_menuitem->id : "(null)"),
|
||||
((old_menuitem != NULL) ? old_menuitem->id : "(null)"));
|
||||
((new_menuitem != NULL) ? new_menuitem->id : "(null)"),
|
||||
((old_menuitem != NULL) ? old_menuitem->id : "(null)"));
|
||||
|
||||
/* First we do the switch */
|
||||
active_menuitem = new_menuitem;
|
||||
@@ -229,9 +229,9 @@ void menuscreen_switch_item (MenuItem * new_menuitem)
|
||||
}
|
||||
|
||||
if (old_menuitem && old_menuitem->event_func)
|
||||
old_menuitem->event_func(old_menuitem, MENUEVENT_LEAVE);
|
||||
old_menuitem->event_func(old_menuitem, MENUEVENT_LEAVE);
|
||||
if (new_menuitem && new_menuitem->event_func)
|
||||
new_menuitem->event_func(new_menuitem, MENUEVENT_ENTER);
|
||||
new_menuitem->event_func(new_menuitem, MENUEVENT_ENTER);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -466,7 +466,7 @@ void menuscreen_create_menu ()
|
||||
menu_add_item (options_menu, driver_menu);
|
||||
if (contrast_avail) {
|
||||
int contrast = driver->get_contrast(driver);
|
||||
|
||||
|
||||
/* menu's client is NULL since we're in the server */
|
||||
slider = menuitem_create_slider ("contrast", contrast_handler, "Contrast",
|
||||
NULL, "min", "max", 0, 1000, 25, contrast);
|
||||
@@ -475,7 +475,7 @@ void menuscreen_create_menu ()
|
||||
if (brightness_avail) {
|
||||
int onbrightness = driver->get_brightness (driver, BACKLIGHT_ON);
|
||||
int offbrightness = driver->get_brightness (driver, BACKLIGHT_OFF);
|
||||
|
||||
|
||||
slider = menuitem_create_slider ("onbrightness", brightness_handler, "On Brightness",
|
||||
NULL, "min", "max", 0, 1000, 25, onbrightness);
|
||||
menu_add_item (driver_menu, slider);
|
||||
@@ -661,8 +661,8 @@ int
|
||||
menuscreen_goto (Menu * menu)
|
||||
{
|
||||
debug (RPT_DEBUG, "%s( m=[%s] ): active_menuitem=[%s]",
|
||||
__FUNCTION__, (menu != NULL) ? menu->id : "(NULL)",
|
||||
(active_menuitem != NULL) ? active_menuitem->id : "(NULL)");
|
||||
__FUNCTION__, (menu != NULL) ? menu->id : "(NULL)",
|
||||
(active_menuitem != NULL) ? active_menuitem->id : "(NULL)");
|
||||
menuscreen_switch_item (menu);
|
||||
return 0;
|
||||
}
|
||||
@@ -673,7 +673,7 @@ int
|
||||
menuscreen_set_main (Menu * menu)
|
||||
{
|
||||
debug (RPT_DEBUG, "%s( m=[%s] )",
|
||||
__FUNCTION__, (menu != NULL) ? menu->id : "(NULL)");
|
||||
__FUNCTION__, (menu != NULL) ? menu->id : "(NULL)");
|
||||
custom_main_menu = menu;
|
||||
return 0;
|
||||
}
|
||||
|
||||
+2
-2
@@ -114,7 +114,7 @@ static int parse_message (const char *str, Client *c)
|
||||
const char escape_chars[] = "nrt";
|
||||
const char escape_trans[] = "\n\r\t";
|
||||
char *p = strchr( escape_chars, str[pos] );
|
||||
|
||||
|
||||
/* Is it wise to have the characters \n, \r & \t expanded ?
|
||||
* Can the displays deal with them ?
|
||||
*/
|
||||
@@ -188,7 +188,7 @@ static int parse_message (const char *str, Client *c)
|
||||
sock_printf_error(c->sock, "Invalid command \"%.40s\"\n", argv[0]);
|
||||
report( RPT_WARNING, "Invalid command from client on socket %d: %.40s", c->sock, str );
|
||||
}
|
||||
|
||||
|
||||
free( arg_space );
|
||||
return 0;
|
||||
}
|
||||
|
||||
+3
-3
@@ -344,7 +344,7 @@ render_frame (LinkedList * list,
|
||||
drivers_string (w->left, w->top, w->text);
|
||||
} else {
|
||||
int necessaryTimeUnits = 0;
|
||||
|
||||
|
||||
if (w->speed > 0) {
|
||||
necessaryTimeUnits = length * w->speed;
|
||||
offset = (timer % (length * w->speed)) / w->speed;
|
||||
@@ -422,7 +422,7 @@ render_frame (LinkedList * list,
|
||||
case 'v':
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
||||
length = strlen (w->text);
|
||||
if (length <= screen_width) {
|
||||
/* no scrolling required... */
|
||||
@@ -431,7 +431,7 @@ render_frame (LinkedList * list,
|
||||
int lines_required = (length / screen_width)
|
||||
+ (length % screen_width ? 1 : 0);
|
||||
int available_lines = (w->bottom - w->top + 1);
|
||||
|
||||
|
||||
if (lines_required <= available_lines) {
|
||||
/* easy...*/
|
||||
for (i = 0; i < lines_required; i++) {
|
||||
|
||||
@@ -54,7 +54,7 @@ server_screen_init ()
|
||||
}
|
||||
server_screen->name = "Server screen";
|
||||
server_screen->duration = 8; /* 1 second, instead of 4...*/
|
||||
|
||||
|
||||
if ((rotate_server_screen == UNSET_INT ) || (rotate_server_screen == 1)) {
|
||||
server_screen->priority = PRI_INFO;
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ sock_shutdown ()
|
||||
retVal = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -86,7 +86,7 @@ int config_read_file(char *filename)
|
||||
#ifdef WITH_LDAP_SUPPORT
|
||||
if (ldap_is_ldap_url(filename)) {
|
||||
use_ldap = 1;
|
||||
|
||||
|
||||
if (0 != (retval = ldap_url_parse(filename, &url))) {
|
||||
report(RPT_ERR, "Errors parsing LDAP URL %s: %s", filename, ldap_err2string(retval));
|
||||
ldap_free_urldesc(url);
|
||||
@@ -302,7 +302,7 @@ connect_to_ldap(void)
|
||||
* }
|
||||
* fprintf(stderr, "LDAP login successful on %s:%d\n", ldap_host, ldap_port);
|
||||
********************************************************/
|
||||
|
||||
|
||||
/* check for the existence of the config object... */
|
||||
if (LDAP_SUCCESS != (retval = ldap_search_s(ld, ldap_base_dn, LDAP_SCOPE_BASE, "objectClass=lcdprocConfig", NULL, 0, &res))) {
|
||||
report(RPT_ERR, "Could not access LDAP server on %s:%d", ldap_host, ldap_port);
|
||||
@@ -441,12 +441,12 @@ key * find_key(section * s, char * keyname, int skip)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
strcpy(buf, "lcdproc");
|
||||
strncat(buf, keyname, BUFSIZE);
|
||||
/* debug(RPT_DEBUG, "Key name translated to attribute name: %s", buf); */
|
||||
vals = ldap_get_values(ld, entry, buf);
|
||||
|
||||
|
||||
if (skip+1 > ldap_count_values(vals)) {
|
||||
debug(RPT_DEBUG, "No such entry found.");
|
||||
if (NULL != buf) {
|
||||
@@ -474,14 +474,14 @@ key * find_key(section * s, char * keyname, int skip)
|
||||
buf=strdup(vals[skip]);
|
||||
debug(RPT_DEBUG, "Entry found. Value is: %s", buf);
|
||||
ldap_value_free(vals);
|
||||
|
||||
|
||||
k = (key *) malloc(sizeof(key));
|
||||
if ( k != NULL) {
|
||||
k->name = strdup(keyname);
|
||||
k->value = strdup(buf);
|
||||
k->next_key = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (NULL != buf) {
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
|
||||
+2
-2
@@ -24,11 +24,11 @@ buffile *buffile_open( const char *path, const char *mode ) {
|
||||
file = malloc(sizeof(*file));
|
||||
if ( NULL == file )
|
||||
return NULL;
|
||||
|
||||
|
||||
file->pos=0;
|
||||
file->bytesread=0;
|
||||
file->buf=NULL;
|
||||
|
||||
|
||||
file->f = fopen( path, mode );
|
||||
if( NULL == file->f ) {
|
||||
free(file);
|
||||
|
||||
+3
-3
@@ -90,7 +90,7 @@ sock_connect (char *host, unsigned short int port)
|
||||
#else
|
||||
{
|
||||
unsigned long tmp = 1;
|
||||
|
||||
|
||||
if (ioctlsocket(sock, FIONBIO, &tmp) == SOCKET_ERROR)
|
||||
report(RPT_ERR, "sock_connect: Error setting socket to non-blocking");
|
||||
}
|
||||
@@ -130,7 +130,7 @@ sock_printf(int fd, const char *format, .../*args*/ )
|
||||
}
|
||||
if (size > sizeof(buf))
|
||||
report(RPT_WARNING, "sock_printf: vsnprintf truncated message");
|
||||
|
||||
|
||||
return sock_send_string(fd, buf);
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ sock_printf_error(int fd, const char *format, .../*args*/ )
|
||||
int size = 0;
|
||||
|
||||
strncpy(buf, huh, sizeof(huh)); // note: sizeof(huh) < MAXMSG
|
||||
|
||||
|
||||
va_start(ap, format);
|
||||
size = vsnprintf(buf + (sizeof(huh)-1), sizeof(buf) - (sizeof(huh)-1), format, ap);
|
||||
buf[sizeof(buf)-1] = '\0';
|
||||
|
||||
Reference in New Issue
Block a user