Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.42 KB | None | 0 0
  1. /***************************************************************************
  2.  * Dr. Evil's Insidious Bomb, Version 1.1
  3.  * Copyright 2011, Dr. Evil Incorporated. All rights reserved.
  4.  *
  5.  * LICENSE:
  6.  *
  7.  * Dr. Evil Incorporated (the PERPETRATOR) hereby grants you (the
  8.  * VICTIM) explicit permission to use this bomb (the BOMB).  This is a
  9.  * time limited license, which expires on the death of the VICTIM.
  10.  * The PERPETRATOR takes no responsibility for damage, frustration,
  11.  * insanity, bug-eyes, carpal-tunnel syndrome, loss of sleep, or other
  12.  * harm to the VICTIM.  Unless the PERPETRATOR wants to take credit,
  13.  * that is.  The VICTIM may not distribute this bomb source code to
  14.  * any enemies of the PERPETRATOR.  No VICTIM may debug,
  15.  * reverse-engineer, run "strings" on, decompile, decrypt, or use any
  16.  * other technique to gain knowledge of and defuse the BOMB.  BOMB
  17.  * proof clothing may not be worn when handling this program.  The
  18.  * PERPETRATOR will not apologize for the PERPETRATOR's poor sense of
  19.  * humor.  This license is null and void where the BOMB is prohibited
  20.  * by law.
  21.  ***************************************************************************/
  22.  
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25. #include "support.h"
  26. #include "phases.h"
  27.  
  28. /*
  29.  * Note to self: Remember to erase this file so my victims will have no
  30.  * idea what is going on, and so they will all blow up in a
  31.  * spectaculary fiendish explosion. -- Dr. Evil
  32.  */
  33.  
  34. FILE *infile;
  35.  
  36. int main(int argc, char *argv[])
  37. {
  38.     char *input;
  39.  
  40.     /* Note to self: remember to port this bomb to Windows and put a
  41.      * fantastic GUI on it. */
  42.  
  43.     /* When run with no arguments, the bomb reads its input lines
  44.      * from standard input. */
  45.     if (argc == 1) {  
  46.     infile = stdin;
  47.     }
  48.  
  49.     /* When run with one argument <file>, the bomb reads from <file>
  50.      * until EOF, and then switches to standard input. Thus, as you
  51.      * defuse each phase, you can add its defusing string to <file> and
  52.      * avoid having to retype it. */
  53.     else if (argc == 2) {
  54.     if (!(infile = fopen(argv[1], "r"))) {
  55.         printf("%s: Error: Couldn't open %s\n", argv[0], argv[1]);
  56.         exit(8);
  57.     }
  58.     }
  59.  
  60.     /* You can't call the bomb with more than 1 command line argument. */
  61.     else {
  62.     printf("Usage: %s [<input_file>]\n", argv[0]);
  63.     exit(8);
  64.     }
  65.  
  66.     /* Do all sorts of secret stuff that makes the bomb harder to defuse. */
  67.     initialize_bomb();
  68.  
  69.     printf("Welcome to my fiendish little bomb. You have 9 phases with\n");
  70.     printf("which to blow yourself up. Have a nice day!\n");
  71.  
  72.     /* Hmm...  Six phases must be more secure than one phase! */
  73.     input = read_line();             /* Get input                   */
  74.     phase_1(input);                  /* Run the phase               */
  75.     phase_defused();                 /* Drat!  They figured it out!
  76.                       * Let me know how they did it. */
  77.     printf("Phase 1 defused. How about the next one?\n");
  78.  
  79.     /* The second phase is harder.  No one will ever figure out
  80.      * how to defuse this... */
  81.     input = read_line();
  82.     phase_2(input);
  83.     phase_defused();
  84.     printf("That's number 2.  Keep going!\n");
  85.  
  86.     /* I guess this is too easy so far.  Some more complex code will
  87.      * confuse people. */
  88.     input = read_line();
  89.     phase_3(input);
  90.     phase_defused();
  91.     printf("One step closer.\n");
  92.  
  93.     /* Oh yeah?  Well, how good is your math?  Try on this saucy problem! */
  94.     input = read_line();
  95.     phase_4(input);
  96.     phase_defused();
  97.     printf("So you got that one.  Try this one.\n");
  98.    
  99.     /* Did you think you were done? */
  100.     input = read_line();
  101.     phase_5(input);
  102.     phase_defused();
  103.     printf("Good work!  On to the next...\n");
  104.  
  105.     /* This phase will never be used, since no one will get past the
  106.      * earlier ones.  But just in case, make this one extra hard. */
  107.     input = read_line();
  108.     phase_6(input);
  109.     phase_defused();
  110.     printf("Impressive, but how about this?\n");
  111.    
  112.     /* Round and 'round in memory we go, where we stop, the bomb blows! */
  113.     input = read_line();
  114.     phase_7(input);
  115.     phase_defused();
  116.     printf("Good, but you're not done yet.\n");
  117.  
  118.     /* I'll get you yet. */
  119.     input = read_line();
  120.     phase_8(input);
  121.     phase_defused();
  122.     printf("One more!\n");
  123.    
  124.     /* All that work!  Pity you won't get this one. */
  125.     input = read_line();
  126.     phase_9(input);
  127.     phase_defused();
  128.    
  129.     return 0;
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement