summaryrefslogtreecommitdiffstats
path: root/usr.bin/ncftp/main.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-04-16 14:26:18 +0000
committerache <ache@FreeBSD.org>1995-04-16 14:26:18 +0000
commitf2a874e028c34904d9a7f7b7f4dcce3475619d4f (patch)
treeb79c9c59cd96d5a26a83f2bf528f972fb3469058 /usr.bin/ncftp/main.c
parent7ef8f4aa3128621b643f8e6d87bc210c96f3baa4 (diff)
downloadFreeBSD-src-f2a874e028c34904d9a7f7b7f4dcce3475619d4f.zip
FreeBSD-src-f2a874e028c34904d9a7f7b7f4dcce3475619d4f.tar.gz
Merge.
Diffstat (limited to 'usr.bin/ncftp/main.c')
-rw-r--r--usr.bin/ncftp/main.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/usr.bin/ncftp/main.c b/usr.bin/ncftp/main.c
index 49adfa7..68d9da7 100644
--- a/usr.bin/ncftp/main.c
+++ b/usr.bin/ncftp/main.c
@@ -2,7 +2,7 @@
#define _main_c_
-#define FTP_VERSION "1.9.3 (March 5, 1995)"
+#define FTP_VERSION "1.9.4 (April 15, 1995)"
/* #define BETA 1 */ /* If defined, it prints a little warning message. */
@@ -460,28 +460,32 @@ int getuserinfo(void)
else
(void) Strncpy(uinfo.homedir, pw->pw_dir);
cp = getenv("MAIL");
-#ifndef __FreeBSD__
- if (cp == NULL)
- cp = getenv("mail");
- if (cp == NULL)
- (void) sprintf(str, "/usr/spool/mail/%s", uinfo.username);
-#else
- if (cp == NULL)
- (void) sprintf(str, "/var/mail/%s", uinfo.username);
-#endif
- else
+ if (cp != NULL) {
(void) Strncpy(str, cp);
+ } else {
+ /* Check a few typical mail directories.
+ * If we don't find it, too bad. Checking for new mail
+ * isn't very important anyway.
+ */
+ (void) sprintf(str, "/usr/spool/mail/%s", uinfo.username);
+ if (access(str, 0) < 0) {
+ (void) sprintf(str, "/var/mail/%s", uinfo.username);
+ }
+ }
cp = str;
-
- /*
- * mbox variable may be like MAIL=(28 /usr/mail/me /usr/mail/you),
- * so try to find the first mail path.
- */
- while ((*cp != '/') && (*cp != 0))
- cp++;
- (void) Strncpy(mail_path, cp);
- if ((cp = index(mail_path, ' ')) != NULL)
- *cp = '\0';
+ if (access(cp, 0) < 0) {
+ mail_path[0] = 0;
+ } else {
+ /*
+ * mbox variable may be like MAIL=(28 /usr/mail/me /usr/mail/you),
+ * so try to find the first mail path.
+ */
+ while ((*cp != '/') && (*cp != 0))
+ cp++;
+ (void) Strncpy(mail_path, cp);
+ if ((cp = index(mail_path, ' ')) != NULL)
+ *cp = '\0';
+ }
return (0);
} else {
PERROR("getuserinfo", "Could not get your passwd entry!");
OpenPOWER on IntegriCloud