Browse Source

Rename -v / --verbose parameter to -d / --debug.

Georgi Chorbadzhiyski 9 years ago
parent
commit
8e881d6d11
6 changed files with 22 additions and 19 deletions
  1. 3
    0
      ChangeLog
  2. 2
    2
      README
  3. 3
    3
      cmd.c
  4. 4
    4
      data.h
  5. 2
    2
      net.c
  6. 8
    8
      videohubctrl.c

+ 3
- 0
ChangeLog View File

@@ -1,4 +1,7 @@
1 1
 |-----------------------------------------------------------------------|
2
+xxxx-xx-xx : Version next
3
+ * Rename -v / --verbose parameter to -d / --debug.
4
+
2 5
 2014-11-27 : Version 0.2
3 6
  * Fix port routing. Previously it was reversed and incorrect.
4 7
  * Fix command parsing of multiple commands comming in one packet.

+ 2
- 2
README View File

@@ -81,7 +81,7 @@ Main options:
81 81
  -p --port <port_number>    | Set device port (default: 9990).
82 82
 
83 83
 Misc options:
84
- -v --verbose               | Increase logging verbosity.
84
+ -d --debug                 | Increase logging verbosity.
85 85
  -q --quiet                 | Suppress warnings.
86 86
  -h --help                  | Show help screen.
87 87
  -V --version               | Show program version.
@@ -157,7 +157,7 @@ If you think you have found bug in videohubctrl, please report it to
157 157
 the e-mail listed in Contact section (see below) of this README file.
158 158
 
159 159
 When reporting bugs, please send the whole output that videohubctrl
160
-generated (preferably by using --verbose option) and also the full
160
+generated (preferably by using --debug option) and also the full
161 161
 command line which you used and describe what you think the videohubctrl
162 162
 does wrong.
163 163
 

+ 3
- 3
cmd.c View File

@@ -164,9 +164,9 @@ bool parse_command(struct videohub_data *data, char *cmd) {
164 164
 		return false;
165 165
 	}
166 166
 
167
-	v("verbose: Got '%s' command.\n", v->txt);
168
-	if (verbose > 1)
169
-		v("----\n%s\n----\n", cmd);
167
+	d("debug: Got '%s' command.\n", v->txt);
168
+	if (debug > 1)
169
+		d("----\n%s\n----\n", cmd);
170 170
 
171 171
 	bool cmd_response = false;
172 172
 	char *p, *cmd_data = xstrdup( cmd + strlen(v->txt) + 2 ); // +2 to compensate for :\n at the end of the command

+ 4
- 4
data.h View File

@@ -52,13 +52,13 @@ struct videohub_data {
52 52
 	struct output_desc		outputs[MAX_OUTPUTS];
53 53
 };
54 54
 
55
-extern int verbose;
55
+extern int debug;
56 56
 extern int quiet;
57 57
 
58
-#define v(fmt, arguments...) \
58
+#define d(fmt, arguments...) \
59 59
 	do { \
60
-		if (verbose) \
61
-			printf("verbose: " fmt, ## arguments); \
60
+		if (debug) \
61
+			printf("debug: " fmt, ## arguments); \
62 62
 	} while(0)
63 63
 
64 64
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))

+ 2
- 2
net.c View File

@@ -53,7 +53,7 @@ int connect_client(int socktype, const char *hostname, const char *service) {
53 53
 	hints.ai_family = ai_family;
54 54
 	hints.ai_socktype = socktype;
55 55
 
56
-	v("Connecting to server %s port %s\n", hostname, service);
56
+	d("Connecting to server %s port %s\n", hostname, service);
57 57
 
58 58
 	n = getaddrinfo(hostname, service, &hints, &res);
59 59
 
@@ -94,7 +94,7 @@ int connect_client(int socktype, const char *hostname, const char *service) {
94 94
 		setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int));
95 95
 	}
96 96
 
97
-	v("Connected to server %s port %s (addr=%s fd=%d).\n",
97
+	d("Connected to server %s port %s (addr=%s fd=%d).\n",
98 98
 		hostname, service, str_addr, sockfd);
99 99
 
100 100
 	set_sock_nonblock(sockfd);

+ 8
- 8
videohubctrl.c View File

@@ -22,7 +22,7 @@
22 22
 
23 23
 #include "libfuncs/libfuncs.h"
24 24
 
25
-int verbose;
25
+int debug;
26 26
 int quiet;
27 27
 
28 28
 static struct videohub_data maindata;
@@ -31,13 +31,13 @@ static int show_monitor = 0;
31 31
 
32 32
 static const char *program_id = PROGRAM_NAME " Version: " VERSION " Git: " GIT_VER;
33 33
 
34
-static const char short_options[] = "s:p:qvhVim";
34
+static const char short_options[] = "s:p:qdhVim";
35 35
 
36 36
 static const struct option long_options[] = {
37 37
 	{ "host",				required_argument, NULL, 's' },
38 38
 	{ "port",				required_argument, NULL, 'p' },
39 39
 	{ "quiet",				no_argument,       NULL, 'q' },
40
-	{ "verbose",			no_argument,       NULL, 'v' },
40
+	{ "debug",				no_argument,       NULL, 'd' },
41 41
 	{ "help",				no_argument,       NULL, 'h' },
42 42
 	{ "version",			no_argument,       NULL, 'V' },
43 43
 	{ "info",				no_argument,       NULL, 'i' },
@@ -54,7 +54,7 @@ static void show_help(struct videohub_data *data) {
54 54
 	printf(" -p --port <port_number>    | Set device port (default: 9990).\n");
55 55
 	printf("\n");
56 56
 	printf("Misc options:\n");
57
-	printf(" -v --verbose               | Increase logging verbosity.\n");
57
+	printf(" -d --debug                 | Increase logging verbosity.\n");
58 58
 	printf(" -q --quiet                 | Suppress warnings.\n");
59 59
 	printf(" -h --help                  | Show help screen.\n");
60 60
 	printf(" -V --version               | Show program version.\n");
@@ -77,9 +77,9 @@ static void parse_options(struct videohub_data *data, int argc, char **argv) {
77 77
 			case 'p': // --port
78 78
 				data->dev_port = optarg;
79 79
 				break;
80
-			case 'v': // --verbose
81
-				verbose++;
82
-				if (verbose)
80
+			case 'd': // --debug
81
+				debug++;
82
+				if (debug)
83 83
 					quiet = 0; // Disable quiet
84 84
 				break;
85 85
 			case 'q': // --quiet
@@ -110,7 +110,7 @@ static void parse_options(struct videohub_data *data, int argc, char **argv) {
110 110
 		exit(EXIT_FAILURE);
111 111
 	}
112 112
 
113
-	v("Device address: %s:%s\n", data->dev_host, data->dev_port);
113
+	d("Device address: %s:%s\n", data->dev_host, data->dev_port);
114 114
 }
115 115
 
116 116
 static void print_device_desc(struct device_desc *d) {

Loading…
Cancel
Save