Skip to content

Commit

Permalink
vcontrold: corrected documentation of command line arguments, some mo…
Browse files Browse the repository at this point in the history
…re small code styling corrections (#40)
  • Loading branch information
hmueller01 authored and speters committed Sep 22, 2018
1 parent ba7e001 commit 34d6f0f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 25 deletions.
49 changes: 28 additions & 21 deletions doc/man/vcontrold.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ Unix daemon for communication with Viessmann Vito heatings
SYNOPSIS
========

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

DESCRIPTION
===========
Expand All @@ -28,25 +30,35 @@ OPTIONS
-x <xml-file>, \--xmlfile <xml-file>
location of the main config file

-d <serial-device>, \--device <serial-device>
-d <device>, \--device <device>
serial device to use.
This option overrides corresponding entry in the config file.

-l <logfile>, \--logfile <logfile>
use <logfile> instead of syslog.

-p <port>, \--port <port>
TCP <port> to use for remote connections.
The default is 3002 and can be specified
in the config file.
The default is 3002 and can be specified in the config file.
This option overrides the corresponding entry in the config file.

-s, \--syslog
use syslog

-l <logfile>, \--logfile <logfile>
use <logfile> instead of syslog.
-n, \--nodaemon
do not fork. This is for testing purpose only. Normaly vcontrold
will detach from the controlling terminal and put itself into the
background.

-c <command-file>, \--commandfile <command-file>
file with lines containing sequences of icmds (WAIT, SEND, RECV, PAUSE)
as used in protocol definitions.
Lines get executed in order
(developer option)

-P <pidfile>, \--pidfile <pidfile>
write process id to <pidfile> when started as a daemon.
When started as root, <pidfile> is written prior to dropping privileges.
-P <pid-file>, \--pidfile <pid-file>
write process id to <pid-file> when started as a daemon.
When started as root, <pid-file> is written prior to dropping privileges.
This overrides the corresponding entry in the config file.

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

-n, \--nodaemon
do not fork. This is for testing purpose only. Normaly vcontrold
will detach from the controlling terminal and put itself into the
background.

-i, \--vsim
use a temp file in ``/tmp/sim-devid.ini`` for use with the vsim simulator
(developer option)

-c <command-file>, \--commandfile <command-file>
file with lines containing sequences of icmds (WAIT, SEND, RECV, PAUSE)
as used in protocol definitions.
Lines get executed in order
(developer option)

-g, \--debug
enable debug mode

-4, --inet4
use IP v4 socket

-6, --inet6
use IP v6 socket

-v, \--verbose
verbose mode

-V, \--Version
print version information, then exit

\--help
-?, \--help
usage information

FILES
Expand Down
11 changes: 7 additions & 4 deletions src/vcontrold.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ extern devicePtr devPtr;
extern configPtr cfgPtr;

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

int readCmdFile(char *filename, char *result, int *resultLen, char *device )
int readCmdFile(char *filename, char *result, int *resultLen, char *device)
{
FILE *cmdPtr;
char line[MAXBUF];
Expand Down Expand Up @@ -265,7 +266,7 @@ int rawModus(int socketfd, char *device)
return 0; // is this correct?
}

int interactive(int socketfd, char *device )
int interactive(int socketfd, char *device)
{
char readBuf[1000];
char *readPtr;
Expand Down Expand Up @@ -627,7 +628,9 @@ static void sigTermHandler(int signo)
logIT(LOG_NOTICE, "Received signal %d", signo);
}
vcontrol_semfree();
if (pidFile) { unlink(pidFile); }
if (pidFile) {
unlink(pidFile);
}
exit(1);
}

Expand Down

0 comments on commit 34d6f0f

Please sign in to comment.