Advertisement
parkdream1

level2.c

Apr 19th, 2012
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main(int argc, char *argv[])
  6. {
  7. char *buffer = malloc(sizeof(char)*(strlen("man ")+strlen(argv[1])+1));
  8.  
  9. if(argc<2 || strlen(argv[1])>50) {
  10. printf("Manpage <argument>\n");
  11. exit(0);
  12. }
  13.  
  14. strcpy(buffer, "man ");
  15. strcat(buffer, argv[1]);
  16.  
  17. system(buffer);
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement