diff options
Diffstat (limited to 'contrib/utils')
-rwxr-xr-x | contrib/utils/ansiprt.c | 60 | ||||
-rwxr-xr-x | contrib/utils/brk2pine.sh | 74 | ||||
-rwxr-xr-x | contrib/utils/mailtrfc.sh | 130 | ||||
-rwxr-xr-x | contrib/utils/pwd2pine | 73 | ||||
-rwxr-xr-x | contrib/utils/sendit.sh | 49 | ||||
-rw-r--r-- | contrib/utils/sendtoall | 49 | ||||
-rwxr-xr-x | contrib/utils/txtcc.sh | 85 |
7 files changed, 520 insertions, 0 deletions
diff --git a/contrib/utils/ansiprt.c b/contrib/utils/ansiprt.c new file mode 100755 index 00000000..17d6e068 --- /dev/null +++ b/contrib/utils/ansiprt.c @@ -0,0 +1,60 @@ +/* + * ansiprt.c + * + * Simple filter to wrap ANSI media copy escape sequences around + * text on stdin. Writes /dev/tty to get around things that might be + * trapping stdout. This is actually a feature because it was written + * to be used with pine's personal print option set up to take "enscript" + * output and send it displayward to be captured/printed to a postscript + * device. Pine, of course, uses popen() to invoke the personal print + * command, and interprets stdout as diagnostic messages from the command. + * + * Michael Seibel, mikes@cac.washington.edu + * + * 21 Apr 92 + * + */ +#include <stdio.h> +#include <sys/file.h> + +#define BUFSIZ 8192 + +main(argc, argv) +int argc; +char **argv; +{ + char c[BUFSIZ]; + int n, d; + int ctrld = 0; + + if(argc > 1){ + n = 0; + while(argc > ++n){ + if(argv[n][0] == '-'){ + switch(argv[n][1]){ + case 'd': + ctrld++; + break; + default : + fprintf(stderr,"unknown option: %c\n", argv[n][1]); + break; + } + } + } + } + + if((d=open("/dev/tty",O_WRONLY)) < 0){ + perror("/dev/tty"); + exit(1); + } + + write(d,"\033[5i", 4); + while((n=read(0, c, BUFSIZ)) > 0) + write(d, c, n); + + if(ctrld) + write(d, "\004", 1); + + write(d,"\033[4i", 4); + close(d); +} diff --git a/contrib/utils/brk2pine.sh b/contrib/utils/brk2pine.sh new file mode 100755 index 00000000..fab1f885 --- /dev/null +++ b/contrib/utils/brk2pine.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# +# T H E P I N E M A I L S Y S T E M +# +# Laurence Lundblade and Mike Seibel +# Networks and Distributed Computing +# Computing and Communications +# University of Washington +# Administration Building, AG-44 +# Seattle, Washington, 98195, USA +# Internet: lgl@CAC.Washington.EDU +# mikes@CAC.Washington.EDU +# +# Please address all bugs and comments to "pine-bugs@cac.washington.edu" +# +# Copyright 1989, 1990, 1991, 1992 University of Washington +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose and without fee to the University of +# Washington is hereby granted, provided that the above copyright notice +# appears in all copies and that both the above copyright notice and this +# permission notice appear in supporting documentation, and that the name of +# the University of Washington not be used in advertising or publicity +# pertaining to distribution of the software without specific, written prior +# permission. This software is made available "as is", and +# THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, +# WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN +# NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL, +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT +# (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION +# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# +# Pine is in part based on The Elm Mail System: +# *********************************************************************** +# * The Elm Mail System - $Revision: 2.13 $ $State: Exp $ * +# * * +# * Copyright (c) 1986, 1987 Dave Taylor * +# * Copyright (c) 1988, 1989 USENET Community Trust * +# *********************************************************************** +# +# + + + +# +# A filter to convert personal mail aliases in a .mailrc file into +# pine address book format. +# +# Usage: program [.mailrc] >> .addressbook +# +# Corey Satten, corey@cac.washington.edu, 9/25/91 +# +sed -n ' +# first fold continued lines (ending in \) into a single long line + /\\[ ]*$/ { + : more + s/\\//g + N + s/\n/ / + /\\/b more + } +# next convert all sequences of whitespace into single space + s/[ ][ ]*/ /g +# finally, reformat and print lines containing alias as the first word + /^ *alias / { + s/^ *alias \([!-~][!-~]*\) \(.*\)$/\1 \1 (\2)/ + s/ /,/g + s/(\([^,]*\))/\1/ + p + } +' ${*-$HOME/.mailrc} diff --git a/contrib/utils/mailtrfc.sh b/contrib/utils/mailtrfc.sh new file mode 100755 index 00000000..2ef69cdc --- /dev/null +++ b/contrib/utils/mailtrfc.sh @@ -0,0 +1,130 @@ +#!/bin/sh +# +# T H E P I N E M A I L S Y S T E M +# +# Laurence Lundblade and Mike Seibel +# Networks and Distributed Computing +# Computing and Communications +# University of Washington +# Administration Building, AG-44 +# Seattle, Washington, 98195, USA +# Internet: lgl@CAC.Washington.EDU +# mikes@CAC.Washington.EDU +# +# Please address all bugs and comments to "pine-bugs@cac.washington.edu" +# +# Copyright 1991, 1992 University of Washington +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose and without fee is hereby granted, provided +# that the above copyright notice appears in all copies and that both the +# above copyright notice and this permission notice appear in supporting +# documentation, and that the name of the University of Washington not be +# used in advertising or publicity pertaining to distribution of the software +# without specific, written prior permission. This software is made +# available "as is", and +# THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, +# WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN +# NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL, +# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT +# (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION +# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# +# Pine is in part based on The Elm Mail System: +# *********************************************************************** +# * The Elm Mail System - $Revision: 2.13 $ $State: Exp $ * +# * * +# * Copyright (c) 1986, 1987 Dave Taylor * +# * Copyright (c) 1988, 1989 USENET Community Trust * +# *********************************************************************** +# +# + + +# +# mailtrfc.sh -- A shell script to analyze the mail traffic as logged in +# /usr/spool/mqueue/syslog*. This currently as the University of Washington +# domains wired in and needs to be made more general. Also, lots more +# formats of message ID's could be added. +# + + + +org=`awk '/^domain/ {print $2}' < /etc/resolv.conf` +domain=`echo $org | sed -e 's/^[^.]*\.//'` +host=`hostname`".$org" + +echo "Domain: $domain" +echo "Organization: $org" +echo "Hostname: $host" + +sed -n -e '/message-id/s/^.*</</p' | +awk 'BEGIN {mailers[0] = "Other"; + mailers[1] = "Pine"; + mailers[2] = "MailManager"; + mailers[3] = "sendmail"; + mailers[4] = "BITNET"; + mailers[5] = "? news ?"; + mailers[6] = "Sprint"; + mailers[7] = "X.400"; + mailers[8] = "Mac MS"; + mailers[9] = "MMDF"; + mailers[10] = "Andrew"; + mailers[11] = "Columbia MM"; + mailers[12] = "Unknown #1"; + mailers[13] = "EasyMail"; + mailers[14] = "CompuServe"; + mailers[15] = "smail"; + mailers[16] = "MCI Mail"; + mailers[17] = "VAX MAIL(?)"; + mailers[18] = "Gator Mail (?)"; + mailers[19] = "TOTAL"; + max = 19;} + {mailer = 0;} + /^<Pine/ {mailer = 1;} + /^<MailManager/ {mailer = 2;} + /^<[12]?[90]?9[0-9]1?[0-9][1-3]?[0-9]+\.[AaBb][AaBb][0-9]+@/ {mailer = 3;} + /^<[0-9A-Z]+@/ {mailer = 4;} + /^<199[0-9][A-Za-z]..[0-9]*\./ {mailer = 5;} + /@sprint.com/ {mailer = 6;} + /\/[A-Z]*=.*\/[A-Z]*=.*/ {mailer = 7;} + /^<MacMS\.[0-9]+\.[0-9]+\.[a-z]+@/ {mailer = 8;} + /^<MAILQUEUE-[0-9]+\.[0-9]+/ {mailer = 9;} + /^<.[d-l][A-Z0-9a-z=_]+00[A-Za-z0-9_=]+@/ {mailer = 10;} + /^<CMM\.[0-9]+\.[0-9]+\.[0-9]+/ {mailer = 11 ;} + /^<9[0-9][JFMASOND][aepuco][nbrylgptvc][0-9][0-9]?\.[0-9]+[a-z]+\./ {mailer = 12;} + /^<EasyMail\.[0-9]+/ {mailer = 13;} + /@CompuServe.COM/ {mailer = 14;} + /^<m[A-Za-z0-9].....-[0-9A-Za-z].....C@/ {mailer = 15;} + /@mcimail.com/ {mailer = 16;} + /^<9[0-9][01][0-9][0-3][0-9][0-2][0-9][0-5][0-9][0-5][0-9].[0-9a-z]*@/ {mailer = 17;} + /^<0[0-9][0-9]+\.[0-9][0-9][0-9][0-9]+\.[0-9][0-9]+@/ {mailer=18;} + + + + '"/$domain>/"' {campus[mailer]++; campus[max]++} + '"/$org>/"' {u[mailer]++; u[max]++} + '"/$host>/"' {milton[mailer]++; milton[max]++} + {total[mailer]++; total[max]++} + {if(mailer == 0) printf("-->%s\n",$0)} + END { + for(m = 0; m <= max; m++) { + printf("%-10.10s", mailers[m]); + printf(" %11d %11d %11d %11d %11d (%3d%%)\n", milton[m], u[m] - milton[m], campus[m] -u[m], total[m] - campus[m], total[m], (total[m]*100)/total[max]); + } + printf(" ---- (%3d%%) (%3d%%) (%3d%%) (%3d%%)\n", (milton[max]*100)/total[max], ((u[max] - milton[max])*100)/total[max], ((campus[max] - u[max])*100)/total[max], ((total[max] - campus[max])*100)/total[max], (u[max]*100)/total[max]); + + }' > /tmp/syslogx.$$ + + +echo $host $org $domain | \ + awk '{printf(" %.17s %.11s %.11s Off Campus Total\n", $1, $2, $3)}' +egrep -v 'TOTAL|----|^-->' /tmp/syslogx.$$ | sort +0.60rn +egrep 'TOTAL|----' /tmp/syslogx.$$ +grep '^-->' /tmp/syslogx.$$ | sed -e 's/-->//' > other-traffic +rm -f /tmp/syslogx.$$ + + diff --git a/contrib/utils/pwd2pine b/contrib/utils/pwd2pine new file mode 100755 index 00000000..49b3de65 --- /dev/null +++ b/contrib/utils/pwd2pine @@ -0,0 +1,73 @@ +#!/usr/local/bin/perl +# +# passwd2pine - translate passwd to pine addressbook +# +# Author: Paul J Murphy <pjm@dcs.ed.ac.uk> +# +# The fullname field will end up falling into one of the following cases: +# +# Last, First - A person +# }group: fullname - A non-person (determined by group or uid/gid < 1024) +# ~user: fullname - A non-person (determined by username or fullname) +# +# This allows the output to be sorted by fullname, with administrative +# accounts left to last (ie the real people come first). +# +# The comment field will contain the groupname of the user, followed by +# anything from the gecos field which seems to be a comment and not part +# of the name. + +### Start of configurable stuff + +$domain = "dcs.ed.ac.uk"; + +# Regular expression for groups which don't contain people +# Case is significant. +# The expression must match the entire groupname string. +$non_people_groups = "local|misc|aliens|cs_dept|\\d*"; + +# Regular expression for users which are not people +# Case is significant. +# The expression must match the entire username string. +$non_people_users = ".*\\d.*"; + +# Regular expression for words within a fullname which signify a non-person +# Case is not significant. +# The expression must match an entire word within the gecos fullname. +$non_people_names = "account|admin|user|system|crew|test|dummy|\ +unit|department|student|project|.*\\d.*"; + +### End of configurable stuff + +while(<>) { + chop; + ($user, $passwd, $uid, $gid, $gecos, $homedir, $shell) = split(/:/, $_, 7); + unless ($gr_name = getgrgid($gid)) { + $gr_name = $gid; + } + + $nickname = $user; + + $fullname = $gecos; + $fullname =~ s/,.*//g; # Reduce gecos to fullname + $fullname =~ s/[._]/ /g; # Translate alternate name separators to space + if ($uid < 1024 || + $gid < 1024 || + $gr_name =~ /^($non_people_groups)$/o) { + $fullname = "}$gr_name: $fullname"; + } elsif ($user =~ /^($non_people_users)$/o || + $fullname =~ /\b($non_people_names)\b/io) { + $fullname = "~$user: $fullname"; + } elsif (($firstname, $lastname, $gecos_comment) = + ($fullname =~ /^(.*)[._ ]([^._ \d(][^._ \d]+)( *\(.*)?$/)) { + $fullname = "$lastname, $firstname"; + } + + $address = "$user\@$domain"; + +# $fcc = ""; + + $comment = "$gr_name$gecos_comment"; + + print "$nickname\t$fullname\t$address\t$fcc\t$comment\n"; +} diff --git a/contrib/utils/sendit.sh b/contrib/utils/sendit.sh new file mode 100755 index 00000000..a8600f00 --- /dev/null +++ b/contrib/utils/sendit.sh @@ -0,0 +1,49 @@ +#! /bin/sh +# +# $Id:$ +# +# T H E P I N E M A I L S Y S T E M +# +# Mike Seibel +# Networks and Distributed Computing +# Computing and Communications +# University of Washington +# Administration Building, AG-44 +# Seattle, Washington, 98195, USA +# Internet: mikes@CAC.Washington.EDU +# +# Please address all bugs and comments to "pine-bugs@cac.washington.edu" +# +# +# Pine and Pico are registered trademarks of the University of Washington. +# No commercial use of these trademarks may be made without prior written +# permission of the University of Washington. +# +# Pine, Pico, and Pilot software and its included text are Copyright +# 1989-1996 by the University of Washington. +# +# The full text of our legal notices is contained in the file called +# CPYRIGHT, included with this distribution. +# + + +# +# Simple script to expedite mail posting at the expense of timely +# error reporting and 8BITMIME support. +# +# NOTE: If for any reason POSTFILE below is created on an nfs mounted +# file system, the trap statement below must get removed or +# altered, and the last line must get replaced with: +# +# ( ${POSTTOOL} ${POSTARGS} < ${POSTFILE} ; rm -f ${POSTFILE} ) & +# + +POSTFILE=/tmp/send$$ +POSTTOOL=/usr/lib/sendmail +POSTARGS="-oi -oem -t" + +umask 077 +trap "rm -f ${POSTFILE}; exit 0" 0 1 2 13 15 + +cat > ${POSTFILE} +${POSTTOOL} ${POSTARGS} < ${POSTFILE} & diff --git a/contrib/utils/sendtoall b/contrib/utils/sendtoall new file mode 100644 index 00000000..f929f527 --- /dev/null +++ b/contrib/utils/sendtoall @@ -0,0 +1,49 @@ +Date: 13 Sep 1996 22:49:40 GMT +From: William Burrow <aa126@fan1.fan.nb.ca> +To: pine-info@cac.washington.edu +Subject: Re: Composing mail to all entries in addressbook + +Ari Y. Weintraub (aweintra@umabnet.ab.umd.edu) wrote: +: Is there any way in Pine 3.94 to compose mail to all of the entries in my +: addressbook. For example, I recently changed my phone number and would +: like to send one message to everybody with the new number. I can't find a +: way to do this - does anyone out there have any idea? TIA + +This would be a nice suggestion for Pine, however, you can do pretty much +the same in Unix using the following awk script. Copy everything between the +lines into a file named: everyone + +-------------%< clip -------------- +{ + printf("everyone\tEveryone\t("); + + if ( $0 ~ /\(/ ) + continue + else + printf("%s", $1); + + while ( getline > 0 ) { + if ( $0 ~ /\(/ ) + continue + else + printf(",%s", $1); + } + printf(")\n"); +} +-------------%< clip -------------- + +Now, type the following exactly at the Unix prompt: + +awk -f everyone < ~/.addressbook >> ~/.addressbook && echo Done. + +You may wish to first copy your ~/.addressbook file to a backup file, +before executing this command. + +If everything went well, it should say Done. When you start Pine, there +should now be a list in your address book with the name: everyone, +containing all of your address book nicknames (but NOT other lists). + + +-- +-- +William Burrow -- Fredericton Area Network diff --git a/contrib/utils/txtcc.sh b/contrib/utils/txtcc.sh new file mode 100755 index 00000000..0d1bb8c9 --- /dev/null +++ b/contrib/utils/txtcc.sh @@ -0,0 +1,85 @@ +#!/bin/sh + +# On ultrix, this will compile string constants into the text segment +# where they can be shared. Use to build pine by saying: +# +# build CC=txtcc gul +# +# As of Pine4.03, this moves about 675k per process into sharable memory +# +# Corey Satten, corey@cac.washington.edu, 9/11/98 + +TMP1=/tmp/cc$$.s +TMP2=/tmp/cc$$.delayed +trap "rm -f $TMP1 $TMP2" 0 1 2 13 15 + + +for i in "$@"; do + case "$oflag//$i" in + //-c) cflag=1;; + //-o) oflag=1;; + //-g) gflag=1;; + 1//*) ofile="$i"; oflag=;; + //*.c) cfile="$i"; : ${ofile=`basename $i .c`.o};; + esac +done + +case "$cflag" in + 1) sfile=`basename $ofile .o`.s + gcc -S "$@" + + # Postprocess assembly language to move strings to .text segment. + # + # Use sed to collect .ascii statements and their preceding label + # and .align and emit those to $TMP2, the rest to $TMP1. + # + # Start in state0 + # In state0: if .align is seen -> state1; else print, -> state0 + # In state1: if a label is seen -> state2; else -> punt + # In state2: if .ascii is seen -> state3; else -> punt + # In state3: if .ascii is seen -> state4; else write TMP2, -> state0 + # In state4: append to buffer, -> state3 + # In state punt: print unprinted lines, -> state0 + # + sed ' + : state0 + /^[ ][ ]*\.align/ b state1 + b + + : state1 + h + N; s/^[^\n]*\n//; H + /^[!-~]*:/ b state2 + b punt + + : state2 + N; s/^[^\n]*\n//; H + /^[ ][ ]*\.ascii/ b state3 + b punt + + : state3 + N; s/^[^\n]*\n// + /^[ ][ ]*\.ascii/ b state4 + x + w '"$TMP2"' + x + b state0 + + : state4 + H + b state3 + + : punt + x + ' $sfile > $TMP1 + + # now add the deferred .ascii statements to .text segment in $TMP1 + echo ' .text' >> $TMP1 + cat $TMP2 >> $TMP1 + + rm `basename $ofile .o`.s + gcc ${gflag+"-g"} -c -o $ofile $TMP1 + ;; + *) gcc "$@" + ;; +esac |