mirror of https://git.sr.ht/~rabbits/parade
Only needing stdio
This commit is contained in:
parent
40b93afad5
commit
dc4ddecf4f
2
build.sh
2
build.sh
|
@ -10,4 +10,4 @@ cc -std=c89 -DDEBUG -Wall -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werr
|
|||
|
||||
./main
|
||||
|
||||
rm ./main
|
||||
# rm ./main
|
||||
|
|
14
main.c
14
main.c
|
@ -1,4 +1,3 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define NAMELEN 32
|
||||
|
@ -397,13 +396,13 @@ act(Parade* p, char* cmd, char* val)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
answer(Parade* p, char* input)
|
||||
{
|
||||
int split = cpof(input, ' ');
|
||||
char action[NAMELEN], value[TEXTLEN];
|
||||
if(scmp(input, "quit"))
|
||||
exit(0);
|
||||
return 0;
|
||||
if(split >= 0) {
|
||||
sstr(input, action, 0, split);
|
||||
sstr(input, value, split + 1, imin(slen(input) - split, TEXTLEN - 1));
|
||||
|
@ -415,6 +414,7 @@ answer(Parade* p, char* input)
|
|||
value[0] = '\0';
|
||||
}
|
||||
act(p, action, value);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -436,8 +436,8 @@ listen(Parade* p)
|
|||
char input[TEXTLEN];
|
||||
printf("~ ");
|
||||
if(fgets(input, TEXTLEN, stdin))
|
||||
answer(p, strm(input));
|
||||
return 1;
|
||||
return answer(p, strm(input));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -449,7 +449,7 @@ main(void)
|
|||
addvessel(¶de, ¶de.vessels[0], "ghost");
|
||||
guest = ¶de.vessels[1];
|
||||
printf("A %s appeared in the %s.\n", guest->name, guest->parent->name);
|
||||
while(1)
|
||||
listen(¶de);
|
||||
while(listen(¶de))
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue