aboutsummaryrefslogtreecommitdiff
path: root/sys/boot/common/ls.c
diff options
context:
space:
mode:
authorMike Smith <msmith@FreeBSD.org>1998-10-07 02:38:26 +0000
committerMike Smith <msmith@FreeBSD.org>1998-10-07 02:38:26 +0000
commitb820c8e6267c0a3145f7b8650db7615ad461c146 (patch)
tree6a8558554fe86d80206f2b23c2fd87cd922b7b99 /sys/boot/common/ls.c
parent82bb1fb746d06dc2fcf322a8b9ecda551eefd550 (diff)
downloadsrc-b820c8e6267c0a3145f7b8650db7615ad461c146.tar.gz
src-b820c8e6267c0a3145f7b8650db7615ad461c146.zip
- VERBOSE_LS is obsolete, as the heap is much better behaved now.
- Don't whine about nodes we can't stat(); these are usually symlinks that lead out of the filesystem. - Autoboot is now controlled by $autoboot_delay, which is a value in seconds or NO to disable autoboot. - Don't autoboot at the end of boot.conf if we have already tried. - Add a 'read' command to complement 'echo'. Both are still hidden. - Improve the 'source' command/function so that it is possible to source scripts off removable media. The entire script is read and saved before beginning execution. Script lines beginning with '@' will not be echoed when being executed. Script execution will normally terminate at the first error, however if the script line begins with '-' this behaviour is overriden for that command.
Notes
Notes: svn path=/head/; revision=40015
Diffstat (limited to 'sys/boot/common/ls.c')
-rw-r--r--sys/boot/common/ls.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/sys/boot/common/ls.c b/sys/boot/common/ls.c
index 1596a3abce78..2cce8adc3876 100644
--- a/sys/boot/common/ls.c
+++ b/sys/boot/common/ls.c
@@ -1,5 +1,5 @@
/*
- * $Id: ls.c,v 1.2 1998/09/03 02:10:07 msmith Exp $
+ * $Id: ls.c,v 1.3 1998/09/26 01:29:13 msmith Exp $
* From: $NetBSD: ls.c,v 1.3 1997/06/13 13:48:47 drochner Exp $
*/
@@ -61,7 +61,6 @@ command_ls(int argc, char *argv[])
static char buf[128]; /* must be long enough for full pathname */
char *path;
int result, ch;
-#ifdef VERBOSE_LS
int verbose;
verbose = 0;
@@ -79,7 +78,6 @@ command_ls(int argc, char *argv[])
}
argv += (optind - 1);
argc -= (optind - 1);
-#endif
if (argc < 2) {
path = "/";
@@ -107,11 +105,9 @@ command_ls(int argc, char *argv[])
result = CMD_ERROR;
goto out;
}
-#ifdef VERBOSE_LS
/* fixup path for stat()ing files */
if (!strcmp(path, "/"))
path = "";
-#endif
while ((size = read(fd, dirbuf, DIRBLKSIZ)) == DIRBLKSIZ) {
struct direct *dp, *edp;
@@ -139,18 +135,14 @@ command_ls(int argc, char *argv[])
}
if (strcmp(dp->d_name, ".") && strcmp(dp->d_name, "..")) {
-#ifdef VERBOSE_LS /* too much UFS activity blows the heap out */
if (verbose) {
/* stat the file, if possible */
sb.st_size = 0;
sprintf(buf, "%s/%s", path, dp->d_name);
- /* ignore return */
- if (stat(buf, &sb)) {
- printf("stat(%s) failed: %s\n", buf, strerror(errno));
- sb.st_size = -1;
- }
+ /* ignore return, could be symlink, etc. */
+ if (stat(buf, &sb))
+ sb.st_size = 0;
sprintf(buf, " %c %8d %s\n", typestr[dp->d_type], (int)sb.st_size, dp->d_name);
-#endif
} else
sprintf(buf, " %c %s\n", typestr[dp->d_type], dp->d_name);
if (pager_output(buf))