[PATCH alsa-utils 10/10] aseqsend: Support long options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add the support for long-style options such as --verbose.

Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---
 seq/aseqsend/aseqsend.1 | 16 ++++++++--------
 seq/aseqsend/aseqsend.c | 13 ++++++++++++-
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/seq/aseqsend/aseqsend.1 b/seq/aseqsend/aseqsend.1
index febbf55dfb16..626f9ea1fb19 100644
--- a/seq/aseqsend/aseqsend.1
+++ b/seq/aseqsend/aseqsend.1
@@ -21,35 +21,35 @@ name.  A port is specified by its number; for port 0 of a client, the
 .SH OPTIONS
 
 .TP
-\-h
+\-h, \-\-help
 Prints a list of options.
 
 .TP
-\-V
+\-V, \-\-version
 Prints the current version.
 
 .TP
-\-l
+\-l, \-\-list
 Prints a list of possible output ports.
 
 .TP
-\-v
+\-v, \-\-verbose
 Prints number of bytes actually sent
 
 .TP
-\-p
+\-p, -\-port=client:port
 Target port by number or name
 
 .TP
-\-s
+\-s, \-\-file=filename
 Send raw binary data from given file name
 
 .TP
-\-i
+\-i, \-\-interval=msec
 Interval between SysEx messages in miliseconds
 
 .TP
-\-u
+\-u, \-\-ump=version
 Specify the MIDI version. 0 for the legacy MIDI 1.0 (default),
 1 for UMP MIDI 1.0 protocol and 2 for UMP MIDI 2.0 protocol.
 
diff --git a/seq/aseqsend/aseqsend.c b/seq/aseqsend/aseqsend.c
index bd1a221d4149..d98423c45c7c 100644
--- a/seq/aseqsend/aseqsend.c
+++ b/seq/aseqsend/aseqsend.c
@@ -362,6 +362,17 @@ static int msg_byte_in_range(mbyte_t *data, mbyte_t len)
 
 int main(int argc, char *argv[])
 {
+	static const struct option long_options[] = {
+		{"help", 0, NULL, 'h'},
+		{"version", 0, NULL, 'V'},
+		{"verbose", 0, NULL, 'v'},
+		{"list", 0, NULL, 'l'},
+		{"port", 1, NULL, 'p'},
+		{"file", 1, NULL, 's'},
+		{"interval", 1, NULL, 'i'},
+		{"ump", 1, NULL, 'u'},
+		{0}
+	};
 	char c = 0;
 	char do_send_file = 0;
 	char do_port_list = 0;
@@ -370,7 +381,7 @@ int main(int argc, char *argv[])
 	int sent_data_c;
 	int k;
 
-	while ((c = getopt(argc, argv, "hi:Vvlp:s:u:")) != -1) {
+	while ((c = getopt_long(argc, argv, "hi:Vvlp:s:u:", long_options, NULL)) != -1) {
 		switch (c) {
 		case 'h':
 			usage();
-- 
2.43.0




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux