From 8351f8e943e16a09b1dac4e55a61e22472f29c61 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Mon, 2 Sep 2013 08:09:54 -0400 Subject: [PATCH] make sure there's a .dpu suffix on the input file --- undpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/undpu.c b/undpu.c index 6aa532a..0a706b2 100755 --- a/undpu.c +++ b/undpu.c @@ -13,6 +13,11 @@ int main (int argc, char **argv){ fputs("I pity the fool who don't have an input file!\n",stderr); return EXIT_FAILURE; } + if(strlen(argv[1]) <= 4 || strcmp(argv[1] + strlen(argv[1]) - 4, ".dpu")) + { + fputs("Where's the rest of the filename?", stderr); + return EXIT_FAILURE; + } if((bob = fopen(argv[1],"r"))==NULL){ fputs("That's no input file, THAT'S A SPACE STATION!\n",stderr); return EXIT_FAILURE;