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 ...
Get Linux Application Development, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.