summaryrefslogtreecommitdiffstats
path: root/login-utils/chfn.c
diff options
context:
space:
mode:
authorSami Kerola2011-11-13 17:36:55 +0100
committerSami Kerola2011-11-23 21:50:17 +0100
commit8187b555df56bdb8bcc63ce8fb39e99564408e62 (patch)
tree064a28c15c1fc2c3e79556f88ccac62956d605cb /login-utils/chfn.c
parentlogin: add version printing option (diff)
downloadkernel-qcow2-util-linux-8187b555df56bdb8bcc63ce8fb39e99564408e62.tar.gz
kernel-qcow2-util-linux-8187b555df56bdb8bcc63ce8fb39e99564408e62.tar.xz
kernel-qcow2-util-linux-8187b555df56bdb8bcc63ce8fb39e99564408e62.zip
chfn, chsh, setpwnam: get true/false from stdbool.h
Requires C99, which should not be a problem. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'login-utils/chfn.c')
-rw-r--r--login-utils/chfn.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/login-utils/chfn.c b/login-utils/chfn.c
index f2f514833..1ddd5864b 100644
--- a/login-utils/chfn.c
+++ b/login-utils/chfn.c
@@ -32,6 +32,7 @@
#include <errno.h>
#include <ctype.h>
#include <getopt.h>
+#include <stdbool.h>
#include "islocal.h"
#include "setpwnam.h"
@@ -62,10 +63,6 @@
#endif /* REQUIRE_PASSWORD */
-typedef unsigned char boolean;
-#define false 0
-#define true 1
-
static char buf[1024];
struct finfo {
@@ -78,12 +75,12 @@ struct finfo {
char *other;
};
-static boolean parse_argv (int argc, char *argv[], struct finfo *pinfo);
+static int parse_argv (int argc, char *argv[], struct finfo *pinfo);
static void parse_passwd (struct passwd *pw, struct finfo *pinfo);
static void ask_info (struct finfo *oldfp, struct finfo *newfp);
static char *prompt (char *question, char *def_val);
static int check_gecos_string (char *msg, char *gecos);
-static boolean set_changed_data (struct finfo *oldfp, struct finfo *newfp);
+static int set_changed_data (struct finfo *oldfp, struct finfo *newfp);
static int save_new_data (struct finfo *pinfo);
/* we do not accept gecos field sizes longer than MAX_FIELD_SIZE */
@@ -108,7 +105,7 @@ static void __attribute__((__noreturn__)) usage(FILE *fp)
int main (int argc, char **argv) {
uid_t uid;
struct finfo oldf, newf;
- boolean interactive;
+ int interactive;
int status;
sanitize_env();
@@ -217,10 +214,10 @@ int main (int argc, char **argv) {
* parse the command line arguments.
* returns true if no information beyond the username was given.
*/
-static boolean parse_argv(int argc, char *argv[], struct finfo *pinfo)
+static int parse_argv(int argc, char *argv[], struct finfo *pinfo)
{
int index, c, status;
- boolean info_given;
+ int info_given;
static struct option long_options[] = {
{ "full-name", required_argument, 0, 'f' },
@@ -403,9 +400,9 @@ static int check_gecos_string(char *msg, char *gecos)
* set_changed_data () --
* incorporate the new data into the old finger info.
*/
-static boolean set_changed_data(struct finfo *oldfp, struct finfo *newfp)
+static int set_changed_data(struct finfo *oldfp, struct finfo *newfp)
{
- boolean changed = false;
+ int changed = false;
if (newfp->full_name) {
oldfp->full_name = newfp->full_name; changed = true; }