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