Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/systat G/C function used in old command parsing



details:   https://anonhg.NetBSD.org/src/rev/8e63853a4d6f
branches:  trunk
changeset: 479718:8e63853a4d6f
user:      jwise <jwise%NetBSD.org@localhost>
date:      Mon Dec 20 04:06:25 1999 +0000

description:
G/C function used in old command parsing

diffstat:

 usr.bin/systat/cmds.c    |  23 ++---------------------
 usr.bin/systat/extern.h  |   3 +--
 usr.bin/systat/netcmds.c |  10 +++++-----
 3 files changed, 8 insertions(+), 28 deletions(-)

diffs (91 lines):

diff -r 301fe08877b6 -r 8e63853a4d6f usr.bin/systat/cmds.c
--- a/usr.bin/systat/cmds.c     Mon Dec 20 03:45:01 1999 +0000
+++ b/usr.bin/systat/cmds.c     Mon Dec 20 04:06:25 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cmds.c,v 1.14 1999/12/20 03:45:01 jwise Exp $  */
+/*     $NetBSD: cmds.c,v 1.15 1999/12/20 04:06:25 jwise Exp $  */
 
 /*-
  * Copyright (c) 1980, 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)cmds.c     8.2 (Berkeley) 4/29/95";
 #endif
-__RCSID("$NetBSD: cmds.c,v 1.14 1999/12/20 03:45:01 jwise Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.15 1999/12/20 04:06:25 jwise Exp $");
 #endif /* not lint */
 
 #include <stdlib.h>
@@ -144,22 +144,3 @@
 {
        error("Showing %s, refresh every %d seconds.", curmode->c_name, naptime);
 }
-
-/* case insensitive prefix comparison */
-int
-prefix(s1, s2)
-       char *s1, *s2;
-{
-       char c1, c2;
-
-       while (1) {
-               c1 = *s1 >= 'A' && *s1 <= 'Z' ? *s1 + 'a' - 'A' : *s1;  
-               c2 = *s2 >= 'A' && *s2 <= 'Z' ? *s2 + 'a' - 'A' : *s2;  
-               if (c1 != c2)
-                       break;
-               if (c1 == '\0')
-                       return (1);
-               s1++, s2++;
-       }
-       return (*s1 == '\0');
-}
diff -r 301fe08877b6 -r 8e63853a4d6f usr.bin/systat/extern.h
--- a/usr.bin/systat/extern.h   Mon Dec 20 03:45:01 1999 +0000
+++ b/usr.bin/systat/extern.h   Mon Dec 20 04:06:25 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.15 1999/12/20 03:45:02 jwise Exp $        */
+/*     $NetBSD: extern.h,v 1.16 1999/12/20 04:06:25 jwise Exp $        */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -145,7 +145,6 @@
 WINDOW *openpigs __P((void));
 WINDOW *openswap __P((void));
 WINDOW *opentcp __P((void));
-int     prefix __P((char *, char *));
 void    redraw __P((int));
 void    showbufcache __P((void));
 void    showicmp __P((void));
diff -r 301fe08877b6 -r 8e63853a4d6f usr.bin/systat/netcmds.c
--- a/usr.bin/systat/netcmds.c  Mon Dec 20 03:45:01 1999 +0000
+++ b/usr.bin/systat/netcmds.c  Mon Dec 20 04:06:25 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netcmds.c,v 1.9 1999/12/20 03:45:02 jwise Exp $        */
+/*     $NetBSD: netcmds.c,v 1.10 1999/12/20 04:06:25 jwise Exp $       */
 
 /*-
  * Copyright (c) 1980, 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)netcmds.c  8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: netcmds.c,v 1.9 1999/12/20 03:45:02 jwise Exp $");
+__RCSID("$NetBSD: netcmds.c,v 1.10 1999/12/20 04:06:25 jwise Exp $");
 #endif /* not lint */
 
 /*
@@ -117,11 +117,11 @@
                showports();
                return;
        }
-       if (prefix(args, "protos"))
+       if (strstr(args, "protos") == args)
                showprotos();
-       else if (prefix(args, "hosts"))
+       else if (strstr(args, "hosts") == args)
                showhosts();
-       else if (prefix(args, "ports"))
+       else if (strstr(args, "ports") == args)
                showports();
        else
                addstr("show what?");



Home | Main Index | Thread Index | Old Index