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

+ 2
- 2
README View File

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

+ 3
- 3
cmd.c View File

164
 		return false;
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
 	bool cmd_response = false;
171
 	bool cmd_response = false;
172
 	char *p, *cmd_data = xstrdup( cmd + strlen(v->txt) + 2 ); // +2 to compensate for :\n at the end of the command
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
 	struct output_desc		outputs[MAX_OUTPUTS];
52
 	struct output_desc		outputs[MAX_OUTPUTS];
53
 };
53
 };
54
 
54
 
55
-extern int verbose;
55
+extern int debug;
56
 extern int quiet;
56
 extern int quiet;
57
 
57
 
58
-#define v(fmt, arguments...) \
58
+#define d(fmt, arguments...) \
59
 	do { \
59
 	do { \
60
-		if (verbose) \
61
-			printf("verbose: " fmt, ## arguments); \
60
+		if (debug) \
61
+			printf("debug: " fmt, ## arguments); \
62
 	} while(0)
62
 	} while(0)
63
 
63
 
64
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
64
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))

+ 2
- 2
net.c View File

53
 	hints.ai_family = ai_family;
53
 	hints.ai_family = ai_family;
54
 	hints.ai_socktype = socktype;
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
 	n = getaddrinfo(hostname, service, &hints, &res);
58
 	n = getaddrinfo(hostname, service, &hints, &res);
59
 
59
 
94
 		setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int));
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
 		hostname, service, str_addr, sockfd);
98
 		hostname, service, str_addr, sockfd);
99
 
99
 
100
 	set_sock_nonblock(sockfd);
100
 	set_sock_nonblock(sockfd);

+ 8
- 8
videohubctrl.c View File

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

Loading…
Cancel
Save