]> diplodocus.org Git - nmh/commitdiff
For slocal, changed default user, if -user switch isn't used, to be
authorDavid Levine <levinedl@acm.org>
Mon, 2 May 2016 16:55:31 +0000 (12:55 -0400)
committerDavid Levine <levinedl@acm.org>
Mon, 2 May 2016 16:55:31 +0000 (12:55 -0400)
the user part of the Local-Mailbox profile entry, if present, or the
current user.  addr uses the same default.  This allows addr
to contain a '.', which slocal did not allow before.

man/slocal.man
test/slocal/test-slocal
uip/slocal.c

index 53f9314..6c8e490 100644 (file)
@@ -1,4 +1,4 @@
-.TH SLOCAL %manext1% "November 23, 2012" "%nmhversion%"
+.TH SLOCAL %manext1% "May 2, 2016" "%nmhversion%"
 .\"
 .\" %nmhwarning%
 .\"
 .\"
 .\" %nmhwarning%
 .\"
@@ -76,7 +76,7 @@ The
 switch tells
 .B slocal
 the name of the user for
 switch tells
 .B slocal
 the name of the user for
-whom it is delivering mail.  The
+whom it is delivering mail.  It must exist on the local system.  The
 .B \-mailbox
 switch tells
 .B slocal
 .B \-mailbox
 switch tells
 .B slocal
@@ -383,8 +383,14 @@ quicker delivery into your maildrop.
 .RB ` \-maildelivery "' defaults to $HOME/\&.maildelivery"
 .RB ` \-mailbox "' deaults to %mailspool%/$USER"
 .RB ` \-file "' defaults to stdin"
 .RB ` \-maildelivery "' defaults to $HOME/\&.maildelivery"
 .RB ` \-mailbox "' deaults to %mailspool%/$USER"
 .RB ` \-file "' defaults to stdin"
+.RB ` \-addr "' defaults to the current user"
 .RB ` \-user "' defaults to the current user"
 .fi
 .RB ` \-user "' defaults to the current user"
 .fi
+.PP
+.B \-addr
+and
+.B \-user
+will be set the the user part of the Local-Mailbox profile entry, if set.
 .SH CONTEXT
 None
 .SH HISTORY
 .SH CONTEXT
 None
 .SH HISTORY
index 08eb1a8..3fb73b2 100755 (executable)
@@ -143,19 +143,23 @@ run_prog $slocal -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/5
 check "$MH_TEST_DIR/Mail/inbox/5" "$actual" 'keep first'
 check "$MH_TEST_DIR/Mail/inbox/5" "$actual2" 'keep first'
 
 check "$MH_TEST_DIR/Mail/inbox/5" "$actual" 'keep first'
 check "$MH_TEST_DIR/Mail/inbox/5" "$actual2" 'keep first'
 
-# Use current login for address, user, etc., because it must be an
-# existing user on the host.
-me=`"$MH_LIBEXEC_DIR"/ap -format '%(me)' 0`
-
 # check -addr
 cat >"$md"  <<EOF
 # check -addr
 cat >"$md"  <<EOF
-addr "$me" qpipe A "$tee $actual"
+addr someaddress qpipe A "$tee $actual"
 EOF
 
 EOF
 
-run_prog $slocal -addr "$me" -maildelivery "$md" $mbox \
+run_prog $slocal -addr someaddress -maildelivery "$md" $mbox \
   <"$MH_TEST_DIR"/Mail/inbox/6
 check "$MH_TEST_DIR/Mail/inbox/6" "$actual" 'keep first'
 
   <"$MH_TEST_DIR"/Mail/inbox/6
 check "$MH_TEST_DIR/Mail/inbox/6" "$actual" 'keep first'
 
+# check -addr with . in address
+cat >"$md"  <<EOF
+addr "first.last" qpipe A "$tee $actual"
+EOF
+run_prog $slocal -addr 'first.last' \
+  -maildelivery "$md" $mbox <"$MH_TEST_DIR"/Mail/inbox/6
+check "$MH_TEST_DIR/Mail/inbox/6" "$actual" 'keep first'
+
 # check -info
 cat >"$md"  <<EOF
 * - qpipe A "\$(info) $actual"
 # check -info
 cat >"$md"  <<EOF
 * - qpipe A "\$(info) $actual"
@@ -167,10 +171,10 @@ check "$MH_TEST_DIR/Mail/inbox/7" "$actual" 'keep first'
 
 # check -sender, which is compared with "source"
 cat >"$md"  <<EOF
 
 # check -sender, which is compared with "source"
 cat >"$md"  <<EOF
-source "$me" qpipe A "$tee $actual"
+source somesender qpipe A "$tee $actual"
 EOF
 
 EOF
 
-run_prog $slocal -sender "$me" -maildelivery "$md" $mbox \
+run_prog $slocal -sender somesender -maildelivery "$md" $mbox \
   <"$MH_TEST_DIR"/Mail/inbox/8
 check "$MH_TEST_DIR/Mail/inbox/8" "$actual" 'keep first'
 
   <"$MH_TEST_DIR"/Mail/inbox/8
 check "$MH_TEST_DIR/Mail/inbox/8" "$actual" 'keep first'
 
@@ -179,10 +183,16 @@ cat >"$md"  <<EOF
 * - qpipe A "$tee $actual"
 EOF
 
 * - qpipe A "$tee $actual"
 EOF
 
+# Use current login for user because it must be an existing user on the host.
+me=`"$MH_LIBEXEC_DIR"/ap -format '%(me)' 0`
 run_prog $slocal -user "$me" -maildelivery "$md" $mbox \
   <"$MH_TEST_DIR"/Mail/inbox/9
 check "$MH_TEST_DIR/Mail/inbox/9" "$actual" 'keep first'
 
 run_prog $slocal -user "$me" -maildelivery "$md" $mbox \
   <"$MH_TEST_DIR"/Mail/inbox/9
 check "$MH_TEST_DIR/Mail/inbox/9" "$actual" 'keep first'
 
+# Can't check -user with . in address because the user must
+# have an account on the local system, and we can't guarantee
+# that there is one.
+
 # check -mailbox
 cat >"$md"  <<EOF
 EOF
 # check -mailbox
 cat >"$md"  <<EOF
 EOF
@@ -221,5 +231,4 @@ run_prog $slocal -suppress -nosuppressdup -maildelivery "$md" $mbox \
   <"$MH_TEST_DIR"/Mail/inbox/2
 check "$MH_TEST_DIR/Mail/inbox/2" "$actual" 'keep first'
 
   <"$MH_TEST_DIR"/Mail/inbox/2
 check "$MH_TEST_DIR/Mail/inbox/2" "$actual" 'keep first'
 
-
 exit ${failed:-0}
 exit ${failed:-0}
index a26432c..927e858 100644 (file)
@@ -273,8 +273,9 @@ main (int argc, char **argv)
 
     if (addr == NULL)
        addr = getusername ();
 
     if (addr == NULL)
        addr = getusername ();
-    if (user == NULL)
-       user = (cp = strchr(addr, '.')) ? ++cp : addr;
+    if (user == NULL) {
+       user = getusername ();
+    }
     if ((pw = getpwnam (user)) == NULL)
        adios (NULL, "no such local user as %s", user);
 
     if ((pw = getpwnam (user)) == NULL)
        adios (NULL, "no such local user as %s", user);