]> Nishi Git Mirror - dataworks.git/commitdiff
comment works
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Sun, 9 Jun 2024 13:26:39 +0000 (13:26 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Sun, 9 Jun 2024 13:26:39 +0000 (13:26 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@198 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Client/client.c

index b27de7c482842c5e7220cf554fbb8e6cdd24dc9a..0ae478682099d1e4b4d8839f89283541416ed5cb 100644 (file)
@@ -206,9 +206,11 @@ int main(int argc, char** argv) {
        }
        char* linebuf = malloc(1);
        linebuf[0] = 0;
+       bool until_end = false;
        while(1) {
                if((ch = fgetc(fp)) == EOF) break;
                if(ch == '\n') {
+                       until_end = false;
                        if(buf[0] == '.') {
                                if(__dw_strcaseequ(buf, ".bye") || __dw_strcaseequ(buf, ".quit")) {
                                        printf("Bye.\n");
@@ -274,6 +276,16 @@ int main(int argc, char** argv) {
                                                        char* line = malloc(i + 1);
                                                        line[i] = 0;
                                                        memcpy(line, linebuf, i);
+                                                       bool comment = false;
+                                                       int j;
+                                                       for(j = 0; line[j] != 0; j++){
+                                                               if(!(line[j] == ' ' || line[j] == '\t')){
+                                                                       char* newline = __dw_strdup(line + j);
+                                                                       free(line);
+                                                                       line = newline;
+                                                                       break;
+                                                               }
+                                                       }
 
                                                        struct dataworks_db_result* r = dataworks_database_execute_code(db, line, log);
                                                        if(r->error) {
@@ -303,6 +315,9 @@ int main(int argc, char** argv) {
                        buf = malloc(1);
                        buf[0] = 0;
                        len = 0;
+               }else if(until_end){
+               }else if(ch == '#'){
+                       until_end = true;
                } else if(ch != '\r') {
                        char* newbuf = malloc(len + 2);
                        for(i = 0; i < len; i++) {