summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorUwe Stuehler <uwe@cvs.openbsd.org>2005-01-11 11:47:12 +0000
committerUwe Stuehler <uwe@cvs.openbsd.org>2005-01-11 11:47:12 +0000
commit83750fba231e943a7b47c7f42c2fe0189ed033db (patch)
tree3090c0a4d19515069e5c70641c015549fe229527 /sys
parent7e0bd0336e033ee08cdfa5139bfc4d6209327f36 (diff)
Let 'boot' and 'ls' take arguments of the form [device:][file].
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/zaurus/stand/zboot/unixdev.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/sys/arch/zaurus/stand/zboot/unixdev.c b/sys/arch/zaurus/stand/zboot/unixdev.c
index 36f1ab9220f..5460099a34f 100644
--- a/sys/arch/zaurus/stand/zboot/unixdev.c
+++ b/sys/arch/zaurus/stand/zboot/unixdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unixdev.c,v 1.1 2005/01/10 00:25:03 deraadt Exp $ */
+/* $OpenBSD: unixdev.c,v 1.2 2005/01/11 11:47:11 uwe Exp $ */
/*
* Copyright (c) 1996-1998 Michael Shalayeff
@@ -67,6 +67,7 @@ unixopen(struct open_file *f, ...)
char **file, *p = NULL;
va_list ap;
int fd;
+ int c;
va_start(ap, f);
file = va_arg(ap, char **);
@@ -76,25 +77,25 @@ unixopen(struct open_file *f, ...)
printf("unixopen: %s\n", *file);
#endif
- if (strncmp("/dev/", *file, 5) == 0) {
- /* p = strchr(p + 5, '/') */
- for (p = *file + 5; *p != '\0' && *p != '/'; p++)
- ;
- if (*(p-1) == ':')
- *(p-1) = '\0';
- if (*p == '/')
- *p = '\0';
- }
+ /* p = strchr(p, ':') */
+ for (p = *file; *p != '\0' && *p != ':'; p++)
+ ;
+ c = *p;
+ *p = '\0';
#if 0
f->f_devdata = (void *)(fd = uopen(*file, O_RDWR, 0));
#else
f->f_devdata = (void *)(fd = uopen(*file, O_RDONLY, 0));
#endif
-
- *file = p;
- if (p != NULL)
- *p = '/';
+ *p = c;
+
+ if (*p == '\0')
+ *file = p;
+ else if (*(p+1) == '\0')
+ *file = (char *)"/";
+ else
+ *file = p+1;
return fd < 0 ? -1 : 0;
}