|
|
1.1 ! root 1: /* ! 2: * ask a question yes or no. ! 3: */ ! 4: #include <stdio.h> ! 5: yn(question) ! 6: char * question; ! 7: { ! 8: char reply[80]; ! 9: ! 10: for(;;) { ! 11: printf("%r <y/n> ", &question); ! 12: fflush(stdout); ! 13: gets(reply); ! 14: switch(*reply) { ! 15: case 'Y': ! 16: case 'y': ! 17: return(1); ! 18: case 'n': ! 19: case 'N': ! 20: return(0); ! 21: } ! 22: printf("You must answer Y or N\n"); ! 23: } ! 24: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.