diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-04-04 12:25:40 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-04-04 12:25:40 +0300 |
commit | 7c939cbc9b2c68f50cbb4b7103f483180a93982d (patch) | |
tree | b52998a54cfeb111c947126ac54c8aec7ff2b245 /mu-aux/gencl | |
parent | 7ed1178111e1a266b8a14ca806f7bcf84f8caf70 (diff) | |
download | mailutils-7c939cbc9b2c68f50cbb4b7103f483180a93982d.tar.gz mailutils-7c939cbc9b2c68f50cbb4b7103f483180a93982d.tar.bz2 |
Another improvement in gencl
* mu-aux/gencl: New option --email.
* Makefile.am: Simplify the ChangeLog command. Use the --email option.
Diffstat (limited to 'mu-aux/gencl')
-rwxr-xr-x | mu-aux/gencl | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/mu-aux/gencl b/mu-aux/gencl index 82ebcce68..6e7ca5844 100755 --- a/mu-aux/gencl +++ b/mu-aux/gencl @@ -27,2 +27,3 @@ my $append_dot; my $ignore_errors; +my $email; @@ -39,2 +40,3 @@ B<gencl> [B<-a> I<FILE>] +[B<-m> I<EMAIL>] [B<-F> I<FILE>] @@ -43,2 +45,3 @@ B<gencl> [B<--append=>I<FILE>] +[B<--email=>I<EMAIL>] [B<--file=>I<FILE>] @@ -88,3 +91,9 @@ The content of I<FILE> is appended verbatim, except that the line beginning with the text B<Local Variables:> is taken to mark the end of file. - + +=item B<-m>, B<--email=>I<EMAIL> + +Sets email address to use in the topmost automatically generated entry. +In the absense of this option, B<gencl> constructs the email from the +current user name and the domain (or host) name. + =item B<-F>, B<--file=>I<FILE> @@ -227,3 +236,4 @@ GetOptions( 'append-dot' => \$append_dot, - 'ignore-errors|i' => \$ignore_errors + 'ignore-errors|i' => \$ignore_errors, + 'email|m=s' => \$email ) or exit(1); @@ -234,2 +244,28 @@ if (! -d '.git') { +unless (defined($email)) { + if (exists($ENV{EMAIL})) { + $email = $ENV{EMAIL}; + } else { + my ($user, $domain); + if (exists($ENV{USER})) { + $user = $ENV{USER}; + } elsif (my ($name) = getpwuid(getuid())) { + $user = $name; + } else { + die "can't get user name"; + } + + if (chomp($domain = `domainname`) && $domain ne "(none)") { + ; + } elsif (exists($ENV{HOSTNAME})) { + $domain = $ENV{HOSTNAME}; + } elsif ($domain = `hostname`) { + chomp $domain; + } else { + $domain = 'localhost'; + } + $email = $user . '@' . $domain; + } +} + read_amend_file($amend_file) if $amend_file; @@ -260,3 +296,3 @@ sub toplevel_entry { - push @header, "$date Automatically generated <bug-mailutils\@gnu.org>"; + push @header, "$date Automatically generated <$email>"; push @header, ''; @@ -291,2 +327,5 @@ sub headcmp { if (open(my $fd, '<', $changelog_file)) { + # Skip first line + $_ = <$fd>; + shift; while (<$fd>) { |