1 /* vi: set sw=4 ts=4: */
5 * Copyright (C) tons of folks. Tracking down who wrote what
6 * isn't something I'm going to worry about... If you wrote something
7 * here, please feel free to acknowledge your work.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
24 * Permission has been granted to redistribute this code under the GPL.
29 #if defined (BB_CHMOD_CHOWN_CHGRP) \
30 || defined (BB_CP_MV) \
31 || defined (BB_FIND) \
33 || defined (BB_INSMOD)
34 /* same conditions as recursiveAction */
35 #define bb_need_name_too_long
37 #define BB_DECLARE_EXTERN
50 #include <sys/param.h> /* for PATH_MAX */
52 #if defined BB_FEATURE_MOUNT_LOOP
54 #include <sys/ioctl.h>
55 #include <linux/loop.h>
59 #if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF
60 # if defined BB_FEATURE_USE_PROCFS
61 const char mtab_file[] = "/proc/mounts";
64 const char mtab_file[] = "/etc/mtab";
66 # error With (BB_MOUNT||BB_UMOUNT||BB_DF) defined, you must define either BB_MTAB or BB_FEATURE_USE_PROCFS
72 extern void usage(const char *usage)
74 fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n",
76 fprintf(stderr, "Usage: %s\n", usage);
81 #if defined (BB_INIT) || defined (BB_PS)
83 #if ! defined BB_FEATURE_USE_PROCFS
84 #error Sorry, I depend on the /proc filesystem right now.
86 /* Returns kernel version encoded as major*65536 + minor*256 + patch,
87 * so, for example, to check if the kernel is greater than 2.2.11:
88 * if (get_kernel_revision() <= 2*65536+2*256+11) { <stuff> }
90 int get_kernel_revision()
93 int major = 0, minor = 0, patch = 0;
95 file = fopen("/proc/sys/kernel/osrelease", "r");
97 /* bummer, /proc must not be mounted... */
100 fscanf(file, "%d.%d.%d", &major, &minor, &patch);
102 return major * 65536 + minor * 256 + patch;
104 #endif /* BB_INIT || BB_PS */
108 #if defined (BB_CP_MV) || defined (BB_DU) || defined (BB_LN)
110 * Return TRUE if a fileName is a directory.
111 * Nonexistant files return FALSE.
113 int isDirectory(const char *fileName, const int followLinks)
118 if (followLinks == TRUE)
119 status = stat(fileName, &statBuf);
121 status = lstat(fileName, &statBuf);
125 if (S_ISDIR(statBuf.st_mode))
131 #if defined (BB_CP_MV)
133 * Copy one file to another, while possibly preserving its modes, times,
134 * and modes. Returns TRUE if successful, or FALSE on a failure with an
135 * error message output. (Failure is not indicted if the attributes cannot
140 copyFile(const char *srcName, const char *destName,
141 int setModes, int followLinks)
148 struct stat srcStatBuf;
149 struct stat dstStatBuf;
150 struct utimbuf times;
152 if (followLinks == TRUE)
153 status = stat(srcName, &srcStatBuf);
155 status = lstat(srcName, &srcStatBuf);
162 if (followLinks == TRUE)
163 status = stat(destName, &dstStatBuf);
165 status = lstat(destName, &dstStatBuf);
168 dstStatBuf.st_ino = -1;
169 dstStatBuf.st_dev = -1;
172 if ((srcStatBuf.st_dev == dstStatBuf.st_dev) &&
173 (srcStatBuf.st_ino == dstStatBuf.st_ino)) {
174 fprintf(stderr, "Copying file \"%s\" to itself\n", srcName);
178 if (S_ISDIR(srcStatBuf.st_mode)) {
179 //fprintf(stderr, "copying directory %s to %s\n", srcName, destName);
180 /* Make sure the directory is writable */
181 status = mkdir(destName, 0777777 ^ umask(0));
182 if (status < 0 && errno != EEXIST) {
186 } else if (S_ISLNK(srcStatBuf.st_mode)) {
187 char link_val[PATH_MAX + 1];
190 //fprintf(stderr, "copying link %s to %s\n", srcName, destName);
191 /* Warning: This could possibly truncate silently, to PATH_MAX chars */
192 link_size = readlink(srcName, &link_val[0], PATH_MAX);
197 link_val[link_size] = '\0';
198 status = symlink(link_val, destName);
203 #if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
204 if (setModes == TRUE) {
205 if (lchown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid) < 0) {
212 } else if (S_ISFIFO(srcStatBuf.st_mode)) {
213 //fprintf(stderr, "copying fifo %s to %s\n", srcName, destName);
214 if (mkfifo(destName, 0644) < 0) {
218 } else if (S_ISBLK(srcStatBuf.st_mode) || S_ISCHR(srcStatBuf.st_mode)
219 || S_ISSOCK(srcStatBuf.st_mode)) {
220 //fprintf(stderr, "copying soc, blk, or chr %s to %s\n", srcName, destName);
221 if (mknod(destName, srcStatBuf.st_mode, srcStatBuf.st_rdev) < 0) {
225 } else if (S_ISREG(srcStatBuf.st_mode)) {
226 //fprintf(stderr, "copying regular file %s to %s\n", srcName, destName);
227 rfd = open(srcName, O_RDONLY);
234 open(destName, O_WRONLY | O_CREAT | O_TRUNC,
242 while ((rcc = read(rfd, buf, sizeof(buf))) > 0) {
243 if (fullWrite(wfd, buf, rcc) < 0)
251 if (close(wfd) < 0) {
256 if (setModes == TRUE) {
257 /* This is fine, since symlinks never get here */
258 if (chown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid) < 0) {
262 if (chmod(destName, srcStatBuf.st_mode) < 0) {
266 times.actime = srcStatBuf.st_atime;
267 times.modtime = srcStatBuf.st_mtime;
268 if (utime(destName, ×) < 0) {
283 #endif /* BB_CP_MV */
287 #if defined BB_TAR || defined BB_LS
289 #define TYPEINDEX(mode) (((mode) >> 12) & 0x0f)
290 #define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)])
292 /* The special bits. If set, display SMODE0/1 instead of MODE0/1 */
293 static const mode_t SBIT[] = {
299 /* The 9 mode bits to test */
300 static const mode_t MBIT[] = {
301 S_IRUSR, S_IWUSR, S_IXUSR,
302 S_IRGRP, S_IWGRP, S_IXGRP,
303 S_IROTH, S_IWOTH, S_IXOTH
306 #define MODE1 "rwxrwxrwx"
307 #define MODE0 "---------"
308 #define SMODE1 "..s..s..t"
309 #define SMODE0 "..S..S..T"
312 * Return the standard ls-like mode string from a file mode.
313 * This is static and so is overwritten on each call.
315 const char *modeString(int mode)
321 buf[0] = TYPECHAR(mode);
322 for (i = 0; i < 9; i++) {
324 buf[i + 1] = (mode & MBIT[i]) ? SMODE1[i] : SMODE0[i];
326 buf[i + 1] = (mode & MBIT[i]) ? MODE1[i] : MODE0[i];
330 #endif /* BB_TAR || BB_LS */
335 * Return the standard ls-like time string from a time_t
336 * This is static and so is overwritten on each call.
338 const char *timeString(time_t timeVal)
346 str = ctime(&timeVal);
348 strcpy(buf, &str[4]);
351 if ((timeVal > now) || (timeVal < now - 365 * 24 * 60 * 60L)) {
352 strcpy(&buf[7], &str[20]);
360 #if defined BB_TAR || defined BB_CP_MV
362 * Write all of the supplied buffer out to a file.
363 * This does multiple writes as necessary.
364 * Returns the amount written, or -1 on an error.
366 int fullWrite(int fd, const char *buf, int len)
374 cc = write(fd, buf, len);
386 #endif /* BB_TAR || BB_CP_MV */
389 #if defined BB_TAR || defined BB_TAIL
391 * Read all of the supplied buffer from a file.
392 * This does multiple reads as necessary.
393 * Returns the amount read, or -1 on an error.
394 * A short read is returned on an end of file.
396 int fullRead(int fd, char *buf, int len)
404 cc = read(fd, buf, len);
419 #endif /* BB_TAR || BB_TAIL */
422 #if defined (BB_CHMOD_CHOWN_CHGRP) \
423 || defined (BB_CP_MV) \
424 || defined (BB_FIND) \
426 || defined (BB_INSMOD)
428 * Walk down all the directories under the specified
429 * location, and do something (something specified
430 * by the fileAction and dirAction function pointers).
432 * Unfortunatly, while nftw(3) could replace this and reduce
433 * code size a bit, nftw() wasn't supported before GNU libc 2.1,
434 * and so isn't sufficiently portable to take over since glibc2.1
435 * is so stinking huge.
437 int recursiveAction(const char *fileName,
438 int recurse, int followLinks, int depthFirst,
439 int (*fileAction) (const char *fileName,
440 struct stat * statbuf),
441 int (*dirAction) (const char *fileName,
442 struct stat * statbuf))
448 if (followLinks == TRUE)
449 status = stat(fileName, &statbuf);
451 status = lstat(fileName, &statbuf);
454 #ifdef BB_DEBUG_PRINT_SCAFFOLD
456 "status=%d followLinks=%d TRUE=%d\n",
457 status, followLinks, TRUE);
463 if ((followLinks == FALSE) && (S_ISLNK(statbuf.st_mode))) {
464 if (fileAction == NULL)
467 return fileAction(fileName, &statbuf);
470 if (recurse == FALSE) {
471 if (S_ISDIR(statbuf.st_mode)) {
472 if (dirAction != NULL)
473 return (dirAction(fileName, &statbuf));
479 if (S_ISDIR(statbuf.st_mode)) {
482 dir = opendir(fileName);
487 if (dirAction != NULL && depthFirst == FALSE) {
488 status = dirAction(fileName, &statbuf);
489 if (status == FALSE) {
494 while ((next = readdir(dir)) != NULL) {
495 char nextFile[PATH_MAX + 1];
497 if ((strcmp(next->d_name, "..") == 0)
498 || (strcmp(next->d_name, ".") == 0)) {
501 if (strlen(fileName) + strlen(next->d_name) + 1 > PATH_MAX) {
502 fprintf(stderr, name_too_long, "ftw");
505 sprintf(nextFile, "%s/%s", fileName, next->d_name);
507 recursiveAction(nextFile, TRUE, followLinks, depthFirst,
508 fileAction, dirAction);
514 status = closedir(dir);
519 if (dirAction != NULL && depthFirst == TRUE) {
520 status = dirAction(fileName, &statbuf);
521 if (status == FALSE) {
527 if (fileAction == NULL)
530 return fileAction(fileName, &statbuf);
535 #endif /* BB_CHMOD_CHOWN_CHGRP || BB_CP_MV || BB_FIND || BB_LS || BB_INSMOD */
539 #if defined (BB_TAR) || defined (BB_MKDIR)
541 * Attempt to create the directories along the specified path, except for
542 * the final component. The mode is given for the final directory only,
543 * while all previous ones get default protections. Errors are not reported
544 * here, as failures to restore files can be reported later.
546 extern int createPath(const char *name, int mode)
550 char buf[PATH_MAX + 1];
554 for (cp = buf; *cp == '/'; cp++);
555 cp = strchr(cp, '/');
558 cp = strchr(cp + 1, '/');
560 retVal = mkdir(buf, cp ? 0777 : mode);
561 if (retVal != 0 && errno != EEXIST) {
569 #endif /* BB_TAR || BB_MKDIR */
573 #if defined (BB_CHMOD_CHOWN_CHGRP) || defined (BB_MKDIR)
574 /* [ugoa]{+|-|=}[rwxst] */
578 extern int parse_mode(const char *s, mode_t * theMode)
582 S_ISVTX | S_ISUID | S_ISGID | S_IRWXU | S_IRWXG | S_IRWXO;
595 groups |= S_ISUID | S_IRWXU;
598 groups |= S_ISGID | S_IRWXG;
604 groups |= S_ISUID | S_ISGID | S_IRWXU | S_IRWXG | S_IRWXO;
610 if (groups == 0) /* The default is "all" */
612 S_ISUID | S_ISGID | S_IRWXU | S_IRWXG | S_IRWXO;
615 if (isdigit(c) && c >= '0' && c <= '7' &&
616 mode == 0 && groups == 0) {
617 *theMode = strtol(--s, NULL, 8);
625 while ((c = *s++) != '\0') {
630 mode |= S_IRUSR | S_IRGRP | S_IROTH;
633 mode |= S_IWUSR | S_IWGRP | S_IWOTH;
636 mode |= S_IXUSR | S_IXGRP | S_IXOTH;
639 mode |= S_IXGRP | S_ISUID | S_ISGID;
653 andMode &= ~(groups);
656 orMode |= mode & groups;
659 andMode &= ~(mode & groups);
670 #endif /* BB_CHMOD_CHOWN_CHGRP || BB_MKDIR */
678 #if defined (BB_CHMOD_CHOWN_CHGRP) || defined (BB_PS)
680 /* Use this to avoid needing the glibc NSS stuff
681 * This uses storage buf to hold things.
683 uid_t my_getid(const char *filename, char *name, uid_t id)
686 char *rname, *start, *end, buf[128];
689 file = fopen(filename, "r");
695 while (fgets(buf, 128, file) != NULL) {
700 end = strchr(start, ':');
707 end = strchr(start, ':');
712 rid = (uid_t) strtol(start, &end, 10);
717 if (0 == strcmp(rname, name)) {
722 if (id != -1 && id == rid) {
723 strncpy(name, rname, 8);
732 uid_t my_getpwnam(char *name)
734 return my_getid("/etc/passwd", name, -1);
737 gid_t my_getgrnam(char *name)
739 return my_getid("/etc/group", name, -1);
742 void my_getpwuid(char *name, uid_t uid)
744 my_getid("/etc/passwd", name, uid);
747 void my_getgrgid(char *group, gid_t gid)
749 my_getid("/etc/group", group, gid);
753 #endif /* BB_CHMOD_CHOWN_CHGRP || BB_PS */
758 #if (defined BB_CHVT) || (defined BB_DEALLOCVT)
761 #include <linux/kd.h>
762 #include <sys/ioctl.h>
764 int is_a_console(int fd)
769 return (ioctl(fd, KDGKBTYPE, &arg) == 0
770 && ((arg == KB_101) || (arg == KB_84)));
773 static int open_a_console(char *fnam)
778 fd = open(fnam, O_RDWR);
780 /* if failed, try read-only */
781 if (fd < 0 && errno == EACCES)
782 fd = open(fnam, O_RDONLY);
784 /* if failed, try write-only */
785 if (fd < 0 && errno == EACCES)
786 fd = open(fnam, O_WRONLY);
788 /* if failed, fail */
792 /* if not a console, fail */
793 if (!is_a_console(fd)) {
803 * Get an fd for use with kbd/console ioctls.
804 * We try several things because opening /dev/console will fail
805 * if someone else used X (which does a chown on /dev/console).
807 * if tty_name is non-NULL, try this one instead.
810 int get_console_fd(char *tty_name)
815 if (-1 == (fd = open_a_console(tty_name)))
821 fd = open_a_console("/dev/tty");
825 fd = open_a_console("/dev/tty0");
829 fd = open_a_console("/dev/console");
833 for (fd = 0; fd < 3; fd++)
834 if (is_a_console(fd))
838 "Couldnt get a file descriptor referring to the console\n");
839 return -1; /* total failure */
843 #endif /* BB_CHVT || BB_DEALLOCVT */
846 #if !defined BB_REGEXP && (defined BB_GREP || defined BB_SED)
848 /* Do a case insensitive strstr() */
849 char *stristr(char *haystack, const char *needle)
851 int len = strlen(needle);
854 if (!strncasecmp(haystack, needle, len))
865 /* This tries to find a needle in a haystack, but does so by
866 * only trying to match literal strings (look 'ma, no regexps!)
867 * This is short, sweet, and carries _very_ little baggage,
868 * unlike its beefier cousin in regexp.c
871 extern int find_match(char *haystack, char *needle, int ignoreCase)
874 if (ignoreCase == FALSE)
875 haystack = strstr(haystack, needle);
877 haystack = stristr(haystack, needle);
878 if (haystack == NULL)
884 /* This performs substitutions after a string match has been found. */
885 extern int replace_match(char *haystack, char *needle, char *newNeedle,
889 char *where, *slider, *slider1, *oldhayStack;
891 if (ignoreCase == FALSE)
892 where = strstr(haystack, needle);
894 where = stristr(haystack, needle);
896 if (strcmp(needle, newNeedle) == 0)
899 oldhayStack = (char *) malloc((unsigned) (strlen(haystack)));
900 while (where != NULL) {
902 strcpy(oldhayStack, haystack);
904 if (strlen(newNeedle) > strlen(needle)) {
906 (char *) realloc(haystack,
907 (unsigned) (strlen(haystack) -
912 for (slider = haystack, slider1 = oldhayStack; slider != where;
913 slider++, slider1++);
915 haystack = strcat(haystack, newNeedle);
916 slider1 += strlen(needle);
917 haystack = strcat(haystack, slider1);
918 where = strstr(slider, needle);
928 #endif /* ! BB_REGEXP && (BB_GREP || BB_SED) */
933 * Routine to see if a text string is matched by a wildcard pattern.
934 * Returns TRUE if the text is matched, or FALSE if it is not matched
935 * or if the pattern is invalid.
936 * * matches zero or more characters
937 * ? matches a single character
938 * [abc] matches 'a', 'b' or 'c'
939 * \c quotes character c
940 * Adapted from code written by Ingo Wilken, and
941 * then taken from sash, Copyright (c) 1999 by David I. Bell
942 * Permission is granted to use, distribute, or modify this source,
943 * provided that this copyright notice remains intact.
944 * Permission to distribute this code under the GPL has been granted.
946 extern int check_wildcard_match(const char *text, const char *pattern)
948 const char *retryPat;
949 const char *retryText;
956 while (*text || *pattern) {
968 while ((ch = *pattern++) != ']') {
985 /* fall into next case */
999 /* fall into next case */
1017 if (pattern == NULL)
1023 #endif /* BB_FIND */
1028 #if defined BB_DF || defined BB_MTAB
1030 * Given a block device, find the mount table entry if that block device
1033 * Given any other file (or directory), find the mount table entry for its
1036 extern struct mntent *findMountPoint(const char *name, const char *table)
1041 struct mntent *mountEntry;
1043 if (stat(name, &s) != 0)
1046 if ((s.st_mode & S_IFMT) == S_IFBLK)
1047 mountDevice = s.st_rdev;
1049 mountDevice = s.st_dev;
1052 if ((mountTable = setmntent(table, "r")) == 0)
1055 while ((mountEntry = getmntent(mountTable)) != 0) {
1056 if (strcmp(name, mountEntry->mnt_dir) == 0
1057 || strcmp(name, mountEntry->mnt_fsname) == 0) /* String match. */
1059 if (stat(mountEntry->mnt_fsname, &s) == 0 && s.st_rdev == mountDevice) /* Match the device. */
1061 if (stat(mountEntry->mnt_dir, &s) == 0 && s.st_dev == mountDevice) /* Match the directory's mount point. */
1064 endmntent(mountTable);
1067 #endif /* BB_DF || BB_MTAB */
1071 #if defined BB_DD || defined BB_TAIL
1073 * Read a number with a possible multiplier.
1074 * Returns -1 if the number format is illegal.
1076 extern long getNum(const char *cp)
1080 if (!isDecimal(*cp))
1085 while (isDecimal(*cp))
1086 value = value * 10 + *cp++ - '0';
1090 case 'm': /* `tail' uses it traditionally */
1118 #endif /* BB_DD || BB_TAIL */
1121 #if defined BB_INIT || defined BB_SYSLOGD
1122 /* try to open up the specified device */
1123 extern int device_open(char *device, int mode)
1127 m = mode | O_NONBLOCK;
1129 /* Retry up to 5 times */
1130 for (f = 0; f < 5; f++)
1131 if ((fd = open(device, m, 0600)) >= 0)
1135 /* Reset original flags. */
1137 fcntl(fd, F_SETFL, mode);
1140 #endif /* BB_INIT BB_SYSLOGD */
1143 #if defined BB_INIT || defined BB_HALT || defined BB_REBOOT
1145 #if ! defined BB_FEATURE_USE_PROCFS
1146 #error Sorry, I depend on the /proc filesystem right now.
1150 * This finds the pid of init (which is not always 1).
1151 * Currently, it's implemented by rummaging through the proc filesystem.
1155 * pid when init's pid is found.
1157 extern pid_t findInitPid()
1163 /* no need to opendir ;) */
1164 for (init_pid = 1; init_pid < 65536; init_pid++) {
1167 sprintf(filename, "/proc/%d/status", init_pid);
1168 status = fopen(filename, "r");
1172 fgets(buffer, 256, status);
1175 if ((strstr(buffer, "init\n") != NULL)) {
1181 #endif /* BB_INIT || BB_HALT || BB_REBOOT */
1183 #if defined BB_GUNZIP \
1184 || defined BB_GZIP \
1185 || defined BB_PRINTF \
1187 extern void *xmalloc(size_t size)
1189 void *cp = malloc(size);
1192 error("out of memory");
1197 extern void error(char *msg)
1199 fprintf(stderr, "\n%s\n", msg);
1202 #endif /* BB_GUNZIP || BB_GZIP || BB_PRINTF || BB_TAIL */
1204 #if (__GLIBC__ < 2) && (defined BB_SYSLOGD || defined BB_INIT)
1205 extern int vdprintf(int d, const char *format, va_list ap)
1210 len = vsprintf(buf, format, ap);
1211 return write(d, buf, len);
1213 #endif /* BB_SYSLOGD */
1215 #if defined BB_FEATURE_MOUNT_LOOP
1216 extern int del_loop(const char *device)
1220 if ((fd = open(device, O_RDONLY)) < 0) {
1224 if (ioctl(fd, LOOP_CLR_FD, 0) < 0) {
1225 perror("ioctl: LOOP_CLR_FD");
1232 extern int set_loop(const char *device, const char *file, int offset,
1235 struct loop_info loopinfo;
1238 mode = *loopro ? O_RDONLY : O_RDWR;
1239 if ((ffd = open(file, mode)) < 0 && !*loopro
1240 && (errno != EROFS || (ffd = open(file, mode = O_RDONLY)) < 0)) {
1244 if ((fd = open(device, mode)) < 0) {
1249 *loopro = (mode == O_RDONLY);
1251 memset(&loopinfo, 0, sizeof(loopinfo));
1252 strncpy(loopinfo.lo_name, file, LO_NAME_SIZE);
1253 loopinfo.lo_name[LO_NAME_SIZE - 1] = 0;
1255 loopinfo.lo_offset = offset;
1257 loopinfo.lo_encrypt_key_size = 0;
1258 if (ioctl(fd, LOOP_SET_FD, ffd) < 0) {
1259 perror("ioctl: LOOP_SET_FD");
1264 if (ioctl(fd, LOOP_SET_STATUS, &loopinfo) < 0) {
1265 (void) ioctl(fd, LOOP_CLR_FD, 0);
1266 perror("ioctl: LOOP_SET_STATUS");
1276 extern char *find_unused_loop_device(void)
1280 struct stat statbuf;
1281 struct loop_info loopinfo;
1283 for (i = 0; i <= 7; i++) {
1284 sprintf(dev, "/dev/loop%d", i);
1285 if (stat(dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) {
1286 if ((fd = open(dev, O_RDONLY)) >= 0) {
1287 if (ioctl(fd, LOOP_GET_STATUS, &loopinfo) == -1) {
1288 if (errno == ENXIO) { /* probably free */
1299 #endif /* BB_FEATURE_MOUNT_LOOP */
1302 #define whine_if_fstab_is_missing() {}
1304 extern void whine_if_fstab_is_missing()
1306 struct stat statBuf;
1308 if (stat("/etc/fstab", &statBuf) < 0)
1310 "/etc/fstab file missing -- install one to name /dev/root.\n\n");