O'Reilly logo

Linux Application Development, Second Edition by Erik W. Troan, Michael K. Johnson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix B. ladsh Source Code

 1: /* ladsh4.c */ 2: 3: #define _GNU_SOURCE 4: 5: #include <ctype.h> 6: #include <errno.h> 7: #include <fcntl.h> 8: #include <glob.h> 9: #include <signal.h> 10: #include <stdio.h> 11: #include <stdlib.h> 12: #include <string.h> 13: #include <sys/ioctl.h> 14: #include <sys/wait.h> 15: #include <unistd.h> 16: 17: #define MAX_COMMAND_LEN 250 /* max length of a single command 18: string */ 19: #define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n" 20: 21: struct jobSet { 22: struct job * head; /* head of list of running jobs */ 23: struct job * fg; /* current foreground job */ 24: }; 25: 26: enum redirectionType { REDIRECT_INPUT, REDIRECT_OVERWRITE, 27: REDIRECT_APPEND }; 28: 29: struct redirectionSpecifier { 30: enum redirectionType ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required