From 49ecb83c8d17324e31e93b99af4616af7fa919b8 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Wed, 22 Oct 2014 16:34:36 -0500 Subject: [PATCH] wmifs: Display long interface names. Patch by Davi Leal . First appeared in Debian package version 1.3b1-10. Revised by Matyas Koszik for version 1.3b1-11. For more information, see: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=103083 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=126501 --- wmifs/wmifs/wmifs.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/wmifs/wmifs/wmifs.c b/wmifs/wmifs/wmifs.c index 0cdb74e..972321c 100644 --- a/wmifs/wmifs/wmifs.c +++ b/wmifs/wmifs/wmifs.c @@ -74,6 +74,12 @@ ---- Changes: --- + 01/15/2002 (Matyas Koszik, koszik@debijan.lonyay.edu.hu) + * Patch that fixes segfaults on long interface names. + 08/31/2001 (Davi Leal, davileal@terra.es) + * Patch that cuts long interface names, so they look + good in wmifs. For example, "dummy0" gets displayed + as "dumm0", "vmnet10" as "vmn10", etc. 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. @@ -540,7 +546,7 @@ void wmifs_routine(int argc, char **argv) { |* void DrawActiveIFS(char *) *| \*******************************************************************************/ -void DrawActiveIFS(char *name) { +void DrawActiveIFS(char *real_name) { /* Cijfers op: 0,65 Letters op: 0,75 @@ -552,11 +558,22 @@ void DrawActiveIFS(char *name) { int i; int c; int k; + int len; + char name[256]; copyXPMArea(5, 84, 30, 10, 5, 5); + strcpy(name,real_name); + len = strlen(name); + if (len > 5) + { + for (i=len-5; i='0' && name[i]<='9'); i++) ; + for (; i<=len; i++) /* '=' to get the '\0' character moved too \*/ + name[i-(len-5)] = name[i]; + } + k = 5; for (i=0; name[i]; i++) { if (i == strlen(name)-1 && strlen(name) <= 4 && name[strlen(name)-1] >= '0' && name[strlen(name)-1] <= '9') {