aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/fdcontrol
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2004-08-20 15:14:25 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2004-08-20 15:14:25 +0000
commit1b67be7b750ed0f074d730bf1164a82fe1bcf83b (patch)
treeb948c22d12f559b0c58f576fc7da5d69acc1c8ef /usr.sbin/fdcontrol
parent0f81131e63eb10706519803242117a8a09dff5c4 (diff)
Notes
Diffstat (limited to 'usr.sbin/fdcontrol')
-rw-r--r--usr.sbin/fdcontrol/fdcontrol.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/usr.sbin/fdcontrol/fdcontrol.c b/usr.sbin/fdcontrol/fdcontrol.c
index 5ef5057e5f774..ff0f90bf36e8c 100644
--- a/usr.sbin/fdcontrol/fdcontrol.c
+++ b/usr.sbin/fdcontrol/fdcontrol.c
@@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$");
#include "fdutil.h"
-static int debug = -1, format, verbose, show = 1, showfmt;
+static int format, verbose, show = 1, showfmt;
static char *fmtstring;
static void showdev(enum fd_drivetype, const char *);
@@ -72,20 +72,14 @@ main(int argc, char **argv)
enum fd_drivetype type;
struct fd_type ft, newft, *fdtp;
const char *name, *descr;
- int fd, i, mode;
+ int fd, i, mode, autofmt;
- while((i = getopt(argc, argv, "d:Ff:s:v")) != -1)
+ autofmt = 0;
+ while((i = getopt(argc, argv, "aFf:s:v")) != -1)
switch(i) {
- case 'd':
- if (strcmp(optarg, "0") == 0)
- debug = 0;
- else if (strcmp(optarg, "1") == 0)
- debug = 1;
- else
- usage();
- show = 0;
- break;
+ case 'a':
+ autofmt = 1;
case 'F':
showfmt = 1;
show = 0;
@@ -141,6 +135,11 @@ mode = O_RDONLY | O_NONBLOCK;
return (0);
}
+ if (autofmt) {
+ memset(&newft, 0, sizeof newft);
+ ft = newft;
+ }
+
if (format) {
getname(type, &name, &descr);
fdtp = get_fmt(format, type);
@@ -195,6 +194,10 @@ mode = O_RDONLY | O_NONBLOCK;
printf("%sPERPENDICULAR", s);
s = ",";
}
+ if (ft.flags & FL_AUTO) {
+ printf("%sAUTO", s);
+ s = ",";
+ }
printf(">\n");
} else {
print_fmt(ft);
@@ -208,11 +211,5 @@ mode = O_RDONLY | O_NONBLOCK;
return (0);
}
- if (debug != -1) {
- if (ioctl(fd, FD_DEBUG, &debug) == -1)
- err(EX_OSERR, "ioctl(FD_DEBUG)");
- return (0);
- }
-
return 0;
}