wmppp.app: Stampfile handling.

This patch adds support for "stampfile" in config file, as described in
manual page.

Based on the patch by Juan Cespedes <cespedes@debian.org>.
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=97509.
This commit is contained in:
Doug Torrance 2014-09-14 12:57:18 -05:00 committed by Carlos R. Mafra
parent b47834fe0b
commit e81a5eb522

View file

@ -192,7 +192,7 @@
#define SPEED_ACTION (NULL)
#define IFDOWN_ACTION (NULL)
#define STAMP_FILE "/var/run/ppp0.pid"
#define STAMP_FILE_PRE "/var/run/wmppp."
/* Defines voor alle coordinate */
@ -362,6 +362,7 @@ char *start_action = NULL;
char *stop_action = NULL;
char *speed_action = NULL;
char *ifdown_action = NULL;
char *stamp_file = NULL;
void wmppp_routine(int argc, char **argv) {
@ -370,6 +371,7 @@ void wmppp_routine(int argc, char **argv) {
{ "stop", &stop_action },
{ "speed", &speed_action },
{ "ifdown", &ifdown_action },
{ "stampfile", &stamp_file },
{ NULL, NULL }
};
@ -411,6 +413,11 @@ void wmppp_routine(int argc, char **argv) {
if (STOP_ACTION) stop_action = strdup(STOP_ACTION);
if (SPEED_ACTION) speed_action = strdup(SPEED_ACTION);
if (IFDOWN_ACTION) ifdown_action = strdup(IFDOWN_ACTION);
if (STAMP_FILE_PRE) {
sprintf (temp, "%s%s", STAMP_FILE_PRE, active_interface);
stamp_file = strdup (temp);
}
strcpy(temp, "/etc/wmppprc");
parse_rcfile(temp, wmppp_keys);
@ -483,7 +490,7 @@ void wmppp_routine(int argc, char **argv) {
if (!starttime) {
starttime = currenttime;
if (stat(STAMP_FILE, &st) == 0)
if (stat(stamp_file, &st) == 0)
starttime = st.st_mtime;
SetOnLED(LED_PPP_POWER);