finally works (updated for 4.1c and merged with sun)
[unix-history] / usr / src / bin / csh / hist.c
index 5d8a379..8a68351 100644 (file)
@@ -1,4 +1,4 @@
-static char *sccsid = "@(#)hist.c 4.3 %G%";
+static char *sccsid = "@(#)hist.c 4.4 %G%";
 
 #include "sh.h"
 
 
 #include "sh.h"
 
@@ -75,7 +75,7 @@ dohist(vp)
        if (setintr)
                sigrelse(SIGINT);
        vp++;
        if (setintr)
                sigrelse(SIGINT);
        vp++;
-       while (*vp[0] == '-') {
+       while (*vp && *vp[0] == '-') {
                if (*vp && eq(*vp, "-h")) {
                        hflg++;
                        vp++;
                if (*vp && eq(*vp, "-h")) {
                        hflg++;
                        vp++;