daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Dec 12th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void processStage(token *tok) {
  2.     int numArgs = getNumArgs(tok);
  3.     char *args[numArgs+1];
  4.     int i = 0;
  5.  
  6.     while(i < numArgs) {
  7.         args[i] = tok[0].text;
  8.         i++;
  9.         tok++;
  10.     }
  11.  
  12.     while(tok[0].type == LOCAL) {
  13.         setLocalVars(tok[0].text);
  14.         tok++;
  15.     }
  16.  
  17.     if (numArgs > 0) {
  18.         // List of args must be null terminated
  19.         args[numArgs] = NULL;
  20.         while(RED_OP(tok[0].type)) {                // HANDLE REDIRECTS
  21.             handleRedirects(tok[0]);
  22.             tok++;
  23.         }
  24.         char *cmd = args[0];  
  25.         execvp(cmd, args);
  26.     } else {
  27.         while(RED_OP(tok[0].type)) {                // HANDLE REDIRECTS
  28.             handleRedirects(tok[0]);
  29.             tok++;
  30.         }
  31.         tok++;
  32.         exit(process(tok));
  33.     }
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top