cb: fix a null pointer dereference

Just added a pair of parentheses. I also ran cb on cb.c to beautify the
code.

This is actually on Gerrit from 2016:
https://plan9port-review.googlesource.com/c/plan9/+/1574

Change-Id: I5e234adba0f95c13d6eecb121bf11bba4bf54566
This commit is contained in:
Neven Sajko 2016-05-31 11:23:30 +02:00 committed by David du Colombier
parent a1ead676e6
commit ab6f1aeac7

View file

@ -29,7 +29,7 @@ main(int argc, char *argv[])
maxleng -= (maxleng + 5)/10; maxleng -= (maxleng + 5)/10;
continue; continue;
default: default:
fprint(2, "cb: illegal option %c\n", *argv[1]); fprint(2, "cb: illegal option %c\n", (*argv)[1]);
exits("boom"); exits("boom");
} }
} }
@ -354,7 +354,7 @@ work(void){
continue; continue;
} }
} }
else if (lbegin == 0 || p > string) else if (lbegin == 0 || p > string)
if(strict) if(strict)
putch(c,NO); putch(c,NO);
else putch(c,YES); else putch(c,YES);
@ -969,7 +969,7 @@ cont:
if(nlct++ > 2)goto done; if(nlct++ > 2)goto done;
} }
puttmp(c,1); puttmp(c,1);
star: star:
if(puttmp((c=Bgetc(input)),1) == '/'){ if(puttmp((c=Bgetc(input)),1) == '/'){
beg = tp; beg = tp;
puttmp((c=Bgetc(input)),1); puttmp((c=Bgetc(input)),1);