diff options
Diffstat (limited to 'editors')
-rw-r--r-- | editors/awk.c | 23 | ||||
-rw-r--r-- | editors/vi.c | 2 |
2 files changed, 12 insertions, 13 deletions
diff --git a/editors/awk.c b/editors/awk.c index 2fea55113..5a500aa83 100644 --- a/editors/awk.c +++ b/editors/awk.c | |||
@@ -571,7 +571,7 @@ static void skip_spaces(char **s) | |||
571 | { | 571 | { |
572 | char *p = *s; | 572 | char *p = *s; |
573 | 573 | ||
574 | while(*p == ' ' || *p == '\t' || | 574 | while (*p == ' ' || *p == '\t' || |
575 | (*p == '\\' && *(p+1) == '\n' && (++p, ++t.lineno))) { | 575 | (*p == '\\' && *(p+1) == '\n' && (++p, ++t.lineno))) { |
576 | p++; | 576 | p++; |
577 | } | 577 | } |
@@ -938,7 +938,7 @@ static uint32_t next_token(uint32_t expected) | |||
938 | syntax_error(EMSG_UNEXP_TOKEN); | 938 | syntax_error(EMSG_UNEXP_TOKEN); |
939 | 939 | ||
940 | t.string = --p; | 940 | t.string = --p; |
941 | while(isalnum_(*(++p))) { | 941 | while (isalnum_(*(++p))) { |
942 | *(p-1) = *p; | 942 | *(p-1) = *p; |
943 | } | 943 | } |
944 | *(p-1) = '\0'; | 944 | *(p-1) = '\0'; |
@@ -1192,7 +1192,7 @@ static void chain_group(void) | |||
1192 | } while (c & TC_NEWLINE); | 1192 | } while (c & TC_NEWLINE); |
1193 | 1193 | ||
1194 | if (c & TC_GRPSTART) { | 1194 | if (c & TC_GRPSTART) { |
1195 | while(next_token(TC_GRPSEQ | TC_GRPTERM) != TC_GRPTERM) { | 1195 | while (next_token(TC_GRPSEQ | TC_GRPTERM) != TC_GRPTERM) { |
1196 | if (t.tclass & TC_NEWLINE) continue; | 1196 | if (t.tclass & TC_NEWLINE) continue; |
1197 | rollback_token(); | 1197 | rollback_token(); |
1198 | chain_group(); | 1198 | chain_group(); |
@@ -1233,7 +1233,7 @@ static void chain_group(void) | |||
1233 | case ST_FOR: | 1233 | case ST_FOR: |
1234 | next_token(TC_SEQSTART); | 1234 | next_token(TC_SEQSTART); |
1235 | n2 = parse_expr(TC_SEMICOL | TC_SEQTERM); | 1235 | n2 = parse_expr(TC_SEMICOL | TC_SEQTERM); |
1236 | if (t.tclass & TC_SEQTERM) { /* for-in */ | 1236 | if (t.tclass & TC_SEQTERM) { /* for-in */ |
1237 | if ((n2->info & OPCLSMASK) != OC_IN) | 1237 | if ((n2->info & OPCLSMASK) != OC_IN) |
1238 | syntax_error(EMSG_UNEXP_TOKEN); | 1238 | syntax_error(EMSG_UNEXP_TOKEN); |
1239 | n = chain_node(OC_WALKINIT | VV); | 1239 | n = chain_node(OC_WALKINIT | VV); |
@@ -1242,7 +1242,7 @@ static void chain_group(void) | |||
1242 | n = chain_loop(NULL); | 1242 | n = chain_loop(NULL); |
1243 | n->info = OC_WALKNEXT | Vx; | 1243 | n->info = OC_WALKNEXT | Vx; |
1244 | n->l.n = n2->l.n; | 1244 | n->l.n = n2->l.n; |
1245 | } else { /* for(;;) */ | 1245 | } else { /* for (;;) */ |
1246 | n = chain_node(OC_EXEC | Vx); | 1246 | n = chain_node(OC_EXEC | Vx); |
1247 | n->l.n = n2; | 1247 | n->l.n = n2; |
1248 | n2 = parse_expr(TC_SEMICOL); | 1248 | n2 = parse_expr(TC_SEMICOL); |
@@ -1279,7 +1279,6 @@ static void chain_group(void) | |||
1279 | /* delete, next, nextfile, return, exit */ | 1279 | /* delete, next, nextfile, return, exit */ |
1280 | default: | 1280 | default: |
1281 | chain_expr(t.info); | 1281 | chain_expr(t.info); |
1282 | |||
1283 | } | 1282 | } |
1284 | } | 1283 | } |
1285 | } | 1284 | } |
@@ -1293,7 +1292,7 @@ static void parse_program(char *p) | |||
1293 | 1292 | ||
1294 | pos = p; | 1293 | pos = p; |
1295 | t.lineno = 1; | 1294 | t.lineno = 1; |
1296 | while((tclass = next_token(TC_EOF | TC_OPSEQ | TC_GRPSTART | | 1295 | while ((tclass = next_token(TC_EOF | TC_OPSEQ | TC_GRPSTART | |
1297 | TC_OPTERM | TC_BEGIN | TC_END | TC_FUNCDECL)) != TC_EOF) { | 1296 | TC_OPTERM | TC_BEGIN | TC_END | TC_FUNCDECL)) != TC_EOF) { |
1298 | 1297 | ||
1299 | if (tclass & TC_OPTERM) | 1298 | if (tclass & TC_OPTERM) |
@@ -1314,7 +1313,7 @@ static void parse_program(char *p) | |||
1314 | f = newfunc(t.string); | 1313 | f = newfunc(t.string); |
1315 | f->body.first = NULL; | 1314 | f->body.first = NULL; |
1316 | f->nargs = 0; | 1315 | f->nargs = 0; |
1317 | while(next_token(TC_VARIABLE | TC_SEQTERM) & TC_VARIABLE) { | 1316 | while (next_token(TC_VARIABLE | TC_SEQTERM) & TC_VARIABLE) { |
1318 | v = findvar(ahash, t.string); | 1317 | v = findvar(ahash, t.string); |
1319 | v->x.aidx = (f->nargs)++; | 1318 | v->x.aidx = (f->nargs)++; |
1320 | 1319 | ||
@@ -1452,7 +1451,7 @@ static int awk_split(char *s, node *spl, char **slist) | |||
1452 | n++; | 1451 | n++; |
1453 | } | 1452 | } |
1454 | } else if (c[0] == '\0') { /* null split */ | 1453 | } else if (c[0] == '\0') { /* null split */ |
1455 | while(*s) { | 1454 | while (*s) { |
1456 | *(s1++) = *(s++); | 1455 | *(s1++) = *(s++); |
1457 | *(s1++) = '\0'; | 1456 | *(s1++) = '\0'; |
1458 | n++; | 1457 | n++; |
@@ -1588,7 +1587,7 @@ static void hashwalk_init(var *v, xhash *array) | |||
1588 | *w = *(w+1) = (char *)(w + 2); | 1587 | *w = *(w+1) = (char *)(w + 2); |
1589 | for (i=0; i<array->csize; i++) { | 1588 | for (i=0; i<array->csize; i++) { |
1590 | hi = array->items[i]; | 1589 | hi = array->items[i]; |
1591 | while(hi) { | 1590 | while (hi) { |
1592 | strcpy(*w, hi->name); | 1591 | strcpy(*w, hi->name); |
1593 | nextword(w); | 1592 | nextword(w); |
1594 | hi = hi->next; | 1593 | hi = hi->next; |
@@ -2567,7 +2566,7 @@ static int awk_exit(int r) | |||
2567 | /* waiting for children */ | 2566 | /* waiting for children */ |
2568 | for (i=0; i<fdhash->csize; i++) { | 2567 | for (i=0; i<fdhash->csize; i++) { |
2569 | hi = fdhash->items[i]; | 2568 | hi = fdhash->items[i]; |
2570 | while(hi) { | 2569 | while (hi) { |
2571 | if (hi->data.rs.F && hi->data.rs.is_pipe) | 2570 | if (hi->data.rs.F && hi->data.rs.is_pipe) |
2572 | pclose(hi->data.rs.F); | 2571 | pclose(hi->data.rs.F); |
2573 | hi = hi->next; | 2572 | hi = hi->next; |
@@ -2729,7 +2728,7 @@ keep_going: | |||
2729 | /* fill in ARGV array */ | 2728 | /* fill in ARGV array */ |
2730 | setvar_i(V[ARGC], argc - optind + 1); | 2729 | setvar_i(V[ARGC], argc - optind + 1); |
2731 | setari_u(V[ARGV], 0, "awk"); | 2730 | setari_u(V[ARGV], 0, "awk"); |
2732 | for(i=optind; i < argc; i++) | 2731 | for (i = optind; i < argc; i++) |
2733 | setari_u(V[ARGV], i+1-optind, argv[i]); | 2732 | setari_u(V[ARGV], i+1-optind, argv[i]); |
2734 | 2733 | ||
2735 | evaluate(beginseq.first, &tv); | 2734 | evaluate(beginseq.first, &tv); |
diff --git a/editors/vi.c b/editors/vi.c index 1122f9919..dc93bc424 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -2817,7 +2817,7 @@ static void refresh(int full_screen) | |||
2817 | int nic = ce-cs+1; | 2817 | int nic = ce-cs+1; |
2818 | char *out = (char*)sp+cs; | 2818 | char *out = (char*)sp+cs; |
2819 | 2819 | ||
2820 | while(nic-- > 0) { | 2820 | while (nic-- > 0) { |
2821 | putchar(*out); | 2821 | putchar(*out); |
2822 | out++; | 2822 | out++; |
2823 | } | 2823 | } |