Module Name:    src
Committed By:   isaki
Date:           Wed May  8 14:44:42 UTC 2019

Modified Files:
        src/usr.bin/audio/ctl: audioctl.1 ctl.c

Log Message:
Remove -p option.  AUDIO_SETCHAN is insecure and is obsoleted.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/audio/ctl/audioctl.1
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/audio/ctl/ctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/audio/ctl/audioctl.1
diff -u src/usr.bin/audio/ctl/audioctl.1:1.21 src/usr.bin/audio/ctl/audioctl.1:1.22
--- src/usr.bin/audio/ctl/audioctl.1:1.21	Fri Feb 10 19:31:42 2017
+++ src/usr.bin/audio/ctl/audioctl.1	Wed May  8 14:44:42 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: audioctl.1,v 1.21 2017/02/10 19:31:42 nat Exp $
+.\" $NetBSD: audioctl.1,v 1.22 2019/05/08 14:44:42 isaki Exp $
 .\"
 .\" Copyright (c) 1997, 1999 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -35,17 +35,14 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl d Ar device
-.Op Fl p Ar channel
 .Op Fl n
 .Fl a
 .Nm
 .Op Fl d Ar device
-.Op Fl p Ar channel
 .Op Fl n
 .Ar name ...
 .Nm
 .Op Fl d Ar device
-.Op Fl p Ar channel
 .Op Fl n
 .Fl w
 .Ar name=value ...
@@ -71,11 +68,6 @@ flag can be used to give an alternative 
 .Pa /dev/audioctl0 .
 .Pp
 The
-.Fl p
-flag can be used to give a virtual channel to control, the default is a new
-channel.
-.Pp
-The
 .Fl n
 flag suppresses printing of the variable name.
 .Sh ENVIRONMENT
@@ -93,10 +85,10 @@ audio control device
 audio I/O device (does not reset on open)
 .El
 .Sh EXAMPLES
-To set the playing sampling rate to 11025, for the channel 3 you can use
-.Dl audioctl -p 3 -w play.sample_rate=11025
+To set the playing sampling rate to 11025, you can use
+.Dl audioctl -w play.sample_rate=11025
 To set all of the play parameters for CD-quality audio, you can use
-.Dl audioctl -p 3 -w play=44100,2,16,slinear_le
+.Dl audioctl -w play=44100,2,16,slinear_le
 Note that many of the variables that can be inspected and changed with
 .Nm
 are reset when

Index: src/usr.bin/audio/ctl/ctl.c
diff -u src/usr.bin/audio/ctl/ctl.c:1.43 src/usr.bin/audio/ctl/ctl.c:1.44
--- src/usr.bin/audio/ctl/ctl.c:1.43	Tue Mar 21 07:04:29 2017
+++ src/usr.bin/audio/ctl/ctl.c	Wed May  8 14:44:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ctl.c,v 1.43 2017/03/21 07:04:29 nat Exp $	*/
+/*	$NetBSD: ctl.c,v 1.44 2019/05/08 14:44:42 isaki Exp $	*/
 
 /*
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: ctl.c,v 1.43 2017/03/21 07:04:29 nat Exp $");
+__RCSID("$NetBSD: ctl.c,v 1.44 2019/05/08 14:44:42 isaki Exp $");
 #endif
 
 
@@ -66,7 +66,6 @@ static char encbuf[1000];
 
 static int properties, fullduplex, rerror;
 
-int channel;
 int verbose;
 
 static struct field {
@@ -291,9 +290,6 @@ getinfo(int fd)
 {
 	int pos, i;
 
-	if (channel >= 0 && ioctl(fd, AUDIO_SETCHAN, &channel) < 0)
-		err(1, "AUDIO_SETCHAN");
-
 	if (ioctl(fd, AUDIO_GETDEV, &adev) < 0)
 		err(1, "AUDIO_GETDEV");
 	for (pos = 0, i = 0; ; i++) {
@@ -326,11 +322,9 @@ usage(void)
 {
 	const char *prog = getprogname();
 
-	fprintf(stderr, "Usage: %s [-d file] [-p] channel "
-			"[-n] name ...\n", prog);
-	fprintf(stderr, "Usage: %s [-d file] [-p] channel [-n] "
-			"-w name=value ...\n", prog);
-	fprintf(stderr, "Usage: %s [-d file] [-p] channel [-n] -a\n", prog);
+	fprintf(stderr, "Usage: %s [-d file] [-n] name ...\n", prog);
+	fprintf(stderr, "Usage: %s [-d file] [-n] -w name=value ...\n", prog);
+	fprintf(stderr, "Usage: %s [-d file] [-n] -a\n", prog);
 	exit(1);
 }
 
@@ -343,12 +337,11 @@ main(int argc, char *argv[])
 	const char *file;
 	const char *sep = "=";
 
-	channel = -1;
 	file = getenv("AUDIOCTLDEVICE");
 	if (file == NULL)
 		file = deffile;
 
-	while ((ch = getopt(argc, argv, "ad:f:np:w")) != -1) {
+	while ((ch = getopt(argc, argv, "ad:f:nw")) != -1) {
 		switch(ch) {
 		case 'a':
 			aflag++;
@@ -359,9 +352,6 @@ main(int argc, char *argv[])
 		case 'n':
 			sep = 0;
 			break;
-		case 'p':
-			channel = atoi(optarg);
-			break;
 		case 'f': /* compatibility */
 		case 'd':
 			file = optarg;
@@ -440,9 +430,6 @@ audioctl_write(int fd, int argc, char *a
 {
 	struct field *p;
 
-	if (channel >= 0 && ioctl(fd, AUDIO_SETCHAN, &channel) < 0)
-		err(1, "AUDIO_SETCHAN");
-
 	AUDIO_INITINFO(&info);
 	while (argc--) {
 		char *q;

Reply via email to