From a85b1bfdf076f3e7db5f037979d0e62af892fbd1 Mon Sep 17 00:00:00 2001 From: Michael Mikonos <127171689+mknos@users.noreply.github.com> Date: Tue, 10 Dec 2024 04:50:25 +0800 Subject: [PATCH] mail: -f usage forbids extra args (#870) * If mail command is invoked with arguments it assumes those are addresses to send mail to, but running "mail -f mbox" is not compatible * Raise an error and print usage string, as done in OpenBSD version * Also use catfile() when constructing a default value for mailbox path --- bin/mail | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/bin/mail b/bin/mail index 95a86ad7..c7fb8dce 100755 --- a/bin/mail +++ b/bin/mail @@ -634,12 +634,13 @@ EDLOOP: { package main; use File::Basename qw(basename); +use File::Spec; use File::Temp; use Getopt::Std; use vars qw($opt_f $opt_s $opt_c $opt_b $opt_v); -our $VERSION = '0.04'; +our $VERSION = '0.05'; our $ROWS = 23; # Screen Dimensions. Yeah, this sucks. our $COLS = 80; our $BUFFERL = 2; # Lines needed for "fluff" @@ -1044,27 +1045,30 @@ sub VERSION_MESSAGE { exit; } -getopts("f:s:c:b:v") || die <catfile($ENV{'HOME'}, 'mbox'); } + Interactive($mbox); } =pod