As elsewhere, I'm a bit sick of the strdup() nonsense, so, this.
Chris Pressey
4 years ago
15 | 15 | } *root; |
16 | 16 | |
17 | 17 | void run(char *); |
18 | ||
19 | char *strdupe(const char *s) | |
20 | { | |
21 | char *t = malloc(strlen(s) + 1); | |
22 | strcpy(t, s); | |
23 | return t; | |
24 | } | |
18 | 25 | |
19 | 26 | char *pop(void) |
20 | 27 | { |
40 | 47 | { |
41 | 48 | char *e, *f; |
42 | 49 | e = pop(); |
43 | f = strdup(e); | |
50 | f = strdupe(e); | |
44 | 51 | push(e); |
45 | 52 | push(f); |
46 | 53 | } |
166 | 173 | |
167 | 174 | int main(int argc, char **argv) |
168 | 175 | { |
169 | char *program = strdup(argv[1]); | |
176 | char *program = strdupe(argv[1]); | |
170 | 177 | root = NULL; |
171 | 178 | run(program); |
172 | 179 | exit(0); |