Mercurial > baum
comparison baum.c @ 31:4e60d96265f0
removed -c option completely; updated man page; new error code 5
author | meillo@marmaro.de |
---|---|
date | Fri, 22 Feb 2008 14:57:04 +0100 |
parents | cd979b979610 |
children | 2e564bf8599c |
comparison
equal
deleted
inserted
replaced
30:cd979b979610 | 31:4e60d96265f0 |
---|---|
15 #include "actions.h" | 15 #include "actions.h" |
16 | 16 |
17 #define VERSION "0.2" | 17 #define VERSION "0.2" |
18 | 18 |
19 | 19 |
20 int option_check = 0; | |
21 int option_verbose = 0; | 20 int option_verbose = 0; |
22 | 21 |
23 struct Node* root = 0; | 22 struct Node* root = 0; |
24 struct Stackitem* stack = NULL; | 23 struct Stackitem* stack = NULL; |
25 | 24 |
176 node = newNode((char*) name, value); | 175 node = newNode((char*) name, value); |
177 if (indent > last_indent) { /* down */ | 176 if (indent > last_indent) { /* down */ |
178 /* if it goes more than one level down -> error */ | 177 /* if it goes more than one level down -> error */ |
179 if (indent - last_indent > 1) { | 178 if (indent - last_indent > 1) { |
180 fprintf(stderr, "error: Indention over more than one level. Only indent by one!\n"); | 179 fprintf(stderr, "error: Indention over more than one level. Only indent by one!\n"); |
181 exit(50); | 180 exit(5); |
182 } | 181 } |
183 last_node->down = node; | 182 last_node->down = node; |
184 push(last_node); | 183 push(last_node); |
185 } else if (indent == last_indent) { /* right */ | 184 } else if (indent == last_indent) { /* right */ |
186 last_node->right = node; | 185 last_node->right = node; |
244 exit(0); | 243 exit(0); |
245 } else if (strcmp(argv[0], "--help") == 0) { | 244 } else if (strcmp(argv[0], "--help") == 0) { |
246 printf("\ | 245 printf("\ |
247 baum --version print version information and exit\n\ | 246 baum --version print version information and exit\n\ |
248 baum --help print this output\n\ | 247 baum --help print this output\n\ |
249 baum [-v] -c <file> (verbosly) check file and return 1 if invalid\n\ | |
250 baum [-v] <file> (verbosly) run file\n\ | 248 baum [-v] <file> (verbosly) run file\n\ |
251 "); | 249 "); |
252 exit(0); | 250 exit(0); |
253 } else if (strcmp(argv[0], "-c") == 0) { | |
254 option_check = 1; | |
255 } else if (strcmp(argv[0], "-v") == 0) { | 251 } else if (strcmp(argv[0], "-v") == 0) { |
256 option_verbose = 1; | 252 option_verbose = 1; |
257 /* | 253 /* |
258 } else if (strcmp(argv[0], "-W") == 0) { | 254 } else if (strcmp(argv[0], "-W") == 0) { |
259 / * TODO: catch if no value given * / | 255 / * TODO: catch if no value given * / |