chfn: remove function prototypes

Requires resuffling functions order they work without issues.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
chfn: rewrite prompt() to use strutils

The left and right white space trimming can be done with strutils.h
[lr]trim_whitespace() functions.

As a minor fix when user input exceeds maxium allowed gecos field length
the remaining characters in stdin are purged so that re-prompting works
correctly.

Additionally the prompt() is made to add message to check_gecos_string(),
so that there are less similar strings for translation project to deal.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
chfn: use xasprintf() rather than bunch of strlen() and malloc() calls

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
chfn: fix usage() regression

Commit db433bf737a5fd4e1c7cca5e3603934743eebd1c changed -u for --help to
-h, that is not true.  The -h is short hand for --home-phone.  And the
--version is accompanied with -v not -V.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
chfn: simplify parse_passwd() by using strsep()

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
chfn: add minimalistic struct chfn_control

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
chfn: clean up parse_argv()

Use switch() case ?: for all option parsing, as in most of the other
source files.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
chfn: move new and old finger structs to chfn control struct

This change is a little bit messy, and requires a comment the struct
finfo should not have 'struct passwd *pw' as it's member.  The earlier
struct design would have been burden to maintain, and confusing to use.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
chfn: make command to obey login.defs CHFN_RESTRICT instructions

Reference: http://man7.org/linux/man-pages/man5/login.defs.5.html
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=138519
Signed-off-by: Sami Kerola <kerolasa@iki.fi>