bandy@well.sf.ca.us (Andrew Scott Beals) (04/13/90)
#! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # README # SHAR # scribble2 # scribble2_worker.c # This archive created: Fri Apr 13 09:51:37 1990 export PATH; PATH=/bin:/usr/bin:$PATH if test -f 'README' then echo shar: "will not over-write existing file 'README'" else cat << \SHAR_EOF > 'README' scribble2, a gift to picospan users, written by Andrew Scott Beals One of the Tenants of life here on the WELL is simple: You Own Your Own Words. This means that you are responsible for them. This also means that you may withdraw them at any time. If you have been participating in a conferencing system for a long time, in my case over four years, you find that you have visited many conferences and made many entries into the system. Going around, looking for and removing these postings can take quite some time, too long for this programmer. So I have automated the task of: 1. Finding all of your postings 2. Determining which have already been censored/scribbled. 3. Censoring and scribbling the remainder. scribble2 takes one argument, the name of a file that has the names of the conferences in which you wish to censor and scribble your words. After answering the three questions, it will then put itself into the background and send you two pieces of mail - one containing the standard output [which topics you censored yourself in] and the other with the standard error output, which contains error messages like "can't censor in frozen topics". Note that this tickles a "feature" in picospan in that Marcus Watts decided that it would be best if everyone knew that someone had censored or scribbled a posting in a quiescent topic. Thus, the topic header shows up but no new postings show, as there aren't really any new postings to show. CAVEATS: This program runs on BSD. The only BSD-ism in the code, I believe, is that it calls mail program /usr/ucb/Mail and expects that it can take the -s "subject text" argument. The latter is not a necessary feature. scribble2_worker can easily be modified into a "find all of my [or a specified user's] postings and report" program. I may still do this today, If only so that I may ask that all of my postings in the frozen topics may be scribbled. SHAR_EOF fi if test -f 'SHAR' then echo shar: "will not over-write existing file 'SHAR'" else cat << \SHAR_EOF > 'SHAR' SHAR_EOF fi if test -f 'scribble2' then echo shar: "will not over-write existing file 'scribble2'" else cat << \SHAR_EOF > 'scribble2' #!/bin/sh # scribble2 by Andrew Scott Beals. Written 12 April 1990 cwd=`pwd` PATH=:$PATH:$cwd:$cwd/c:/usr2/bandy/picoscan:/usr2/bandy/picoscan/c:/usr2/bandy/bin: export PATH user=`whoami` conflist=$1 echo -n 'Are you sure you want to perform a mass censor/scribble? (yes or no) ' read y if [ "X$y" != Xyes ] ; then exit fi echo -n "Are you truely sure you want to delete every word you've said? " read y if [ "X$y" != Xyes ] ; then exit fi echo -n "This is your last chance. Do you want to go on? " read y if [ "X$y" != Xyes ] ; then exit fi ( echo nopager for confs in `cat $conflist` do echo j $confs echo j echo d conf done echo quit ) | ( nice -1 pico -o -l -u | nice -1 awk ' /^Conference: / { cname=substr($3, 2, index($3, ")")-2) print "cd " $2 " ; nice -1 .scribble2_worker " cname " _* | nice -1 pico -l -u -n" }' | sh | /usr/ucb/Mail -s 'standard output' $USER ) 2>&1| /usr/ucb/Mail -s 'error output' $USER & SHAR_EOF chmod +x 'scribble2' fi if test -f 'scribble2_worker.c' then echo shar: "will not over-write existing file 'scribble2_worker.c'" else cat << \SHAR_EOF > 'scribble2_worker.c' /* * make pico commands to scribble every response of yours in a topic * * by Andrew Scott Beals <bandy@toad.com>, written 12 April 1990 * */ #include <stdio.h> char *getenv(), *index(), *rindex(), *getlogin(); main(argc, argv) char **argv; { register char *user=getenv("USER"), *s; register unsigned k, response, entered, resptype; FILE *fp; char line[32768]; if(argc < 3) { fprintf(stderr, "usage: %s conferencename files\n", *argv); exit(1); } printf("j %s\nset stay\n", argv[1]); for(k=2;k<argc;k++) { if((fp=fopen(argv[k], "r")) == NULL) { fprintf(stderr, "%s: can't open %s for input\n", *argv, argv[k]); continue; } response=0; entered=0; while(fgets(line, sizeof line, fp) != NULL) { if(line[0] != ',') continue; if(line[1]=='R') { resptype=line[5]; continue; } if(line[1]=='U') { if(resptype == '3') { response++; continue; } s=rindex(line, '\n'); if(s != NULL) *s='\0'; s=rindex(line, ','); if(s == NULL) { /* "Can't Happen" */ response++; continue; } if(!strcmp(s+1, user)) { if(!entered) { printf("r %s nor nof\n", argv[k]+1); entered=1; } printf("scribble %d\n", response); } response++; } } if(entered) printf("pre\n"); fclose(fp); } printf("quit\n"); exit(0); } SHAR_EOF fi exit 0 # End of shell archive