From 8bfc5756fb68e0b13d7e7c0073ad5b9a4790d1b6 Mon Sep 17 00:00:00 2001 From: rmanfredi Date: Thu, 24 Aug 2006 12:32:52 +0000 Subject: Moving project to sourceforge. git-svn-id: https://dist.svn.sourceforge.net/svnroot/dist/trunk/dist@1 190e5f8e-a817-0410-acf6-e9863daed9af --- pl/comment.pl | 46 ++++++++++++++++++++++++++++++++++ pl/copyright.pl | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ pl/editor.pl | 23 +++++++++++++++++ pl/fullname.pl | 49 ++++++++++++++++++++++++++++++++++++ pl/listedit.pl | 36 ++++++++++++++++++++++++++ pl/logname.pl | 24 ++++++++++++++++++ pl/makedir.pl | 29 +++++++++++++++++++++ pl/manifake.pl | 42 +++++++++++++++++++++++++++++++ pl/newer.pl | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pl/package.pl | 40 +++++++++++++++++++++++++++++ pl/patseq.pl | 27 ++++++++++++++++++++ pl/profile.pl | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++ pl/rangeargs.pl | 48 +++++++++++++++++++++++++++++++++++ pl/rcsargs.pl | 60 ++++++++++++++++++++++++++++++++++++++++++++ pl/snapshot.pl | 28 +++++++++++++++++++++ pl/tilde.pl | 25 ++++++++++++++++++ pl/users.pl | 48 +++++++++++++++++++++++++++++++++++ 17 files changed, 747 insertions(+) create mode 100644 pl/comment.pl create mode 100644 pl/copyright.pl create mode 100644 pl/editor.pl create mode 100644 pl/fullname.pl create mode 100644 pl/listedit.pl create mode 100644 pl/logname.pl create mode 100644 pl/makedir.pl create mode 100644 pl/manifake.pl create mode 100644 pl/newer.pl create mode 100644 pl/package.pl create mode 100644 pl/patseq.pl create mode 100644 pl/profile.pl create mode 100644 pl/rangeargs.pl create mode 100644 pl/rcsargs.pl create mode 100644 pl/snapshot.pl create mode 100644 pl/tilde.pl create mode 100644 pl/users.pl (limited to 'pl') diff --git a/pl/comment.pl b/pl/comment.pl new file mode 100644 index 0000000..2059466 --- /dev/null +++ b/pl/comment.pl @@ -0,0 +1,46 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: comment.pl,v $ +;# Revision 3.0 1993/08/18 12:10:50 ram +;# Baseline for dist 3.0 netwide release. +;# +;# +sub rcscomment { + local($file) = @_; + local($comment) = ''; + open(FILE,$file); + while () { + if (/^(.*)\$Log[:\$]/) { # They know better than us (hopefully) + $comment = $1; + last; + } + } + close FILE; + unless ($comment) { + if ($file =~ /\.SH$|[Mm]akefile/) { # Makefile template + $comment = '# '; + } elsif ($file =~ /\.U$/) { # Metaconfig unit + $comment = '?RCS: '; + } elsif ($file =~ /\.man$/) { # Manual page + $comment = "''' "; + } elsif ($file =~ /\.\d\w?$/) { # Manual page + $comment = "''' "; + } elsif ($file =~ /\.[chyl]$/) { # C source + $comment = " * "; + } elsif ($file =~ /\.e$/) { # Eiffel source + $comment = "-- "; + } elsif ($file =~ /\.pl$/) { # Perl library + $comment = ";# "; + } + } + $comment; +} + diff --git a/pl/copyright.pl b/pl/copyright.pl new file mode 100644 index 0000000..5216048 --- /dev/null +++ b/pl/copyright.pl @@ -0,0 +1,71 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: copyright.pl,v $ +;# Revision 3.0 1993/08/18 12:10:51 ram +;# Baseline for dist 3.0 netwide release. +;# +;# +;# Copyright expansion. The @COPYRIGHT@ symbol is expanded the first time +;# it is seen in a file, and before the $Log RCS marker is reached. The +;# automaton needs to be reset for each file. +;# +package copyright; + +# Read in copyright file +sub init { + local($file) = @_; # Copyright file + undef @copyright; + open(COPYRIGHT, $file) || die "Can't open $file: $!\n"; + chop(@copyright = ); + close COPYRIGHT; +} + +# Reset the automaton for a new file. +sub reset { + $copyright_seen = @copyright ? 0 : 1; + $marker_seen = 0; +} + +# Filter file, line by line, and expand the copyright string. The @COPYRIGHT@ +# symbol may be preceded by some random comment. A leader can be defined and +# will be pre-pended to all the input lines. +sub filter { + local($line, $leader) = @_; # Leader is optional + return $leader . $line if $copyright_seen || $marker_seen; + $marker_seen = 1 if $line =~ /\$Log[:\$]/; + $copyright_seen = 1 if $line =~ /\@COPYRIGHT\@/; + return $leader . $line unless $copyright_seen; + local($comment, $trailer) = $line =~ /^(.*)\@COPYRIGHT\@\s*(.*)/; + $comment = $leader . $comment; + $comment . join("\n$comment", @copyright) . "\n"; +} + +# Filter output of $cmd redirected into $file by expanding copyright, if any. +sub expand { + local($cmd, $file) = @_; + if (@copyright) { + open(CMD,"$cmd|") || die "Can't start '$cmd': $!\n"; + open(OUT, ">$file") || die "Can't create $file: $!\n"; + &reset; + local($_); + while () { + print OUT &filter($_); + } + close OUT; + close CMD; + } else { + system "$cmd > $file"; + die "Command '$cmd' failed!" if $?; + } +} + +package main; + diff --git a/pl/editor.pl b/pl/editor.pl new file mode 100644 index 0000000..4c59cc4 --- /dev/null +++ b/pl/editor.pl @@ -0,0 +1,23 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: editor.pl,v $ +;# Revision 3.0.1.1 1993/08/25 14:08:07 ram +;# patch6: created +;# +# Compute suitable editor name +sub geteditor { + local($editor) = $ENV{'VISUAL'}; + $editor = $ENV{'EDITOR'} unless $editor; + $editor = $defeditor unless $editor; + $editor = 'vi' unless $editor; + $editor; +} + diff --git a/pl/fullname.pl b/pl/fullname.pl new file mode 100644 index 0000000..3305d10 --- /dev/null +++ b/pl/fullname.pl @@ -0,0 +1,49 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: fullname.pl,v $ +;# Revision 3.0 1993/08/18 12:10:52 ram +;# Baseline for dist 3.0 netwide release. +;# +;# +sub getfullname { + local($logname) = @_; + local($foo,$bar); + if ($ENV{'NAME'}) { + $ENV{'NAME'}; + } else { + open(PASSWD,'/etc/passwd') || die "Can't open /etc/passwd"; + while () { + /(\w+):/; + last if $1 eq $logname; + } + close PASSWD; + local($login,$passwd,$uid,$gid,$gcos,$home,$shell) = split(/:/); + if (-f "$home/.fullname") { + open(FN,"$home/.fullname"); + chop($foo = ); + close FN; + $foo; + } elsif ($nametype eq 'bsd') { + $gcos =~ s/[,;].*//; + if ($gcos =~ /&/) { # oh crud + ($foo,$bar) = ($logname =~ /(.)(.*)/); + $foo =~ y/a-z/A-Z/; + $gcos =~ s/&/$foo$bar/; + } + $gcos; + } else { + $gcos =~ s/[(].*//; + $gcos =~ s/.*-//; + $gcos; + } + } +} + diff --git a/pl/listedit.pl b/pl/listedit.pl new file mode 100644 index 0000000..4eb5c81 --- /dev/null +++ b/pl/listedit.pl @@ -0,0 +1,36 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: listedit.pl,v $ +;# Revision 3.0.1.2 1993/08/27 14:40:57 ram +;# patch7: forgot to unlink temporary file +;# +;# Revision 3.0.1.1 1993/08/25 14:08:12 ram +;# patch6: created +;# +;# Requires geteditor.pl +;# +# Allow user to inplace-edit a list of items held in an array +sub listedit { + local(*list) = @_; + local($tmp) = "/tmp/dist.$$"; + local($editor) = &geteditor; + open(TMP, ">$tmp") || die "Can't create $tmp: $!\n"; + foreach $item (@list) { + print TMP $item, "\n"; + } + close TMP; + system "$editor $tmp"; + open(TMP, "$tmp") || die "Can't reopen $tmp: $!\n"; + chop(@list = ); + close TMP; + unlink $tmp; +} + diff --git a/pl/logname.pl b/pl/logname.pl new file mode 100644 index 0000000..70e3a03 --- /dev/null +++ b/pl/logname.pl @@ -0,0 +1,24 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: logname.pl,v $ +;# Revision 3.0 1993/08/18 12:10:53 ram +;# Baseline for dist 3.0 netwide release. +;# +;# +sub getlogname { + local($logname) = $ENV{'USER'}; + $logname = $ENV{'LOGNAME'} unless $logname; + chop($logname = `who am i`) unless $logname; + $logname =~ s/\s.*//; + $logname =~ s/.*!//; + $logname; +} + diff --git a/pl/makedir.pl b/pl/makedir.pl new file mode 100644 index 0000000..a358deb --- /dev/null +++ b/pl/makedir.pl @@ -0,0 +1,29 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: makedir.pl,v $ +;# Revision 3.0 1993/08/18 12:10:54 ram +;# Baseline for dist 3.0 netwide release. +;# +;# +# Make directories for files +# E.g, for /usr/lib/perl/foo, it will check for all the +# directories /usr, /usr/lib, /usr/lib/perl and make +# them if they do not exist. +sub makedir { + local($_) = shift; + local($dir) = $_; + if (!-d && $_ ne '') { + # Make dirname first + do makedir($_) if s|(.*)/.*|\1|; + mkdir($dir, 0700) if ! -d $dir; + } +} + diff --git a/pl/manifake.pl b/pl/manifake.pl new file mode 100644 index 0000000..1096adf --- /dev/null +++ b/pl/manifake.pl @@ -0,0 +1,42 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: manifake.pl,v $ +;# Revision 3.0 1993/08/18 12:10:55 ram +;# Baseline for dist 3.0 netwide release. +;# +;# +sub manifake { + # make MANIFEST and MANIFEST.new say the same thing + if (! -f $NEWMANI) { + if (-f $MANI) { + open(IN,$MANI) || die "Can't open $MANI"; + open(OUT,">$NEWMANI") || die "Can't create $NEWMANI"; + while () { + if (/---/) { + # Everything until now was a header... + close OUT; + open(OUT,">$NEWMANI") || + die "Can't recreate $NEWMANI"; + next; + } + s/^\s*(\S+\s+)[0-9]*\s*(.*)/$1$2/; + print OUT; + print OUT "\n" unless /\n$/; # If no description + } + close IN; + close OUT; + } + else { +die "You need to make a $NEWMANI file, with names and descriptions.\n"; + } + } +} + diff --git a/pl/newer.pl b/pl/newer.pl new file mode 100644 index 0000000..21839d2 --- /dev/null +++ b/pl/newer.pl @@ -0,0 +1,78 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: newer.pl,v $ +;# Revision 3.0.1.2 1994/01/24 14:33:48 ram +;# patch16: now also aborts when .newer file holds a single new-line +;# +;# Revision 3.0.1.1 1993/09/09 11:51:07 ram +;# patch9: now skips the 'users' file when computing newest file list +;# +;# Revision 3.0 1993/08/18 12:10:56 ram +;# Baseline for dist 3.0 netwide release. +;# +;# +sub newer { + open(FIND, "find . -type f -newer patchlevel.h -print | sort |") || + die "Can't run find.\n"; + open(NEWER,">.newer") || die "Can't create .newer.\n"; + open(MANI,"MANIFEST.new"); + while () { + ($name,$foo) = split; + $mani{$name} = 1; + } + close MANI; + while () { + s|^\./||; + chop; + next if m|^MANIFEST|; + next if m|^PACKLIST$|; + if (!$mani{$_}) { + next if m|^MANIFEST.new$|; + next if m|^Changes$|; + next if m|^Wanted$|; + next if m|^.package$|; + next if m|^bugs|; + next if m|^users$|; + next if m|^UU/|; + next if m|^RCS/|; + next if m|/RCS/|; + next if m|^config.sh$|; + next if m|/config.sh$|; + next if m|^make.out$|; + next if m|/make.out$|; + next if m|^all$|; + next if m|/all$|; + next if m|^core$|; + next if m|/core$|; + next if m|^toto|; + next if m|/toto|; + next if m|^\.|; + next if m|/\.|; + next if m|\.o$|; + next if m|\.old$|; + next if m|\.orig$|; + next if m|~$|; + next if $mani{$_ . ".SH"}; + next if m|(.*)\.c$| && $mani{$1 . ".y"}; + next if m|(.*)\.c$| && $mani{$1 . ".l"}; + next if (-x $_ && !m|^Configure$|); + } + print NEWER $_,"\n"; + } + close FIND; + close NEWER; + print "Please remove unwanted files...\n"; + sleep(2); + system '${EDITOR-vi} .newer'; + die "Aborted.\n" unless -s '.newer' > 1; + @ARGV = split(' ',`cat .newer`); +} + diff --git a/pl/package.pl b/pl/package.pl new file mode 100644 index 0000000..ba52e1a --- /dev/null +++ b/pl/package.pl @@ -0,0 +1,40 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: package.pl,v $ +;# Revision 3.0 1993/08/18 12:10:57 ram +;# Baseline for dist 3.0 netwide release. +;# +;# +sub readpackage { + if (! -f '.package') { + if ( + -f '../.package' || + -f '../../.package' || + -f '../../../.package' || + -f '../../../../.package' + ) { + die "Run in top level directory only.\n"; + } else { + die "No .package file! Run packinit.\n"; + } + } + open(PACKAGE,'.package'); + while () { + next if /^:/; + next if /^#/; + if (($var,$val) = /^\s*(\w+)=(.*)/) { + $val = "\"$val\"" unless $val =~ /^['"]/; + eval "\$$var = $val;"; + } + } + close PACKAGE; +} + diff --git a/pl/patseq.pl b/pl/patseq.pl new file mode 100644 index 0000000..6647695 --- /dev/null +++ b/pl/patseq.pl @@ -0,0 +1,27 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: patseq.pl,v $ +;# Revision 3.0.1.1 1993/08/24 12:22:14 ram +;# patch3: created +;# +;# +# Compute patch sequence by scanning the bugs directory and looking for +# .logs and/or .mods files to determine what was the last issued patch series. +sub patseq { + local($cur) = @_; # Current patch level + local(@seq); # Issued patch sequence + local($i); + for ($i = 1; $i <= $cur; $i++) { + push(@seq, $i) if -f "bugs/.logs$i" || -f "bugs/.mods$i"; + } + @seq; +} + diff --git a/pl/profile.pl b/pl/profile.pl new file mode 100644 index 0000000..5a588ff --- /dev/null +++ b/pl/profile.pl @@ -0,0 +1,73 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: profile.pl,v $ +;# Revision 3.0.1.1 1994/01/24 14:33:53 ram +;# patch16: created +;# +;# +;# Dist profile management (works like MH and its ~/.mh_profile): +;# - Profile name is held in the environment variable DIST. If not defined, +;# use ~/.dist_profile by default. +;# - Each line in the profile not starting with a '#' (comment line) should +;# have the following format: +;# progname: additional command line options +;# The profile is parsed once when the command is launched and profile +;# options are added at the beginning of the @ARGV array. +;# +;# Per-program configuration values may be also be added. For instance, +;# program foo may pay attention to a profile component 'bar', which may be +;# set via: +;# foo-bar: value +;# i.e. the program name is followed by a '-', followed by the profile +;# component. +;# +;# Uses &tilda_expand to perform ~name substitution. +;# Requires shellwords.pl to properly quote shell words (perl library). +;# +# Set up profile components into %Profile, add any profile-supplied options +# into @ARGV and return the command invocation name. +sub profile { + local($profile) = &tilda_expand($ENV{'DIST'} || '~/.dist_profile'); + local($me) = $0; # Command name + $me =~ s|.*/(.*)|$1|; # Keep only base name + return $me unless -s $profile; + local(*PROFILE); # Local file descriptor + local($options) = ''; # Options we get back from profile + unless (open(PROFILE, $profile)) { + warn "$me: cannot open $profile: $!\n"; + return; + } + local($_); + local($component); + while () { + next if /^\s*#/; # Skip comments + next unless /^$me/o; + if (s/^$me://o) { # progname: options + chop; + $options .= $_; # Merge options if more than one line + } + elsif (s/^$me-([^:]+)://o) { # progname-component: value + $component = $1; + chop; + s/^\s+//; # Trim leading and trailing spaces + s/\s+$//; + $Profile{$component} = $_; + } + } + close PROFILE; + return unless $options; + require 'shellwords.pl'; + local(@opts); + eval '@opts = &shellwords($options)'; # Protect against mismatched quotes + unshift(@ARGV, @opts); + return $me; # Return our invocation name +} + diff --git a/pl/rangeargs.pl b/pl/rangeargs.pl new file mode 100644 index 0000000..9212f84 --- /dev/null +++ b/pl/rangeargs.pl @@ -0,0 +1,48 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: rangeargs.pl,v $ +;# Revision 3.0 1993/08/18 12:10:58 ram +;# Baseline for dist 3.0 netwide release. +;# +;# +sub rangeargs { + local($result) = ''; + local($min,$max,$_); + open(PL,"patchlevel.h") || die "Can't open patchlevel.h\n"; + while () { + $maxspec = $1 if /^#define\s+PATCHLEVEL\s+(\d+)/; + } + close PL; + die "Malformed patchlevel.h file.\n" if $maxspec eq ''; + while ($#_ >= 0) { + $_ = shift(@_); + while (/^\s*\d/) { + s/^\s*(\d+)//; + $min = $1; + if (s/^,//) { + $max = $min; + } elsif (s/^-(\d*)//) { + $max = $1; + if ($max == 0 && $maxspec) { + $max = $maxspec; + } + s/^[^,],?//; + } else { + $max = $min; + } + for ($i = $min; $i <= $max; ++$i) { + $result .= $i . ' '; + } + } + } + $result; +} + diff --git a/pl/rcsargs.pl b/pl/rcsargs.pl new file mode 100644 index 0000000..8fdeab1 --- /dev/null +++ b/pl/rcsargs.pl @@ -0,0 +1,60 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: rcsargs.pl,v $ +;# Revision 3.0 1993/08/18 12:11:01 ram +;# Baseline for dist 3.0 netwide release. +;# +;# +sub rcsargs { + local($result) = ''; + local($_); + while ($_ = shift(@_)) { + if ($_ =~ /^-/) { + $result .= $_ . ' '; + } elsif ($#_ >= 0 && do equiv($_,$_[0])) { + $result .= $_ . ' ' . $_[0] . ' '; + shift(@_); + } else { + $result .= $_ . ' ' . do other($_) . ' '; + } + } + $result; +} + +sub equiv { + local($s1, $s2) = @_; + $s1 =~ s|.*/||; + $s2 =~ s|.*/||; + if ($s1 eq $s2) { + 0; + } elsif ($s1 =~ s/$RCSEXT$// || $s2 =~ s/$RCSEXT$//) { + $s1 eq $s2; + } else { + 0; + } +} + +sub other { + local($s1) = @_; + ($dir,$file) = ('./',$s1) unless local($dir,$file) = ($s1 =~ m|(.*/)(.*)|); + $dir = $TOPDIR . $dir if -d $TOPDIR . "$dir/RCS"; + local($wasrcs) = ($file =~ s/$RCSEXT$//); + if ($wasrcs) { + `mkdir $dir` unless -d $dir; + $dir =~ s|RCS/||; + } else { + $dir .= 'RCS/'; + `mkdir $dir` unless -d $dir; + $file .= $RCSEXT; + } + "$dir$file"; +} + diff --git a/pl/snapshot.pl b/pl/snapshot.pl new file mode 100644 index 0000000..8eb40d9 --- /dev/null +++ b/pl/snapshot.pl @@ -0,0 +1,28 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: snapshot.pl,v $ +;# Revision 3.0.1.1 1993/08/24 12:22:34 ram +;# patch3: created +;# +# Read snapshot file and build %Snap, indexed by file name -> RCS revision +sub readsnapshot { + local($snap) = @_; + open(SNAP, $snap) || warn "Can't open $snap: $!\n"; + local($_); + local($file, $rev); + while () { + next if /^#/; + ($file, $rev) = split; + $Snap{$file} = "$rev"; + } + close SNAP; +} + diff --git a/pl/tilde.pl b/pl/tilde.pl new file mode 100644 index 0000000..0890ffb --- /dev/null +++ b/pl/tilde.pl @@ -0,0 +1,25 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: tilde.pl,v $ +;# Revision 3.0 1993/08/18 12:11:01 ram +;# Baseline for dist 3.0 netwide release. +;# +;# +# Perform ~name expansion ala ksh... +# (banish csh from your vocabulary ;-) +sub tilda_expand { + local($path) = @_; + return $path unless $path =~ /^~/; + $path =~ s:^~([^/]+):(getpwnam($1))[$[+7]:e; # ~name + $path =~ s:^~:$ENV{'HOME'} || (getpwuid($<))[$[+7]:e; # ~ + $path; +} + diff --git a/pl/users.pl b/pl/users.pl new file mode 100644 index 0000000..807e0dc --- /dev/null +++ b/pl/users.pl @@ -0,0 +1,48 @@ +;# $Id$ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# Original Author: Graham Stoney +;# +;# $Log: users.pl,v $ +;# Revision 3.0.1.2 1993/11/10 17:41:37 ram +;# patch14: adapted users file format to new @SH package command +;# +;# Revision 3.0.1.1 1993/08/24 12:23:19 ram +;# patch3: added some comments about the users file format +;# patch3: random cleanup +;# +;# Revision 3.0 1993/08/18 12:11:02 ram +;# Baseline for dist 3.0 netwide release. +;# +;# The users file, as built by mailagent upon reception of an '@SH package' +;# command contains a list of e-mail addresses, prefixed by a single letter. +;# Users tagged with 'U' or 'L' are plain users, those with 'M' wish to +;# receive issued patches by e-mail while 'N' users simply want to be notified +;# when a new patch is released; +;# +sub readusers { + return unless open(USERS, 'users'); + local($_); + local($status, $name, $pl); + while () { + next if /^#/; + chop if /\n$/; # Emacs may leave final line without \n + ($status, $pl, $name) = split; + # Handle oldstyle two-field user file format (PL13 and before) + $name = $pl unless defined $name; + if ($status eq 'M') { + $recipients = $recipients ? "$recipients $name" : $name; + } elsif ($status eq 'N') { + $notify = $notify ? "$notify $name" : $name; + } + } + close USERS; +} + -- cgit v1.2.3