wmifs: Add lock mode.

Patch by Jorge García <Jorge.Garcia@uv.es>  First appeared in Debian package
version 1.3b1-7, revised in 1.3b1-8.

For more information, see:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=26870
This commit is contained in:
Doug Torrance 2014-10-22 16:34:35 -05:00 committed by Carlos R. Mafra
parent 44d68e454e
commit 6e208d3f75

View file

@ -74,6 +74,9 @@
---- ----
Changes: Changes:
--- ---
06/16/2001 (Jorge García, Jorge.Garcia@uv.es)
* Added the LockMode, so wmifs doesn't swap to another
interface if the one requested with "-i" isn't up.
05/06/2001 (Jordi Mallach, jordi@sindominio.net) 05/06/2001 (Jordi Mallach, jordi@sindominio.net)
* Integrated many patches, fixing issues with suspended * Integrated many patches, fixing issues with suspended
wmifs. wmifs.
@ -224,6 +227,7 @@ char *ProgName;
char *active_interface = NULL; char *active_interface = NULL;
int TimerDivisor=60; int TimerDivisor=60;
int WaveForm=0; int WaveForm=0;
int LockMode=0;
/*****************/ /*****************/
/* PPP variables */ /* PPP variables */
@ -286,6 +290,9 @@ int main(int argc, char *argv[]) {
active_interface = argv[i+1]; active_interface = argv[i+1];
i++; i++;
break; break;
case 'l' :
LockMode = 1;
break;
case 'v' : case 'v' :
printversion(); printversion();
exit(0); exit(0);
@ -768,8 +775,23 @@ int checknetdevs(void) {
i++; i++;
} }
} }
if (LockMode && active_interface != NULL) {
k = 0;
for (j=0; j<i; j++)
if (!strcmp(stat_devices[j].name, active_interface)) {
k = 1;
break;
}
if (!k) {
strcpy(stat_devices[i].name, active_interface);
for (k=0; k<48; k++) {
stat_devices[i].his[k][0] = 0;
stat_devices[i].his[k][1] = 0;
}
devsfound++;
}
}
return devsfound; return devsfound;
} }
@ -841,6 +863,7 @@ void usage(void) {
fprintf(stderr, "\t-d <display name>\n"); fprintf(stderr, "\t-d <display name>\n");
fprintf(stderr, "\t-h\tthis help screen\n"); fprintf(stderr, "\t-h\tthis help screen\n");
fprintf(stderr, "\t-i <interface name>\tdefault (as it appears in /proc/net/route)\n"); fprintf(stderr, "\t-i <interface name>\tdefault (as it appears in /proc/net/route)\n");
fprintf(stderr, "\t-l\tstarts in lock mode\n");
fprintf(stderr, "\t-v\tprint the version number\n"); fprintf(stderr, "\t-v\tprint the version number\n");
fprintf(stderr, "\t-w\twaveform load\n"); fprintf(stderr, "\t-w\twaveform load\n");
fprintf(stderr, "\n"); fprintf(stderr, "\n");