diff options
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; } |