Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "include/key_presses.h"
- #include <stdio.h>
- #include <unistd.h>
- #include <string.h>
- 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";
- void catcher(int num)
- {
- puts("^C\n");
- }
- int main(int *argc, char** argv)
- {
- // could easily substitute using a switch statement for less convoluted code
- if(strcmp(argv[1], "--help") || strcmp(argv[1], "--h"))
- {
- printf("%s", help_message);
- }
- if(strcmp(argv[1], "\0"))
- {
- size_t size = strlen(argv[1]);
- size -= 1; //null term
- memset(argv[1], "--c", size);
- exit(1);
- }
- if(S_CHECK_FOR_ERROR(catcher()))
- {
- exit(1);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment