home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume28
/
bmw-5
/
part01
/
ledit
< prev
next >
Wrap
Text File
|
1994-07-09
|
887b
|
54 lines
#! /usr/bin/perl
#
# List Editor ledit/dedit
#
# Edit the mailing list in a safe manner.
#
$USAGE = "$0 <list>";
if ($#ARGV < 0) {
print "USAGE: $USAGE\n";
exit(-1);
}
$EDITOR = "/usr/bin/vi";
$SDIR = "/home/bmw";
$EDITDIGEST = 0;
$LISTNAME = $ARGV[0];
if ($LISTNAME eq "-d") {
$EDITDIGEST = 1;
shift;
$LISTNAME = $ARGV[0];
}
$LISTNAME =~ tr/A-Z/a-z/;
$LISTDIR = $SDIR . "/" . $LISTNAME;
if (! -d $LISTDIR) {
print "I can't find $LISTDIR\n";
exit(-2);
}
$LISTFILE = $LISTDIR . "/subscribers";
$LISTFILE = $LISTFILE . ".d" if ($EDITDIGEST);
if (! -e $LISTFILE) {
print "I can't file $LISTFILE\n";
exit(-3);
}
$LOCKFILE = $LISTFILE . ".LOCK";
if (-e $LOCKFILE) {
print "$LISTFILE is currently locked by some other process.\n";
exit(-4);
}
system("touch $LOCKFILE");
system("$EDITOR $LISTFILE");
system("rm $LOCKFILE");
print "Have a nice day.\n";
exit(0);