summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2020-10-22 11:02:54 +0200
committerGitHub <noreply@github.com>2020-10-22 11:02:54 +0200
commit46f29e2e07d210e6804786b1863b087aee05a540 (patch)
treed1760b99a6c5843812aae4b1d831f4e80f3a6bbd
parent886935f09b885b90391c29d1be85d286af15222c (diff)
parent935fcd2d82761dd605211a1ac0556a17f0188b17 (diff)
downloadATCD-46f29e2e07d210e6804786b1863b087aee05a540.tar.gz
Merge pull request #1261 from jwillemsen/jwi-cle
Removed changelog editor, we don't maintain manual changelogs anymore…
-rw-r--r--ACE/bin/ChangeLogEditor/CVSFileLocator.pm125
-rw-r--r--ACE/bin/ChangeLogEditor/ChangeLogEdit.pm122
-rw-r--r--ACE/bin/ChangeLogEditor/ChangeLogEntry.pm145
-rw-r--r--ACE/bin/ChangeLogEditor/EmailTranslator.pm52
-rw-r--r--ACE/bin/ChangeLogEditor/FileLocator.pm77
-rw-r--r--ACE/bin/ChangeLogEditor/FileLocatorFactory.pm61
-rw-r--r--ACE/bin/ChangeLogEditor/SVNFileLocator.pm75
-rwxr-xr-xACE/bin/cle.pl296
8 files changed, 0 insertions, 953 deletions
diff --git a/ACE/bin/ChangeLogEditor/CVSFileLocator.pm b/ACE/bin/ChangeLogEditor/CVSFileLocator.pm
deleted file mode 100644
index 8e478509f01..00000000000
--- a/ACE/bin/ChangeLogEditor/CVSFileLocator.pm
+++ /dev/null
@@ -1,125 +0,0 @@
-package CVSFileLocator;
-
-# ************************************************************
-# Description : Use CVS to determine the list of modified files.
-# Author : Chad Elliott
-# Create Date : 11/29/2005
-# ************************************************************
-
-# ************************************************************
-# Pragmas
-# ************************************************************
-
-use strict;
-use FileHandle;
-
-use FileLocator;
-
-use vars qw(@ISA);
-@ISA = qw(FileLocator);
-
-# ************************************************************
-# Subroutine Section
-# ************************************************************
-
-sub locate {
- my($self) = shift;
- my(@dirs) = @_;
- my($fh) = new FileHandle();
- my(@modified) = ();
- my(@removed) = ();
- my(@conflicts) = ();
- my(@unknown) = ();
- my($error) = undef;
- my($cvsroot) = $self->obtainCVSROOT();
- my($err) = $self->tmpnam('cle_cvs.err');
-
- if (open($fh, 'cvs -f -q ' . ($^O eq 'MSWin32' ? '-N ' : '') .
- (defined $cvsroot ? "-d $cvsroot " : '') .
- "-n update @dirs 2> $err |")) {
- while(<$fh>) {
- my($line) = $_;
- if ($line =~ /^[AM]\s+(.*)/) {
- push(@modified, $1);
- }
- elsif ($line =~ /^[R]\s+(.*)/) {
- push(@removed, $1);
- }
- elsif ($line =~ /^[C]\s+(.*)/) {
- push(@conflicts, $1);
- }
- elsif ($line =~ /^[\?]\s+(.*)/ && index($line, $err) == -1) {
- push(@unknown, $1);
- }
- }
- close($fh);
-
- $error = $self->process_errors($err);
- }
- else {
- $error = "Unable to run cvs with error redirection.";
- }
-
- return \@modified, \@removed, \@conflicts, \@unknown, $error;
-}
-
-
-sub obtainCVSROOT {
- my($self) = shift;
- my($fh) = new FileHandle();
- my($croot) = undef;
-
- if (open($fh, 'CVS/Root')) {
- while(<$fh>) {
- my($line) = $_;
- $line =~ s/\s+$//;
- if ($line =~ /^:pserver/ || $line =~ /^:ext/) {
- if (defined $ENV{CVSROOT} && $line eq $ENV{CVSROOT}) {
- last;
- }
- else {
- my($check) = $line;
- $check =~ s/:\w+\@/:\@/;
- $check =~ s/\.\w+\.\w+:/:/;
- my($clen) = length($check);
- foreach my $key (keys %ENV) {
- my($echeck) = $ENV{$key};
- $echeck =~ s/:\w+\@/:\@/;
- $echeck =~ s/\.\w+\.\w+:/:/;
- if ($check eq $echeck) {
- $croot = $ENV{$key};
- last;
- }
- else {
- my($len) = length($echeck);
- if ($len > 0 &&
- substr($check, $clen - $len, $len) eq $echeck) {
- $croot = $ENV{$key};
- last;
- }
- }
- }
- if (defined $croot) {
- last;
- }
- }
- if (!defined $croot) {
- $croot = $line;
- }
- }
- else {
- $croot = $line;
- last;
- }
- }
- close($fh);
- }
- else {
- $croot = $ENV{CVSROOT};
- }
-
- return $croot;
-}
-
-
-1;
diff --git a/ACE/bin/ChangeLogEditor/ChangeLogEdit.pm b/ACE/bin/ChangeLogEditor/ChangeLogEdit.pm
deleted file mode 100644
index 1bbfee507b1..00000000000
--- a/ACE/bin/ChangeLogEditor/ChangeLogEdit.pm
+++ /dev/null
@@ -1,122 +0,0 @@
-package ChangeLogEdit;
-
-# ************************************************************
-# Description : Edit the existing ChangeLog.
-# Author : Chad Elliott
-# Create Date : 9/10/2002
-# ************************************************************
-
-# ************************************************************
-# Pragmas
-# ************************************************************
-
-use strict;
-use FileHandle;
-use File::Copy;
-
-use ChangeLogEntry;
-
-# ************************************************************
-# Subroutine Section
-# ************************************************************
-
-sub new {
- my($class) = shift;
- my($name) = shift;
- my($email) = shift;
- my($self) = bless {'name' => $name,
- 'email' => $email,
- }, $class;
- return $self;
-}
-
-
-sub edit {
- my($self) = shift;
- my($ofile) = shift;
- my(@dirs) = @_;
- my($tfile) = "$ofile.$<.$$";
- my($status) = 0;
- my($error) = '';
- my($rh) = new FileHandle();
- my($unknown) = undef;
-
- if (open($rh, $ofile)) {
- my($creator) = new ChangeLogEntry($self->{'name'},
- $self->{'email'});
- my($entry) = '';
- ($entry, $unknown, $error) = $creator->create(@dirs);
- if (defined $entry) {
- if ($entry =~ /^ERROR:/) {
- $error = $entry;
- }
- else {
- my($oh) = new FileHandle();
- if (open($oh, ">$tfile")) {
- $status = print $oh $entry;
- if ($status) {
- while(<$rh>) {
- my($line) = $_;
- $line =~ s/\s+$//;
- if ($line =~ /\t/) {
- $line = $self->convertTabs($line);
- }
- $status = print $oh "$line\n";
- if ($status == 0) {
- $error = "Unable to copy $ofile";
- last;
- }
- }
- }
- else {
- $error = 'Unable to print the first entry';
- }
- close($oh);
- }
- else {
- $error = "Unable to open $tfile for writing";
- }
- close($rh);
-
- if ($status) {
- $status = 0;
- if (unlink($ofile)) {
- if (rename($tfile, $ofile)) {
- $status = 1;
- }
- else {
- $error = "Unable to rename $tfile to $ofile";
- }
- }
- else {
- $error = "Unable to remove $ofile";
- }
- }
- }
- }
- else {
- $error = (defined $error ? "There is a revision control system " .
- "problem:\n$error" :
- 'There are no modified/removed files.');
- }
- }
- else {
- $error = "Unable to open $ofile for reading";
- }
-
- return $status, $error, $unknown;
-}
-
-
-sub convertTabs {
- my($self) = shift;
- my($line) = shift;
- while($line =~ /\t/) {
- my($spaces) = 8 - (index($line, "\t") % 8);
- $line =~ s/\t/sprintf("%${spaces}s", ' ')/e;
- }
- return $line;
-}
-
-
-1;
diff --git a/ACE/bin/ChangeLogEditor/ChangeLogEntry.pm b/ACE/bin/ChangeLogEditor/ChangeLogEntry.pm
deleted file mode 100644
index 1fdcf9d3da3..00000000000
--- a/ACE/bin/ChangeLogEditor/ChangeLogEntry.pm
+++ /dev/null
@@ -1,145 +0,0 @@
-package ChangeLogEntry;
-
-# ************************************************************
-# Description : Create a ChangeLog entry based on modified files.
-# Author : Chad Elliott
-# Create Date : 6/18/2002
-# ************************************************************
-
-# ************************************************************
-# Pragmas
-# ************************************************************
-
-use strict;
-use File::Basename;
-
-use FileLocatorFactory;
-
-# ************************************************************
-# Subroutine Section
-# ************************************************************
-
-sub new {
- my($class) = shift;
- my($name) = shift;
- my($email) = shift;
- my($self) = bless {'name' => $name,
- 'email' => $email,
- }, $class;
- return $self;
-}
-
-
-sub escape_regex_special {
- my($self) = shift;
- my($name) = shift;
-
- $name =~ s/([\+\-\\\$\[\]\(\)\.])/\\$1/g;
- return $name;
-}
-
-
-sub sortFileList {
- my($self) = shift;
- return sort {
- if ($a =~ /\.h$/) {
- my($base) = $a;
- $base =~ s/\.h//;
- $base = $self->escape_regex_special($base);
- if ($b =~ /^$base\./) {
- return -1;
- }
- else {
- return $a cmp $b;
- }
- }
- elsif ($a =~ /\.i(nl)?$/) {
- my($base) = $a;
- $base =~ s/\.i(nl)?$//;
- $base = $self->escape_regex_special($base);
- if ($b =~ /^$base\.cpp/) {
- return -1;
- }
- else {
- return $a cmp $b;
- }
- }
- elsif ($a =~ /\.cpp?$/) {
- my($base) = $a;
- $base =~ s/\.cpp?$//;
- $base = $self->escape_regex_special($base);
- if ($b =~ /^$base\./) {
- return 1;
- }
- else {
- return $a cmp $b;
- }
- }
- return $a cmp $b;
- } @_;
-}
-
-
-sub create {
- my($self) = shift;
- my(@dirs) = @_;
- my($fl) = FileLocatorFactory::create();
- my($modif,
- $remov,
- $confl,
- $unknown,
- $error) = $fl->locate(@dirs);
- my($entry) = scalar(gmtime());
-
- if (defined $$confl[0]) {
- $entry = "ERROR: The following files have conflicts:\n";
- foreach my $file (@$confl) {
- $entry .= "$file\n";
- }
- }
- else {
- my($prefix) = ' * ';
-
- ## Correct the timezone (if there is any)
- my($tz) = 'UTC';
- $entry =~ s/(:\d\d\s+)(.*)(\d\d\d\d)$/$1$tz $3/;
-
- ## Add the name and email address
- $entry .= " $self->{'name'} <$self->{'email'}>\n\n";
-
- my($previous) = undef;
- foreach my $file ($self->sortFileList(@$modif)) {
- my($directory) = dirname($file);
- if (defined $previous && $previous ne $directory) {
- $entry .= "\n";
- }
- $entry .= "$prefix$file:\n";
- $previous = $directory;
- }
- $previous = '';
- my($removed) = 0;
- foreach my $file ($self->sortFileList(@$remov)) {
- my($directory) = dirname($file);
- if (defined $previous && $previous ne $directory) {
- $entry .= "\n";
- }
- $entry .= "$prefix$file:\n";
- $previous = $directory;
- $removed++;
- }
- if ($removed) {
- $entry .= "\n Removed " .
- ($removed > 1 ? 'these files' : 'this file') . ".\n";
- }
- $entry .= "\n";
- }
-
- if (!defined $$modif[0] && !defined $$remov[0]) {
- $entry = undef;
- }
-
- return $entry, $unknown, $error;
-}
-
-
-1;
diff --git a/ACE/bin/ChangeLogEditor/EmailTranslator.pm b/ACE/bin/ChangeLogEditor/EmailTranslator.pm
deleted file mode 100644
index eacbff22497..00000000000
--- a/ACE/bin/ChangeLogEditor/EmailTranslator.pm
+++ /dev/null
@@ -1,52 +0,0 @@
-package EmailTranslator;
-
-# ************************************************************
-# Description : Translate the given user name and domain into
-# an email address.
-# Author : Chad Elliott
-# Create Date : 6/18/2002
-# ************************************************************
-
-# ************************************************************
-# Pragmas
-# ************************************************************
-
-use strict;
-use FileHandle;
-
-# ************************************************************
-# Subroutine Section
-# ************************************************************
-
-sub new {
- my($class) = shift;
- my($domain) = shift;
- my($self) = bless {'domain' => "\@$domain",
- }, $class;
- return $self;
-}
-
-
-sub translate {
- my($self) = shift;
- my($name) = shift;
- my($domain) = $self->{'domain'};
- my($email) = "$name$domain";
- my(%special) = ();
-
- if (defined $ENV{REPLYTO}) {
- $email = $ENV{REPLYTO};
- }
- elsif (defined $special{$name}) {
- $email = $special{$name} . $domain;
- }
- elsif ($name =~ /([^\s]+)\s+([^\s]+)/) {
- ## Last name underscore first initial
- $email = lc($2 . '_' . substr($1, 0, 1)) . $domain;
- }
-
- return $email;
-}
-
-
-1;
diff --git a/ACE/bin/ChangeLogEditor/FileLocator.pm b/ACE/bin/ChangeLogEditor/FileLocator.pm
deleted file mode 100644
index 5707a84c345..00000000000
--- a/ACE/bin/ChangeLogEditor/FileLocator.pm
+++ /dev/null
@@ -1,77 +0,0 @@
-package FileLocator;
-
-# ************************************************************
-# Description : Base class for file locators.
-# Author : Chad Elliott
-# Create Date : 6/18/2002
-# ************************************************************
-
-# ************************************************************
-# Pragmas
-# ************************************************************
-
-use strict;
-use FileHandle;
-
-# ************************************************************
-# Subroutine Section
-# ************************************************************
-
-sub new {
- my($class) = shift;
- my($self) = bless {
- }, $class;
- return $self;
-}
-
-
-sub tmpnam {
- my($self) = shift;
- my($file) = shift;
- my(@def) = ("/tmp", ".");
-
- foreach my $possible ($ENV{TMPDIR}, $ENV{TEMP}, $ENV{TMP}, @def) {
- if (defined $possible && -d $possible && -w $possible) {
- $possible =~ s!\\!/!g;
- return $possible . '/' . $$ . '_' . $> . '_' . $file;;
- }
- }
-
- return $file;
-}
-
-
-sub process_errors {
- my($self) = shift;
- my($file) = shift;
- my($error) = undef;
-
- if (-s $file != 0) {
- my($fh) = new FileHandle();
- if (open($fh, $file)) {
- $error = '';
- while(<$fh>) {
- $error .= $_;
- }
- close($fh);
- $error =~ s/\s+$//;
- }
- }
- unlink($file);
-
- return $error;
-}
-
-
-sub locate {
- my($self) = shift;
- my(@dirs) = @_;
- my(@modified) = ();
- my(@removed) = ();
- my(@conflicts) = ();
- my(@unknown) = ();
- return \@modified, \@removed, \@conflicts, \@unknown;
-}
-
-
-1;
diff --git a/ACE/bin/ChangeLogEditor/FileLocatorFactory.pm b/ACE/bin/ChangeLogEditor/FileLocatorFactory.pm
deleted file mode 100644
index 39e124c4ca9..00000000000
--- a/ACE/bin/ChangeLogEditor/FileLocatorFactory.pm
+++ /dev/null
@@ -1,61 +0,0 @@
-package FileLocatorFactory;
-
-# ************************************************************
-# Description : Create FileLocator objects.
-# Author : Chad Elliott
-# Create Date : 11/29/2005
-# ************************************************************
-
-# ************************************************************
-# Pragmas
-# ************************************************************
-
-use strict;
-
-use Cwd;
-use CVSFileLocator;
-use SVNFileLocator;
-
-# ************************************************************
-# Subroutine Section
-# ************************************************************
-
-sub create {
- ## Check for Subversion first. It is unlikely that the .svn directory
- ## will exist when Subversion isn't the rcs being used. However, that
- ## is not the case for CVS directories.
- switch: {
- ((defined $ENV{SVN_ASP_DOT_NET_HACK} && -d '_svn') || searchParentDirectory('.svn'))
- && do { return new SVNFileLocator(); };
- -d 'CVS' && do { return new CVSFileLocator(); };
- print STDERR "WARNING: Unsupported revision control protocol\n";
- }
-
- return new FileLocator();
-}
-
-sub searchParentDirectory {
- my($hidden) = shift;
- my($path) = cwd();
- my($index) = -1;
-
- # Search all parent directories for the specified hidden
- # directory. We stop when we either found the hidden directory
- # of there are no more parent directories let to search.
- do {
- if (-d $path . '/' . $hidden) {
- return 1;
- }
-
- $index = rindex($path, '/');
-
- if ($index != -1) {
- $path = substr ($path, 0, $index);
- }
- } while ($index != -1);
-
- return 0;
-}
-
-
-1;
diff --git a/ACE/bin/ChangeLogEditor/SVNFileLocator.pm b/ACE/bin/ChangeLogEditor/SVNFileLocator.pm
deleted file mode 100644
index 55a8674af81..00000000000
--- a/ACE/bin/ChangeLogEditor/SVNFileLocator.pm
+++ /dev/null
@@ -1,75 +0,0 @@
-package SVNFileLocator;
-
-# ************************************************************
-# Description : Use SVN to determine the list of modified files.
-# Author : Chad Elliott
-# Create Date : 11/29/2005
-# ************************************************************
-
-# ************************************************************
-# Pragmas
-# ************************************************************
-
-use strict;
-use FileHandle;
-
-use FileLocator;
-
-use vars qw(@ISA);
-@ISA = qw(FileLocator);
-
-# ************************************************************
-# Subroutine Section
-# ************************************************************
-
-sub locate {
- my($self) = shift;
- my(@dirs) = @_;
- my($fh) = new FileHandle();
- my(@modified) = ();
- my(@removed) = ();
- my(@conflicts) = ();
- my(@unknown) = ();
- my($error) = undef;
- my($err) = $self->tmpnam('cle_svn.err');
-
- if (open($fh, "svn status @dirs 2> $err |")) {
- while(<$fh>) {
- my($line) = $_;
- if ($line =~ /^([A-Z\s\?])([A-Z\s])[A-Z\s][\+\*\s][A-Z\s][A-Z\s]\s+(.*)$/) {
- my($content) = $1;
- my($property) = $2;
- my($file) = $3;
-
- ## Subversion differs from CVS in that it will print paths with
- ## windows style back-slashes instead of forward slashes.
- $file =~ s!\\!/!g if ($^O eq 'MSWin32');
-
- if ($property eq 'M' ||
- $content eq 'M' || $content eq 'A' || $content eq 'R') {
- push(@modified, $file);
- }
- elsif ($content eq 'D') {
- push(@removed, $file);
- }
- elsif ($content eq 'C' || $property eq 'C') {
- push(@conflicts, $file);
- }
- elsif ($content eq '?' && index($line, $err) == -1) {
- push(@unknown, $file);
- }
- }
- }
- close($fh);
-
- $error = $self->process_errors($err);
- }
- else {
- $error = "Unable to run svn with error redirection.";
- }
-
- return \@modified, \@removed, \@conflicts, \@unknown, $error;
-}
-
-
-1;
diff --git a/ACE/bin/cle.pl b/ACE/bin/cle.pl
deleted file mode 100755
index 26e2f35e90c..00000000000
--- a/ACE/bin/cle.pl
+++ /dev/null
@@ -1,296 +0,0 @@
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
- & eval 'exec perl -S $0 $argv:q'
- if 0;
-
-# ******************************************************************
-# Author: Chad Elliott
-# Date: 6/18/2002
-# ******************************************************************
-
-use strict;
-use Cwd;
-use File::Basename;
-use Sys::Hostname;
-
-if ( $^O eq 'VMS' ) {
- require VMS::Filespec;
- import VMS::Filespec qw(unixpath);
-}
-
-unshift(@INC, getExecutePath($0) . 'ChangeLogEditor');
-
-require ChangeLogEdit;
-require EmailTranslator;
-
-# ************************************************************
-# Subroutine Section
-# ************************************************************
-
-sub which {
- my($prog) = shift;
- my($exec) = $prog;
- my($part) = '';
- if ( $^O eq 'VMS' ) {
- my($envSep) = ';';
- if (defined $ENV{'PATH'}) {
- foreach $part (split(/$envSep/, $ENV{'PATH'})) {
- $part .= "$prog";
- if ( -x $part ) {
- $exec = $part;
- last;
- }
- }
- }
- }
- else {
- my($envSep) = ($^O eq 'MSWin32' ? ';' : ':');
- if (defined $ENV{'PATH'}) {
- foreach $part (split(/$envSep/, $ENV{'PATH'})) {
- $part .= "/$prog";
- if ( -x $part ) {
- $exec = $part;
- last;
- }
- }
- }
- }
-
- return $exec;
-}
-
-
-sub getExecutePath {
- my($prog) = shift;
- my($loc) = '';
-
- if ( $^O eq 'VMS' ) {
- if ($prog ne basename($prog)) {
- my($dir) = unixpath( dirname($prog) );
- if ($prog =~ /^[\/\\]/) {
- $loc = $dir;
- }
- else {
- $loc = unixpath(getcwd()) . $dir;
- }
- }
- else {
- $loc = unixpath( dirname(which($prog)) );
- }
-
- if ($loc eq '.') {
- $loc = unixpath( getcwd() );
- }
- } else {
- if ($prog ne basename($prog)) {
- if ($prog =~ /^[\/\\]/ ||
- $prog =~ /^[A-Za-z]:[\/\\]?/) {
- $loc = dirname($prog);
- }
- else {
- $loc = getcwd() . '/' . dirname($prog);
- }
- }
- else {
- $loc = dirname(which($prog));
- }
-
- $loc =~ s/\/\.$//;
-
- if ($loc eq '.') {
- $loc = getcwd();
- }
-
- if ($loc ne '') {
- $loc .= '/';
- }
- }
-
- return $loc;
-}
-
-sub getDefaultDomain {
- my($domain) = undef;
- my($host) = hostname();
-
- if (defined $host) {
- ## First try the hostname
- if ($host =~ /[^\.]+\.(.*)/) {
- $domain = $1;
- }
- else {
- ## Next try the hosts file
- my($hosts) = ($^O eq 'MSWin32' ?
- "$ENV{SystemRoot}/system32/drivers/etc/hosts" :
- '/etc/hosts');
- my($fh) = new FileHandle();
- if (open($fh, $hosts)) {
- while(<$fh>) {
- if (/$host\.([^\s]+)/) {
- $domain = $1;
- last;
- }
- }
- close($fh);
- }
-
- if (!defined $domain) {
- ## Next try ipconfig on Windows
- if ($^O eq 'MSWin32') {
- if (open($fh, 'ipconfig /all |')) {
- while(<$fh>) {
- if (/Primary\s+DNS\s+Suffix[^:]+:\s+(.*)/) {
- $domain = $1;
- }
- elsif (/DNS\s+Suffix\s+Search[^:]+:\s+(.*)/) {
- $domain = $1;
- }
- }
- close($fh);
- }
- }
- else {
- ## Try /etc/resolv.conf on UNIX
- if (open($fh, '/etc/resolv.conf')) {
- while(<$fh>) {
- if (/search\s+(.*)/) {
- $domain = $1;
- last;
- }
- }
- close($fh);
- }
- }
- }
- }
- }
- return $domain;
-}
-
-
-sub usageAndExit {
- my($arg) = shift;
- my($base) = basename($0);
- if (defined $arg) {
- print "$arg\n\n";
- }
- print "Usage: $base [ChangeLog File] [user name] [email address]\n" .
- " " . (' ' x length($base)) . "[-d <dir1 dir2 ... dirN>]\n\n" .
- " Uses cvs to determine which files are modified or added\n" .
- " and generates a bare ChangeLog entry based on those files.\n" .
- " This script should be run at the same directory level in\n" .
- " which the ChangeLog exists. The entry is prepended to the\n" .
- " existing ChangeLog.\n" .
- "\n" .
- " Email addresses are generated with a certain set of\n" .
- " defaults and can be modified using various environment\n" .
- " variables. By default email addresses are generated\n" .
- " using the user last name followed by an underscore and\n" .
- " the first initial of the user first name followed by the\n" .
- " email domain.\n" .
- "\n" .
- " REPLYTO If this environment variable is set, the value\n" .
- " is used as the email address.\n" .
- " CL_USERNAME This environment variable is used to override\n" .
- " the user name (obtained from the password file).\n" .
- " CL_CHANGELOG_FILE This environment variable is used as the\n".
- " [ChangeLog File] argument if none is given\n".
- " on the command line.\n".
- "\n" .
- " The user name and email address can be passed as a parameter to\n" .
- " this script. If either is not passed, then the script will try\n" .
- " to determine it automatically.\n" .
- "\n" .
- " If -d is used, everything on the command line after it is\n" .
- " considered a directory or file to be considered in the\n" .
- " ChangeLog entry.\n";
- exit(0);
-}
-
-
-# ************************************************************
-# Subroutine Section
-# ************************************************************
-
-my($file) = undef;
-my($name) = undef;
-my($email) = undef;
-my(@dirs) = ();
-my($restdirs) = 0;
-
-foreach my $arg (@ARGV) {
- if ($restdirs) {
- push(@dirs, $arg);
- }
- elsif ($arg eq '-h') {
- usageAndExit();
- }
- elsif ($arg eq '-d') {
- $restdirs = 1;
- }
- elsif ($arg =~ /^\-/) {
- usageAndExit("Unrecognized parameter: $arg");
- }
- elsif (!defined $file) {
- $file = $arg;
- }
- elsif (!defined $name) {
- $name = $arg;
- }
- elsif (!defined $email) {
- $email = $arg;
- }
-}
-
-if (!defined $file) {
- if (defined $ENV{CL_CHANGELOG_FILE}) {
- $file = $ENV{CL_CHANGELOG_FILE};
- }
- else {
- $file = 'ChangeLog';
- }
-}
-if (!defined $name) {
- my(@pwd) = ();
- if (defined $ENV{CL_USERNAME}) {
- $pwd[6] = $ENV{CL_USERNAME};
- }
- else {
- if ($^O eq 'MSWin32' || $^O eq 'cygwin') {
- $pwd[6] = 'unknown';
- }
- else {
- @pwd = getpwuid($<);
- $pwd[6] =~ s/,//g;
- }
- }
- $name = $pwd[6];
-}
-
-if (!defined $email) {
- my($trans) = new EmailTranslator(getDefaultDomain());
- $email = $trans->translate($name);
-}
-
-my($editor) = new ChangeLogEdit($name, $email);
-my($status, $error, $unknown) = $editor->edit($file, @dirs);
-
-if (defined $unknown) {
- my(@uarray) = @$unknown;
- if ($#uarray >= 0) {
- print "WARNING: The following files are unknown to the ",
- "revision control system:\n";
- foreach my $unk (@uarray) {
- print "$unk\n";
- }
- print "\n";
- }
-}
-
-if ($status) {
- print "You are now ready to edit the $file.\n";
-}
-else {
- print "$error\n";
-}
-
-exit($status ? 0 : 1);