1
0
Fork 0
forked from len0rd/rockbox

Initial check in dumb 0.9.2 - has a few usages of floating point that should

be rewritten to fixed point. seems to compile cleanly for iriver.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6197 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michiel Van Der Kolk 2005-03-17 20:50:03 +00:00
parent 7e7662bb71
commit 27be5bc728
67 changed files with 18488 additions and 1 deletions

View file

@ -0,0 +1,30 @@
#include <stdio.h>
#include <ctype.h>
int main(int argc, const char *const argv[])
{
const char *message = argv[1];
const char *options;
if (!message) {
fprintf(stderr,
"dumbask: asks the user a question.\n"
"Specify a message as the first argument (quoted!).\n"
"You may optionally specify the choices as the second argument.\n"
"Default choices are YN. Exit code is 0 for first, 1 for second, etc.\n");
return 0;
}
options = argv[2] ? : "YN"; /* I _had_ to use a GNU Extension _somewhere_! */
printf("%s", argv[1]);
for (;;) {
char c = toupper(getchar());
int i;
for (i = 0; options[i]; i++)
if (c == toupper(options[i]))
return i;
}
}