Category : System Diagnostics for your computer
Archive   : SYSACT13.ZIP
Filename : ASKYN.C
Output of file : ASKYN.C contained in archive : SYSACT13.ZIP
/* askyn - ask yes/no question, set errorlevel=1 if yes, 0 if no */
/* initial coding, s.h.smith, 1-feb-87 */
/* added -R option to reverse meaning of yes/no */
/* translated to c (with tpc10) 8-feb-87 */
#include
#include
int i;
char ans;
int rev;
int yes,no;
main(argc,argv)
int argc;
char *argv[];
{
if ((argc-1) == 0)
{
printf("usage: askyn [-R] prompt\n");
printf("where prompt is the user prompt\n");
printf("returns ERRORLEVEL=1 if user answers Yes\n");
printf("-R option reverses yes/no (i.e. No gives ERRORLEVEL=1)\n");
exit(1);
}
if ((strcmp(argv[1], "-R") == 0))
{
yes = 0;
i = 2;
}
else
{
yes = !0;
i = 1;
}
no = !yes;
printf("%s",argv[i]);
for (i = i + 1; i <= (argc-1); i++)
printf(" %s",argv[i]);
printf("? (Y/N) ");
do {
ans = toupper(getch());
} while ((ans != 'Y') && (ans != 'N'));
printf("%c\n",ans);
if (ans == 'Y') /* return 1 on yes without -R */
/* return 0 on yes with -R */
exit(yes);
else
exit(no);
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/