summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorRobert Nagy <robert@cvs.openbsd.org>2007-05-20 15:22:24 +0000
committerRobert Nagy <robert@cvs.openbsd.org>2007-05-20 15:22:24 +0000
commit3d1a9ae558fb02fb38891e69eefe0a1a32e797f4 (patch)
tree1623d43aae1789190657518acf599003e135190d /sbin
parent3c991cf05f60bab8b8da9aba082e163465cc2805 (diff)
add a -f option to allow specifing an alternative
control device; "put it in" miod@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/wsconsctl/wsconsctl.87
-rw-r--r--sbin/wsconsctl/wsconsctl.c22
2 files changed, 23 insertions, 6 deletions
diff --git a/sbin/wsconsctl/wsconsctl.8 b/sbin/wsconsctl/wsconsctl.8
index dc57dd404ef..100ec4bfc63 100644
--- a/sbin/wsconsctl/wsconsctl.8
+++ b/sbin/wsconsctl/wsconsctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: wsconsctl.8,v 1.18 2004/07/30 23:28:23 jmc Exp $
+.\" $OpenBSD: wsconsctl.8,v 1.19 2007/05/20 15:22:22 robert Exp $
.\" $NetBSD: wsconsctl.8,v 1.5 1999/09/12 18:47:11 kleink Exp $
.\"
.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -46,12 +46,15 @@
.Op Fl n
.Fl a
.Nm wsconsctl
+.Op Fl f Ar file
.Op Fl n
.Ar name ...
.Nm wsconsctl
+.Op Fl f Ar file
.Op Fl n
.Ar name Ns = Ns Ar value ...
.Nm wsconsctl
+.Op Fl f Ar file
.Op Fl n
.Ar name Ns += Ns Ar value ...
.Sh DESCRIPTION
@@ -66,6 +69,8 @@ The options are as follows:
.Bl -tag -width Ds
.It Fl a
Print all device variables and their current values.
+.It Fl f Ar file
+Specify an alternative control device.
.It Fl n
Suppress printing of the variable name in the output.
.It Ar name Ns = Ns Ar value
diff --git a/sbin/wsconsctl/wsconsctl.c b/sbin/wsconsctl/wsconsctl.c
index d6d70dadeb3..d1e96bde567 100644
--- a/sbin/wsconsctl/wsconsctl.c
+++ b/sbin/wsconsctl/wsconsctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsconsctl.c,v 1.17 2006/04/01 23:13:53 miod Exp $ */
+/* $OpenBSD: wsconsctl.c,v 1.18 2007/05/20 15:22:23 robert Exp $ */
/* $NetBSD: wsconsctl.c,v 1.2 1998/12/29 22:40:20 hannken Exp $ */
/*-
@@ -83,9 +83,9 @@ usage(char *msg)
fprintf(stderr,
"usage: %s [-n] -a\n"
- " %s [-n] name ...\n"
- " %s [-n] name=value ...\n"
- " %s [-n] name+=value ...\n",
+ " %s [-f file] [-n] name ...\n"
+ " %s [-f file] [-n] name=value ...\n"
+ " %s [-f file] [-n] name+=value ...\n",
__progname, __progname, __progname, __progname);
exit(1);
@@ -97,13 +97,17 @@ main(int argc, char *argv[])
int i, ch, error = 0, aflag = 0, do_merge;
struct vartypesw *sw = NULL;
char *sep = "=", *p;
+ char *wdev = NULL;
struct field *f;
- while ((ch = getopt(argc, argv, "anw")) != -1) {
+ while ((ch = getopt(argc, argv, "af:nw")) != -1) {
switch(ch) {
case 'a':
aflag = 1;
break;
+ case 'f':
+ wdev = optarg;
+ break;
case 'n':
sep = NULL;
break;
@@ -150,6 +154,10 @@ main(int argc, char *argv[])
sw = tab_by_name(argv[i]);
if (!sw)
continue;
+
+ if (wdev != NULL)
+ sw->file = (const char *)wdev;
+
if (sw->fd < 0 &&
(sw->fd = open(sw->file, O_WRONLY)) < 0 &&
(sw->fd = open(sw->file, O_RDONLY)) < 0) {
@@ -181,6 +189,10 @@ main(int argc, char *argv[])
sw = tab_by_name(argv[i]);
if (!sw)
continue;
+
+ if (wdev != NULL)
+ sw->file = (const char *)wdev;
+
if (sw->fd < 0 &&
(sw->fd = open(sw->file, O_WRONLY)) < 0 &&
(sw->fd = open(sw->file, O_RDONLY)) < 0) {