diff options
author | KatolaZ <katolaz@freaknet.org> | 2018-04-23 14:34:59 +0100 |
---|---|---|
committer | KatolaZ <katolaz@freaknet.org> | 2018-04-23 14:34:59 +0100 |
commit | 2bf7cce2ac5df3a6793c3124da9d7d5639769e04 (patch) | |
tree | e1ae7a7375c099d16a3e4a3056aee421bc5625d6 /main.c | |
parent | 771b998ba5d1f451586aef0562d0012442d6bf23 (diff) |
Patched ';'
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 23 |
1 files changed, 19 insertions, 4 deletions
@@ -26,7 +26,7 @@ const char* skip_blank(const char **c){ int get_addr(const char **cmd){ int addr, n, got; - char sign = 0, comma = 0; + char sign = 0, comma = 0, semic = 0; const char *c; addr1 = addr2 = -1; @@ -63,19 +63,29 @@ int get_addr(const char **cmd){ if (addr1 ==-1) addr2 = 1, addr1=num; else if (addr1 < addr2){ - *cmd = c; + *cmd = c++; return -1; } break; + case ';': + semic = 1; + if (addr1 == -1) + addr2 = pos, addr1=num; + else if (addr1 < addr2){ + *cmd = c++; + return -1; + } + break; default: goto check; } c++; } } + check: *cmd = c; - + fprintf(stderr, " >>> get_addr: addr1: %d addr2: %d\n", addr1, addr2); if (addr1 == -1){ @@ -84,11 +94,16 @@ int get_addr(const char **cmd){ addr2 = 1; return 2; } + if (semic){ + addr1 = num; + addr2 = pos; + return 2; + } addr1 = addr2 = pos; return 0; } if (addr2 == -1){ - if (comma){ + if (comma || semic){ addr2 = addr1; return 2; } |