Browse Source

Add -V and --version parameters.

Georgi Chorbadzhiyski 13 years ago
parent
commit
679c420862
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      tsdecrypt.c

+ 7
- 1
tsdecrypt.c View File

@@ -83,6 +83,7 @@ static const struct option long_options[] = {
83 83
 
84 84
 	{ "debug",				required_argument, NULL, 'D' },
85 85
 	{ "help",				no_argument,       NULL, 'h' },
86
+	{ "version",			no_argument,       NULL, 'V' },
86 87
 
87 88
 	{ 0, 0, 0, 0 }
88 89
 };
@@ -157,6 +158,7 @@ static void show_help(struct ts *ts) {
157 158
 	printf("                            .    3 = show duplicate ECMs\n");
158 159
 	printf("                            .    4 = packet debug\n");
159 160
 	printf(" -h --help                  | Show help screen.\n");
161
+	printf(" -V --version               | Show program version.\n");
160 162
 	printf("\n");
161 163
 }
162 164
 
@@ -185,7 +187,7 @@ static int parse_io_param(struct io *io, char *opt, int open_flags, mode_t open_
185 187
 
186 188
 static void parse_options(struct ts *ts, int argc, char **argv) {
187 189
 	int j, i, ca_err = 0, server_err = 1, input_addr_err = 0, output_addr_err = 0, output_intf_err = 0, ident_err = 0;
188
-	while ( (j = getopt_long(argc, argv, "i:d:l:L:I:RzO:o:t:pc:C:s:U:P:y:eZ:Ef:X:G:KJ:D:h", long_options, NULL)) != -1 ) {
190
+	while ( (j = getopt_long(argc, argv, "i:d:l:L:I:RzO:o:t:pc:C:s:U:P:y:eZ:Ef:X:G:KJ:D:hV", long_options, NULL)) != -1 ) {
189 191
 		char *p = NULL;
190 192
 		switch (j) {
191 193
 			case 'i':
@@ -325,6 +327,10 @@ static void parse_options(struct ts *ts, int argc, char **argv) {
325 327
 			case 'h':
326 328
 				show_help(ts);
327 329
 				exit(0);
330
+
331
+			case 'V':
332
+				printf("%s\n", program_id);
333
+				exit(0);
328 334
 		}
329 335
 	}
330 336
 	if (ts->syslog_active && !ts->ident[0])

Loading…
Cancel
Save