From 66900c733ccef6a01b8fc6d7ca9f5f9adac7656a Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 7 Apr 1999 22:57:47 +0000 Subject: First round of post-5.0.0 buglets. svn path=/trunk/; revision=2430 --- env.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'env.c') diff --git a/env.c b/env.c index ad915263..dd6755d4 100644 --- a/env.c +++ b/env.c @@ -40,23 +40,22 @@ void envquery(int argc, char **argv) else program_name = argv[0]; - if ((user = getenv("USER")) == (char *)NULL) - user = getenv("LOGNAME"); - - if ((user == (char *)NULL) || (home = getenv("HOME")) == (char *)NULL) + if ((pw = getpwuid(getuid())) != NULL) { - if ((pw = getpwuid(getuid())) != NULL) - { - user = pw->pw_name; - home = pw->pw_dir; - } - else - { - fprintf(stderr, - _("%s: can't find your name and home directory!\n"), - program_name); - exit(PS_UNDEFINED); - } + user = pw->pw_name; + home = pw->pw_dir; + } + else if ((home = getenv("HOME"))) + { + if ((user = getenv("LOGNAME")) == (char *)NULL || user[0] == '\0') + user = getenv("USER"); + } + else + { + fprintf(stderr, + _("%s: can't find your name and home directory!\n"), + program_name); + exit(PS_UNDEFINED); } #define RCFILE_NAME ".fetchmailrc" -- cgit v1.2.3