home *** CD-ROM | disk | FTP | other *** search
- From decwrl!ucbvax!agate!eos!ames!nrl-cmf!mailrus!cwjcc!hal!ncoast!allbery Sun Nov 27 00:29:47 PST 1988
- Article 734 of comp.sources.misc:
- Path: granite!decwrl!ucbvax!agate!eos!ames!nrl-cmf!mailrus!cwjcc!hal!ncoast!allbery
- From: gore@eecs.UUCP (Jacob Gore)
- Newsgroups: comp.sources.misc
- Subject: v05i058: A safe comp.mail.maps saver
- Message-ID: <8811251934.aa26419@gamma.eecs.nwu.edu>
- Date: 26 Nov 88 04:42:57 GMT
- Sender: allbery@ncoast.UUCP
- Reply-To: gore@eecs.UUCP (Jacob Gore)
- Lines: 108
- Approved: allbery@ncoast.UUCP
-
- Posting-number: Volume 5, Issue 58
- Submitted-by: "Jacob Gore" <gore@eecs.UUCP>
- Archive-name: savemap.nawk
-
- [Wants the "new" awk. I'll probably translate it myself later. ++bsa]
-
- # This is a shell archive. Remove anything before this line,
- # then unpack it by saving it in a file and typing "sh file".
- #
- # Wrapped by gore at gamma.eecs.nwu.edu on Fri Nov 25 19:32:52 1988
- #
- # This archive contains:
- # README savemap
- #
-
- echo x - README
- cat >README <<'@EOF'
- This sh/awk script can be used to safely save map shars posted to
- comp.mail.maps in some directory. It does not execute the shars, but
- extracts the map files from them.
-
- It has hard-wired "knowledge" of what the current official map shars look
- like. On the down side, this means that should the format ever change,
- this script will probably have to be changed too. On the up side, the
- worst some joker can do is overwrite your maps with junk or with fake maps.
- The script does not even attempt to verify the poster of the shar.
-
- It uses the new awk (as described in whe A., W. & K. book).
-
- To configure it, modify the "Customization:" paragraph near the beginning
- of the script.
-
- To use it, just pipe an article from comp.mail.maps into it. This can be
- done automatically, by having your system send news to a fake host (such as
- "uumap") and use this script as the command for transmission.
-
- Jacob Gore Gore@EECS.NWU.Edu
- Northwestern Univ., EECS Dept. {oddjob,gargoyle,att}!nucsrl!gore
- @EOF
-
- chmod 644 README
-
- echo x - savemap
- cat >savemap <<'@EOF'
- #!/bin/sh -
- PATH=/bin
- IFS="
- "
-
- # Saves a map posting from comp.mail.maps in directory MapDir (specified
- # below).
- #
- # Jacob Gore <gore@eecs.nwu.edu> 88/11/25
-
- # Customization:
- MapDir=/usr/uumap
- Awk=/usr/local/bin/nawk
- Cd=cd
- Mv=/bin/mv
- Rm=/bin/rm
-
- TMP=tmp$$; export TMP
-
- $Cd $MapDir
-
- destination=`$Awk '
-
- BEGIN {
- while ($1 != "cat" && $2 != "<<" && $4 != ">") {
- getline;
- }
- split($3, tmp_array, "'\''");
- end_marker = tmp_array[2];
- destination = $5;
- "echo $TMP" | getline temp_file
- exit_status = 1;
- }
-
- $1 == end_marker {
- print destination
- exit_status = 0;
- exit(exit_status);
- }
-
- {
- print > temp_file
- }
-
- END {
- exit(exit_status);
- }
- '`
- status=$?
-
- if [ $status -eq 0 ]
- then
- $Mv -f $TMP $destination
- exit 0
-
- else
- $Rm -f $TMP
- exit $status
- fi
- @EOF
-
- chmod 755 savemap
-
- exit 0
-
-
-