Explicitly initialize startup_delay_sec variable

... with its default of 0 seconds, rather than relying on memset(0) to
do the job further up init_context().

Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Minor clean up to doing startup-delay only once

1) Make variable name more meaningful, startup -> first_startup.
2) Minimise scope of variable to enhance code readability.
3) Clarify comment explaining the purpose of the first startup delay.

Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Document SIGUSR1 in the manual page

Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Minor update to logging of commands

Inadyn taking actions based on receipt of signals is important enough to
be logged.  Currently the forced update command is not logged and the
remaining commands are logged with priority debug.  Typically syslog
isn't configured to record debug messages.

1) Raise priority of logging commands from DEBUG to INFO.
2) Add logging of the forced update command on receipt of SIGUSR1.

Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Correct -L option in the manual page

Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Enhance manual page documentation of the startup-delay option

Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Stop handling SIGQUIT and SIGALRM

1) No longer use SIGQUIT to stop inadyn.
SIGQUIT is intended to initiate a core dump for diagnostic purposes.

2) No longer use SIGALRM to stop inadyn.
POSIX allows the implementation of sleep(3) and usleep(3) [1] to be
implemented using SIGALRM.  Blocking or ignoring the signal or otherwise
changing the time when SIGALRM is scheduled to be generated causes
unspecified behaviour; i.e. platform specific behaviour not defined by
POSIX.  On Linux, Glibc's implementation of usleep(3) doesn't use
SIGALRM, but on other platforms it may [2].

3) Block exactly the handled signals while the handler is running.
Not necessary, but just means the handler isn't called recursively if
two different signals are deliver simultaneously.

References:
[1] POSIX.1-2004, usleep(3) definition
    http://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html

[2] GNU C Library Reference Manual, 10.24 usleep
    http://www.gnu.org/software/gnulib/manual/html_node/usleep.html

Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Move clearing of the force_addr_update flag

... to the same location that time_since_last_update is reset to zero,
immediately after the successful update of any alias.

(Should the update of other aliases fail, the relevant
alias[i].update_required flag will still be set, and the updates retried
on the following loop.  force_addr_update flag doesn't need to be set
for this).

Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Move clearing of CMD_FORCED_UPDATE in DDNS client main loop

Scenario:
Inadyn is in the middle of an update check, in the call chain starting
with dyn_dns_update_ip(), when SIGUSR1 is received.

Example sequence of the previous code from that point onwards:
1) An OS call such as recv() is interrupted by the signal, returning an
   error.
2) The signal handler sets ctx->cmd = CMD_FORCED_UPDATE.
3) dyn_dns_update_ip() eventually returns an error.
4) DDNS client main loop clears ctx->cmd to NO_CMD before
   dyn_dns_wait_for_cmd().
Outcome is that forced update is NOT performed.

Fix by clearing ctx->cmd to NO_CMD immediately after force_addr_update
flag is set.  This is after all the only step which needs performing to
initiate a forced update.

Example sequence of the new code from the same point onwards:
[(1) to (3) as before]
4) DDNS client main loop calls dyn_dns_wait_for_cmd()
5) dyn_dns_wait_for_cmd() returns immediately because ctx->cmd is set to
   CMD_FORCED UPDATE.
6) FORCED_UPDATE log message is emitted and force_addr_update flag set.
Outcome is that the forced update is performed.

Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Clear current command as soon as possible

Not required, but just for consistency with the processing of
CMD_FORCED_UPDATE where it is required.  See previous commit for
details.

Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>