crontab: make usage easier to read

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
crond: make usage easier to read

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
compliancy: use sysconf() to determine max hostname length

Earlier use of MAXHOSTNAMELEN is not posix compliant, though it usually
results to be correct value.  Using sysconf() is more correct, and avoids
rather nasty gethostname() catch.  If a hostname length is exactly the
maximum a character buffer which has lenght of MAXHOSTNAMELEN will not be
null terminated.  That will leave the later string operations vulnerable
to buffer overflow.

Reference: http://refspecs.linuxfoundation.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-generic.html#BASELIB-SETHOSTNAME-2
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
smatch scan: fix various warningss found using smatch

entry.c:396 load_entry() info: redundant null check on e->pwd calling free()
entry.c:398 load_entry() info: redundant null check on e->cmd calling free()

/usr/include/bits/fcntl.h:48:10: warning: preprocessor token O_NOFOLLOW redefined
macros.h:136:9: this was the original definition

security.c:98:44: warning: non-ANSI function declaration of function 'cron_restore_default_security_context'
crontab.c:439:29: warning: non-ANSI function declaration of function 'tmp_path'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
compile: fix signed and unsigned warnings

cron.c:100:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
cron.c:108:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
cron.c:125:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
compile: add function attributes

Some of the argument values are not in use, and few functions does not
return.  Informing which will make few warning messages disapper, and
compiler to generate better binary.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
anacron: add function attributes

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
anacron: fix shadow declarations

Similar issue as below time after time in various functions.

log.c:74:35: warning: declaration of 'args' shadows a global declaration [-Wshadow]
global.h:97:15: warning: shadowed declaration is here [-Wshadow]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
anacron: remove unnecessary casts, and redundant assigment

readtab.c:288:54: warning: cast from function call of type 'int' to non-matching type 'double' [-Wbad-function-cast]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
anacron: set end job message string to be constant

runjob.c:308:7: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
anacron: clean up usage() output

Inform in usage which options will need arguments, and add reference to
manual page.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
anacron: remove numeric exit and file descriptor values

Use symbolic values from standard header instead.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
common: move xgethostname to cronie_common.h

The function is needed by both cron and anacron.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
anacron: make function declarations to be ansi compliant

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
init script: remove bashisms

References: https://sourceforge.net/projects/checkbaskisms/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>