Guest User

Untitled

a guest
Jun 19th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. /*
  2. * do_bgfg - Execute the builtin bg and fg commands
  3. */
  4. void do_bgfg(char **argv)
  5. {
  6.  
  7. int pid;
  8. /* determine whether argv[1] is a jid or a pid */
  9. printf("jid or pid: %s \n", argv[1]);
  10. if(strncmp(argv[1], "%", 1) == 0)
  11. {
  12. printf("found- this is a jid\n");
  13. char key[] = "1234567890";
  14. char * pch;
  15. pch = strpbrk (argv[1], key);
  16. int i = atoi(pch);
  17. printf("%i\n", i);
  18. pch = strpbrk (pch+1,key);
  19. }
  20.  
  21. else
  22. {
  23. printf("this is a pid. \n");
  24. pid = atoi(argv[1]);
  25. }
  26. return;
  27. }
Add Comment
Please, Sign In to add comment