old-c-code/demos/fakedos.c
2021-10-24 16:16:03 -07:00

46 lines
1.6 KiB
C

/* fakedos - Fake out that DOS prompt. Perfect for fooling your friends.
Copyright (C) 2003 Shaun Marquardt
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
// string.h for strcmp.. using it is actually smaller then what I had wrote.
#include <string.h>
void main()
{
char input[20];
/* One of the goals of this program is to have it as small as
possible so it can be fit on a disk with others, and the nessasary
other programs and configuration files which the A+ class break disk needs.
A FOR loop does this nicely, although while looks better, it requres
more setup, and space on the disk. */
for(;;) //loop forever
{
printf("C:\\>"); //fake out dos prompt
gets(input); //get user input
if(!strcmp(input,"password")) //if input is the password, break
{
printf("Correct password. Returning to DOS.\n");
break; //return to dos
}
printf("Bad command or file name\n"); //nope dont play that game
}
}