File: askq.c

package info (click to toggle)
allegro4.2 2:4.2.0-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 24,436 kB
  • ctags: 14,714
  • sloc: ansic: 126,425; asm: 17,011; cpp: 3,846; sh: 2,120; objc: 925; makefile: 715; python: 216; pascal: 179; perl: 73
file content (38 lines) | stat: -rw-r--r-- 573 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 *  ASKQ - asks a yes/no question, returning an exit status to the caller.
 *  This is used by the msvcmake installation batch file.
 */


#include <stdio.h>
#include <ctype.h>



int main(int argc, char *argv[])
{
   int i;

   puts("\n");

   for (i=1; i<argc; i++) {
      if (i > 1)
	 putc(' ', stdout);

      puts(argv[i]);
   }

   puts("? [y/n] ");

   for (;;) {
      i = getc(stdin);

      if ((tolower(i) == 'y') || (tolower(i) == 'n')) {
	 putc(i, stdout);
	 puts("\n\n");
	 return (tolower(i) == 'y') ? 0 : 1;
      }
      else
	 putc(7, stdout);
   }
}