home *** CD-ROM | disk | FTP | other *** search
- /*
- COUNTDOWN Ver 1.11 This Program is PUBLIC DOMAIN
- Author: Kirby Angell Do with it what you will
- Date : Oct 88
-
- Commets to the author may be addressed to:
- via NetMail address 147/42
- BBS Number (405)771-5954
- Or by snail at
- 12500 Teakwood Rd
- Edmond, OK 73013
- */
-
- #define MAXLEN 80
- #define LIMIT 30
- #define OK 0
- #define ERROR 1
- #include <stdlib.h>
-
- logo()
- {
- printf("\nCOUNTDOWN ver 1.11\n");
-
- }
-
- argcheck(int count, char *param)
- {
- if (count < 2) {
- printf("\nUSAGE: COUNTDN 2 50 Hold_for_RoboCoder_or_press_any_key\n");
- printf("Would exit with errorlevel 2 if you press a key before the program ends,\n");
- printf("or exit in 50 seconds with errorlevel %d if you don't.\n",OK);
- printf("This would also print out \"Hold for RoboCoder or press any key\"\n");
- printf("as the prompt. The maximum prompt length is %d.\n",MAXLEN);
- printf("The program exits with errorlevel %d if there is are improper command line\n",ERROR);
- printf("arguments.\n");
- exit(ERROR);
- }
- if ((atoi(param) == OK) || (atoi(param) == ERROR)) {
- printf("\nERROR: Errorlevel cannot equal %d or %d\n",OK,ERROR);
- exit(ERROR);
- }
- }
-
- stripblanks(char *in)
- {
- while (*in++ != '\0')
- if (*in == '_')
- *in = ' ';
- }
-
- main(int argc, char *argv[])
- {
- int timer;
- int errorlevel;
- int top;
- char prompt[MAXLEN] = "Press any key to exit with errorlevel...\n\0";
-
- logo();
- argcheck(argc,argv[1]);
-
- errorlevel = atoi(argv[1]);
- if (argc >= 3)
- top = atoi(argv[2]);
- else
- top = LIMIT;
-
- if (argc == 4)
- stripblanks(strcpy(prompt,argv[3]));
-
- printf("%s\n",prompt);
-
- for (timer = top;timer > 0; --timer) {
- printf(".");
- delay(1000);
- if (kbhit())
- {
- getch();
- printf("\n");
- exit(errorlevel);
- }
- }
- printf("\n");
- return OK;
- }