Skip to content

Commit 34d6f0f

Browse files
hmueller01speters
authored andcommitted
vcontrold: corrected documentation of command line arguments, some more small code styling corrections (#40)
1 parent ba7e001 commit 34d6f0f

2 files changed

Lines changed: 35 additions & 25 deletions

File tree

doc/man/vcontrold.rst

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ Unix daemon for communication with Viessmann Vito heatings
1414
SYNOPSIS
1515
========
1616

17-
vcontrold [-x <xml-file>] [-d <device>] [-l <logfile>] [-p <port>] [-s] [-n] [-g] [-v] [-V]
17+
vcontrold [-x <xml-file>] [-d <device>] [-l <logfile>] [-p <port>] [-s] [-n]
18+
[-c <command-file>] [-P <pid-file>] [-U <username>] [-G <groupname>]
19+
[-i] [-g] [-4] [-6] [-v] [-V] [-?]
1820

1921
DESCRIPTION
2022
===========
@@ -28,25 +30,35 @@ OPTIONS
2830
-x <xml-file>, \--xmlfile <xml-file>
2931
location of the main config file
3032

31-
-d <serial-device>, \--device <serial-device>
33+
-d <device>, \--device <device>
3234
serial device to use.
3335
This option overrides corresponding entry in the config file.
3436

37+
-l <logfile>, \--logfile <logfile>
38+
use <logfile> instead of syslog.
39+
3540
-p <port>, \--port <port>
3641
TCP <port> to use for remote connections.
37-
The default is 3002 and can be specified
38-
in the config file.
42+
The default is 3002 and can be specified in the config file.
3943
This option overrides the corresponding entry in the config file.
4044

4145
-s, \--syslog
4246
use syslog
4347

44-
-l <logfile>, \--logfile <logfile>
45-
use <logfile> instead of syslog.
48+
-n, \--nodaemon
49+
do not fork. This is for testing purpose only. Normaly vcontrold
50+
will detach from the controlling terminal and put itself into the
51+
background.
52+
53+
-c <command-file>, \--commandfile <command-file>
54+
file with lines containing sequences of icmds (WAIT, SEND, RECV, PAUSE)
55+
as used in protocol definitions.
56+
Lines get executed in order
57+
(developer option)
4658

47-
-P <pidfile>, \--pidfile <pidfile>
48-
write process id to <pidfile> when started as a daemon.
49-
When started as root, <pidfile> is written prior to dropping privileges.
59+
-P <pid-file>, \--pidfile <pid-file>
60+
write process id to <pid-file> when started as a daemon.
61+
When started as root, <pid-file> is written prior to dropping privileges.
5062
This overrides the corresponding entry in the config file.
5163

5264
-U <username>, \--username <username>
@@ -59,31 +71,26 @@ OPTIONS
5971
instead of group dialout. This overrides the corresponding entry in the config file.
6072
If using a serial link, ensure that user or group has access rights to the serial device.
6173

62-
-n, \--nodaemon
63-
do not fork. This is for testing purpose only. Normaly vcontrold
64-
will detach from the controlling terminal and put itself into the
65-
background.
66-
6774
-i, \--vsim
6875
use a temp file in ``/tmp/sim-devid.ini`` for use with the vsim simulator
6976
(developer option)
7077

71-
-c <command-file>, \--commandfile <command-file>
72-
file with lines containing sequences of icmds (WAIT, SEND, RECV, PAUSE)
73-
as used in protocol definitions.
74-
Lines get executed in order
75-
(developer option)
76-
7778
-g, \--debug
7879
enable debug mode
7980

81+
-4, --inet4
82+
use IP v4 socket
83+
84+
-6, --inet6
85+
use IP v6 socket
86+
8087
-v, \--verbose
8188
verbose mode
8289

8390
-V, \--Version
8491
print version information, then exit
8592

86-
\--help
93+
-?, \--help
8794
usage information
8895

8996
FILES

src/vcontrold.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ extern devicePtr devPtr;
7070
extern configPtr cfgPtr;
7171

7272
// Declarations
73-
int readCmdFile(char *filename, char *result, int *resultLen, char *device );
73+
int readCmdFile(char *filename, char *result, int *resultLen, char *device);
7474
int interactive(int socketfd, char *device);
7575
void printHelp(int socketfd);
7676
int rawModus (int socketfd, char *device);
@@ -86,6 +86,7 @@ void usage()
8686
printf("usage: vcontrold [-x|--xmlfile xml-file] [-d|--device <device>]\n");
8787
printf(" [-l|--logfile <logfile>] [-p|--port port] [-s|--syslog]\n");
8888
printf(" [-n|--nodaemon] [-v|--verbose] [-V|--Version]\n");
89+
printf(" [-c|--commandfile <command-file>] [-P|--pidfile <pid-file>]");
8990
printf(" [-U|--username <username>] [-G|--groupname <groupname>]\n");
9091
printf(" [-?|--help] [-i|--vsim] [-g|--debug]\n");
9192
printf(" [-4|--inet4] [-6|--inet6]\n\n");
@@ -118,7 +119,7 @@ int reloadConfig()
118119
}
119120
}
120121

121-
int readCmdFile(char *filename, char *result, int *resultLen, char *device )
122+
int readCmdFile(char *filename, char *result, int *resultLen, char *device)
122123
{
123124
FILE *cmdPtr;
124125
char line[MAXBUF];
@@ -265,7 +266,7 @@ int rawModus(int socketfd, char *device)
265266
return 0; // is this correct?
266267
}
267268

268-
int interactive(int socketfd, char *device )
269+
int interactive(int socketfd, char *device)
269270
{
270271
char readBuf[1000];
271272
char *readPtr;
@@ -627,7 +628,9 @@ static void sigTermHandler(int signo)
627628
logIT(LOG_NOTICE, "Received signal %d", signo);
628629
}
629630
vcontrol_semfree();
630-
if (pidFile) { unlink(pidFile); }
631+
if (pidFile) {
632+
unlink(pidFile);
633+
}
631634
exit(1);
632635
}
633636

0 commit comments

Comments
 (0)