Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator) (02/04/90)
Submitted-by: overload!dillon (Matt Dillon) Posting-number: Volume 90, Issue 048 Archive-name: unix/uucp-1.03d/part04 #!/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 4 (of 16)." # Contents: Disk1.contents Problems.DOC man/Grep src/GUtil/gnote.c # src/GUtil/uuserdump.c src/News060/postnews.c # src/compress/tarsplit.c src/compress/uudecode.c # src/dmail/do_lists.c src/lib/alias.c src/sendmail/domain.c # src/uucico/modem.c src/uucico/uucp.c src/uucico/uux.c # Wrapped by tadguy@xanth on Sat Feb 3 20:51:05 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'Disk1.contents' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Disk1.contents'\" else echo shar: Extracting \"'Disk1.contents'\" \(3887 characters\) sed "s/^X//" >'Disk1.contents' <<'END_OF_FILE' X XArchive ../uucp1.03D.zoo.1: XLength CF Size Now Date Time X-------- --- -------- --------- -------- X 908 28% 656 28 Nov 88 10:11:14 uucp0/l/null-handler X 5204 32% 3540 25 Jan 90 14:31:56 uucp0/l/uuser-handler X 118 19% 96 7 Jan 90 21:49:46 uucp0/l/.DistFiles X 1379 38% 860 15 Oct 89 17:25:22 uucp0/s/.edrc X 9 0% 9 3 Nov 89 15:59:20 uucp0/s/.DistFiles X 872 28% 626 14 Jan 90 19:58:06 uucp0/s/startup-sequence X 471 20% 375 8 Jan 90 19:52:58 uucp0/s/crontab X 32 0% 32 7 Jan 90 21:51:14 uucp0/libs/.DistFiles X 30 0% 30 7 Jan 90 21:48:14 uucp0/devs/.DistFiles X 185 25% 138 29 Oct 89 15:17:58 uucp0/devs/Mountlist X 71 8% 65 10 Jan 90 12:14:48 uucp0/lib/NewsGroups X 3 0% 3 10 Jan 90 12:28:48 uucp0/lib/SeqNews X 99 0% 99 7 Jan 90 21:35:58 uucp0/lib/Getty-header X 987 34% 656 8 Jan 90 18:23:54 uucp0/lib/Domain X 369 25% 278 5 Jan 90 14:06:32 uucp0/lib/Security X 600 21% 477 8 Jan 90 18:33:52 uucp0/lib/Passwd X 497 37% 315 8 Jan 90 18:38:54 uucp0/lib/L.Sys X 255 24% 194 8 Jan 90 19:03:00 uucp0/lib/Config X 164 19% 133 14 Oct 89 15:36:20 uucp0/lib/news.distribution X 167 13% 145 8 Jan 90 21:33:42 uucp0/lib/.signature X 1027 32% 694 8 Jan 90 22:20:12 uucp0/lib/.dmailrc X 1273 29% 900 14 Jan 90 19:16:04 uucp0/lib/Aliases X 4 0% 4 25 Jan 90 12:45:38 uucp0/lib/seq X 0 0% 0 25 Jan 90 23:03:10 uucp0/mail/news/zoo-dummy X 0 0% 0 25 Jan 90 23:03:10 uucp0/mail/zoo-dummy X 0 0% 0 25 Jan 90 23:03:10 uucp0/spool/zoo-dummy X 0 0% 0 25 Jan 90 23:03:10 uucp0/pub/zoo-dummy X 23648 51% 11528 25 Jan 90 23:03:14 uucp0/man/dmail.help X 3727 42% 2155 24 Jan 90 20:15:56 uucp0/Problems.DOC X 14853 49% 7635 14 Jan 90 20:58:48 uucp0/SlowSetup.DOC X 755 29% 537 12 Jan 90 12:40:16 uucp0/NewsSetup.DOC X 2213 59% 909 10 Jan 90 19:32:04 uucp0/MakeDist X 5830 42% 3390 25 Jan 90 16:34:14 uucp0/QuickSetup.DOC X 7968 47% 4240 25 Jan 90 23:01:34 uucp0/README.NOW X 1265 29% 892 25 Jan 90 22:47:10 uucp0/VERSION.DOC X 58896 26% 43360 25 Jan 90 17:09:12 uucp0/c/dme X 11292 21% 8930 18 Oct 89 23:17:54 uucp0/c/dcron X 44864 28% 32107 25 Jan 90 14:20:44 uucp0/c/uucico X 9328 22% 7232 25 Jan 90 14:22:46 uucp0/c/uupoll X 7316 22% 5709 25 Jan 90 14:24:16 uucp0/c/uuname X 11976 22% 9318 25 Jan 90 14:23:50 uucp0/c/gnote X 12684 23% 9783 25 Jan 90 14:25:54 uucp0/c/expandm X 8840 23% 6817 25 Jan 90 14:26:22 uucp0/c/trimfile X 14144 25% 10656 25 Jan 90 14:21:54 uucp0/c/uuxqt X 13932 24% 10591 25 Jan 90 14:23:54 uucp0/c/uux X 14028 24% 10691 25 Jan 90 14:09:40 uucp0/c/uucp X 27592 25% 20767 25 Jan 90 14:30:24 uucp0/c/rmail X 19684 26% 14478 25 Jan 90 13:57:46 uucp0/c/rnews X 17820 26% 13146 25 Jan 90 13:58:18 uucp0/c/PostNews X 18408 25% 13751 25 Jan 90 14:28:02 uucp0/c/getty X 47948 31% 33291 14 Jan 90 19:20:04 uucp0/c/dmail X 27592 25% 20767 25 Jan 90 14:30:22 uucp0/c/sendmail X 24760 27% 17952 10 Jan 90 18:48:56 uucp0/c/anews X 43 2% 42 8 Jan 90 19:21:04 uucp0/c/.DistFiles X 240 10% 215 2 Jan 90 21:45:42 uucp0/c/auxscript X 7352 23% 5647 25 Jan 90 14:21:40 uucp0/c/uuserdump X 26904 31% 18627 5 Feb 89 15:02:34 uucp0/c/dmake X-------- --- -------- --------- -------- X 500626 29% 355488 57 files END_OF_FILE if test 3887 -ne `wc -c <'Disk1.contents'`; then echo shar: \"'Disk1.contents'\" unpacked with wrong size! fi # end of 'Disk1.contents' fi if test -f 'Problems.DOC' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Problems.DOC'\" else echo shar: Extracting \"'Problems.DOC'\" \(3727 characters\) sed "s/^X//" >'Problems.DOC' <<'END_OF_FILE' X X X PROBLEMS.DOC X X Matthew Dillon X 891 Regal Rd. X Berkeley, Ca. 94708 X X pacbell.PacBell.COM!sorinc!overload!dillon X X X MODEM AND GETTY X X There are several possible sources of problems in setting up X UUCP. The major problem areas in order of likelyhood are X listed below: X X (1) The modem is expecting a protocol that Getty has not X been told to use (XON/XOFF, 7WIRE, none) X X If the modem uses 7-wire use the -7 option for Getty, else it is X assumed the modem uses no protocol. Normally you specify -7 but X the modem will probably work just fine whether you specify it or X not. X X (2) The modem does not hangup when DTR is dropped X X All modern modems hangup when DTR is dropped. Usually a dip switch X enables the option. If it is impossible to drop a connection by X dropping DTR you can use the -d0 option to make Getty use the +++ X sequence. This only works if you do not specify a dumb modem in X the -M option. X X (3) The modem does not understand simple AT commands or does X not generate a CONNECT message. X X If the modem does understand dropping DTR but does not understand X simple AT commands or generate a CONNECT message use -c0 -Md (no X connect msg and dumb modem). In this case the baud rate must be X known and specified with one or more -B options. When no CONNECT X message is available Getty does not know what the connect baud rate X actually is. It will begin by trying the first -B option and X switch to the next whenever a line-break is received. X X (4) Baud rate problems X X The default modem type when no -M option is specified for Getty is X a hays modem. If you have a multimodem you can use -Mm and the X baud adjust options for Getty. Normally you specify a -B option X for each baud rate the modem is capable of connecting at. If the X modem generates a CONNECT message you need only specify one -B X option that is used to reset the modem and Getty will automatically X handle the CONNECT messages. X X If your modem always talks to your Amiga at a given baud rate no X matter what the CONNECT message says then use a single -B option to X specify that baud rate then the -A option which tells getty to X ignore any baud rate specified in the CONNECT message. X X X OUTGOING CALLS X X Unfortunately Getty handles only incomming calls. UUCico deals without X outgoing calls itself. Currently you must specify the proper baud rate X in the L.Sys file for uucico to work properly. UUCico currently ignores X any connect message. X X Disconnecting will work the same way Getty handles it. If there is no X Getty running disconnecting works by dropping DTR. X X X NEWS X X RNews currently takes a large amount of memory (the 16 bit uncompress). X At the moment there is no real solution to this problem. If you X run out of memory you may be left with queue files that did not X get uuxqt'd due to uuxqt being unable to run rnews. X X X MAIL ADDRESSES X X If you have problems queuing mail check your L.sys file. Try emailing X to the adjacent node directly. E.G. if you can connect to 'foo' try X emailing a test message to 'foo!postmaster'. If you do not wind X up with three queue files in UUSPOOL: then your L.sys file X probably has no entry for foo. Whenever you email to somebody three X files should end up being added to UUSPOOL: and whenever you UUCico X to a given machine the spool files in question should be deleted as X they are sent. When UUCico receives mail from the remote machine it X will download the remote queue files to UUSPOOL: then uuxqt them. X That is, the remote queue files should will be placed temporarily in X UUSPOOL:, unpacked with rmail and placed in UUMAIL:, then deleted. X X END_OF_FILE if test 3727 -ne `wc -c <'Problems.DOC'`; then echo shar: \"'Problems.DOC'\" unpacked with wrong size! fi # end of 'Problems.DOC' fi if test -f 'man/Grep' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'man/Grep'\" else echo shar: Extracting \"'man/Grep'\" \(3569 characters\) sed "s/^X//" >'man/Grep' <<'END_OF_FILE' X XNAME X grep, - search file for regular expression X XSYNTAX X grep [option...] expression [file...] X XDESCRIPTION X The grep command searchs the input files (standard input X default) for lines matching a pattern. Normally, each X line found is copied to the standard output. The grep com- X mand patterns are limited regular expressions in the style X of ex(1), which uses a compact nondeterministic algorithm. X X In all cases the file name is shown if there is more than X one input file. Care should be taken when using the charac- X ters $ * [ ^ | ( ) and \ in the expression as they are also X meaningful to some Shells. It is safest to enclose the X entire expression argument in single quotes ' '. X X A \ followed by a single character other than new line X matches that character. X X The character ^ matches the beginning of a line. X X The character $ matches the end of a line. X X A . (period) matches any character. X X A single character not otherwise endowed with special X meaning matches that character. X X A string enclosed in brackets [] matches any single X character from the string. Ranges of ASCII character X codes may be abbreviated as in `a-z0-9'. A ] may occur X only as the first character of the string. A literal - X must be placed where it can't be mistaken as a range X indicator. X X A regular expression followed by an * (asterisk) X matches a sequence of 0 or more matches of the regular X expression. A regular expression followed by a + X (plus) matches a sequence of 1 or more matches of the X regular expression. A regular expression followed by a X ? (question mark) matches a sequence of 0 or 1 matches X of the regular expression. X X Two regular expressions concatenated match a match of X the first followed by a match of the second. X X Two regular expressions separated by | or new line X match either a match for the first or a match for the X second. X X A regular expression enclosed in parentheses matches a X match for the regular expression. X X The order of precedence of operators at the same parenthesis X level is [] then *+? then concatenation then | and new line. X X Ideally there should be only one grep, but we don't know a X single algorithm that spans a wide enough range of space- X time tradeoffs. X XOPTIONS X -b Precedes each output line with its block number. This is X sometimes useful in locating disk block numbers by con- X text. X X -c Produces count of matching lines only. X X -e expression X Uses next argument as expression that begins with a minus X (-). X X -i Considers upper and lowercase letter identical in making X comparisons. X X -l Lists files with matching lines only once, separated by a X new line. X X -n Precedes each matching line with its line number. X X -s Silent mode and nothing is printed (except error mes- X sages). This is useful for checking the error status X X -v Displays all lines that do not match specified expres- X sion. X X -w Searches for an expression as for a word (as if sur- X rounded by `\<' and `\>'). X XRESTRICTIONS X Lines are limited to 256 characters; longer lines are trun- X cated. X XDIAGNOSTICS X Exit status is 0 if any matches are found, 1 if none, 2 for X syntax errors or inaccessible files. X END_OF_FILE if test 3569 -ne `wc -c <'man/Grep'`; then echo shar: \"'man/Grep'\" unpacked with wrong size! fi # end of 'man/Grep' fi if test -f 'src/GUtil/gnote.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/GUtil/gnote.c'\" else echo shar: Extracting \"'src/GUtil/gnote.c'\" \(3220 characters\) sed "s/^X//" >'src/GUtil/gnote.c' <<'END_OF_FILE' X X/* X * GNOTE.C X * X * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved. X * X * GNOTE hellofile notefile X * X * Allow the user to enter a note and append it to notefile. See X * Getty. Password entry should have a '*' in front of the executable X * name for Getty to provide automatic stdin/stdout X * X */ X X#include <proto/all.h> X#include <stdio.h> X#include <time.h> X#include "/version.h" X XIDENT(".00"); X Xchar *GetLine(); Xvoid PutDaChar(); Xvoid FlushChars(); X Xvoid Xmain(ac, av) Xchar *av[]; X{ X time_t t; X char *ptr; X FILE *fi; X X time(&t); X X if (ac < 3) { X printf("gnote: expect 2 arguments, got %d\n", ac - 1); X fflush(stdout); X Delay(50*2); X exit(1); X } X printf("%s %s", Ident, ctime(&t)); X if (fi = fopen(av[1], "r")) { X char buf[128]; X while (fgets(buf, sizeof(buf), fi)) X fputs(buf, stdout); X fclose(fi); X } X fflush(stdout); X X if ((fi = fopen(av[2], "a")) == NULL) { X puts("couldn't open note file"); X fflush(stdout); X Delay(50*2); X exit(1); X } X fprintf(fi, "**NOTE** %s", ctime(&t)); X X while (ptr = GetLine()) { X if (strcmp(ptr, ".") == 0) X break; X if (strncmp(ptr, "**NOTE**", 8) == 0) X fprintf(fi, " "); X fprintf(fi, "%s\n", ptr); X } X puts("Thank you, hanging up in 5 seconds"); X fflush(stdout); X fclose(fi); X Delay(50*5); X} X X Xchar * XGetLine() X{ X static char buf[256]; X static char tab[256]; X short col = 0; X short i = 0; X short limit = 5*60; /* 5 minute idle timeout */ X short lcnt = 0; X short c; X X for (;;) { X c = GetDaChar(); X if (c == EOF) { X clrerr(stdin); X ++lcnt; X if (lcnt == limit - 30) { X puts("\r\n(idle, hangup in 30)\r\n"); X fflush(stdout); X } X if (lcnt == limit) X break; X continue; X } X lcnt = 0; X X switch(c) { X case 10: X case 13: X PutDaChar('\r'); X PutDaChar('\n'); X FlushChars(); X buf[i] = 0; X return(buf); X case 8: X case 127: X if (i) { X short n = 1; X --i; X if (buf[i] == 9) X n = tab[i]; X col -= n; X while (n--) { X PutDaChar('\010'); X PutDaChar(' '); X PutDaChar('\010'); X } X } X break; X case 'x'&0x1F: X PutDaChar('^'); X PutDaChar('X'); X PutDaChar('\r'); X PutDaChar('\n'); X i = 0; X break; X case 'r'&0x1F: X PutDaChar('\r'); X PutDaChar('\n'); X FlushChars(); X buf[i] = 0; X printf("%s", buf); X fflush(stdout); X break; X case 9: X if (i < sizeof(buf) - 2) { X tab[i] = 8 - (col & 7); X col += tab[i] - 1; /* because we ++ below */ X } X /* fall through */ X default: X if (i < sizeof(buf) - 2) { X PutDaChar(c); X buf[i++] = c; X ++col; X } else { X PutDaChar('g' & 0x1F); X } X break; X } X } X return(NULL); X} X Xvoid XFlushChars() X{ X PutDaChar(256); X} X Xvoid XPutDaChar(c) X{ X static char buf[256]; X static short len; X X if (c == 256 || len == sizeof(buf)) { X if (len) X write(0, buf, len); X len = 0; X } X if (c != 256) { X buf[len++] = c; X } X} X X XGetDaChar() X{ X static char buf[256]; X static short idx, len; X X if (idx == len) { X if (read(0, buf, 0) < 0) X FlushChars(); X idx = 0; X len = read(0, buf, sizeof(buf)); X if (len <= 0) { X len = 0; X return(EOF); X } X } X return((int)buf[idx++]); X} X END_OF_FILE if test 3220 -ne `wc -c <'src/GUtil/gnote.c'`; then echo shar: \"'src/GUtil/gnote.c'\" unpacked with wrong size! fi # end of 'src/GUtil/gnote.c' fi if test -f 'src/GUtil/uuserdump.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/GUtil/uuserdump.c'\" else echo shar: Extracting \"'src/GUtil/uuserdump.c'\" \(3865 characters\) sed "s/^X//" >'src/GUtil/uuserdump.c' <<'END_OF_FILE' X X/* X * UUSERDUMP.C X * X * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved. X * X * UUSERDUMP filename X * X * KEY THINGS ABOUT UUSER: USED AS STDIN/STDOUT X * X * Currently UUSER: works only with single sessions started X * by Getty (this has to do with how UUSER: deals with carrier X * detect). THIS WILL BE FIXED. X * X * (1) Use Level 1 I/O if you can (read/write) X * read() returns 0 on timeout, -1 on carrier lost X * otherwise, read() returns the immediate number of X * data bytes ready up to the amount you requested. X * (i.e. if you read(0,buf,256) you can get anywhere from X * -1, 0, 1 to 256 back). X * X * write() returns the number you wrote or -1 (lost carrier) X * X * To 'poll' data ready you can read(0, NULL, 0) .. reading X * 0 bytes returns 0 (data ready) or -1 (data not ready). X * NOTE: 0 (data ready) will be returned if carrier is lost X * when you read 0 bytes... this is so your program thinks X * data is ready and when it does a real read it finds that X * carrier was lost! X * X * (2) If you want to use Level 2 I/O (stdio) I suggest you use X * it for writing only. If you really want to use it for X * reading remember that the timeout will cause an EOF X * condition which must be cleared (clrerr()). And you X * must call ferror() to determine whether an EOF is an X * EOF (timeout()) or an actual error (lost carrier). X */ X X#include <proto/all.h> X#include <stdio.h> X#include "/version.h" X XIDENT(".00"); X Xvoid XCXBRK() /* on BREAK */ X{ X exit(1); X} X Xchar buf[256]; Xshort i; X Xvoid Xmain(ac, av) Xchar *av[]; X{ X short i; X char c; X short n; X FILE *fi = fopen(av[1], "r"); X X /* X * set output to line buffering (stdio), else it will use X * file buffering! Which is bad if we want to catch ^S/^C X */ X X setvbuf(stdout, NULL, _IOLBF, 0); X X X if (ac == 1) X exit(1); X X if (fi == NULL) X printf("Info file %s not available\r\n", av[1]); X X printf("Dumping info file (suggest capture), hit Enter when ready\n"); X fflush(stdout); X X /* X * Getty uses the R1000 option, so there is a one second timeout X * on reads when no data is present. If data is present, UUSER: X * returns the number of bytes immediately available regardless of X * how many you requested. X */ X X for (i = 0; i < 60; ++i) { X n = read(0, &c, 1); X if (n < 0) /* lost carrier */ X exit(1); X /* success */ X if (n > 0 && (c == 10 || c == 13)) X goto skip; X /* timeout */ X } X exit(1); Xskip: X while (fgets(buf, 256, fi)) { X if (CheckControl()) X break; X fputs(buf, stdout); X } X fclose(fi); X X printf("End of dump, any key to disconnect\n"); X fflush(stdout); X for (i = 0; i < 60; ++i) { X n = read(0, &c, 1); X if (n == 0) /* 1 second timeout */ X continue; X break; /* any key or lost cd */ X } X} X X/* X * Here we use a UUSER: trick ... requesting 0 bytes in a read() X * incurs NO timeout. 0 is returned if data is ready, -1 if data X * is not ready. X * X * Another way to do it is to dump a seconds worth of data, then X * call read() (which blocks for up to 1 second if no data is X * ready, but the user doesn't see that because we've already queued X * a second's worth of data). The first method is better because X * there is finer granularity (that is, the one used below) X */ X XCheckControl() X{ X char c = 0; X short n; X X if (read(0, NULL, 0) == 0) { /* returns 0=data ready, -1=not rdy */ X read(0, &c, 1); X if (c == ('s'&0x1F)) { /* ^S */ X for (;;) { X n = read(0, &c, 1); X if (n < 0) /* lost carrier */ X exit(1); X if (n == 0) /* timeout */ X continue; X break; /* got a key */ X } X return(0); X } X if (c == ('c'&0x1F)) /* ^C */ X return(1); X } X return(0); X} X END_OF_FILE if test 3865 -ne `wc -c <'src/GUtil/uuserdump.c'`; then echo shar: \"'src/GUtil/uuserdump.c'\" unpacked with wrong size! fi # end of 'src/GUtil/uuserdump.c' fi if test -f 'src/News060/postnews.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/News060/postnews.c'\" else echo shar: Extracting \"'src/News060/postnews.c'\" \(4092 characters\) sed "s/^X//" >'src/News060/postnews.c' <<'END_OF_FILE' X X/* X * PostNews.c X * X * Copyright 1988 by William Loftus. All rights reserved. X * X * Version 0.60 Beta X */ X X#include <time.h> X#include <stdio.h> X#include <stdlib.h> X#include "log.h" X Xchar *UserName; Xchar *NodeName; Xchar *RealName; Xchar *NewsEditor; Xchar *DomainName; Xchar to_buf[128]; Xchar grp_buf[128]; Xchar dist_buf[128]; Xchar subject_buf[128]; Xchar *temp_file_name; X Xint seq; X Xchar *NewsFeed; X Xchar cmd[128]; Xchar path[128]; Xchar signature[121]; X Xvoid read_ctl(); Xvoid GetTo(); Xvoid GetDist(); Xvoid GetSubject(); Xvoid GetMessage(); Xvoid BuildRnews(); Xvoid Signature(); Xvoid PromptGet(); Xchar *TmpFileName(); Xchar *FindConfig(); X Xvoid Xerrormsg (msg) Xchar *msg; X{ X printf(msg); X} X X Xvoid Xmain() X{ X temp_file_name = TmpFileName("UUSPOOL:news"); X X LogProgram = "PostNews"; X X UserName = FindConfig("UserName"); X NodeName = FindConfig("NodeName"); X NewsFeed = FindConfig("NewsFeed"); X NewsEditor=FindConfig("NewsEditor"); X RealName = FindConfig("RealName"); X DomainName=FindConfig("DomainName"); X X if (UserName == NULL || NodeName == NULL || NewsFeed == NULL || X NewsEditor==NULL || RealName == NULL || DomainName == NULL) X { X printf("UULIB:Config incomplete, missing one or more of:\n"); X printf(" UserName, NodeName, DomainName, NewsFeed, NewsEditor, RealName\n"); X exit(1); X } X X GetTo(); X GetDist(); X GetSubject(); X GetMessage(); X BuildRnews(); X} X Xvoid XGetTo() X{ X PromptGet("Newsgroup(s): ", 0, grp_buf, sizeof(grp_buf), stdin); X} X Xvoid XGetDist() X{ X FILE *fd; X char buf[128]; X X if (!(fd = fopen("UULIB:news.distribution", "r"))) { X errormsg("Can't Find news.distribution file"); X exit(3); X } X X while (fgets(buf, sizeof buf, fd)) { X printf("%s", buf); X } X X PromptGet("Distribution: ", 0, dist_buf, sizeof(dist_buf), stdin); X} X Xvoid XGetSubject() X{ X PromptGet("Subject: ", 1, subject_buf, sizeof(subject_buf), stdin); X} X Xvoid XGetMessage() X{ X FILE *fp; X time_t t; X X seq = GetSequence(4); X X fp = fopen(temp_file_name, "w"); X X if (fp) { X time(&t); X fprintf(fp,"Relay-Version: X-AmigaNEWS version 0.60 BETA; site %s%s\n", NodeName, DomainName); X fprintf(fp,"Posting-Version: X-AmigaNEWS version 0.60 BETA; site %s%s\n", NodeName, DomainName); X fprintf(fp,"Path: %s!%s\n", NodeName, UserName); X fprintf(fp,"From: %s@%s%s (%s)\n", UserName, NodeName, DomainName, RealName); X fprintf(fp,"Newsgroups: %s", grp_buf); X fprintf(fp,"Subject: %s", subject_buf); X fprintf(fp,"Message-Id: <%05d.AA%05d@%s%s>\n", seq, seq, NodeName, DomainName); X fprintf(fp,"Date: %s", ctime(&t)); X fprintf(fp,"Followup-To: %s", grp_buf); X fprintf(fp,"Expires: \n"); X fprintf(fp,"Keywords: \n"); X fprintf(fp,"Distribution: %s\n\n", dist_buf); X X fclose(fp); X } else { X errormsg("Can't open temp file %s\n", temp_file_name); X exit(1); X } X X sprintf(cmd,"%s %s", NewsEditor, temp_file_name); X system(cmd); X X printf("Append .signature file? [y/n] "); X fgets(signature, sizeof signature, stdin); X if ((signature[0] | 0x20) != 'n') { X Signature(); X printf(".signature file appended.\n"); X } X} X Xvoid XBuildRnews() X{ X NewsFeed[7] = '\0'; X X sprintf(cmd, "UUX %s \"%s!rnews\"", temp_file_name, NewsFeed); X system(cmd); X remove(temp_file_name); X} X X/* X * Read the control file and grab a few parameters. X */ X Xvoid XSignature() X{ X FILE *fp; X FILE *sf; X char buff[128]; X X fp = fopen(temp_file_name, "a"); /* should already exist!! */ X X if (!fp) { X errormsg("Can't open temp file--%s\n", temp_file_name); X exit(1); X } X X fprintf(fp, "\n--\n"); X X sf = fopen("UULIB:.signature", "r"); X X if (sf) { X while (NULL != fgets(buff, sizeof buff, sf)) { X fprintf(fp, "%s", buff); X } X fclose(sf); X } else { X errormsg("Can't open UULIB:.signature file\n"); X } X fclose(fp); X} X Xvoid XPromptGet(prompt, loop, buf, bufsize, fin) Xchar *prompt; Xchar *buf; XFILE *fin; X{ X short i; X X do { X printf("%s", prompt); X fflush(stdout); X if (fgets(buf, bufsize, fin) == NULL) X break; X for (i = 0; buf[i] == ' ' || buf[i] == 9; ++i); X if (buf[i] != '\n') X break; X } while (loop); X} X X END_OF_FILE if test 4092 -ne `wc -c <'src/News060/postnews.c'`; then echo shar: \"'src/News060/postnews.c'\" unpacked with wrong size! fi # end of 'src/News060/postnews.c' fi if test -f 'src/compress/tarsplit.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/compress/tarsplit.c'\" else echo shar: Extracting \"'src/compress/tarsplit.c'\" \(3856 characters\) sed "s/^X//" >'src/compress/tarsplit.c' <<'END_OF_FILE' X X/* X * TarSplit -- split up tar files (creating directories as needed) X * X * usage: TarSplit [pathname] X * X * semantics: splits up tar file taken from stdin (or pathname, if X * specified) and creates the files therein under the working data X * directory. X * X * AmigaDOS Version - no support for stdin. X */ X X#include <stdio.h> X#include "/version.h" X XIDENT(".00"); X X#ifdef AMIGA X#include <stdlib.h> X#include <exec/types.h> X#include <proto/all.h> Xtypedef int bool ; Xbool ChkSumOK() ; X#include <libraries/dosextens.h> X#else X#include <modes.h> X#include <bool.h> X#define DIRMODE (S_IREAD | S_IWRITE | S_IEXEC | S_IOREAD | S_IOEXEC) X#endif X#define TBLOCK 512 X#define NAMSIZ 100 X Xunion hblock { X char dummy[TBLOCK]; X struct header { X char name[NAMSIZ]; X char mode[8]; X char uid[8]; X char gid[8]; X char size[12]; X char mtime[12]; X char chksum[8]; X char linkflag; X char linkname[NAMSIZ]; X } dbuf; X}; X X#define BLKSIZE (sizeof (union hblock)) X#define HARDLINK '1' X#define SYMBLINK '2' X#define NORMAL '\0' X Xvoid DoFile(); X Xmain(argc, argv) Xint argc; Xchar *argv[]; X{ X FILE *TarFP; X union hblock TarBlock; X X#ifndef AMIGA X /* make the compiler happy about formatted I/O for longs... */ X pflinit(); X#endif X X switch(argc) { X#ifndef AMIGA X case 1: X TarFP = stdin; X break; X#endif X case 2: X if ((TarFP = fopen(argv[1], "r")) == NULL) { X fprintf(stderr, "TarSplit: can't open %s\n", argv[1]); X exit(1); X } X break; X default: X fprintf(stderr, "usage: TarSplit [pathname]\n"); X exit(1); X } X X for (;;) { X if (fread((char *)&TarBlock, BLKSIZE, 1, TarFP) == NULL) { X fprintf(stderr, "TarSplit: premature EOF\n"); X exit(1); X } else if (IsZero(&TarBlock)) { X while (fread((char *)&TarBlock, BLKSIZE, 1, TarFP) != NULL) X ; X break; X } else X DoFile(&TarBlock, TarFP); X } X X} X Xbool XIsZero(block) Xunion hblock *block; X{ X int i; X char *cblock; X X cblock = block->dummy; X for (i = 0; i < TBLOCK; i++) X if (*cblock++ != '\0') X return(FALSE); X X return (TRUE); X X} X Xvoid XDoFile(block, TarFP) Xunion hblock *block; XFILE *TarFP; X{ X long FSize; X char FName[NAMSIZ], *RefName; X int i; X bool IsDir, OpenOK; X FILE *NewFP; X X if (!ChkSumOK(block)) { X fprintf(stderr, "TarSplit: bad checksum, name %s?\n", X block->dbuf.name); X exit(1); X } X X switch(block->dbuf.linkflag) { X case HARDLINK: X case SYMBLINK: X fprintf(stderr, "TarSplit: can't handle links\n"); X exit(1); X case NORMAL: X break; X default: X fprintf(stderr, "TarSplit: unknown linkflag\n"); X exit(1); X } X X#ifdef AMIGA X if (sscanf(block->dbuf.size, "%12lo", &FSize) != 1) { X#else X if (sscanf(block->dbuf.size, "%12O", &FSize) != 1) { X#endif X fprintf(stderr, "TarSplit: bad size\n"); X exit(1); X } X X for (i = 0, RefName = block->dbuf.name; *RefName; i++, RefName++) X FName[i] = *RefName; X X if (IsDir = (*(RefName - 1) == '/')) { X FName[i - 1] = '\0'; X if (strcmp(FName, ".") == 0) X OpenOK = TRUE; X else X#ifdef AMIGA X { X BPTR Lock; X OpenOK = (Lock = CreateDir(FName)) != 0; X UnLock(Lock) ; X } X#else X OpenOK = mknod(FName, DIRMODE) == 0; X#endif X } else { X FName[i] = '\0'; X OpenOK = (NewFP = fopen(FName, "w")) != NULL; X } X X if (!OpenOK) { X fprintf(stderr, "TarSplit: can't create %s\n", FName); X exit(1); X } X X for (; FSize > 0; FSize -= TBLOCK) { X if (fread((char *)block, BLKSIZE, 1, TarFP) == NULL) { X fprintf(stderr, "TarSplit: premature EOF\n"); X exit(1); X } X if (!IsDir) X fwrite(block->dummy, 1, X (FSize > TBLOCK ? TBLOCK : (int) FSize), NewFP); X } X X if (!IsDir) X fclose(NewFP); X} X Xbool XChkSumOK(block) Xunion hblock *block; X{ X long Accum, ChkSumVal; X int i; X X#ifdef AMIGA X sscanf(block->dbuf.chksum, "%8lo", &ChkSumVal); X#else X sscanf(block->dbuf.chksum, "%8O", &ChkSumVal); X#endif X for (i = 0; i < 8; i++) X block->dbuf.chksum[i] = ' '; X X Accum = 0; X for (i = 0; i < TBLOCK; i++) X Accum += 0xff & block->dummy[i]; X X return(Accum == ChkSumVal); X X} END_OF_FILE if test 3856 -ne `wc -c <'src/compress/tarsplit.c'`; then echo shar: \"'src/compress/tarsplit.c'\" unpacked with wrong size! fi # end of 'src/compress/tarsplit.c' fi if test -f 'src/compress/uudecode.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/compress/uudecode.c'\" else echo shar: Extracting \"'src/compress/uudecode.c'\" \(3204 characters\) sed "s/^X//" >'src/compress/uudecode.c' <<'END_OF_FILE' X/* X * uudecode [input] X * X * create the specified file, decoding as you go. X * used with uuencode. X */ X X#include <stdio.h> X#include "/version.h" X XIDENT(".00"); X X#ifdef UNIX X# include <pwd.h> X# include <sys/types.h> X# include <sys/stat.h> X#endif X X#ifdef VMS X# include <types.h> X# include <stat.h> X#endif X X/* single character decode */ X#define DEC(c) (((c) - ' ') & 077) X Xvoid outdec(); Xvoid decode(); X Xvoid Xmain(argc, argv) Xchar **argv; X{ X FILE *in, *out; X#ifdef UNIX | VMS X struct stat sbuf; X#endif X int mode; X char dest[128]; X char buf[80]; X X /* optional input arg */ X if (argc > 1) { X if ((in = fopen(argv[1], "r")) == NULL) { X perror(argv[1]); X exit(1); X } X argv++; argc--; X } else X in = stdin; X X if (argc != 1) { X printf("Usage: uudecode [infile]\n"); X exit(2); X } X X /* search for header line */ X for (;;) { X if (fgets(buf, sizeof buf, in) == NULL) { X fprintf(stderr, "No begin line\n"); X exit(3); X } X if (strncmp(buf, "begin ", 6) == 0) X break; X } X sscanf(buf, "begin %o %s", &mode, dest); X X#ifdef UNIX X /* handle ~user/file format */ X if (dest[0] == '~') { X char *sl; X struct passwd *getpwnam(); X char *index(); X struct passwd *user; X char dnbuf[100]; X X sl = index(dest, '/'); X if (sl == NULL) { X fprintf(stderr, "Illegal ~user\n"); X exit(3); X } X *sl++ = 0; X user = getpwnam(dest+1); X if (user == NULL) { X fprintf(stderr, "No such user as %s\n", dest); X exit(4); X } X strcpy(dnbuf, user->pw_dir); X strcat(dnbuf, "/"); X strcat(dnbuf, sl); X strcpy(dest, dnbuf); X } X#endif /* UNIX */ X X /* create output file */ X out = fopen(dest, "w"); X if (out == NULL) { X perror(dest); X exit(4); X } X#ifdef UNIX | VMS X chmod(dest, mode); X#endif X X decode(in, out); X X if (fgets(buf, sizeof buf, in) == NULL || strcmp(buf, "end\n")) { X fprintf(stderr, "No end line\n"); X exit(5); X } X exit(0); X} X X/* X * copy from in to out, decoding as you go along. X */ X Xvoid Xdecode(in, out) XFILE *in; XFILE *out; X{ X char buf[80]; X char *bp; X int n; X X for (;;) { X /* for each input line */ X if (fgets(buf, sizeof buf, in) == NULL) { X printf("Short file\n"); X exit(10); X } X n = DEC(buf[0]); X if (n <= 0) X break; X X bp = &buf[1]; X while (n > 0) { X outdec(bp, out, n); X bp += 4; X n -= 3; X } X } X} X X/* X * output a group of 3 bytes (4 input characters). X * the input chars are pointed to by p, they are to X * be output to file f. n is used to tell us not to X * output all of them at the end of the file. X */ X Xvoid Xoutdec(p, f, n) Xchar *p; XFILE *f; X{ X int c1, c2, c3; X X c1 = DEC(*p) << 2 | DEC(p[1]) >> 4; X c2 = DEC(p[1]) << 4 | DEC(p[2]) >> 2; X c3 = DEC(p[2]) << 6 | DEC(p[3]); X if (n >= 1) X putc(c1, f); X if (n >= 2) X putc(c2, f); X if (n >= 3) X putc(c3, f); X} X X X/* fr: like read but stdio */ Xint Xfr(fd, buf, cnt) XFILE *fd; Xchar *buf; Xint cnt; X{ X int c, i; X X for (i=0; i<cnt; i++) { X c = getc(fd); X if (c == EOF) X return(i); X buf[i] = c; X } X return (cnt); X} X X/* X * Return the ptr in sp at which the character c appears; X * NULL if not found X */ X Xchar * Xindex(sp, c) Xregister char *sp, c; X{ X do { X if (*sp == c) X return(sp); X } while (*sp++); X return(NULL); X} X X#ifdef AMIGA Xperror(err) Xchar *err; X{ X printf("Can not open file \"%s\"\n", err); X return(NULL); X} X#endif END_OF_FILE if test 3204 -ne `wc -c <'src/compress/uudecode.c'`; then echo shar: \"'src/compress/uudecode.c'\" unpacked with wrong size! fi # end of 'src/compress/uudecode.c' fi if test -f 'src/dmail/do_lists.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/dmail/do_lists.c'\" else echo shar: Extracting \"'src/dmail/do_lists.c'\" \(4023 characters\) sed "s/^X//" >'src/dmail/do_lists.c' <<'END_OF_FILE' X X/* X * DO_LISTS.C X * X * (C) Copyright 1985-1990 by Matthew Dillon, All Rights Reserved. X * X * Global Routines: DO_SETLIST() X * DO_LIST() X * DO_SELECT() X * DO_DEFER() X * X * Static Routines: None. X * X * LIST associated commands. X * X */ X X#include <stdio.h> X#include "dmail.h" X X Xdo_setlist(str) Xchar *str; X{ X int i, fw, idx, localecho = 1; X int sac = 1; X X push_break(); X if (ac > sac && strcmp (av[sac], "-s") == 0) { X ++sac; X localecho = 0; X } X hold_load(); X if (ac > sac) { X Listsize = 0; X for (i = sac; i < ac; ++i) { X fw = atoi(av[i]); X if (fw > 4096) X fw = 4096; X if (fw < 0 || (*av[i] < '0' || *av[i] > '9')) X fw = 20; X else X ++i; X if (i >= ac) X continue; X idx = get_extra_ovr (av[i]); X if (idx < 0) { X printf ("To many entries, cannot load: %s\n", av[i]); X fflush (stdout); X continue; X } X header[Listsize] = idx; X width[Listsize] = fw; X ++Listsize; X } X } X nohold_load(); X pop_break(); X if (localecho) { X puts (""); X printf ("Entry Width Field\n\n"); X for (i = 0; i < Listsize; ++i) X printf ("%-6d %-5d %s\n", i, width[i], Find[header[i]].search); X puts (""); X } X return (1); X} X X X/* X * Pre-position # 0 > Current article X * 1 - Read already X */ X Xdo_rlist() X{ X int num = 20; X int istart = Current, iend = Current; X short dir = 1; X short try; X char buf[64]; X X if (av[1]) X num = atoi(av[1]); X if (num < 0) { X dir = -1; X num = -num; X } X for (try = 0; try < 2 && num; ++try, (dir = -dir)) { X int i; X if (dir < 0) { X for (i = Current; i >= 0 && num; --i) { X if (Entry[i].no && !(Entry[i].status & ST_DELETED)) { X istart = i; X --num; X } X } X } else { X for (i = Current; i < Entries && num; ++i) { X if (Entry[i].no && !(Entry[i].status & ST_DELETED)) { X iend = i; X --num; X } X } X } X } X if (istart != iend) { X sprintf(buf, "%d-%d", Entry[istart].no, Entry[iend].no); X ac = 2; X av[1] = buf; X return(do_list()); X } else { X return(-1); X } X} X Xdo_list() X{ X int i, j; X static char curr[10] = { " " }; X X if (ac == 1) { X av[1] = "all"; X ++ac; X } X if (push_base()) { X push_break(); X pop_base(); X PAGER (-1); X pop_break(); X return (-1); X } X PAGER (0); X FPAGER ("\n "); X for (j = 0; j < Listsize; ++j) { X if (width[j]) { X sprintf (Puf, "%-*.*s", X 2 + width[j], X 2 + width[j], X Find[header[j]].search); X FPAGER (Puf); X } X } X FPAGER ("\n"); X rewind_range (1); X while (i = get_range()) { X i = indexof(i); X if (Entry[i].no && ((Entry[i].status & ST_DELETED) == 0)) { X curr[0] = (Entry[i].status & ST_TAG) ? 'T' : ' '; X curr[1] = (i == Current) ? '>' : ' '; X curr[2] = (Entry[i].status & ST_READ) ? 'r' : ' '; X curr[3] = (Entry[i].status & ST_STORED) ? 'w' : ' '; X sprintf (Puf, "%s%-3d", curr, Entry[i].no); X FPAGER (Puf); X for (j = 0; j < Listsize; ++j) { X if (width[j]) { X sprintf(Puf, " %-*.*s", X width[j], X width[j], X Entry[i].fields[header[j]]); X FPAGER (Puf); X } X } X FPAGER ("\n"); X } X } X FPAGER ("\n"); X PAGER (-1); X pop_base(); X return (1); X} X X X Xdo_select(str, mode) Xchar *str; X{ X int ret = 1; X int localecho = 1; X int avi = 1; X int scr; X if (ac == 1) X return (1); X if (strcmp (av[avi], "-s") == 0) { X localecho = 0; X ++avi; X --ac; X } X switch (ac) { X case 2: X if (localecho) X puts ("SELECT ALL"); X ret = m_select (Nulav, mode); X break; X case 1: X break; X default: X ret = m_select (av + avi, mode); X scr = indexof(0); X if (scr > 0 && localecho) X printf ("%d Entries selected\n", Entry[scr].no); X break; X } X if (ret < 0 && localecho) { X puts ("Null field"); X return (-1); X } X return (1); X} X X Xdo_defer() X{ X register int i, j; X X push_break(); X j = 1; X for (i = 0; i < Entries; ++i) { X if (Entry[i].no) X Entry[i].no = (Entry[i].status & ST_READ) ? 0 : j++; X } X pop_break(); X return (1); X} X END_OF_FILE if test 4023 -ne `wc -c <'src/dmail/do_lists.c'`; then echo shar: \"'src/dmail/do_lists.c'\" unpacked with wrong size! fi # end of 'src/dmail/do_lists.c' fi if test -f 'src/lib/alias.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/lib/alias.c'\" else echo shar: Extracting \"'src/lib/alias.c'\" \(4268 characters\) sed "s/^X//" >'src/lib/alias.c' <<'END_OF_FILE' X X/* X * ALIAS.C X * X * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved. X * X * Interpret UULIB:Aliases file. To save space we do not load X * the entire file, just sections on demand. X * X * # = comment X * id: name [, name...] X * X * name is a user name, path, or |filter, or quoted name. Example, X * "|more" or "|rnews" X */ X X#include <proto/all.h> X#include <stdio.h> X#include <stdlib.h> X#include <fcntl.h> X#include <time.h> X X#include "log.h" X X#define HASHSIZE 256 X#define HASHMASK (HASHSIZE-1) X X#define HF_TERM 0x01 /* terminator name */ X#define HF_ALIAS 0x02 /* alias */ X#define HF_LOADED 0x04 /* def loaded */ X Xtypedef struct Hash { X struct Hash *Next; X short NumAlias; /* # of aliases */ X short Flags; X char *Name; /* aliased user name */ X union { X struct Hash **Alias; /* list of aliases */ X long Offset; /* offset into file */ X } u; X} Hash; X Xstatic Hash *HashTab[HASHSIZE]; Xstatic char Tmp[256]; X Xvoid XLoadAliases() X{ X FILE *fi = fopen("UULIB:Aliases", "r"); X short i; X short j; X short k; X short line = 0; X long newoffset = 0; X long offset; X Hash *h; X char *buf = Tmp; X X if (fi == NULL) { X ulog(-1, "Can't open UULIB:Aliases"); X return; X } X while (fgets(buf, 256, fi)) { X offset = newoffset; X newoffset = ftell(fi); X ++line; X for (i = 0; buf[i] == ' ' || buf[i] == 9; ++i); X if (buf[i] == '#' || buf[i] == '\n') X continue; X for (j = i; buf[j] && buf[j] != ':'; ++j); X if (buf[j] == 0) { X ulog(-1, "No Colon UULIB:Aliases line %d", line); X continue; X } X buf[j] = 0; X X k = HashFunc(buf + i); X h = malloc(sizeof(Hash)); X h->Next = HashTab[k]; X h->NumAlias = 0; X h->Flags = HF_ALIAS; X h->Name = malloc(strlen(buf+i) + 1); X h->u.Offset = offset + j + 1; X strcpy(h->Name, buf + i); X X HashTab[k] = h; X } X fclose(fi); X} X Xstatic XHash * XFindHashObject(name) Xchar *name; X{ X short k = HashFunc(name); X Hash *h; X X for (h = HashTab[k]; h; h = h->Next) { X if (strcmp(name, h->Name) == 0) X return(h); X } X return(NULL); X} X Xstatic Xvoid XLoadHashObject(hash) XHash *hash; X{ X FILE *fi = fopen("UULIB:Aliases", "r"); X char *buf = Tmp; X short i, j; X short c; X short numalloc = 4; X Hash **hv = malloc(sizeof(Hash *) * 4); X Hash *h; X X if (fi == NULL) { X ulog(-1, "Can't open UULIB:Aliases"); X return; X } X X hash->Flags |= HF_LOADED; X fseek(fi, hash->u.Offset, 0); X while (fgets(buf, 256, fi)) { X i = 0; X c = 'x'; X X for (;;) { X while (buf[i] == ' ' || buf[i] == 9) X ++i; X if (buf[i] == 0 || buf[i] == '\n') X break; X X for (j = i; buf[j] != '\n' && buf[j] != ' ' && buf[j] != 9 && buf[j] != ','; ++j) { X if (buf[j] == '\"') { X i = j + 1; X for (++j; buf[j] != '\n' && buf[j] != '\"'; ++j); X break; X } X } X c = buf[j]; X buf[j] = 0; X X if ((h = FindHashObject(buf + i)) == NULL) { X short k = HashFunc(buf + i); X X h = malloc(sizeof(Hash)); X h->Next = HashTab[k]; X h->NumAlias = 0; X h->Flags = HF_TERM; X h->Name = malloc(strlen(buf + i) + 1); X h->u.Alias = NULL; X strcpy(h->Name, buf + i); X X HashTab[k] = h; X } X X if (hash->NumAlias == numalloc) { X Hash **hvo = hv; X short add = 4; X X hv = malloc(sizeof(Hash *) * (numalloc + add)); X movmem((char *)hvo, (char *)hv, sizeof(Hash *) * numalloc); X numalloc += add; X } X hv[hash->NumAlias++] = h; X X i = j + 1; X if (c == '\"') X c = buf[i++]; X if (c == '\n' || c == 0) X i = j; X } X if (c != ',') X break; X } X hash->u.Alias = hv; X} X Xvoid XUserAliasList(user, callback) Xchar *user; Xvoid (*callback)(); X{ X short i; X Hash *hash = FindHashObject(user); X static short stack; X X if (++stack == 32) { X ulog(-1, "UULIB:Aliases recursion near user %s", user); X --stack; X return; X } X X if (hash && (hash->Flags & HF_TERM) == 0) { X if ((hash->Flags & HF_LOADED) == 0) X LoadHashObject(hash); X for (i = 0; i < hash->NumAlias; ++i) { X Hash *h = hash->u.Alias[i]; X UserAliasList(h->Name, callback); X } X } else { X (*callback)(user); X } X --stack; X} X Xstatic int XHashFunc(str) Xchar *str; X{ X unsigned long v = 0x14FBA5C3; X while (*str) { X v = (v << 5) ^ (*str & 0x1F) ^ (v >> 27); X ++str; X } X return((int)(v & HASHMASK)); X} X END_OF_FILE if test 4268 -ne `wc -c <'src/lib/alias.c'`; then echo shar: \"'src/lib/alias.c'\" unpacked with wrong size! fi # end of 'src/lib/alias.c' fi if test -f 'src/sendmail/domain.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/sendmail/domain.c'\" else echo shar: Extracting \"'src/sendmail/domain.c'\" \(4164 characters\) sed "s/^X//" >'src/sendmail/domain.c' <<'END_OF_FILE' X X/* X * DOMAIN.C X * X * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved. X * X * Given the first machine in a path scan the domain list and X * return the type, class, and address of the resource entry. X * X * AUTOMATIC HACKS: scans L.sys file and automatically deals X * with machine[.UUCP] domain, returning X * Type=MD Class=UU Addr=machine.UUCP X */ X X#include <proto/all.h> X#include <stdio.h> X#include <stdlib.h> X Xextern char *DefaultNode; X XDomainLookup(name, len, tb, cb, ab) Xchar *name; Xchar *tb; Xchar *cb; Xchar *ab; X{ X char *dary[16]; X char *tmp = malloc(len + 1); X char *tbase = tmp; X short b, i; X short di; X FILE *fi; X short level; /* best domain level found so far */ X static char buf[256]; X X for (b = i = di = 0; i < len && name[i] != '!'; ++i) { X if (name[i] == '.') { X if (di == sizeof(dary)/sizeof(dary[0]) - 1) { X ulog(-1, "DomainLookup, too many domains! %s", name); X break; X } X strncpy(tmp, name + b, i - b); X tmp[i - b] = 0; X dary[di] = tmp; X tmp += i - b + 1; X b = i + 1; X ++di; X } X } X strncpy(tmp, name + b, i - b); X tmp[i - b] = 0; X dary[di++] = tmp; X X#ifdef NOTDEF X { X short i; X for (i = 0; i < di; ++i) X printf("XX '%s'\n", dary[i]); X } X#endif X X fi = fopen("UULIB:Domain", "r"); X level = 0; X if (fi) { X while (fgets(buf, sizeof(buf), fi)) { X short l2; X short di2 = 0; X char *dary2[16]; X X if (buf[0] == ' ' || buf[0] == 9 || buf[0] == '\n' || buf[0] == '#') X continue; X for (b = i = 0; buf[i] && buf[i] != ' ' && buf[i] != 9; ++i) { X if (buf[i] == '.') { X if (di2 == sizeof(dary2)/sizeof(dary2[0]) - 1) { X ulog(-1, "UULIB:Domain, entry has too many subdomains: %s", buf); X break; X } X dary2[di2++] = buf + b; X buf[i] = 0; X b = i + 1; X } X } X buf[i] = 0; X dary2[di2++] = buf + b; X X buf[i] = 0; /* get domain name/wildcard */ X X l2 = CompareDomain(dary, di, dary2, di2); X X#ifdef NOTDEF X { X short i; X printf("\nres %d\n", l2); X for (i = 0; i < di; ++i) X printf("#1 %s\n", dary[i]); X for (i = 0; i < di2; ++i) X printf("#2 %s\n", dary2[i]); X } X#endif X X if (l2 > level) { /* better domain then what we have */ X sscanf(buf + i + 1, "%s %s %s", tb, cb, ab); X level = l2; X } X } X fclose(fi); X } X X /* X * Couldn't find the appropriate domain entry, check L.sys X * OR domain entry is a forwarder, check L.sys X */ X X if (strcmp(tb, "MF") == 0 || level == 0) { X if (fi = fopen("UULIB:L.sys", "r")) { X while (fgets(buf, sizeof(buf), fi)) { X if (buf[0] == ' ' || buf[0] == 9 || buf[0] == '#' || buf[0] == '\n') X continue; X for (i = 0; buf[i] && buf[i] != ' ' && buf[i] != 9; ++i); X buf[i] = 0; X if (strcmpi(dary[0], buf) == 0) { X strcpy(tb, "MD"); X strcpy(cb, "UU"); X strcpy(ab, buf); X strcat(ab, ".UUCP"); X level = 1; X break; X } X } X fclose(fi); X } X } X X /* X * Couldn't find nothing, use DefaultNode X */ X X if (level == 0) { X ulog(-1, "Warning, unable to interpret addr %s, using DefaultNode", name); X if (DefaultNode == NULL) { X ulog(-1, "Error, DefaultNode must exist if no UULIB:Domain"); X printf("ERROR, no entry in UULIB:Domain, UULIB:L.sys, and\n"); X printf("no DefaultNode config entry for %s\n", name); X puts("cannot send mail"); X free(tbase); X return(0); X } X strcpy(tb, "MF"); X strcpy(cb, "UU"); X strcpy(ab, DefaultNode); X level = 1; X } X free(tbase); X return(level > 0); X} X X/* X * Compares a broken up address with a domain entry (buf). X */ X XCompareDomain(da1, di1, da2, di2) Xchar **da1; Xshort di1; Xchar **da2; Xshort di2; X{ X short i, j; X short level = 0; X X for (i = di1 - 1, j = di2 - 1; i >= 0 && j >= 0; --i, --j) { X if (da2[j][0] == '*') { X ++level; X if (i && j == 0) /* so loop does not terminate */ X ++j; X continue; X } X if (strcmpi(da1[i], da2[j]) == 0) X level += 2; X else { X if (j + 1 < di2 && da2[j+1][0] == '*') { X ++level; X ++j; X } else X return(0); X } X } X if (j >= 0) /* didn't exhaust domain entry */ X return(0); X return((int)level); X} X END_OF_FILE if test 4164 -ne `wc -c <'src/sendmail/domain.c'`; then echo shar: \"'src/sendmail/domain.c'\" unpacked with wrong size! fi # end of 'src/sendmail/domain.c' fi if test -f 'src/uucico/modem.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/uucico/modem.c'\" else echo shar: Extracting \"'src/uucico/modem.c'\" \(3471 characters\) sed "s/^X//" >'src/uucico/modem.c' <<'END_OF_FILE' X X/* X * MODEM.C X * X * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved. X * X */ X X#include "includes.h" X#include "uucp.h" X#include "sysdep.h" X#include "modem.h" X#include "log.h" X X/* X * NOTE: modem stuff pretty much ignored if we are run from X * a getty. X */ X X#define MULTIMODEM /* I have a multi-modem */ X Xextern int Getty; Xextern int IgnoreCD; X Xint twrite(); Xint instr(); X Xvoid set_baud(); X Xvoid Xopenline() X{ X signal(SIGINT,sigint); X IgnoreCD |= 4; Xstart_again: X chkabort(); X if (instr("CONNECT", 7)) X goto start_again; X X X#ifdef MULTIMODEM X X#else X set_baud(get_baud()); X#endif X Delay(120); /* sleep 2 seconds */ X X IgnoreCD &= ~4; X} X X#ifndef MULTIMODEM X Xint Xget_baud() X{ X/* We've seen the CONNECT message, now we must see what baud rate X we've connected with */ X/* gather input until \r then see if it's 300, 1200, or 2400 */ X/* this is for hayes compatibles */ X X int data; X char rate[10]; X int rate_inx = 0; X X DEBUG(2,"looking for baud rate\n",0); X X while ( ((data = xgetc(BYTE_TO)) != EOF) && ((char)data != '\r')) { X if ((char)data == ' ') continue; X rate[rate_inx++] = (char)data; X } X DEBUG(2, "found baud rate of %s\n", rate); X if (strncmp(rate,"1200",4) == 0) return 1200; X if (strncmp(rate,"2400",4) == 0) return 2400; X if (rate_inx == 0) return 300; X return 1200; /* default */ X} X X#endif X Xvoid Xmodem_init() X{ X reset_modem(); X} X X/* X * Simple dialer routine. Needs replacement with a full blown X * script driven dialer. Next week maybe :-). FIXME. X */ X Xint Xdial_nbr(nbr) Xchar *nbr; X{ X char dial[30]; X int i; X X IgnoreCD |= 4; X X sprintf(dial, "%s%s\r", "ATDT", nbr); X X DEBUG(2,"dialing %s\n", dial); X X twrite(dial, strlen(dial)); X X i = instr("CONNECT", 7); X X if (i == 0) /* for those modems which don't bring CD up */ X Delay(50); /* immediately */ X X IgnoreCD &= ~4; X X return (i); X} X X/* X * RESET_MODEM() X * X * If run from a Getty we do NOT reset the modem, which would X * disconnect an already connected connection. X * X * Note that the delay between CloseSerial() and OpenSerial() only X * serves to give the Getty, if running, time to lock the port and X * begin a disconnect sequence. X */ X Xvoid Xreset_modem() X{ X if (Getty) /* called from a getty */ X return; X DEBUG(4, "Beg-Reset\n", 0); X CloseSerial(); /* drop dtr */ X Delay(50*3); /* delay 3 seconds */ X DEBUG(4, "End-Reset-1\n", 0); X OpenSerial(); /* re-open serial */ X DEBUG(4, "End-Reset-2\n", 0); X} X X#ifdef NOTDEF X X if (GettyCmd(DeviceName, DeviceUnit, '0', NULL) == 0) X return; X X /* X * Getty doesn't exist, we have to reset the modem ourselves! X */ X X IgnoreCD |= 4; X X#ifdef MULTIMODEM X set_baud(19200); X X if (CheckCarrier()) { X Delay(60); X twrite("+++", 3); X Delay(120); X } X twrite("ATH0\r", 5); X instr("OK\r\n", 4); X twrite("ATZ\r", 4); X instr("OK\r\n", 4); X twrite("ATZ\r", 4); X instr("OK\r\n", 4); X X /*amiga_closeopen();*/ X sprintf(init, "%s\r", "ATM0S0=2X4$BA0"); X if (debug > 0) X init[3] = '1'; X twrite(init, strlen(init)); X instr("OK\r\n",4); X#else X twrite("+++", 3); X Delay(60); X twrite("ATH0\r", 5); X Delay(120); X twrite("ATZ\r", 4); X Delay(60); X twrite("ATZ\r", 4); X Delay(60); X sprintf(init, "%s\r", "ATS2"); X twrite(init, strlen(init)); X Delay(60); X#endif X IgnoreCD &= ~4; X} X X#endif X END_OF_FILE if test 3471 -ne `wc -c <'src/uucico/modem.c'`; then echo shar: \"'src/uucico/modem.c'\" unpacked with wrong size! fi # end of 'src/uucico/modem.c' fi if test -f 'src/uucico/uucp.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/uucico/uucp.c'\" else echo shar: Extracting \"'src/uucico/uucp.c'\" \(3907 characters\) sed "s/^X//" >'src/uucico/uucp.c' <<'END_OF_FILE' X X/* X * UUCP.c written by William Loftus X * Copyright 1988 by William Loftus. All rights reserved. X */ X X#include <stdio.h> X#include "/version.h" X XIDENT(".00"); X Xchar to_buf[128]; Xchar from_buf[128]; Xchar path[128]; Xchar user[8]; X Xchar command_file[128]; Xint seq; X Xvoid BuildReceiveFile(); Xvoid BuildSendFile(); Xvoid read_ctl(); Xchar *expand_file(); Xchar *strchr(); Xchar *getcwd(); X X#define TRUE 1 X#define FALSE 0 X XCXBRK() X{ X return(0); X} X Xvoid Xmain(argc,argv) Xint argc; Xchar **argv; X{ X int to_bang, from_bang; X X if (argc != 3) { X printf("Usage: UUCP from_file to_file\n"); X exit(1); X } else { X strcat(from_buf, argv[1]); X strcat(to_buf, argv[2]); X } X X getcwd(path,128); X X if (chdir("UUSPOOL:")) { X printf("Couldn't change current working directory to UUSPOOL:\n"); X exit(1); X } X X read_ctl(); X X seq = GetSequence(2); X if (seq < 0) { X chdir(path); X exit(1); X } X X from_bang = (int)strchr(from_buf,'!'); X to_bang = (int)strchr(to_buf,'!'); X X if (from_bang && to_bang) { X printf("Can not specify a remote system in both arguments.\n"); X chdir(path); X exit(1); X } X X if (from_bang) { X BuildReceiveFile(); X } X X if (to_bang) { X BuildSendFile(); X } X X chdir(path); X exit(0); X} X Xvoid XBuildSendFile() X{ X FILE *fp; X char system_name[32]; X int bang; X X strcpy(from_buf,expand_file(from_buf)); X X bang = (int)strchr(to_buf,'!'); X bang = bang - (int)to_buf; X X strncpy(system_name,to_buf,bang); X X system_name[bang] = '\0'; X X if (!is_in_L_sys_file(system_name)) { X printf("System \"%s\" not in L.sys file.\n", system_name); X chdir(path); X exit(1); X } X X system_name[7] = '\0'; X X sprintf(command_file,"C.%sA%04d", system_name, seq++); X X LockFile(command_file); X X fp = fopen(command_file,"w"); X X if (fp) { X /* srcnam desnam who flags temp mode who */ X fprintf(fp,"S %s %s %s %s %s %s %s\n", X from_buf, X to_buf + bang + 1, X user, X "-c", X from_buf, X "0666", X user X ); X fclose(fp); X } else { X UnLockFile(command_file); X perror(command_file); X chdir(path); X exit(1); X } X UnLockFile(command_file); X printf("Command queue for transfer to %s.\n", system_name); X} X Xvoid XBuildReceiveFile() X{ X FILE *fp; X char system_name[32]; X int bang; X X strcpy(to_buf,expand_file(to_buf)); X X bang = (int)strchr(from_buf,'!'); X bang = bang - (int)from_buf; X X strncpy(system_name,from_buf,bang); X X system_name[bang] = '\0'; X X if (!is_in_L_sys_file(system_name)) { X printf("System \"%s\" not in L.sys file.\n", system_name); X chdir(path); X exit(1); X } X X system_name[7] = '\0'; X X sprintf(command_file,"C.%sA%04d", system_name, seq++); X X LockFile(command_file); X X fp = fopen(command_file,"w"); X if (fp) { X /* srcnam desnam who flags */ X fprintf(fp,"R %s %s %s %s\n", X from_buf + bang + 1, X to_buf, X user, X "-c" X ); X fclose(fp); X } else { X UnLockFile(command_file); X perror(command_file); X chdir(path); X exit(1); X } X UnLockFile(command_file); X printf("Command queue for transfer from %s.\n", system_name); X} X Xstatic char name[128]; X Xchar * Xexpand_file(file_name) Xchar *file_name; X{ X char *colon; X X colon = strchr(file_name,':'); X if ((colon != (char*)NULL) && (colon != file_name)) { X return(file_name); X } else { X if (path[strlen(path)-1] != ':') { X sprintf(name,"%s/%s",path,file_name); X return name; X } else { X sprintf(name,"%s%s",path,file_name); X return name; X } X } X} X X#define CTL_DELIM " \t\r\n" X X/* X * Read the control file and grab a few parameters. X */ X Xvoid Xread_ctl() X{ X FILE *fd; X static char buf[128]; X X if (! (fd = fopen("UULIB:Config", "r"))) { X printf("Can't Find config file.\n"); X chdir(path); X exit(3); X } X X while (NULL != fgets(buf, sizeof buf, fd)) { X if (strncmp(buf, "UserName", 8) == 0) X strcpy(user, strtok(&buf[9], CTL_DELIM) ) ; X } X fclose(fd); X} X X END_OF_FILE if test 3907 -ne `wc -c <'src/uucico/uucp.c'`; then echo shar: \"'src/uucico/uucp.c'\" unpacked with wrong size! fi # end of 'src/uucico/uucp.c' fi if test -f 'src/uucico/uux.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/uucico/uux.c'\" else echo shar: Extracting \"'src/uucico/uux.c'\" \(3441 characters\) sed "s/^X//" >'src/uucico/uux.c' <<'END_OF_FILE' X X/* X * UUX.C by William Loftus X * Copyright 1988 by William Loftus. All rights reserved. X * X * Example: 1> uux mail-message "burdvax!rmail wpl" X */ X X#include <stdio.h> X#include <string.h> X#include "/version.h" X XIDENT(".01"); X Xchar user[128]; Xchar file_name[128]; Xchar command[128]; X Xchar exec_file[128]; Xchar x_exec_file[128]; Xchar command_file[128]; Xchar data_file[128]; Xint seq; X Xchar path[128]; X Xvoid read_ctl(); Xvoid GetTo(); Xvoid GetSubject(); X X#define TRUE 1 X#define FALSE 0 X XCXBRK() X{ X return(0); X} X Xvoid Xmain(argc, argv) Xint argc; Xchar **argv; X{ X int error; X X getcwd(path,128); X chdir("UUSPOOL:"); X read_ctl(); X if (argc == 3) { X strcpy(file_name, argv[1]); X strcpy(command, argv[2]); X } else { X printf("Usage: uux file-name command\n"); X printf("Example: 1> uux mail-message \"burdvax!rmail wpl\"\n"); X chdir(path); X exit(1); X } X seq = GetSequence(4); X if (seq >= 0) X error = Queue(); X UnLockFile(exec_file); X UnLockFile(x_exec_file); X UnLockFile(command_file); X UnLockFile(data_file); X chdir(path); X if (seq < 0 || error < 0) X exit(1); X} X XQueue() X{ X FILE *fp; X char system_name[32]; X int bang; X int error; X X bang = (int)strchr(command,'!'); X bang = bang - (int)command; X X strncpy(system_name,command,bang); X X system_name[bang] = '\0'; X X if (!is_in_L_sys_file(system_name)) { X printf ("System \"%s\" not in L.sys file.\n", system_name); X return(-1); X } X X system_name[7] = '\0'; X X sprintf(exec_file,"D.%sX%04d", system_name, seq++); X sprintf(x_exec_file,"X.%sX%04d", system_name, seq++); X sprintf(command_file,"C.%sA%04d", system_name, seq++); X sprintf(data_file,"D.%sB%04d", system_name, seq); X X LockFile(exec_file); X LockFile(x_exec_file); X LockFile(command_file); X LockFile(data_file); X X fp = fopen(exec_file,"w"); X if (fp) { X fprintf(fp,"U %s\n", user); X fprintf(fp,"F %s\n", data_file); X fprintf(fp,"I %s\n", data_file); X fprintf(fp,"C %s\n", (char *)command + bang + 1); X fclose(fp); X } else { X perror(exec_file); X return(-1); X } X X fp = fopen(command_file,"w"); X if (fp) { X fprintf(fp,"S %s %s %s - %s 0666\n", X data_file, X data_file, X user, X data_file X ); X fprintf(fp,"S %s %s %s - %s 0666\n", X exec_file, X x_exec_file, X user, X exec_file X ); X fclose(fp); X } else { X perror(command_file); X return(-1); X } X chdir(path); X error = Copy(file_name, data_file); X chdir("UUSPOOL:"); X return(error); X} X X/* X * Read the control file and grab a few parameters. X */ X X#define CTL_DELIM " \t\n\r" X Xvoid Xread_ctl() X{ X FILE *fd; X static char buf[128]; X X if (! (fd = fopen("UULIB:config", "r"))) { X printf("Can't Find config file"); X perror("config"); X chdir(path); X exit(3); X } X X while (NULL != fgets(buf, sizeof buf, fd)) { X if (strncmp(buf, "UserName", 8) == 0) X strcpy(user, strtok(&buf[9], CTL_DELIM)); X } X fclose(fd); X} X XCopy(from, to) Xchar *from; Xchar *to; X{ X FILE *fd; X FILE *td; X int c; X static char to_buf[128]; X X fd = fopen(from, "r"); X if (!fd) { X printf("Could not open %s.\n", from); X perror(from); X return(-1); X } X X strcpy(to_buf, "UUSPOOL:"); X strcat(to_buf, to); X X td = fopen(to_buf, "w"); X if (!td) { X printf("Could not open %s.\n", to_buf); X perror(to); X return(-1); X } X while ((c = fgetc(fd)) != EOF) { X fputc((char)c, td); X } X fclose(fd); X fclose(td); X return(1); X} X X END_OF_FILE if test 3441 -ne `wc -c <'src/uucico/uux.c'`; then echo shar: \"'src/uucico/uux.c'\" unpacked with wrong size! fi # end of 'src/uucico/uux.c' fi echo shar: End of archive 4 \(of 16\). cp /dev/null ark4isdone 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.