summaryrefslogtreecommitdiff
path: root/app/xvctl
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2013-08-26 19:25:11 +0000
committerMarc Espie <espie@cvs.openbsd.org>2013-08-26 19:25:11 +0000
commitf90b5c0b441b0da6cad5e6dd838c9bb5d8376a9e (patch)
tree0204dbc055a5d4ba45085b21707d376d139aeb0c /app/xvctl
parent26447b579236b8786d500cfa5c9d764345973f8b (diff)
revisit old program of mine, make it look a bit more like sysctl after
simplifications. okay matthieu@
Diffstat (limited to 'app/xvctl')
-rw-r--r--app/xvctl/xvctl.16
-rw-r--r--app/xvctl/xvctl.c19
2 files changed, 9 insertions, 16 deletions
diff --git a/app/xvctl/xvctl.1 b/app/xvctl/xvctl.1
index 607a34397..74fe7615b 100644
--- a/app/xvctl/xvctl.1
+++ b/app/xvctl/xvctl.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: xvctl.1,v 1.2 2010/03/20 20:13:27 schwarze Exp $
+.\" $OpenBSD: xvctl.1,v 1.3 2013/08/26 19:25:10 espie Exp $
.\"
.\" Copyright (c) 2001 Marc Espie
.\"
@@ -75,12 +75,10 @@ affect adaptor #
By default, the first display adaptor will be chosen.
.It Fl a
list all the currently available gettable attributes.
+This is the default, if no parameters are givne.
.It Fl n
suppress printing of the field name, only output the field value.
Useful for setting shell variables.
-.It Fl w
-required to set a variable. The name should be followed
-by an equal sign and the new value.
.El
.Sh SEE ALSO
.Xr xvinfo 1 ,
diff --git a/app/xvctl/xvctl.c b/app/xvctl/xvctl.c
index a0de30d18..51435723e 100644
--- a/app/xvctl/xvctl.c
+++ b/app/xvctl/xvctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xvctl.c,v 1.2 2009/05/02 19:18:13 oga Exp $ */
+/* $OpenBSD: xvctl.c,v 1.3 2013/08/26 19:25:10 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
*
@@ -38,7 +38,7 @@ usage()
{
fprintf(stderr, "usage:\t%s\n\t%s\n\t%s\n",
"xvctl [-n] [-d display] [-s screen] [-A adaptor] variable ...",
- "xvctl [-n] [-d display] [-s screen] [-A adaptor] -w variable=value ...",
+ "xvctl [-n] [-d display] [-s screen] [-A adaptor] variable=value ...",
"xvctl [-n] [-d display] [-s screen] [-A adaptor] -a");
exit(1);
}
@@ -85,7 +85,7 @@ printattribute(Display *dpy, XvPortID id, int nflag, XvAttribute *a)
if (atom != None)
if (Success == XvGetPortAttribute(dpy, id, atom, &v)) {
if (!nflag)
- printf("%s = ", reformat(a->name));
+ printf("%s=", reformat(a->name));
printf("%d\n", v);
}
}
@@ -144,7 +144,7 @@ showvar(Display *dpy, XvPortID id, int nflag, XvAttribute table[], int nattr,
}
void
-parse(Display *dpy, XvPortID id, int nflag, int wflag, XvAttribute table[],
+parse(Display *dpy, XvPortID id, int nflag, XvAttribute table[],
int nattr, const char *s)
{
char buf[BUFSIZ];
@@ -158,8 +158,6 @@ parse(Display *dpy, XvPortID id, int nflag, int wflag, XvAttribute table[],
char *end;
char *tail;
- if (!wflag)
- errx(2, "Can't set variables without -w");
tail = cp;
while (tail > buf && isspace(tail[-1]))
tail--;
@@ -189,7 +187,6 @@ main(int argc, char *argv[])
int ch;
int aflag = 0;
int nflag = 0;
- int wflag = 0;
char *display = NULL;
int screen = -1;
int nscreens;
@@ -219,7 +216,7 @@ main(int argc, char *argv[])
nflag = 1;
break;
case 'w':
- wflag = 1;
+ /* flag no longer needed */
break;
default:
usage();
@@ -236,7 +233,7 @@ main(int argc, char *argv[])
errx(1, "No X-Video extension on %s", displayname(display));
if (!nflag)
- printf("X-Video extension version %i.%i on %s\n", ver, rev,
+ printf("# X-Video extension version %i.%i on %s\n", ver, rev,
displayname(display));
nscreens = ScreenCount(dpy);
@@ -258,12 +255,10 @@ main(int argc, char *argv[])
if (argc == 0) {
- if (!aflag)
- usage();
showall(dpy, ainfo[adaptor].base_id, nflag, table, nattr);
}
for (; *argv != NULL; ++argv)
- parse(dpy, ainfo[adaptor].base_id, nflag, wflag, table,
+ parse(dpy, ainfo[adaptor].base_id, nflag, table,
nattr, *argv);
XFree(table);
exit(0);