the format string gets modified by parsefmt -- don't use it twice
[unix-history] / usr / src / bin / ps / keyword.c
index fa72529..94f2b94 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)keyword.c  5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)keyword.c  5.9 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -260,13 +260,14 @@ showkey()
 parsefmt(p)
        char *p;
 {
 parsefmt(p)
        char *p;
 {
+       static struct varent *vtail;
        register VAR *v;
        register char *cp;
        register struct varent *vent;
        static VAR *findvar();
 
 #define        FMTSEP  " \t,\n"
        register VAR *v;
        register char *cp;
        register struct varent *vent;
        static VAR *findvar();
 
 #define        FMTSEP  " \t,\n"
-       while (p) {
+       while (p && *p) {
                while ((cp = strsep(&p, FMTSEP)) != NULL && *cp == '\0')
                        /* void */;
                if (!(v = findvar(cp)))
                while ((cp = strsep(&p, FMTSEP)) != NULL && *cp == '\0')
                        /* void */;
                if (!(v = findvar(cp)))