jph@ais.org (Joseph Hillenburg) (01/29/91)
Archive-Name: rot13/part01 Hello. This is a dual posting of a rot13 program and a unix chat program. I felt bored, so I took some existing source both ways and modified it. The rot13 program was originally by Scott Berry, and only ran under VMS. It only had the C source file. It now has a Makefile for UNIX, a Config.MMS file for VMS, and a .CLD file for VMS. It's only in beta at this point. I've still got to finish the part of the program that handles the .CLD. The Chat program was originally from Citadel/UX, and intended for a BBS environment. While not the best chat in the world, it is simple and easy to maintain. If you are the chat maintainer, you MUST be the first one to run it after you delete the chat.tmp file every so often. The chat.tmp file that's created serves two purposes: 1) to log the chat 2) to provide history capability // Joseph Hillenburg, Secretary, Bloomington Amiga Users Group \X/ joseph@valnet.UUCP jph@irie.ais.org jph@ai.mit.edu "Only Apple could slow down a 68030 chip" --Computer Shopper #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: README rot13.c Makefile descrip.mms rot13.cld chat # Wrapped by jph@irie.ais.org on Mon Jan 28 20:16:47 1991 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'README'\" else echo shar: Extracting \"'README'\" \(1983 characters\) sed "s/^X//" >'README' <<'END_OF_FILE' X X1.12j Rot13 01-28-91 X XNote: Although this is version 1.12j, it's still in beta test. I've still Xgot a few things to do to it, but when I finish it, I'll release it in a Xset of programs. X XCredits: X Scott Berry X Joseph Hillenburg X Earl Chew X Jayanth N. Anantharaman X XWhat is Rot13? X X Rot13 is a program to convert text files into rot13 format for Xusenet. This is often useful when you think you have some text that might Xbe offensive to some people. X XHow do I run Rot13? X X Just use the syntax: X X rot13 <infile> <outfile> X XWhere <infile> is the file to be processed, and <outfile> is the file to Xbe written to. X XWhat systems support Rot13? X X I have sucessfully compiled it on an IBM RT running BSD 4.3, a XSPARCstation running GNU, and some HP-9000's running GNU, as well as a XVAX 6440 running VMS 5.3-1. X XHow do I build Rot13? X X Under UNIX, just type 'make'. Under VMS, just type 'MMS' at the DCL Xprompt. It will automatically build itself. X XWhat about the compile time errors that my compiler _may_ give me? X X You may have an error that looks like this: X Xmain: Function has no return statement. X XI'd appreciate help on eliminating this so I can completely clean out the Xsource. X XNOTE ABOUT rot13.cld: X X It's not quite finished yet. I still have to finish that section. XFor now, under VMS, install ROT13 with a line in your login.com (or Xsylogin.com) that looks like: X X$ ROT13 :== <disk>:[DIR...]ROT13.EXE X XPretty soon, you'll only have to edit the .CLD file to point to the location Xof the executable and have a line in your login.com that resembles: X X$ SET COMMAND ROT13.CLD X XUsing CLDs is a much faster and efficient way to install it. X XPlease send bug fixes, etc to me in the form of context diffs. X X-joseph hillenburg X X // Joseph Hillenburg, Secretary, Bloomington Amiga Users Group X \X/ joseph@valnet.UUCP jph@irie.ais.org jph@ai.mit.edu X "Only Apple could slow down a 68030 chip" --Computer Shopper X END_OF_FILE if test 1983 -ne `wc -c <'README'`; then echo shar: \"'README'\" unpacked with wrong size! fi # end of 'README' fi if test -f 'rot13.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'rot13.c'\" else echo shar: Extracting \"'rot13.c'\" \(2330 characters\) sed "s/^X//" >'rot13.c' <<'END_OF_FILE' X/* X** X** rot13 X** rot13 is a program to convert text to rot13 format for UseNet, most X** generally for rec.humor, and the alt.sex.* groups. X** X** Feel free to make any mods, but please mail them to the people who have X** already worked on this. X** X** History: X** X** 11-21-90 X** Scott Berry (fxsdb@acad3.alaska.edu) X** Created. X** X** 11-23-90 X** Scott Berry (fxsdb@acad3.alaska.edu) X** Bug fixes. X** X** 01-16-91 X** Joseph Hillenburg (jph@ais.org) X** Ported to UNIX, now dynamically knows it's name. X** X** 01-20-91 X** Joseph Hillenburg (jph@ais.org) X** Gradually trying to move towards proper C syntax. :) X** X** 01-21-91 X** Joseph Hillenburg (jph@ais.org) X** Cleaning up code, adding a real version number. X** X** 01-21-91 X** Earl Chew (cechew@bruce.cs.monash.oz.au) X** Bug fixes. X** X** 01-25-91 X** Joseph Hillenburg (jph@ais.org) X** Bug fixes. X** X** Thanks to: X** Scott Berry (fxsdb@acad3.alaska.edu) X** Joseph Hillenburg (jph@ais.org) X** Earl Chew (cechew@bruce.cs.monash.oz.au) X** Jayanth N. Anantharaman (jayanth@ee.eng.ohio-state.edu) X** X*/ X X#include <ctype.h> X#include <stdio.h> X Xint main(argc,argv) Xchar *argv[]; Xint argc; X{ X int ch; X FILE *infile,*outfile; X char *version = "1.12j"; X X#ifndef VMS X char *progname = argv[0]; X#else X char *progname = "ROT13"; X#endif X X if((argc < 2) || (argc >3)) X { X fprintf(stderr,"%s %s by Scott Berry and Joseph Hillenburg.\n",progname,version); X fprintf(stderr,"Usage: %s <infile> [outfile]\n",progname); X exit(1); X } X if(( infile = fopen(argv[1], "r")) == ( FILE * ) NULL ) X { X fprintf(stderr,"%s: Input file, %s, not found.\n",progname,argv[1]); X exit(1); X } X if((outfile = (argc == 3 ? fopen(argv[2],"w") : stdout)) X == ( FILE * ) NULL ) X { X fprintf(stderr,"%s: Could not open output file, %s.\n",progname,argv[2]); X exit(1); X } X while ((ch=fgetc(infile)) != EOF) X { X if (isupper(ch)) X ch = (ch>'M'?ch-13:ch+13); X if (islower(ch)) X ch = (ch>'m'?ch-13:ch+13); X fputc((ch), outfile); X } X fclose(infile); X if (argc == 3) X fclose (outfile); X exit(0); X } END_OF_FILE if test 2330 -ne `wc -c <'rot13.c'`; then echo shar: \"'rot13.c'\" unpacked with wrong size! fi # end of 'rot13.c' fi if test -f 'Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Makefile'\" else echo shar: Extracting \"'Makefile'\" \(335 characters\) sed "s/^X//" >'Makefile' <<'END_OF_FILE' X# X# Makefile for "rot13" X# X# Written by: Scott Berry and Joseph Hillenburg X# Last update: (01-28-91) X# This file is in the public domain. X# X XCC = cc XEXE = rot13 XCFLAGS = -O -DUNIX X XOBJECTS = rot13.o X Xall: $(EXE) clean X X$(EXE): $(OBJECTS) X $(CC) $(CFLAGS) -o $(EXE) $(OBJECTS) X Xclean: X rm $(OBJECTS) X strip $(EXE) END_OF_FILE if test 335 -ne `wc -c <'Makefile'`; then echo shar: \"'Makefile'\" unpacked with wrong size! fi # end of 'Makefile' fi if test -f 'descrip.mms' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'descrip.mms'\" else echo shar: Extracting \"'descrip.mms'\" \(433 characters\) sed "s/^X//" >'descrip.mms' <<'END_OF_FILE' X! X! Descrip.MMS for "rot13" X! X! Written by: Scott Berry and Joseph Hillenburg X! Last update: (01-28-91) X! This file is in the public domain. X! X XEXE = ROT13.EXE XCDEFS = /DEFINE=(VMS) XSOURCES = ROT13.C XOBJECTS = ROT13.OBJ X X.SUFFIXES .C .OBJ X XROT13.EXE : $(OBJECTS) X LINK /NODEBUG/EXEC=$(EXE) $(OBJECTS),sys$library:vaxcrtl.olb/libr X DELETE $(OBJECTS);* X X.C.OBJ X CC $(CDEFS) /NODEB/OPTIM/OBJ=$*.OBJ $*.C END_OF_FILE if test 433 -ne `wc -c <'descrip.mms'`; then echo shar: \"'descrip.mms'\" unpacked with wrong size! fi # end of 'descrip.mms' fi if test -f 'rot13.cld' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'rot13.cld'\" else echo shar: Extracting \"'rot13.cld'\" \(155 characters\) sed "s/^X//" >'rot13.cld' <<'END_OF_FILE' XDEFINE VERB ROT13 X XIMAGE CINDERELLA:[ANLHILLE.ROT13]ROT13.EXE X XQUALIFIER INPUT,VALUE(TYPE=$INFILE,REQUIRED) X XQUALIFIER OUTPUT,VALUE(TYPE=$INFILE,REQUIRED) END_OF_FILE if test 155 -ne `wc -c <'rot13.cld'`; then echo shar: \"'rot13.cld'\" unpacked with wrong size! fi # end of 'rot13.cld' fi if test -f 'chat' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'chat'\" else echo shar: Extracting \"'chat'\" \(1333 characters\) sed "s/^X//" >'chat' <<'END_OF_FILE' X#!/bin/sh X# A kludge to yak at multiple people at once. Turns out that sh is a lot X# better for this than csh... Xname="${1}" X# This was ripped straight out of Citadel/UX X# I have modified it to work better in a standalone environment. X# -jph Xif test "${name}"; then X echo "Using ${name} as your nickname..." Xelse X if test "$CHAT_NICK"; then X name=$CHAT_NICK X echo "Using $CHAT_NICK as your nickname..." X else X echo "Using $USER as your nickname..." X name=$USER X echo "Notice: You can use the syntax: chat <nickname>" X echo " or set the environment variable CHAT_NICK." X fi Xfi Xexport name Xtime=`date` Xexport time Xecho "Type ^D to leave chat." X Xecho "These people are in chat right now:" Xw | grep chat Xlfile=/tmp/chat.tmp Xif test -f $lfile ; then X (umask 0 ; touch $lfile) Xfi XCHAT_MAINTAINER=jph ; export CHAT_MAINTAINER Xif test $name=$CHAT_MAINTAINER ; then X chmod og+rw $lfile Xfi X Xecho "The chat maintainer is ${CHAT_MAINTAINER}" Xstty intr \^H Xstty lnext "" Xstty quit \^[ X(tail -1f $lfile | egrep -v "^$name") & Xtjob=$! Xsleep 1 Xecho "[${name} entering at ${time}]" >> $lfile Xtrap "" 2 Xwhile read line; do X echo "${name}: ${line}" >> $lfile Xdone X# Here the luser wanted to leave, so inform and clean up Xecho "[${name} leaving at ${time}]" >> $lfile Xkill -9 $tjob Xstty intr \^C Xstty quit \^\\ Xexit 0 X END_OF_FILE if test 1333 -ne `wc -c <'chat'`; then echo shar: \"'chat'\" unpacked with wrong size! fi chmod +x 'chat' # end of 'chat' fi echo shar: End of shell archive. exit 0 -- // Joseph Hillenburg, Secretary, Bloomington Amiga Users Group \X/ joseph@valnet.UUCP jph@irie.ais.org jph@ai.mit.edu "Only Apple could slow down a 68030 chip" --Computer Shopper