Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator) (02/04/90)
Submitted-by: overload!dillon (Matt Dillon) Posting-number: Volume 90, Issue 047 Archive-name: unix/uucp-1.03d/part03 #!/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 archive 3 (of 16)." # Contents: MakeDist man/L.sys man/Passwd man/UUCP man/UUCico # man/UUlog src/MUtil/from.c src/News060/Anews/raw.c # src/News060/Anews/sendpacket.c src/dmail/README src/dmail/compat.c # src/dmail/dmail.h src/dmail/help.c src/dmail/range.c # src/dmail/set.c src/lib/lockfile.c src/lib/security.c # src/lib/serialport.c src/uucico/includes.h src/uucico/uuxqt.c # Wrapped by tadguy@xanth on Sat Feb 3 20:51:02 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'MakeDist' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'MakeDist'\" else echo shar: Extracting \"'MakeDist'\" \(2213 characters\) sed "s/^X//" >'MakeDist' <<'END_OF_FILE' X Xfailat 25 Xmakedir dist:uucp0 Xmakedir dist:uucp0/man Xmakedir dist:uucp1 Xmakedir dist:uucp1/c Xfailat 20 X Xcopy #? dist:uucp0 CLONE X Xdupdate c dist:uucp0/c FORCE Xdupdate lib dist:uucp0/lib FORCE X Xfailat 25 Xmakedir dist:uucp0/mail Xmakedir dist:uucp0/mail/news Xmakedir dist:uucp0/spool Xmakedir dist:uucp0/pub Xecho >dist:uucp0/mail/zoo-dummy Xecho >dist:uucp0/mail/news/zoo-dummy Xecho >dist:uucp0/spool/zoo-dummy Xecho >dist:uucp0/pub/zoo-dummy Xfailat 20 X Xdelete dist:uucp0/lib/L.sys Xdelete dist:uucp0/lib/Passwd Xdelete dist:uucp0/lib/logfile Xdelete dist:uucp0/lib/Config Xdelete dist:uucp0/lib/Domain Xdelete dist:uucp0/lib/Aliases Xdelete dist:uucp0/lib/Getty-Header Xdelete dist:uucp0/lib/.signature Xdelete dist:uucp0/lib/.dmailrc Xrename dist:uucp0/lib/L.Sys.Sample dist:uucp0/lib/L.Sys Xrename dist:uucp0/lib/Passwd.Sample dist:uucp0/lib/Passwd Xrename dist:uucp0/lib/Config.sample dist:uucp0/lib/Config Xrename dist:uucp0/lib/Domain.sample dist:uucp0/lib/Domain Xrename dist:uucp0/lib/Aliases.sample dist:uucp0/lib/Aliases Xrename dist:uucp0/lib/Getty-Header.sample dist:uucp0/lib/Getty-header Xrename dist:uucp0/lib/.signature.sample dist:uucp0/lib/.signature Xrename dist:uucp0/lib/.dmailrc.sample dist:uucp0/lib/.dmailrc Xcopy man/dmail.help dist:uucp0/man X X; Move aux executables out of boot floppy Xcopy dist:uucp0/c/uuencode dist:uucp1/c Xcopy dist:uucp0/c/uudecode dist:uucp1/c Xcopy dist:uucp0/c/tarsplit dist:uucp1/c Xcopy dist:uucp0/c/tar dist:uucp1/c Xcopy dist:uucp0/c/man dist:uucp1/c Xcopy dist:uucp0/c/uident dist:uucp1/c Xcopy dist:uucp0/c/unshar dist:uucp1/c Xcopy dist:uucp0/c/from dist:uucp1/c Xcopy dist:uucp0/c/compress dist:uucp1/c Xdelete dist:uucp0/c/uuencode Xdelete dist:uucp0/c/uudecode Xdelete dist:uucp0/c/tarsplit Xdelete dist:uucp0/c/tar Xdelete dist:uucp0/c/man Xdelete dist:uucp0/c/uident Xdelete dist:uucp0/c/unshar Xdelete dist:uucp0/c/from Xdelete dist:uucp0/c/compress X X; remainder of distribution. X Xdupdate devs dist:uucp0/devs FORCE Xdupdate system dist:uucp0/system FORCE Xdupdate libs dist:uucp0/libs FORCE Xdupdate man dist:uucp1/man FORCE Xdupdate src dist:uucp1/src FORCE Xdupdate l dist:uucp0/l FORCE Xdupdate libs dist:uucp0/libs FORCE Xdupdate s dist:uucp0/s FORCE X X X END_OF_FILE if test 2213 -ne `wc -c <'MakeDist'`; then echo shar: \"'MakeDist'\" unpacked with wrong size! fi # end of 'MakeDist' fi if test -f 'man/L.sys' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'man/L.sys'\" else echo shar: Extracting \"'man/L.sys'\" \(2380 characters\) sed "s/^X//" >'man/L.sys' <<'END_OF_FILE' X XNAME X UULIB:L.Sys X XDESCRIPTION X X The L.Sys file is used by UUCico and sendmail (that is, Mail X and DMail) to get information about one or more UUCP nodes X that you can call. X X An example L.Sys entry: X X ------- (not part of the file) X X# This is a comment. X XA500 Any SER: 9600 5551344 ogin: uover sword: qwee\r Xcae780 Any SER: 2400 5555667 ogin: Udillon sword: xarbge\r Xspooge Any SER: 2400 5551234 ogin: uucp sword: gugg\r Xsorinc Any SER: 2400 5551111 ogin: uover sword: bleg\r X#this is commented out. X#postgres Any SER: 9600 5556783 ogin: dillon sword: foobarb\r X X ------- (not part of the file) X X The first field is the name of the machine in question. X CASE IS IMPORTANT. Most machines use all lower-case names. X X The second field is currently not used by AmigaUUCP but is X reserved to indicate times we can call. X X The third field is currently not used by AmigaUUCP but should X remain SER: for future compatibility. The SER: device is not X actually used by UUCICO. X X The fourth field is the call-out baud rate. Call-in baud rates X (that is, receiving a call) are determined by Getty. X X The fifth field is the phone number to call to reach the X machine in question. X X Remaining fields are expect-send strings. Once UUCico dials X out and reaches the machine in question, it must login into that X machine using the proper login and password. The fields are X always expect send expect send expect send expect ... until the X end of the line. The expect field may be "" (two quote characters) X to indicate we expect nothing and should immediately move to the X next (send) field. X X Special character sequences within a send field are recognized: X X \b send break. X \r write a carriage return X \n write a line feed X \\ a backslash X \t a tab character X \d a 2 second delay occurs before further processing takes place X \s a space X \c Normally the send field is automatically terminated with X a CR. This DISABLES that. X X As you will note by the above example, we usually do not have the X first character of an expected string. This is because the X expect-send fields are case sensitive and some machines say X 'login:' while others say 'Login:'. X X Refer to GETTY:Passwd (Man Passwd) on how to handle incomming calls. X XREFERENCES X X L.Sys X Passwd X END_OF_FILE if test 2380 -ne `wc -c <'man/L.sys'`; then echo shar: \"'man/L.sys'\" unpacked with wrong size! fi # end of 'man/L.sys' fi if test -f 'man/Passwd' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'man/Passwd'\" else echo shar: Extracting \"'man/Passwd'\" \(2130 characters\) sed "s/^X//" >'man/Passwd' <<'END_OF_FILE' X XNAME X GETTY:PASSWD X XSYNOPSIS X - X XDESCRIPTION X GETTY:PASSWD is similar to the UNIX /etc/passwd file and is X currently used by Getty to verify remote logins and run the X appropriate 'shell', which in most cases will be uucico. The X format is: X X ------ start of GETTY:PASSWD ----- X X # Put any comment here X # X # User,Password,Uid,GroupId,Finger-Info,Home-Dir,Command-To-Run X X bbs,*,10,0,BBS,ram:,mybbs:c/mybbs X foo,bar,23,2,The Guy,ram:,uucp:c/uucico X gaa,xxx,24,2,The Guy,ram:,uucp:c/uucico X X ------ end of UUCP:LIB/PASSWD ------- X X The above example runs uucico when somebody logs in as 'foo' X with the proper password (bar). Normally the user runs a X Getty from s:startup-sequence for each serial port he wishes X to allow logins on. X X The GETTY:PASSWD file combined with appropriate entries and X a running Getty allow arbitrary UUCP connections to be made X into your Amiga. X X Sendmail will add your finger info to the From: field of any X mail message. X XFIELDS X User = user name, up to 8 characters X X Password= password, up to 8 characters (uncrypted for now) X * = no password X X Uid = unique numerical id (don't use 0 please), this WILL X be used by some programs to find password entries. X Give each entry a different UID. X X Gid = not currently used, set to 2 (don't use 0). X X Finger = Finger information (your name). Future sub fields X within the finger information will be separated by X colons (:). X X Home-Dir= Directory from which to run the command X X Command = Command to run. This command CANNOT BE A BCPL PROGRAM. X Command is run with arguments you specify plus: X X -DEVICE devicename -UNIT unitname X X Where the devicename and unitname together make up X a serial port which the command should use for further X communications. stdin and stdout are set to NULL:, X as is the console handler. X X (Getty accomplishes all of this) X X If there is a '*' infront of the command name, X then Getty will setup stdin and stdout using the X UUSER: device, allowing programs to use stdio X to talk to the serial device. X X See UUSER.MAN X X X X END_OF_FILE if test 2130 -ne `wc -c <'man/Passwd'`; then echo shar: \"'man/Passwd'\" unpacked with wrong size! fi # end of 'man/Passwd' fi if test -f 'man/UUCP' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'man/UUCP'\" else echo shar: Extracting \"'man/UUCP'\" \(2919 characters\) sed "s/^X//" >'man/UUCP' <<'END_OF_FILE' X XNAME X uucp, uulog, uuname - unix to unix copy X XSYNTAX X uucp [option...] source-file... destination-file X X uulog [option...] X X uuname [option...] X XDESCRIPTION X The uucp command copies files named by the source-file argu- X ments to the destination-file argument. A file name either X may be a path name on your machine or may have the form X X system-name!pathname X X where `system-name' is taken from a list of system names X which uucp knows about. Shell metacharacters ?*[] appearing X in the pathname part will be expanded on the appropriate X system. X X Pathnames may be a full pathname, a pathname preceded by X ~user, where user is a userid on the specified system and is X replaced by that user's login directory, or anything else X prefixed by the current directory. X X If the result is an erroneous pathname for the remote sys- X tem, the copy will fail. If the destination-file is a X directory, the last part of the source-file name is used. X If a simple ~user destination is inaccessible to uucp, data X is copied to a spool directory and the user is notified by X mail(1). X X The uucp command preserves execute permissions across the X transmission and gives 0666 read and write permissions. For X further information, see chmod(2). X XOPTIONS X The following options are interpreted by uucp. X X -d Creates all necessary directories for the file copy. X X -c Uses the source file when copying out rather than copying X the file to the spool directory. X X -m Sends you mail to the requester when the copy is com- X plete. X X -W Expands only local files. Normally files names are X prepended with the current working directory if a full X path is not specified. The -W tells uucp to expand local X files only. X X The uulog command prints a summary of uucp and uux transac- X tions that were recorded in the file X UUCP:spool/LOGFILE. X X The options cause uulog to print logging information: X X -ssys X Displays information about work involving specified sys- X tem. X X -uuser X Displays information about work involving specified user. X X The uuname command lists the uucp names of known systems. X XWARNINGS X The domain of remotely accessible files can (and for obvious X security reasons, usually should) be severely restricted. X You will very likely not be able to fetch files by pathname. X Ask a responsible person on the remote system to send them X to you. For the same reasons, you will probably not be able X to send files to arbitrary pathnames. X XRESTRICTIONS X All files received by uucp will be owned by uucp. X The -m option will only work sending files or receiving a X single file. (Receiving multiple files specified by special X shell characters ?*[] will not activate the -m option.) X END_OF_FILE if test 2919 -ne `wc -c <'man/UUCP'`; then echo shar: \"'man/UUCP'\" unpacked with wrong size! fi # end of 'man/UUCP' fi if test -f 'man/UUCico' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'man/UUCico'\" else echo shar: Extracting \"'man/UUCico'\" \(2893 characters\) sed "s/^X//" >'man/UUCico' <<'END_OF_FILE' X X XNAME X UUCico X XSYNOPSIS X UUCico -D[EVICE] device -U[NIT] unit -Getty -w -r1 -xn -o -[s/S]system -e X XDESCRIPTION X UUCico is the basis for UUCP. It can be run either from a X GETTY when somebody logs into the Amiga, or it can be run X from DCRON or manually to originate connections. X X Some options to UUCico are now outdated and should not be X used. Specifically, earlier distributions did not have a X GETTY and UUCICO had to deal with waiting for connections X itself. X X Either way, the final result is a connection between your X machine and some remote machine. UUCICO will retrieve any X queued work on the remote machine and send any queued work on X your machine. These work files are located in UUCP:SPOOL. X X The term 'work' refers to items queued by other programs, X such as PNEWS and MAIL. These programs create files in X UUCP:SPOOL that inform UUCICO what to do with them and where X to send them to. On the flip side, when UUCICO receives a X work file it will write it to UUCP:SPOOL then run UUXQT. X X UUXQT scans received files and determines how to break them X up (for example, append them to the appropriate mail box or X news directory). The control files in UUCP:SPOOL contain a X line indicating the appropriate program required to unpack X the files. UUXQT reads this line and runs the proper X unpacker (RMAIL, RNEWS, or CUNBATCH). X XGENERAL OPTIONS X X (*)'d Options are supplied automatically on Getty Initiated X connections X X (*) -D devicename Default is serial.device X (*) -U unitnumber Default is 0 X -xn Set log level X XGETTY INITIATED OPTIONS X X (*) -Getty Tells UUCICO that it was started from a Getty. X XMANUAL POLL OPTIONS X X -ssystem Poll (call-up) the specified system X -Ssystem Same as -s but ignore time restrictions X -r1 Call all systems we have pending work for X XOBSOLETE OPTIONS (WAIT MODE OPTIONS) DO NOT USE IF YOU CAN HELP IT X X -w Tells UUCICO to wait for one or more X connections (depending on -e) AFTER having X previously polled one or more systems X (-r, -s, -S). X X -o Tells UUCICO to not search for a CONNECT X message when carrier is detected (hardwired X configuration) X X -e Tells UUCICO to loop forever waiting for X connections. X X -n FORCE WINDOW SIZE IN G PROTOCOL TO 1. X Normally arbitrates 1 or 2. X X <nooptions> If UUCICO is run without either -Getty, X -s, or -r, it will wait for a single X connection. X XEXAMPLE X ----- X X ; Place a line similar to this in your startup-sequence! X ; See GETTY manual X X resident uucp:C/Getty X run <nil: >nil: Getty -A -B19200 -Mm X X ----- X X ; Manually poll system 'foo' X UUCico -sfoo X X ----- X X ; From DCRON (DCRON ENTRY) X40 1 * * * uucp:c/uucico -r1 X X X XFILES/REQUIRES X UUCP: X UUCP:c/* X UUCP:lib/* X UUCP:mail/ X UUCP:spool/ X UUCP:spool/LOGFILE X XREFERENCES X manuals/Getty X manuals/DCron X X X END_OF_FILE if test 2893 -ne `wc -c <'man/UUCico'`; then echo shar: \"'man/UUCico'\" unpacked with wrong size! fi # end of 'man/UUCico' fi if test -f 'man/UUlog' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'man/UUlog'\" else echo shar: Extracting \"'man/UUlog'\" \(2919 characters\) sed "s/^X//" >'man/UUlog' <<'END_OF_FILE' X XNAME X uucp, uulog, uuname - unix to unix copy X XSYNTAX X uucp [option...] source-file... destination-file X X uulog [option...] X X uuname [option...] X XDESCRIPTION X The uucp command copies files named by the source-file argu- X ments to the destination-file argument. A file name either X may be a path name on your machine or may have the form X X system-name!pathname X X where `system-name' is taken from a list of system names X which uucp knows about. Shell metacharacters ?*[] appearing X in the pathname part will be expanded on the appropriate X system. X X Pathnames may be a full pathname, a pathname preceded by X ~user, where user is a userid on the specified system and is X replaced by that user's login directory, or anything else X prefixed by the current directory. X X If the result is an erroneous pathname for the remote sys- X tem, the copy will fail. If the destination-file is a X directory, the last part of the source-file name is used. X If a simple ~user destination is inaccessible to uucp, data X is copied to a spool directory and the user is notified by X mail(1). X X The uucp command preserves execute permissions across the X transmission and gives 0666 read and write permissions. For X further information, see chmod(2). X XOPTIONS X The following options are interpreted by uucp. X X -d Creates all necessary directories for the file copy. X X -c Uses the source file when copying out rather than copying X the file to the spool directory. X X -m Sends you mail to the requester when the copy is com- X plete. X X -W Expands only local files. Normally files names are X prepended with the current working directory if a full X path is not specified. The -W tells uucp to expand local X files only. X X The uulog command prints a summary of uucp and uux transac- X tions that were recorded in the file X UUCP:spool/LOGFILE. X X The options cause uulog to print logging information: X X -ssys X Displays information about work involving specified sys- X tem. X X -uuser X Displays information about work involving specified user. X X The uuname command lists the uucp names of known systems. X XWARNINGS X The domain of remotely accessible files can (and for obvious X security reasons, usually should) be severely restricted. X You will very likely not be able to fetch files by pathname. X Ask a responsible person on the remote system to send them X to you. For the same reasons, you will probably not be able X to send files to arbitrary pathnames. X XRESTRICTIONS X All files received by uucp will be owned by uucp. X The -m option will only work sending files or receiving a X single file. (Receiving multiple files specified by special X shell characters ?*[] will not activate the -m option.) X END_OF_FILE if test 2919 -ne `wc -c <'man/UUlog'`; then echo shar: \"'man/UUlog'\" unpacked with wrong size! fi # end of 'man/UUlog' fi if test -f 'src/MUtil/from.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/MUtil/from.c'\" else echo shar: Extracting \"'src/MUtil/from.c'\" \(2388 characters\) sed "s/^X//" >'src/MUtil/from.c' <<'END_OF_FILE' X X/* X * FROM.C X * X * FROM [user] X * X * Displays From: and Subject fields, attempts to find personal name X * in From: field. If user not specified searches UULIB:Config X * for UserName. X */ X X#include <stdio.h> X#include <stdlib.h> X#include <config.h> X#include "/version.h" X XIDENT(".00"); X Xvoid FromUser(); Xchar *ExtractPersonalName(); X Xvoid Xmain(ac, av) Xchar *av[]; X{ X char haduser = 0; X short i; X X for (i = 1; i < ac; ++i) { X if (av[i][0] != '-') { X haduser = 1; X FromUser(av[i]); X } X } X if (haduser == 0) { X char *user; X if (user = FindConfig(USERNAME)) X FromUser(user); X else X printf("UULIB:Config, no 'UserName' entry!\n"); X } X} X Xvoid XFromUser(user) Xchar *user; X{ X static char Buf[256]; X static char FromLine[256]; X static char SubjLine[256]; X char *file = malloc(strlen(user) + 32); X char *fromstr; X FILE *fi; X X sprintf(file, "UUMAIL:%s", user); X if (fi = fopen(file, "r")) { X while (fgets(Buf, 256, fi)) { X X /* X * Start of message X */ X X if (strncmp(Buf, "From ", 5) != 0) X continue; X X /* X * Scan headers for From: and Subject: X * Headers end with a blank line. X */ X X FromLine[0] = 0; X SubjLine[0] = '\n'; X SubjLine[1] = 0; X X while (fgets(Buf, 256, fi) && Buf[0] != '\n') { X if (strncmp(Buf, "From:", 5) == 0) X strcpy(FromLine, Buf + 5); X if (strncmp(Buf, "Subject:", 8) == 0) X strcpy(SubjLine, Buf + 8); X } X X fromstr = ExtractPersonalName(FromLine); X printf("%-20s %s", fromstr, SubjLine); X } X } X} X X/* X * Search for (name) or name <addr> or <addr> name X */ X Xchar * XExtractPersonalName(str) Xchar *str; X{ X char *p1, *p2; X char sp = 1; X X for (p1 = str; *p1; ++p1) { X if (*p1 == '<') { X if (sp == 0) { /* name before <addr> */ X p2 = p1 - 1; X p1 = str; X break; X } X /* name after <addr> */ X while (*p1 && *p1 != '>') X ++p1; X if (*p1 == '>') X ++p1; X p2 = str + strlen(str) - 1; X break; X } X if (*p1 == '(') { X ++p1; X for (p2 = p1; *p2 && *p2 != ')'; ++p2); X if (*p2 == ')') X --p2; X break; X } X if (*p1 != ' ' && *p1 != 9) X sp = 0; X } X if (*p1 == 0) { /* could find a personal name! */ X p1 = str; X p2 = str + strlen(str) - 1; X } X while (p2 >= p1 && (*p2 == '\n' || *p2 == ' ' || *p2 == 9)) X --p2; X ++p2; X if (p2 < p1) X p2 = p1; X *p2 = 0; X return(p1); X} X END_OF_FILE if test 2388 -ne `wc -c <'src/MUtil/from.c'`; then echo shar: \"'src/MUtil/from.c'\" unpacked with wrong size! fi # end of 'src/MUtil/from.c' fi if test -f 'src/News060/Anews/raw.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/News060/Anews/raw.c'\" else echo shar: Extracting \"'src/News060/Anews/raw.c'\" \(2229 characters\) sed "s/^X//" >'src/News060/Anews/raw.c' <<'END_OF_FILE' X X/* X * RAW.C X * X * This is a routine for setting a given stream to raw or cooked mode on the X * Amiga . This is useful when you are using Lattice C to produce programs X * that want to read single characters with the "getch()" or "fgetc" call. X * X * Written : 18-Jun-87 By Chuck McManis. X */ X X#include <exec/types.h> X#include <libraries/dos.h> X#include <libraries/dosextens.h> X#include <stdio.h> X X#include <ios1.h> X#include <error.h> X Xextern int errno; /* The error variable */ X X/* X * Function raw() - Convert the specified file pointer to 'raw' mode. This X * only works on TTY's and essentially keeps DOS from translating keys for X * you, also (BIG WIN) it means getch() will return immediately rather than X * wait for a return. You lose editing features though. X */ X Xlong Xraw(fp) XFILE *fp; X{ X struct MsgPort *mp; /* The File Handle message port */ X struct FileHandle *afh; X struct UFB *ufb; X long Arg[1], res; X X ufb = (struct UFB *) chkufb(fileno(fp)); /* Step one, get the file X * handle */ X afh = (struct FileHandle *) (ufb->ufbfh); X X if (!IsInteractive(afh)) { /* Step two, check to see if it's a console */ X errno = ENOTTY; X return (-1); X } X /* Step three, get it's message port. */ X mp = ((struct FileHandle *) (BADDR(afh)))->fh_Type; X Arg[0] = -1L; X res = SendPacket(mp, ACTION_SCREEN_MODE, Arg, 1); /* Put it in RAW: mode */ X if (res == 0) { X errno = ENXIO; X return (-1); X } X return (0); X} X X/* X * Function - cooked() this function returns the designate file pointer to X * it's normal, wait for a <CR> mode. This is exactly like raw() except that X * it sends a 0 to the console to make it back into a CON: from a RAW: X */ X Xlong Xcooked(fp) XFILE *fp; X{ X struct MsgPort *mp; /* The File Handle message port */ X struct FileHandle *afh; X struct UFB *ufb; X long Arg[1], res; X X ufb = (struct UFB *) chkufb(fileno(fp)); X afh = (struct FileHandle *) (ufb->ufbfh); X if (!IsInteractive(afh)) { X errno = ENOTTY; X return (-1); X } X mp = ((struct FileHandle *) (BADDR(afh)))->fh_Type; X Arg[0] = 0; X res = SendPacket(mp, ACTION_SCREEN_MODE, Arg, 1); X if (res == 0) { X errno = ENXIO; X return (-1); X } X return (0); X} X X END_OF_FILE if test 2229 -ne `wc -c <'src/News060/Anews/raw.c'`; then echo shar: \"'src/News060/Anews/raw.c'\" unpacked with wrong size! fi # end of 'src/News060/Anews/raw.c' fi if test -f 'src/News060/Anews/sendpacket.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/News060/Anews/sendpacket.c'\" else echo shar: Extracting \"'src/News060/Anews/sendpacket.c'\" \(2055 characters\) sed "s/^X//" >'src/News060/Anews/sendpacket.c' <<'END_OF_FILE' X X/* X * Sendpacket.c X * X * An invaluable addition to your Amiga.lib file. This code sends a packet the X * given message port. This makes working around DOS lots easier. X * X * Note, I didn't write this, those wonderful folks at CBM did. I do suggest X * however that you may wish to add it to Amiga.Lib, to do so, compile it and X * say 'oml lib:amiga.lib -r sendpacket.o' X */ X X#include <exec/types.h> X#include <exec/ports.h> X#include <exec/memory.h> X#include <libraries/dos.h> X#include <libraries/dosextens.h> X X/* X * Function - SendPacket written by Phil Lindsay, Carolyn Scheppner, and Andy X * Finkel. This function will send a packet of the given type to the Message X * Port supplied. X */ X Xlong XSendPacket(pid, action, args, nargs) X struct MsgPort *pid; /* process indentifier ... (handlers message X * port ) */ X long action, /* packet type ... (what you want handler to X * do ) */ X args[], /* a pointer to a argument list */ X nargs; /* number of arguments in list */ X{ X struct MsgPort *replyport; X struct StandardPacket *packet; X X long count, *pargs, res1; X X replyport = (struct MsgPort *) CreatePort(NULL, 0); X if (!replyport) X return (0); X X /* Allocate space for a packet, make it public and clear it */ X packet = (struct StandardPacket *) X AllocMem((long) sizeof(struct StandardPacket), MEMF_PUBLIC | MEMF_CLEAR); X if (!packet) { X DeletePort(replyport); X return (0); X } X packet->sp_Msg.mn_Node.ln_Name = (char *) &(packet->sp_Pkt); X packet->sp_Pkt.dp_Link = &(packet->sp_Msg); X packet->sp_Pkt.dp_Port = replyport; X packet->sp_Pkt.dp_Type = action; X X /* copy the args into the packet */ X pargs = &(packet->sp_Pkt.dp_Arg1); /* address of first argument */ X for (count = 0; count < nargs; count++) X pargs[count] = args[count]; X X PutMsg(pid, packet); /* send packet */ X X WaitPort(replyport); X GetMsg(replyport); X X res1 = packet->sp_Pkt.dp_Res1; X X FreeMem(packet, (long) sizeof(struct StandardPacket)); X DeletePort(replyport); X X return (res1); X} END_OF_FILE if test 2055 -ne `wc -c <'src/News060/Anews/sendpacket.c'`; then echo shar: \"'src/News060/Anews/sendpacket.c'\" unpacked with wrong size! fi # end of 'src/News060/Anews/sendpacket.c' fi if test -f 'src/dmail/README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/dmail/README'\" else echo shar: Extracting \"'src/dmail/README'\" \(3029 characters\) sed "s/^X//" >'src/dmail/README' <<'END_OF_FILE' X XREADME FILE FOR DMAIL v1.12 distribution June 1989 X XRead Makefile for compiling and installation procedures. X XDmail compiles fine on UNIX BSD 4.2/4.3. A man page exists and Xevery command as a full help page online from Dmail. X XAN EXAMPLE OF A .DMAILRC FILE: (happens to be mine) X--------------------------------------------------------------------------- Xalias normal "setlist -s 18 From 38 Subject 10 To 0 Cc 0 Date" Xalias from "setlist -s 66 From; list; normal" Xalias me "select To dillon , Cc dillon" Xalias bugs "select To root staff manag , Cc staff manag root" Xalias trek "select To trek , Cc trek" Xalias notme "select -s To !dillon; resel -s Cc !dillon; resel From !dillon" Xalias hack "select To hacker , Cc hacker" Xalias page set page more Xalias nopage unset page Xalias k tag Xalias kn "tag ; next" Xalias spool "g /usr/spool/mail/dillon ~/Dmail/mbox" Xalias keep "g ~/Dmail/keep" Xalias mbox "g ~/Dmail/mbox" Xalias q "select -s all; write ~/Dmail/keep -s tag; delete -s tag; quit" Xalias g "select -s all; write ~/Dmail/keep -s tag; delete -s tag; qswi" Xset amiga "decwrl!pyramid!amiga!support" Xset header ~/.mailheader Xset ask Xnormal Xcd ~/Dmail X--------------------------------------------------------------------------- X XIn the above example, I have created a Dmail directory to hold all my Xfolders. Each folder will be a file containing multiple messages, fully Xcompatible with /usr/spool/ and mbox. X Xmy dmail alias is this: Xalias dmail '\dmail -O -l ~/Dmail/.dmailrc -o ~/Dmail/mbox -F Cc -F Date' X XNOTE: you don't need to alias dmail to anything. without any arguments, Xit acts like /bin/Mail getting your mail from your spool, and placing Xread mail on quit to mbox in your home directory. I use -O so dmail Xgives me a command prompt even if there is no mail, and the -F options Xtell dmail to load those subjects into memory automatically (because I'm Xgoing to select on them immediately anyway). If a field which you select Xon is not in memory, dmail must go to the mail file to find the field. XThis is transparent. X XGOOD LUCK! X---------------------------------------------- Another example of an .dmailrc Xif !comlinemail Xalias ls "! ls" Xalias normal "setlist -s 18 From 38 Subject 10 To 0 Cc 0 Date" Xalias news "setlist -s 18 Newsgroup 30 Subject 10 Date 6 Lines 0 Keywords" Xalias hack "select To hacker , Cc hacker" Xalias page set page more Xalias nopage unset page Xalias spool "g /usr/spool/mail/dillon ~/Dmail/mbox" Xalias keep "g ~/Dmail/keep" Xalias mbox "g ~/Dmail/mbox" Xalias amiga "select Resent-From: info , To: info , Cc: info Xalias g "qswitch" Xalias kill "%var sel Sub $var;d all;sel all" Xset amiga "decwrl!pyramid!amiga!support" Xset header ~/.mailheader Xnormal Xcd ~/Dmail Xset archive ~/Dmail/arch Xendif X------------------------------------------------------------------- X X -Matt X X dillon@ucb-vax.berkeley.edu X ...!ucbvax!dillon X END_OF_FILE if test 3029 -ne `wc -c <'src/dmail/README'`; then echo shar: \"'src/dmail/README'\" unpacked with wrong size! fi # end of 'src/dmail/README' fi if test -f 'src/dmail/compat.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/dmail/compat.c'\" else echo shar: Extracting \"'src/dmail/compat.c'\" \(2344 characters\) sed "s/^X//" >'src/dmail/compat.c' <<'END_OF_FILE' X X/* X * COMPAT.C X * X * (C) Copyright 1985-1990 by Matthew Dillon, All Rights Reserved. X * X */ X X#include <stdio.h> X#include <pwd.h> X#include <sys/stat.h> X#include "config.h" X X#ifdef AMIGA X Xextern char *gettmpenv(); Xextern char *getenv(); X X#include <stdlib.h> X#include <exec/types.h> X#include <libraries/dos.h> X#include <libraries/dosextens.h> X Xgetpid() X{ X return((long)FindTask(NULL)); X} X Xgetuid() X{ X return(0); X} X Xstatic struct passwd pas; X Xstruct passwd * Xgetpwuid() X{ X char *name = gettmpenv("USER"); X if (name == NULL) { X name = FindConfig(USERNAME); X if (name == NULL) { X puts("Warning, USER enviroment variable not set!"); X name = "root"; X } X } X pas.pw_name = malloc(strlen(name) + 1); X pas.pw_dir = malloc(16); X strcpy(pas.pw_name, name); X strcpy(pas.pw_dir, "sys:"); X return(&pas); X} X Xstruct passwd * Xgetpwnam() X{ X return(getpwuid(0)); X} X Xvoid Xbzero(d, n) Xchar *d; X{ X setmem(d, n, 0); X} X Xvoid Xbcopy(s, d, n) Xchar *s, *d; X{ X movmem(s, d, n); X} X Xvoid Xsleep(n) X{ X if (n) X Delay(50 * n); X} X Xstat(file, st) Xchar *file; Xstruct stat *st; X{ X struct FileLock *lock; X struct FileInfoBlock *fib = (struct FileInfoBlock *)malloc(sizeof(struct FileInfoBlock)); X X lock = (struct FileLock *)Lock(file, SHARED_LOCK); X if (lock == NULL) X return(-1); X Examine((BPTR)lock, fib); X lock = (struct FileLock *)((long)lock << 2); X st->st_ino = lock->fl_Key; X st->st_ctime = st->st_mtime = fib->fib_Date.ds_Tick / 50 + fib->fib_Date.ds_Minute * 60 + fib->fib_Date.ds_Days * 86400; X X lock = (struct FileLock *)((long)lock >> 2); X UnLock((BPTR)lock); X free(fib); X return(0); X} X Xflock(fd, locktype) X{ X return(0); X} X Xchar * Xgettmpenv(id) Xchar *id; X{ X static char *buf; X static char *res = NULL; X long fh; X long len; X X buf = malloc(strlen(id) + 8); X sprintf(buf, "ENV:%s", id); X fh = Open(buf, 1005); X free(buf); X if (fh) { X Seek(fh, 0L, 1); X len = Seek(fh, 0L, -1); X if (len < 0) { X Close(fh); X return(NULL); X } X if (res) X free(res); X res = malloc(len + 1); X Read(fh, res, len); X Close(fh); X res[len] = 0; X return(res); X } X return(NULL); X} X X Xchar * Xgetenv(id) Xchar *id; X{ X char *res = gettmpenv(id); X char *perm = NULL; X X if (res) { X perm = malloc(strlen(res) + 1); X strcpy(perm, res); X } X return(perm); X} X X#endif X END_OF_FILE if test 2344 -ne `wc -c <'src/dmail/compat.c'`; then echo shar: \"'src/dmail/compat.c'\" unpacked with wrong size! fi # end of 'src/dmail/compat.c' fi if test -f 'src/dmail/dmail.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/dmail/dmail.h'\" else echo shar: Extracting \"'src/dmail/dmail.h'\" \(2605 characters\) sed "s/^X//" >'src/dmail/dmail.h' <<'END_OF_FILE' X X/* X * DMAIL.H X * X * (C) Copyright 1985-1990 by Matthew Dillon, All Rights Reserved. X * X */ X X#define DVERSION "Dmail Version 1.12, June 1989" X#define MAXTYPE 16 /* Max number of different fields remembered */ X#define EXSTART 3 /* Beginning of dynamic fields, rest are wired */ X#define MAXLIST 16 /* Maximum # list elements in SETLIST */ X#define LONGSTACK 64 /* Maximum # levels for the longjump stack */ X#define MAILMODE 0600 /* Standard mail mode for temp. files */ X#define MAXFIELDSIZE 4096 /* Maximum handlable field size (& scratch bufs) */ X X#define LEVEL_SET 0 /* which variable set to use */ X#define LEVEL_ALIAS 1 X#define LEVEL_MALIAS 2 X X#define R_INCLUDE 1 /* Include message For DO_REPLY() */ X#define R_FORWARD 2 /* Forward message */ X#define R_REPLY 3 /* Reply to message */ X#define R_MAIL 4 /* Mail from scratch */ X X#define M_RESET 0 X#define M_CONT 1 X X X#define PAGER(Puf) _pager(Puf, 1) /* Auto newline */ X#define FPAGER(Puf) _pager(Puf, 0) /* output as is */ X#define push_base() (setjmp (env[1 + Longstack]) ? 1 : (++Longstack, 0)) X#define pop_base() --Longstack X#define push_break() ++Breakstack X#define pop_break() --Breakstack X X#define ST_DELETED 0x0001 /* Status flag.. item has been deleted */ X#define ST_READ 0x0002 /* item has been read or marked */ X#define ST_STORED 0x0010 /* item has been written */ X#define ST_TAG 0x0020 /* item has been taged */ X#define ST_SCR 0x0080 /* scratch flag to single out messages */ X X#include <stdio.h> X#include <setjmp.h> X Xstruct ENTRY { X long fpos; X int no; X int status; X char *from; X char *fields[MAXTYPE]; X}; X Xstatic struct FIND { X char *search; X int len; X int notnew; X int age; X}; X Xextern char *getenv(), *malloc(), *realloc(), *next_word(), *get_field(); Xextern char *alloca(); Xextern char *get_var(); X Xextern char *mail_file; Xextern char *user_name; Xextern char *output_file; Xextern char *home_dir; Xextern char *visual; Xextern char Buf[]; Xextern char Puf[]; Xextern char *av[], *Nulav[3]; Xextern int Longstack, Breakstack; Xextern int XDebug; Xextern int Entries, Current; Xextern int Silence; Xextern int ac; Xextern FILE *m_fi; Xextern struct ENTRY *Entry; Xextern struct FIND Find[]; Xextern jmp_buf env[]; X Xextern int width[], header[], Listsize; Xextern int No_load_mail, XDisable, Did_cd; X Xextern char *S_sendmail; Xextern int S_page, S_novibreak, S_verbose, S_ask, S_archive; Xextern int lmessage_overide; X X END_OF_FILE if test 2605 -ne `wc -c <'src/dmail/dmail.h'`; then echo shar: \"'src/dmail/dmail.h'\" unpacked with wrong size! fi # end of 'src/dmail/dmail.h' fi if test -f 'src/dmail/help.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/dmail/help.c'\" else echo shar: Extracting \"'src/dmail/help.c'\" \(2476 characters\) sed "s/^X//" >'src/dmail/help.c' <<'END_OF_FILE' X X/* X * HELP.C X * X * (C) Copyright 1985-1990 by Matthew Dillon, All Rights Reserved. X * X * Global Routines: DO_HELP() X * X */ X X#include <stdio.h> X#include "dmail.h" X#include "execom.h" X X#ifdef AMIGA X#define HELPFILE "MAN:dmail.help" X#endif X X#ifndef HELPFILE Xstatic char *help[] = { X#include ".dmkout" X}; X Xdo_help() X{ X int i, j; X char *ptr; X X if (push_base()) { X push_break(); X pop_base(); X PAGER (-1); X pop_break(); X return; X } X PAGER (0); X if (ac == 1) { X for (j = 0; help[j] && *help[j] != '.'; ++j) X PAGER (help[j]); X for (i = 0; Command[i].name != NULL; ++i) { X if (*Command[i].name && !(Command[i].stat & C_NO)) { X if (Desc[i] == NULL) X puts("Software error, premature EOF in description table"); X sprintf (Puf, "%-10s %s", Command[i].name, Desc[i]); X PAGER (Puf); X } X } X } X PAGER (""); X for (i = 1; i < ac; ++i) { X j = 0; Xagain: X while (help[j] && *help[j] != '.') X ++j; X if (help[j]) { X if (strncmp (av[i], help[j] + 1, strlen(av[i]))) { X ++j; X goto again; X } X while (help[j] && *help[j] == '.') X ++j; X while (help[j] && *help[j] != '.') X PAGER (help[j++]); X PAGER (""); X goto again; X } X } X PAGER (-1); X pop_base(); X} X X#else X Xdo_help() X{ X int i; X FILE *fi = NULL; X char *eof; X X if (push_base()) { X push_break(); X pop_base(); X PAGER (-1); X if (fi != NULL) { X fclose (fi); X fi = NULL; X } X pop_break(); X return (-1); X } X fi = fopen (HELPFILE, "r"); X if (fi == NULL) { X printf ("Cannot open help file: %s\n", HELPFILE); X PAGER (-1); X pop_base(); X return (-1); X } X PAGER (0); X if (ac == 1) { X while (fgets (Puf, MAXFIELDSIZE, fi) && *Puf != '.') X FPAGER (Puf); X fclose (fi); X fi = NULL; X for (i = 0; Command[i].name != NULL; ++i) { X if (*Command[i].name) { X sprintf (Puf, "%-10s %s", Command[i].name, Desc[i]); X PAGER (Puf); X } X } X PAGER (-1); X pop_base(); X return (1); X } X PAGER (""); X for (i = 1; i < ac; ++i) { X fseek (fi, 0, 0); Xagain: X while ((eof = fgets (Puf, MAXFIELDSIZE, fi)) && *Puf != '.'); X if (!eof) X continue; X if (strncmp (av[i], Puf + 1, strlen(av[i]))) X goto again; X while ((eof = fgets (Puf, MAXFIELDSIZE, fi)) && *Puf == '.'); X if (!eof) X continue; X FPAGER (Puf); X while ((eof = fgets (Puf, MAXFIELDSIZE, fi)) && *Puf != '.') X FPAGER (Puf); X PAGER (""); X if (!eof) X continue; X goto again; X } X fclose (fi); X fi = NULL; X PAGER (-1); X pop_base(); X} X X#endif X END_OF_FILE if test 2476 -ne `wc -c <'src/dmail/help.c'`; then echo shar: \"'src/dmail/help.c'\" unpacked with wrong size! fi # end of 'src/dmail/help.c' fi if test -f 'src/dmail/range.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/dmail/range.c'\" else echo shar: Extracting \"'src/dmail/range.c'\" \(3087 characters\) sed "s/^X//" >'src/dmail/range.c' <<'END_OF_FILE' X X/* X * RANGE.C X * X * (C) Copyright 1985-1990 by Matthew Dillon, All Rights Reserved. X * X * Global Routines: REWIND_RANGE() X * GET_RANGE() X * SINGLE_POSITION() X * X * Static Routines: None. X * X * X */ X X#include <stdio.h> X#include "dmail.h" X X Xstatic int range_ac; Xstatic int in, start, end; X Xstruct RANOP { X char *name; X int status, kstatus; X}; X Xstatic struct RANOP Ranop[] = { X "all", 0, 0, X "tag", ST_TAG, ST_DELETED, X "wri", ST_STORED, ST_DELETED, X "del", ST_DELETED, 0, X "mar", ST_READ, ST_DELETED, X "unt", 0, ST_DELETED | ST_TAG, X "unw", 0, ST_DELETED | ST_STORED, X "und", 0, ST_DELETED, X "unm", 0, ST_DELETED | ST_READ, X NULL , 0, 0 }; X Xvoid Xrewind_range(beg) X{ X Silence = 0; X range_ac = beg; X X if (range_ac >= ac) { X start = (Current >= 0) ? Entry[Current].no : 0; X end = start; X in = 1; X } else { X in = 0; X } X} X X Xget_range() X{ X register char *ptr; X register int i; X static int status; /* Status items required */ X static int kstatus; /* Status items which cannot be present */ X Xagain: X if (in && start <= end) { X i = indexof(start++); X if (i < 0 || (Entry[i].status & status) != status || X (Entry[i].status & kstatus)) X goto again; X return (start - 1); X } X in = status = kstatus = 0; X if (range_ac >= ac) X return (0); X ptr = av[range_ac++]; X if (*ptr == '-') { X if (xstrncmp (ptr, "-s", 2) == 0) { X Silence = 1; X goto again; X } X start = 1; X ++ptr; X goto dash; X } X if (*ptr < '0' || *ptr > '9') { X start = 1; X end = 0; X for (i = 0; Ranop[i].name; ++i) { X if (xstrncmp (ptr, Ranop[i].name, 3) == 0) { X status = Ranop[i].status; X kstatus = Ranop[i].kstatus; X goto imprange; X } X } X goto again; X } X start = atoi(ptr); X while (*(++ptr)) { X if (*ptr == '-') { X ++ptr; X goto dash; X } X } X if (range_ac >= ac) X return (start); X if (*av[range_ac] == '-') { X ptr = av[range_ac++] + 1; X goto dash; X } X return (start); Xdash: X if (*ptr) { X end = atoi(ptr); X goto imprange; X } X if (range_ac >= ac) { X end = 0; X goto imprange; X } X end = atoi(av[range_ac++]); Ximprange: X if (end == 0) { X end = indexof (0); X if (end < 0) X return (0); X end = Entry[end].no; X } X if (start > end) { X printf ("Bad Range: %s\n", av[range_ac - 1]); X return (0); X } X in = 1; X goto again; X} X X Xsingle_position() X{ X int old = Current; X X switch (ac) { X case 1: X break; X case 2: X if (*av[1] == '\0' || (*av[1] == ' ' && strlen(av[1]) == 1)) X break; X Current = indexof (atoi(av[1])); X if (Current < 0) { X Current = old; X puts ("Out of Range, 0 will take you to the last entry"); X return (-1); X } X break; X default: X puts ("Range not implemented (yet?)"); X return (-1); X } X while (Current < Entries && Entry[Current].no == 0) X ++Current; X if (Current >= Entries) { X Current = old; X puts ("No More Messages"); X return (-1); X } X position_current(); X return (1); X} X X END_OF_FILE if test 3087 -ne `wc -c <'src/dmail/range.c'`; then echo shar: \"'src/dmail/range.c'\" unpacked with wrong size! fi # end of 'src/dmail/range.c' fi if test -f 'src/dmail/set.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/dmail/set.c'\" else echo shar: Extracting \"'src/dmail/set.c'\" \(2727 characters\) sed "s/^X//" >'src/dmail/set.c' <<'END_OF_FILE' X X/* X * SET.C X * X * (C) Copyright 1985-1990 by Matthew Dillon, All Rights Reserved. X * X * Variable set/unset/get/reset routines X * X */ X X X#include <stdio.h> X#include "dmail.h" X#define MAXLEVELS 3 X Xstruct MASTER { X struct MASTER *next; X struct MASTER *last; X char *name; X char *text; X}; X Xstruct MASTER *Mbase[MAXLEVELS]; X Xvoid Xset_var (level, name, str) Xregister char *name, *str; X{ X register struct MASTER *base = Mbase[level]; X register struct MASTER *last; X X push_break(); X while (base != NULL) { X if (strcmp (name, base->name) == 0) { X xfree (base->text); X goto gotit; X } X last = base; X base = base->next; X } X if (base == Mbase[level]) { X base = Mbase[level] = (struct MASTER *)malloc (sizeof (struct MASTER)); X base->last = NULL; X } else { X base = (struct MASTER *)malloc (sizeof (struct MASTER)); X base->last = last; X last->next = base; X } X base->name = malloc (strlen (name) + 1); X strcpy (base->name, name); X base->next = NULL; Xgotit: X base->text = malloc (strlen (str) + 1); X strcpy (base->text, str); X pop_break(); X} X X Xunset_var(level, name, str) Xregister char *name, *str; X{ X register struct MASTER *base = Mbase[level]; X register struct MASTER *last = NULL; X X push_break(); X while (base != NULL) { X if (strcmp (name, base->name) == 0) { X if (base != Mbase[level]) X last->next = base->next; X else X Mbase[level] = base->next; X if (base->next != NULL) X base->next->last = last; X if (base == Mbase[level]) X Mbase[level] = base->next; X xfree (base->name); X xfree (base->text); X xfree (base); X pop_break(); X return (1); X } X last = base; X base = base->next; X } X pop_break(); X return (-1); X} X X Xchar * Xget_var(level, name) Xregister char *name; X{ X register struct MASTER *base = Mbase[level]; X X while (base != NULL) { X if (strcmp (name, base->name) == 0) X return (base->text); X base = base->next; X } X return (NULL); X} X X Xdo_unset_var(str, level) Xchar *str; X{ X int i; X X push_break(); X for (i = 1; i < ac; ++i) X unset_var (level, av[i]); X fix_globals(); X pop_break(); X return (1); X} X Xvoid Xdo_set_var(command, level) Xchar *command; X{ X register struct MASTER *base = Mbase[level]; X register char *str; X X if (ac == 1) { X while (base) { X printf ("%-10s %s\n", base->name, base->text); X base = base->next; X } X } X if (ac == 2) { X str = get_var (level, av[1]); X if (str) { X printf ("%-10s %s\n", av[1], str); X } else { X push_break(); X set_var (level, av[1], ""); X fix_globals(); X pop_break(); X } X } X if (ac > 2) { X push_break(); X set_var (level, av[1], next_word (next_word (command))); X fix_globals(); X pop_break(); X } X} X X X END_OF_FILE if test 2727 -ne `wc -c <'src/dmail/set.c'`; then echo shar: \"'src/dmail/set.c'\" unpacked with wrong size! fi # end of 'src/dmail/set.c' fi if test -f 'src/lib/lockfile.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/lib/lockfile.c'\" else echo shar: Extracting \"'src/lib/lockfile.c'\" \(2345 characters\) sed "s/^X//" >'src/lib/lockfile.c' <<'END_OF_FILE' X X/* X * LOCKFILE.C X * X * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved. X * X * Lock and unlock a file. Under AmigaDOS, openning a file mode 1006 X * (accomplished with fopen(,"w"), locks the file exclusively. That X * is, further fopen()s will fail. Thus, we need only keep a live X * file descriptor to 'lock' the file. X * X * This is advantagious because if the program exits without removing X * the lock file we are still ok... the file is unlocked by virtue of X * the file descriptor getting closed. X */ X X#include <exec/types.h> X#include <exec/lists.h> X#include <proto/all.h> X#include <stdio.h> X#include <stdlib.h> X Xtypedef struct List LIST; Xtypedef struct Node NODE; X Xtypedef struct { X NODE Node; X FILE *Fi; X short Refs; X} LNode; X XLIST LockList = { (NODE *)&LockList.lh_Tail, NULL, (NODE *)&LockList.lh_Head }; X Xvoid FreeLockNode(); X Xvoid XLockFile(file) Xchar *file; X{ X char *ptr; X X LNode *node; X LNode *n; X X for (ptr = file + strlen(file); ptr >= file && *ptr != '/' && *ptr != ':'; --ptr); X ++ptr; X X X if (node = malloc(sizeof(LNode) + strlen(ptr) + 16)) { X node->Node.ln_Name = (char *)(node + 1); X sprintf(node->Node.ln_Name, "T:%s.LOCK", ptr); X X for (n = (LNode *)LockList.lh_Head; n != (LNode *)&LockList.lh_Tail; n = (LNode *)n->Node.ln_Succ) { X if (strcmp(node->Node.ln_Name, n->Node.ln_Name) == 0) { X ++n->Refs; X free(node); X return; X } X } X X while ((node->Fi = fopen(node->Node.ln_Name, "w")) == NULL) { X sleep(2); X chkabort(); X } X node->Refs = 1; X AddTail(&LockList, &node->Node); X } X} X Xvoid XUnLockFile(file) Xchar *file; X{ X LNode *node; X short len; X char *ptr; X X for (ptr = file + strlen(file); ptr >= file && *ptr != '/' && *ptr != ':'; --ptr); X ++ptr; X len = strlen(ptr); X X for (node = (LNode *)LockList.lh_Head; node != (LNode *)&LockList.lh_Tail; node = (LNode *)node->Node.ln_Succ) { X if (strncmp(ptr, node->Node.ln_Name + 2, len) == 0 && strlen(node->Node.ln_Name) == len + 7) { X if (--node->Refs == 0) X FreeLockNode(node); X return; X } X } X} X Xvoid XUnLockFiles() X{ X LNode *node; X X while ((node = (LNode *)LockList.lh_Head) != (LNode *)&LockList.lh_Tail) X FreeLockNode(node); X} X Xvoid XFreeLockNode(node) XLNode *node; X{ X Remove(node); X fclose(node->Fi); X unlink(node->Node.ln_Name); X free(node); X} X END_OF_FILE if test 2345 -ne `wc -c <'src/lib/lockfile.c'`; then echo shar: \"'src/lib/lockfile.c'\" unpacked with wrong size! fi # end of 'src/lib/lockfile.c' fi if test -f 'src/lib/security.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/lib/security.c'\" else echo shar: Extracting \"'src/lib/security.c'\" \(2279 characters\) sed "s/^X//" >'src/lib/security.c' <<'END_OF_FILE' X X/* X * SECURITY.C X * X * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved. X * X * Checks whether a given file should be allowed to be read or written X * X * Lock directory containing file X * Generate directory path X * Check path against allowed list (UULIB:Security) X * X * If type == 'c' return 1 if file name begins with a C. X * return -1 if file name does not begin with a C. X * return 0 if file name begins with a C. but is for X * a directory other than the current one. X */ X X#include <proto/all.h> X#include <libraries/dosextens.h> X#include <stdio.h> X Xtypedef struct FileLock FileLock; X Xstatic char TmpBuf[128]; X XSecurityDisallow(file, type) Xchar *file; X{ X char *fs; X char c; X int disallow = 1; X BPTR lock; X BPTR slock; X X for (fs = file + strlen(file); fs >= file && *fs != '/' && *fs != ':'; --fs); X ++fs; X if (fs == file) { /* just a file name */ X if (type == 'c') { X if ((file[0]|0x20) == 'c' && file[1] == '.') X return(1); X return(-1); X } X return(0); /* type r or w, current dir, allow. */ X } X if (type == 'c') /* not just a file name, allow C. */ X return(0); X c = *fs; X *fs = 0; /* keep just the path */ X X lock = Lock(file, SHARED_LOCK); X if (lock) { X FILE *fi = fopen("UULIB:Security", "r"); X if (fi) { X while (fgets(TmpBuf, sizeof(TmpBuf), fi)) { X char *ptr; X if (TmpBuf[0] == '#' || TmpBuf[0] == '\n' || TmpBuf[0] == 0) X continue; X X /* X * breakout the directory name and permissions X */ X X for (ptr = TmpBuf; *ptr != '\n' && *ptr != ' ' && *ptr != 9; ++ptr); X *ptr = 0; X X /* X * permissions allowed? X */ X X for (++ptr; *ptr && *ptr != type; ++ptr); X if (*ptr == 0) /* sorry */ X continue; X X if (slock = Lock(TmpBuf, SHARED_LOCK)) { X if (SameLock(lock, slock)) X disallow = 0; X UnLock(slock); X } X if (disallow == 0) X break; X } X fclose(fi); X } X UnLock(lock); X } X X *fs = c; /* restore path */ X X return(disallow); X} X XSameLock(lock, slock) XBPTR lock, slock; X{ X FileLock *fl1 = (FileLock *)((long)lock << 2); X FileLock *fl2 = (FileLock *)((long)slock << 2); X X if (fl1->fl_Task == fl2->fl_Task && fl1->fl_Key == fl2->fl_Key) X return(1); X return(0); X} X END_OF_FILE if test 2279 -ne `wc -c <'src/lib/security.c'`; then echo shar: \"'src/lib/security.c'\" unpacked with wrong size! fi # end of 'src/lib/security.c' fi if test -f 'src/lib/serialport.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/lib/serialport.c'\" else echo shar: Extracting \"'src/lib/serialport.c'\" \(2562 characters\) sed "s/^X//" >'src/lib/serialport.c' <<'END_OF_FILE' X X/* X * SERIALPORT.C X * X * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved. X * X * Serial Port locking to prevent collisions between, say, a Getty X * accepting a login sequence and a uucico calling up another machine. X * X * The existance of the public port indicates a lock. People waiting X * for the lock PutMsg() EXEC messages to the port. Upon unlocking, X * the unlocker will deallocate the port only if no messages are X * pending, else it will ReplyMsg() the first message in the queue X * and NOT deallocate the port. X * X * On receiving a message back you own the port and its memory X */ X X#include <proto/all.h> X#include <exec/memory.h> X Xtypedef struct MsgPort PORT; Xtypedef struct Message MSG; X Xstruct SMsgPort { X PORT Port; X short NameLen; X short Reserved; X}; X Xtypedef struct SMsgPort SPORT; X Xstatic SPORT *SPLock; X Xint IAmGetty = 0; X Xvoid XLockSerialPort(name, unit) Xchar *name; Xlong unit; X{ X short namelen = strlen(name) + 32; X char *portname; X SPORT *sport; X PORT *rport = NULL; X MSG msg; X X if (SPLock) X return; X X portname = AllocMem(namelen, MEMF_PUBLIC | MEMF_CLEAR); X X sprintf(portname, "SPLock-%d-%s", unit, name); X X Forbid(); X if (sport = (SPORT *)FindPort(portname)) { X rport = CreatePort(NULL, 0); X msg.mn_ReplyPort = rport; X msg.mn_Length = 0; X if (IAmGetty) X AddHead(&sport->Port.mp_MsgList, &msg); X else X AddTail(&sport->Port.mp_MsgList, &msg); X FreeMem(portname, namelen); X } else { X sport = AllocMem(sizeof(SPORT), MEMF_PUBLIC | MEMF_CLEAR); X sport->Port.mp_Node.ln_Name = portname; X sport->Port.mp_Node.ln_Type = NT_MSGPORT; X sport->Port.mp_Flags = PA_IGNORE; X sport->NameLen = namelen; X AddPort(&sport->Port); X } X Permit(); X SPLock = sport; X if (rport) { /* wait for message to be returned */ X WaitPort(rport); X DeletePort(rport); X } X} X X/* X * Unlock the serial port. If I am NOT the Getty then delay before X * unlocking to give the Getty a chance to take the next lock (it takes X * about a second for the Getty to realize the serial.device has been X * closed and try to take the lock. X */ X Xvoid XUnLockSerialPort(name, unit) Xchar *name; Xlong unit; X{ X MSG *msg; X X if (SPLock) { X if (IAmGetty == 0) X sleep(2); X Forbid(); X if (msg = GetMsg(&SPLock->Port)) { /* somebody else wants it */ X ReplyMsg(msg); X } else { /* nobody else wants it */ X RemPort(&SPLock->Port); X FreeMem(SPLock->Port.mp_Node.ln_Name, SPLock->NameLen); X FreeMem(SPLock, sizeof(SPORT)); X } X Permit(); X SPLock = NULL; X } X} X END_OF_FILE if test 2562 -ne `wc -c <'src/lib/serialport.c'`; then echo shar: \"'src/lib/serialport.c'\" unpacked with wrong size! fi # end of 'src/lib/serialport.c' fi if test -f 'src/uucico/includes.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/uucico/includes.h'\" else echo shar: Extracting \"'src/uucico/includes.h'\" \(2821 characters\) sed "s/^X//" >'src/uucico/includes.h' <<'END_OF_FILE' X/* X * @(#)includes.h 1.2 87/08/14 -- Copyright 1987 by John Gilmore X * Copying governed by GNU Emacs General Public License. X * X * Include files for various supported systems: X * Note that NAMESIZE should be the max length of a file name, including X * all its directories, drive specifiers, extensions, and the like. X * E.g. on a Unix with 14-char file names, NAMESIZE is several hundred X * characters, since the 14-char names can be nested. X * X * Ported to Amiga by William Loftus X * Changes Copyright 1988 by William Loftus. All rights reserved. X */ X X#ifdef BSD X/* Unix Berserkeley systems */ X#include <stdio.h> X#include <ctype.h> X#include <sys/param.h> X#include <sys/file.h> X#include <sys/time.h> X#include <string.h> X Xextern char *strtok(); X X#define UNIX X#define NAMESIZE MAXPATHLEN X#endif X X#ifdef SYSV X/* Unix System V */ X#include <stdio.h> X#include <ctype.h> X#include <fcntl.h> X#include <string.h> X X#define UNIX X#endif X X#ifdef UNIX X/* Stuff common to all Unix systems */ X#define remove unlink /* Unix-ism for removing a file */ X#define MULTITASK X#define STDIN 0 X#define SPOOLDIR "/usr/spool/uucp" X#define PUBDIR "/usr/spool/uucppublic" X#define LOGFILE "LOGFILE" X#define O_BINARY 0 /* No distinction between text and binary */ X#endif X X#ifdef CPM X/* CP/M-80 */ X#include <stdio.h> X#include <ctype.h> X#include <fcntl.h> X X#define NAMESIZE 50 /* No directories... */ X#endif X X#ifdef MSDOS X/* Microsoft DOS */ X#include <stdio.h> X#include <ctype.h> X#include <fcntl.h> X#include <time.h> X#include <signal.h> X#include <dos.h> X#include <conio.h> X#include <stdlib.h> X#include <process.h> X#include <string.h> X#include <direct.h> X#include <memory.h> X X/* Turn on support for the interrupt driven comm port routines */ X#define COMPORT X X#ifdef COMPORT X#include "comport.h" Xint handler(); X#endif X X#define GET_TIME 0x2c /* DOS function number for get_time */ X#define DOS_INT 0x21 /* DOS interrupt number */ X Xtypedef struct timetype { X unsigned hour; X unsigned minute; X unsigned sec; X unsigned hsec; X} TIME, *TIME_PTR; X X X/* FIXME, these should all be uppercase. */ X#define fnamesize sizeof("FILENAME") /* 8 chars */ X#define NAMESIZE 128 /* full path size */ X#define ufnamesize 5 /* uux id size */ X#endif X X#ifdef ST X/* Atari ST */ X#include <stdio.h> X#include <ctype.h> X#include <osbind.h> X#include <signal.h> X X#define O_RDONLY 0 /* for read only open() */ X#define AUX 1 /* rs232 port */ X#define CON 2 /* console */ X#define NAMESIZE 13 /* filename size */ X#define CTRL(X) (X & 037) X X#endif X X#ifdef AMIGA X#include <exec/types.h> X#include <fcntl.h> X#include <exec/exec.h> X#include <devices/serial.h> X#include <devices/keymap.h> X#include <devices/timer.h> X#include <libraries/dos.h> X#include <signal.h> X#include <stdio.h> X#include <stdlib.h> X#include <string.h> X#include <ctype.h> X#include <time.h> X#define NAMESIZE 128 X#endif END_OF_FILE if test 2821 -ne `wc -c <'src/uucico/includes.h'`; then echo shar: \"'src/uucico/includes.h'\" unpacked with wrong size! fi # end of 'src/uucico/includes.h' fi if test -f 'src/uucico/uuxqt.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/uucico/uuxqt.c'\" else echo shar: Extracting \"'src/uucico/uuxqt.c'\" \(2378 characters\) sed "s/^X//" >'src/uucico/uuxqt.c' <<'END_OF_FILE' X X/* X * UUXQT.C by William Loftus X * Copyright 1988 by William Loftus. All rights reserved. X * X * Beta Version 0.31 X * X */ X X#include <stdio.h> X#include <string.h> X#include "/version.h" X XIDENT(".01"); X Xstatic char names[3000]; Xstatic char *pointers[300]; Xstatic int file_pointer; Xstatic int error; Xstatic char* xfile; Xstatic char dfile[128]; Xstatic char cmd[1024]; Xstatic char ccmd[128]; Xstatic char ccmd_args[128]; Xstatic char buf[128]; Xstatic char path[128]; X X#define DELIM " \t\n\r" X XCXBRK() X{ X return(0); X} X Xchar * Xwork_scan() X{ X static char name[128]; X int count; X X file_pointer = 0; X X sprintf(name,"UUSPOOL:X.#?"); X X count = getfnl(name,names,sizeof(names),0); X X if (count > 0) { X printf("New files have arrived.\n"); X X if (strbpl(pointers,300,names) != count) { X printf("Too many execute files\n"); X return (char *)NULL; X } X } else { X return (char *)NULL; X } X return (char *)1; X} X Xchar * Xwork_next() X{ X return pointers[file_pointer++]; X} X Xparse(x) Xchar *x; X{ X FILE *fp; X char *tmp; X X fp = fopen(x, "r"); X if (fp == (char *)NULL) { X printf("Can't open file %s\n",x); X chdir(path); X return(0); X } X while (fgets(buf, sizeof buf, fp)) { X if (strncmp(buf, "F", 1) == 0) X strcpy(dfile, strtok(&buf[1],DELIM)); X else if (strncmp(buf, "C", 1) == 0) X strcpy(ccmd, strtok(&buf[1],DELIM)); X strcpy(ccmd_args, strtok(NULL, DELIM)); X while ((tmp = (char *)strtok(NULL, DELIM)) != NULL) { X strcat(ccmd_args, " "); X strcat(ccmd_args, tmp); X } X } X X if (strncmp(ccmd, "rmail", 5) == 0) { X sprintf(cmd,"uucp:c/rmail < %s %s", dfile, ccmd_args); X } else if (strncmp(ccmd, "cunbatch", 5) == 0) { X sprintf(cmd,"uucp:c/cunbatch < %s %s", dfile, ccmd_args); X } else if (strncmp(ccmd, "rnews", 5) == 0) { X sprintf(cmd,"uucp:c/rnews < %s %s", dfile, "UseNet"); X } else { X printf("Unknown command request %s - Operation Aborted -\n", ccmd); X error = 1; X } X fclose(fp); X return(1); X} X X Xvoid Xmain() X{ X getcwd(path,128); X chdir("UUSPOOL:"); X if (work_scan() != (char *)NULL) { X while ((xfile = work_next()) != (char *)NULL) { X LockFile(xfile); X if (parse(xfile)) { X int syserr; X if (syserr = system(cmd + 7)) X syserr = system(cmd); X if (syserr == 0 && error != 1) { X remove(xfile); X remove(dfile); X } X } X UnLockFile(xfile); X } X } X chdir(path); X} X END_OF_FILE if test 2378 -ne `wc -c <'src/uucico/uuxqt.c'`; then echo shar: \"'src/uucico/uuxqt.c'\" unpacked with wrong size! fi # end of 'src/uucico/uuxqt.c' fi echo shar: End of archive 3 \(of 16\). cp /dev/null ark3isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 16 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Submissions to comp.sources.amiga and comp.binaries.amiga should be sent to: amiga@cs.odu.edu or amiga@xanth.cs.odu.edu ( obsolescent mailers may need this address ) or ...!uunet!xanth!amiga ( very obsolescent mailers need this address ) Comments, questions, and suggestions should be addressed to ``amiga-request'' (please only use ``amiga'' for actual submissions) at the above addresses.