When we run our new signal3 program on a solaris

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: mmand(char **argv) { if (!strcmp(argv[0], "quit")) /* quit command */ exit(0); if (!strcmp(argv[0], "&")) /* ignore singleton & */ return 1; return 0; /* not a builtin command */ } code/ecf/shellex.c Figure 8.21: eval: evaluates the shell command line. 8.5. SIGNALS 421 code/ecf/shellex.c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 /* parseline - parse the int parseline(const char { char array[MAXLINE]; char *buf = array; char *delim; int argc; int bg; command line and build the argv array */ *cmdline, char **argv) /* /* /* /* /* holds local copy of command line */ ptr that traverses command line */ points to first space delimiter */ number of args */ background job? */ strcpy(buf, cmdline); buf[strlen(buf)-1] = ’ ’; /* replace trailing ’\n’ with space */ while (*buf && (*buf == ’ ’)) /* ignore leading spaces */ buf++; /* build the argv list */ argc = 0; while ((delim = strchr(buf, ’ ’))) { argv[argc++] = buf; *delim = ’\0’; buf = delim + 1; while (*buf &&...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online