From 2bf7cce2ac5df3a6793c3124da9d7d5639769e04 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Mon, 23 Apr 2018 14:34:59 +0100 Subject: Patched ';' --- main.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 57c3b0e..74bd93c 100644 --- a/main.c +++ b/main.c @@ -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; } -- cgit v1.2.3