chiark / gitweb /
Unify parse_argv style
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 2 Aug 2014 15:12:21 +0000 (11:12 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 4 Aug 2014 01:46:07 +0000 (21:46 -0400)
commit601185b43da638b1c74153deae01dbd518680889
treeb4f1bc609e57e542a03ca00553098eabbb3b196b
parent75cd513ef830d8e00d0d2d6a64917fec533315db
Unify parse_argv style

getopt is usually good at printing out a nice error message when
commandline options are invalid. It distinguishes between an unknown
option and a known option with a missing arg. It is better to let it
do its job and not use opterr=0 unless we actually want to suppress
messages. So remove opterr=0 in the few places where it wasn't really
useful.

When an error in options is encountered, we should not print a lengthy
help() and overwhelm the user, when we know precisely what is wrong
with the commandline. In addition, since help() prints to stdout, it
should not be used except when requested with -h or --help.

Also, simplify things here and there.
46 files changed:
CODING_STYLE
src/activate/activate.c
src/analyze/analyze.c
src/ask-password/ask-password.c
src/binfmt/binfmt.c
src/boot/bootctl.c
src/bootchart/bootchart.c
src/bus-proxyd/bus-proxyd.c
src/cgls/cgls.c
src/cgtop/cgtop.c
src/core/main.c
src/core/shutdown.c
src/delta/delta.c
src/detect-virt/detect-virt.c
src/escape/escape.c
src/firstboot/firstboot.c
src/hostname/hostnamectl.c
src/journal-remote/journal-gatewayd.c
src/journal-remote/journal-remote.c
src/journal/cat.c
src/journal/coredumpctl.c
src/journal/journalctl.c
src/libsystemd/sd-bus/busctl.c
src/locale/localectl.c
src/login/inhibit.c
src/login/loginctl.c
src/machine-id-setup/machine-id-setup-main.c
src/machine/machinectl.c
src/modules-load/modules-load.c
src/network/networkd-wait-online.c
src/notify/notify.c
src/nspawn/nspawn.c
src/path/path.c
src/readahead/readahead.c
src/resolve-host/resolve-host.c
src/run/run.c
src/sleep/sleep.c
src/socket-proxy/socket-proxyd.c
src/sysctl/sysctl.c
src/systemctl/systemctl.c
src/sysusers/sysusers.c
src/test/test-libudev.c
src/timedate/timedatectl.c
src/tmpfiles/tmpfiles.c
src/tty-ask-password-agent/tty-ask-password-agent.c
src/udev/udevadm.c