Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main (int argc, char *argv[])
- {
- char str1[10], str2[10], str3[10], str4[10];
- strcpy(str1, "--version");
- strcpy(str2, "--usage");
- strcpy(str3, "--hexdump");
- if (argc > 1)
- {
- strcpy(str4, argv[1]);
- }
- if (((strcmp(str1, str4)) == 0) && (argc == 2))
- {
- fprintf(stdout, "1.0\n");
- return 0;
- }
- if (((strcmp(str2, str4)) == 0) && (argc == 2))
- {
- fprintf(stdout, "Usage:\n./pnmdump.exe --version\n./pnmdump.exe --usage\n./pnmdump.exe --hexdump [FILE]\n");
- return 0;
- }
- if (((strcmp(str3, str4)) == 0) && (argc == 3))
- {
- fprintf(stdout, "print the file (1.0)\n");
- return 0;
- }
- else
- {
- fprintf(stderr, "pnmdump: bad arguments\nUsage:\n./pnmdump.exe --version\n./pnmdump.exe --usage\n./pnmdump.exe --hexdump [FILE]\n");
- return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement