Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 21st, 2012  |  syntax: None  |  size: 0.48 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <stdio.h>
  2. #include <string.h>
  3. void dostuff(int uid, char *command)
  4. {
  5. if (uid > 0)
  6. printf("command %s\n",command);
  7. else
  8. printf("welcome to the machine\n"); // **admin**
  9. }
  10. int main(int argc, char ** argv)
  11. {
  12. int test;
  13. int uid;
  14. char cmd[32];
  15. if (argc<3) {
  16. printf("start with %s password command\n",argv[0]);
  17. return -1;
  18. }
  19. if (!strcmp(argv[1],"secret")) //replace by database
  20. // access
  21. uid=-1;
  22. else
  23. uid =1;
  24. strcpy(cmd, argv[2]);
  25. dostuff(uid, cmd);
  26. printf("done\n");
  27. }