lazix

Untitled

Apr 16th, 2021 (edited)
944
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "include/key_presses.h"
  2. #include <stdio.h>
  3. #include <unistd.h>
  4. #include <string.h>
  5. extern char* help_message = "HELP MENU\n\n\n\n\t --h: SHOW THIS MESSAGE\n\t--c: COMPILE FILE\n\t--r: REPL\n\n\nWORK IN PROGRESS";
  6. void catcher(int num)
  7. {
  8.     puts("^C\n");
  9. }
  10.  
  11. int main(int *argc, char** argv)
  12. {
  13.     // could easily substitute using a switch statement for less convoluted code
  14.     if(strcmp(argv[1], "--help") || strcmp(argv[1], "--h"))
  15.     {
  16.         printf("%s", help_message);
  17.     }
  18.     if(strcmp(argv[1], "\0"))
  19.     {
  20.         size_t size = strlen(argv[1]);
  21.         size -= 1; //null term
  22.         memset(argv[1], "--c", size);
  23.         exit(1);
  24.     }
  25.     if(S_CHECK_FOR_ERROR(catcher()))
  26.     {
  27.         exit(1);
  28.     }    
  29.     return 0;
  30. }
RAW Paste Data