mj@dfv.rwth-aachen.de (Martin Junius) (05/24/91)
---- Cut Here and feed the following to sh ---- #!/bin/sh # This is part 02 of a multipart archive # ============= getdate.y ============== if test -f 'getdate.y' -a X"$1" != X"-c"; then echo 'x - skipping getdate.y (File already exists)' else echo 'x - extracting getdate.y (Text)' sed 's/^X//' << 'SHAR_EOF' > 'getdate.y' && %token ID MONTH DAY MERIDIAN NUMBER UNIT MUNIT SUNIT ZONE DAYZONE AGO %{ X /* Originally from: Steven M. Bellovin (unc!smb) */ X /* Dept. of Computer Science */ X /* University of North Carolina at Chapel Hill */ X /* @(#)getdate.y 2.17 11/30/87 */ X /* #include "defs.h" JF not used any more */ #include <sys/types.h> #ifdef USG struct timeb { X time_t time; X unsigned short millitm; X short timezone; X short dstflag; }; #else #include <sys/timeb.h> #endif #include <ctype.h> X #if defined(BSD4_2) || defined (BSD4_1C) #include <sys/time.h> #else /* sane */ #include <time.h> #endif /* sane */ X #ifdef __GNUC__ #define alloca __builtin_alloca #else #ifdef sparc #include <alloca.h> #endif #endif X #define NULL 0 #define daysec (24L*60L*60L) X static int timeflag, zoneflag, dateflag, dayflag, relflag; X static time_t relsec, relmonth; X static int hh, mm, ss, merid, day_light; X static int dayord, dayreq; X static int month, day, year; X static int ourzone; #define AM 1 #define PM 2 #define DAYLIGHT 1 #define STANDARD 2 #define MAYBE 3 X static time_t timeconv(); static time_t daylcorr(); static lookup(); X %} X %% timedate: /* empty */ X | timedate item X ; X item: tspec X {timeflag++;} X | zone X {zoneflag++;} X | dtspec X {dateflag++;} X | dyspec X {dayflag++;} X | rspec X {relflag++;} X | nspec; X nspec: NUMBER X {if (timeflag && dateflag && !relflag) year = $1; X else if ($1 > 10000) { X dateflag++; X day= $1%100; X month= ($1/100)%100; X year = month/10000; X } else {timeflag++;hh = $1/100;mm = $1%100;ss = 0;merid = 24;}}; X tspec: NUMBER MERIDIAN X {hh = $1; mm = 0; ss = 0; merid = $2;} X | NUMBER ':' NUMBER X {hh = $1; mm = $3; merid = 24;} X | NUMBER ':' NUMBER MERIDIAN X {hh = $1; mm = $3; merid = $4;} X | NUMBER ':' NUMBER NUMBER X {hh = $1; mm = $3; merid = 24; X day_light = STANDARD; ourzone = -($4%100 + 60*($4/100));} X | NUMBER ':' NUMBER ':' NUMBER X {hh = $1; mm = $3; ss = $5; merid = 24;} X | NUMBER ':' NUMBER ':' NUMBER MERIDIAN X {hh = $1; mm = $3; ss = $5; merid = $6;} X | NUMBER ':' NUMBER ':' NUMBER NUMBER X {hh = $1; mm = $3; ss = $5; merid = 24; X day_light = STANDARD; ourzone = -($6%100 + 60*($6/100));}; X zone: ZONE X {ourzone = $1; day_light = STANDARD;} X | DAYZONE X {ourzone = $1; day_light = DAYLIGHT;}; X dyspec: DAY X {dayord = 1; dayreq = $1;} X | DAY ',' X {dayord = 1; dayreq = $1;} X | NUMBER DAY X {dayord = $1; dayreq = $2;}; X dtspec: NUMBER '/' NUMBER X {month = $1; day = $3;} X | NUMBER '/' NUMBER '/' NUMBER X {month = $1; day = $3; year = $5;} X | MONTH NUMBER X {month = $1; day = $2;} X | MONTH NUMBER ',' NUMBER X {month = $1; day = $2; year = $4;} X | NUMBER MONTH X {month = $2; day = $1;} X | NUMBER MONTH NUMBER X {month = $2; day = $1; year = $3;}; X X rspec: NUMBER UNIT X {relsec += 60L * $1 * $2;} X | NUMBER MUNIT X {relmonth += $1 * $2;} X | NUMBER SUNIT X {relsec += $1;} X | UNIT X {relsec += 60L * $1;} X | MUNIT X {relmonth += $1;} X | SUNIT X {relsec++;} X | rspec AGO X {relsec = -relsec; relmonth = -relmonth;}; %% X static int mdays[12] = X {31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; #define epoch 1970 X extern struct tm *localtime(); X static time_t dateconv(mm, dd, yy, h, m, s, mer, zone, dayflag) int mm, dd, yy, h, m, s, mer, zone, dayflag; { X time_t tod, jdate; X register int i; X X if (yy < 0) yy = -yy; X if (yy < 100) yy += 1900; X mdays[1] = 28 + (yy%4 == 0 && (yy%100 != 0 || yy%400 == 0)); X if (yy < epoch || yy > 1999 || mm < 1 || mm > 12 || X dd < 1 || dd > mdays[--mm]) return (-1); X jdate = dd-1; X for (i=0; i<mm; i++) jdate += mdays[i]; X for (i = epoch; i < yy; i++) jdate += 365 + (i%4 == 0); X jdate *= daysec; X jdate += zone * 60L; X if ((tod = timeconv(h, m, s, mer)) < 0) return (-1); X jdate += tod; X if (dayflag==DAYLIGHT || (dayflag==MAYBE&&localtime(&jdate)->tm_isdst)) X jdate += -1*60*60; X return (jdate); } X static time_t dayconv(ord, day, now) int ord, day; time_t now; { X register struct tm *loctime; X time_t tod; X X tod = now; X loctime = localtime(&tod); X tod += daysec * ((day - loctime->tm_wday + 7) % 7); X tod += 7*daysec*(ord<=0?ord:ord-1); X return daylcorr(tod, now); } X static time_t timeconv(hh, mm, ss, mer) register int hh, mm, ss, mer; { X if (mm < 0 || mm > 59 || ss < 0 || ss > 59) return (-1); X switch (mer) { X case AM: if (hh < 1 || hh > 12) return(-1); X return (60L * ((hh%12)*60L + mm)+ss); X case PM: if (hh < 1 || hh > 12) return(-1); X return (60L * ((hh%12 +12)*60L + mm)+ss); X case 24: if (hh < 0 || hh > 23) return (-1); X return (60L * (hh*60L + mm)+ss); X default: return (-1); X } } X static time_t monthadd(sdate, relmonth) time_t sdate, relmonth; { X struct tm *ltime; X time_t dateconv(); X int mm, yy; X X if (relmonth == 0) return 0; X ltime = localtime(&sdate); X mm = 12*ltime->tm_year + ltime->tm_mon + relmonth; X yy = mm/12; X mm = mm%12 + 1; X return daylcorr(dateconv(mm, ltime->tm_mday, yy, ltime->tm_hour, X ltime->tm_min, ltime->tm_sec, 24, ourzone, MAYBE), sdate); } X static time_t daylcorr(future, now) time_t future, now; { X int fdayl, nowdayl; X X nowdayl = (localtime(&now)->tm_hour+1) % 24; X fdayl = (localtime(&future)->tm_hour+1) % 24; X return (future-now) + 60L*60L*(nowdayl-fdayl); } X static char *lptr; X static yylex() { X extern int yylval; X int sign; X register char c; X register char *p; X char idbuf[20]; X int pcnt; X X for (;;) { X while (isspace(*lptr)) X lptr++; X X if (isdigit(c = *lptr) || c == '-' || c == '+') { X if (c== '-' || c == '+') { X if (c=='-') sign = -1; X else sign = 1; X if (!isdigit(*++lptr)) { X /* yylval = sign; return (NUMBER); */ X return yylex(); /* skip the '-' sign */ X } X } else sign = 1; X yylval = 0; X while (isdigit(c = *lptr++)) X yylval = 10*yylval + c - '0'; X yylval *= sign; X lptr--; X return (NUMBER); X X } else if (isalpha(c)) { X p = idbuf; X while (isalpha(c = *lptr++) || c=='.') X if (p < &idbuf[sizeof(idbuf)-1]) *p++ = c; X *p = '\0'; X lptr--; X return (lookup(idbuf)); X } X X else if (c == '(') { X pcnt = 0; X do { X c = *lptr++; X if (c == '\0') return(c); X else if (c == '(') pcnt++; X else if (c == ')') pcnt--; X } while (pcnt > 0); X } X X else return (*lptr++); X } } X struct table { X char *name; X int type, value; }; X static struct table mdtab[] = { X {"january", MONTH, 1}, X {"february", MONTH, 2}, X {"march", MONTH, 3}, X {"april", MONTH, 4}, X {"may", MONTH, 5}, X {"june", MONTH, 6}, X {"july", MONTH, 7}, X {"august", MONTH, 8}, X {"september", MONTH, 9}, X {"sept", MONTH, 9}, X {"october", MONTH, 10}, X {"november", MONTH, 11}, X {"december", MONTH, 12}, X X {"sunday", DAY, 0}, X {"monday", DAY, 1}, X {"tuesday", DAY, 2}, X {"tues", DAY, 2}, X {"wednesday", DAY, 3}, X {"wednes", DAY, 3}, X {"thursday", DAY, 4}, X {"thur", DAY, 4}, X {"thurs", DAY, 4}, X {"friday", DAY, 5}, X {"saturday", DAY, 6}, X {0, 0, 0}}; X #define HRS *60 #define HALFHR 30 X static struct table mztab[] = { X {"a.m.", MERIDIAN, AM}, X {"am", MERIDIAN, AM}, X {"p.m.", MERIDIAN, PM}, X {"pm", MERIDIAN, PM}, X {"nst", ZONE, 3 HRS + HALFHR}, /* Newfoundland */ X {"n.s.t.", ZONE, 3 HRS + HALFHR}, X {"ast", ZONE, 4 HRS}, /* Atlantic */ X {"a.s.t.", ZONE, 4 HRS}, X {"adt", DAYZONE, 4 HRS}, X {"a.d.t.", DAYZONE, 4 HRS}, X {"est", ZONE, 5 HRS}, /* Eastern */ X {"e.s.t.", ZONE, 5 HRS}, X {"edt", DAYZONE, 5 HRS}, X {"e.d.t.", DAYZONE, 5 HRS}, X {"cst", ZONE, 6 HRS}, /* Central */ X {"c.s.t.", ZONE, 6 HRS}, X {"cdt", DAYZONE, 6 HRS}, X {"c.d.t.", DAYZONE, 6 HRS}, X {"mst", ZONE, 7 HRS}, /* Mountain */ X {"m.s.t.", ZONE, 7 HRS}, X {"mdt", DAYZONE, 7 HRS}, X {"m.d.t.", DAYZONE, 7 HRS}, X {"pst", ZONE, 8 HRS}, /* Pacific */ X {"p.s.t.", ZONE, 8 HRS}, X {"pdt", DAYZONE, 8 HRS}, X {"p.d.t.", DAYZONE, 8 HRS}, X {"yst", ZONE, 9 HRS}, /* Yukon */ X {"y.s.t.", ZONE, 9 HRS}, X {"ydt", DAYZONE, 9 HRS}, X {"y.d.t.", DAYZONE, 9 HRS}, X {"hst", ZONE, 10 HRS}, /* Hawaii */ X {"h.s.t.", ZONE, 10 HRS}, X {"hdt", DAYZONE, 10 HRS}, X {"h.d.t.", DAYZONE, 10 HRS}, X X {"gmt", ZONE, 0 HRS}, X {"g.m.t.", ZONE, 0 HRS}, X {"bst", DAYZONE, 0 HRS}, /* British Summer Time */ X {"b.s.t.", DAYZONE, 0 HRS}, X {"eet", ZONE, 0 HRS}, /* European Eastern Time */ X {"e.e.t.", ZONE, 0 HRS}, X {"eest", DAYZONE, 0 HRS}, /* European Eastern Summer Time */ X {"e.e.s.t.", DAYZONE, 0 HRS}, X {"met", ZONE, -1 HRS}, /* Middle European Time */ X {"m.e.t.", ZONE, -1 HRS}, X {"mest", DAYZONE, -1 HRS}, /* Middle European Summer Time */ X {"m.e.s.t.", DAYZONE, -1 HRS}, X {"wet", ZONE, -2 HRS }, /* Western European Time */ X {"w.e.t.", ZONE, -2 HRS }, X {"west", DAYZONE, -2 HRS}, /* Western European Summer Time */ X {"w.e.s.t.", DAYZONE, -2 HRS}, X X {"jst", ZONE, -9 HRS}, /* Japan Standard Time */ X {"j.s.t.", ZONE, -9 HRS}, /* Japan Standard Time */ X /* No daylight savings time */ X X {"aest", ZONE, -10 HRS}, /* Australian Eastern Time */ X {"a.e.s.t.", ZONE, -10 HRS}, X {"aesst", DAYZONE, -10 HRS}, /* Australian Eastern Summer Time */ X {"a.e.s.s.t.", DAYZONE, -10 HRS}, X {"acst", ZONE, -(9 HRS + HALFHR)}, /* Australian Central Time */ X {"a.c.s.t.", ZONE, -(9 HRS + HALFHR)}, X {"acsst", DAYZONE, -(9 HRS + HALFHR)}, /* Australian Central Summer */ X {"a.c.s.s.t.", DAYZONE, -(9 HRS + HALFHR)}, X {"awst", ZONE, -8 HRS}, /* Australian Western Time */ X {"a.w.s.t.", ZONE, -8 HRS}, /* (no daylight time there, I'm told */ X {0, 0, 0}}; X static struct table unittb[] = { X {"year", MUNIT, 12}, X {"month", MUNIT, 1}, X {"fortnight", UNIT, 14*24*60}, X {"week", UNIT, 7*24*60}, X {"day", UNIT, 1*24*60}, X {"hour", UNIT, 60}, X {"minute", UNIT, 1}, X {"min", UNIT, 1}, X {"second", SUNIT, 1}, X {"sec", SUNIT, 1}, X {0, 0, 0}}; X static struct table othertb[] = { X {"tomorrow", UNIT, 1*24*60}, X {"yesterday", UNIT, -1*24*60}, X {"today", UNIT, 0}, X {"now", UNIT, 0}, X {"last", NUMBER, -1}, X {"this", UNIT, 0}, X {"next", NUMBER, 2}, X {"first", NUMBER, 1}, X /* {"second", NUMBER, 2}, */ X {"third", NUMBER, 3}, X {"fourth", NUMBER, 4}, X {"fifth", NUMBER, 5}, X {"sixth", NUMBER, 6}, X {"seventh", NUMBER, 7}, X {"eigth", NUMBER, 8}, X {"ninth", NUMBER, 9}, X {"tenth", NUMBER, 10}, X {"eleventh", NUMBER, 11}, X {"twelfth", NUMBER, 12}, X {"ago", AGO, 1}, X {0, 0, 0}}; X static struct table milzone[] = { X {"a", ZONE, 1 HRS}, X {"b", ZONE, 2 HRS}, X {"c", ZONE, 3 HRS}, X {"d", ZONE, 4 HRS}, X {"e", ZONE, 5 HRS}, X {"f", ZONE, 6 HRS}, X {"g", ZONE, 7 HRS}, X {"h", ZONE, 8 HRS}, X {"i", ZONE, 9 HRS}, X {"k", ZONE, 10 HRS}, X {"l", ZONE, 11 HRS}, X {"m", ZONE, 12 HRS}, X {"n", ZONE, -1 HRS}, X {"o", ZONE, -2 HRS}, X {"p", ZONE, -3 HRS}, X {"q", ZONE, -4 HRS}, X {"r", ZONE, -5 HRS}, X {"s", ZONE, -6 HRS}, X {"t", ZONE, -7 HRS}, X {"u", ZONE, -8 HRS}, X {"v", ZONE, -9 HRS}, X {"w", ZONE, -10 HRS}, X {"x", ZONE, -11 HRS}, X {"y", ZONE, -12 HRS}, X {"z", ZONE, 0 HRS}, X {0, 0, 0}}; X static lookup(id) char *id; { #define gotit (yylval=i->value, i->type) X X char idvar[128]; X register char *j, *k; X register struct table *i; X int abbrev; X X (void) strcpy(idvar, id); X j = idvar; X k = id - 1; X while (*++k) X *j++ = isupper(*k) ? tolower(*k) : *k; X *j = '\0'; X X if (strlen(idvar) == 3) X abbrev = 1; X else X if (strlen(idvar) == 4 && idvar[3] == '.') { X abbrev = 1; X idvar[3] = '\0'; X } X else X abbrev = 0; X X for (i = mdtab; i->name; i++) { X k = idvar; X for (j = i->name; *j++ == *k++;) { X if (abbrev && j == i->name+3) X return gotit; X if (j[-1] == 0) X return gotit; X } X } X X for (i = mztab; i->name; i++) X if (strcmp(i->name, idvar) == 0) X return gotit; X X for (i=mztab; i->name; i++) X if (strcmp(i->name, idvar) == 0) X return gotit; X X for (i=unittb; i->name; i++) X if (strcmp(i->name, idvar) == 0) X return gotit; X X if (idvar[strlen(idvar)-1] == 's') X idvar[strlen(idvar)-1] = '\0'; X X for (i=unittb; i->name; i++) X if (strcmp(i->name, idvar) == 0) X return gotit; X X for (i = othertb; i->name; i++) X if (strcmp(i->name, idvar) == 0) X return gotit; X X if (strlen(idvar) == 1 && isalpha(*idvar)) { X for (i = milzone; i->name; i++) X if (strcmp(i->name, idvar) == 0) X return gotit; X } X X return ID; } X time_t getdate(p, now) char *p; struct timeb *now; { #define mcheck(f) if (f>1) err++ X time_t monthadd(); X int err; X struct tm *lt; X struct timeb ftz; X X time_t sdate, tod; X X lptr = p; X if (now == ((struct timeb *) NULL)) { X now = &ftz; X ftime(&ftz); X } X lt = localtime(&now->time); X year = lt->tm_year; X month = lt->tm_mon+1; X day = lt->tm_mday; X relsec = 0; relmonth = 0; X timeflag=zoneflag=dateflag=dayflag=relflag=0; X ourzone = now->timezone; X day_light = MAYBE; X hh = mm = ss = 0; X merid = 24; X X if (err = yyparse()) return (-1); X X mcheck(timeflag); X mcheck(zoneflag); X mcheck(dateflag); X mcheck(dayflag); X X if (err) return (-1); X if (dateflag || timeflag || dayflag) { X sdate = dateconv(month,day,year,hh,mm,ss,merid,ourzone,day_light); X if (sdate < 0) return -1; X } X else { X sdate = now->time; X if (relflag == 0) X sdate -= (lt->tm_sec + lt->tm_min*60 + X lt->tm_hour*(60L*60L)); X } X X sdate += relsec; X sdate += monthadd(sdate, relmonth); X X if (dayflag && !dateflag) { X tod = dayconv(dayord, dayreq, sdate); X sdate += tod; X } X X /* X ** Have to do *something* with a legitimate -1 so it's distinguishable X ** from the error return value. (Alternately could set errno on error.) X */ X return (sdate == -1) ? 0 : sdate; } X static yyerror(s) char *s; { } X #ifdef USG ftime(timeb) struct timeb *timeb; { X extern long timezone; X extern int daylight; X long t = 0; X X localtime(&t); /* Dummy to init timzeone */ X ctime(&t); /* Dummy to init timzeone (XENIX) */ X time(&(timeb->time)); X timeb->millitm=0; X timeb->timezone=timezone/60; /* Timezone is in seconds! */ X timeb->dstflag=daylight; } #endif SHAR_EOF chmod 0644 getdate.y || echo 'restore of getdate.y failed' Wc_c="`wc -c < 'getdate.y'`" test 13426 -eq "$Wc_c" || echo 'getdate.y: original size 13426, current size' "$Wc_c" fi # ============= frecv.sh ============== if test -f 'frecv.sh' -a X"$1" != X"-c"; then echo 'x - skipping frecv.sh (File already exists)' else echo 'x - extracting frecv.sh (Text)' sed 's/^X//' << 'SHAR_EOF' > 'frecv.sh' && : #!/bin/sh # # $Id: frecv.sh,v 1.5 91/03/29 18:10:43 mj Exp $ # # This shell script feeds the msg in SPOOL/unpacked to # either rnews or rmail, depending on their destination: # # N.xxxx -> rnews # M.xxxx -> rmail # # Must be used after fido mail packets were processed # with funpack. # X SPOOL=??SPOOL?? X # # Test for addresses allowed to FIDONET users # # name # name@hippo # name@hippo.uucp # name@slcdec (UUCP feed) # name@system.domain.de (DNet) # name="[#$%&*+-/0-9=?A-Z_a-z.]+" pattern1="^${name}$" pattern2="^${name}@hippo(\.uucp)?$" pattern3="^${name}@${name}\.de$" pattern4="^${name}@slcdec$" pattern="$pattern1 $pattern2 $pattern3 $pattern4" addrok="no" X testaddr() { # Im Moment sind erstmal wieder alle Adressen erlaubt! addrok="yes" # addrok="no" # for p in $pattern # do # echo $1 | egrep "$p" >/dev/null # if [ $? -eq 0 ]; then addrok="yes"; break; fi # done } X X X cd ${SPOOL}/unpacked X # # Process news messages # for f in N.* do X if [ -f $f ] X then X rnews < $f X status=$? X if [ $status -eq 0 ] X then X rm -f $f X else X mv $f ../bad X fi X fi done X # # Process messages for mail # for f in M.* do X if [ -f $f ] X then X set X `sed <$f -n -e '/^To:/{' -e 's/To: *//p' -e q -e '}'` X shift X set X "$@" `sed <$f -n -e '/^Cc:/{' -e 's/Cc: *//p' -e q -e '}'` X shift X set X "$@" `sed <$f -n -e '/^Bcc:/{' -e 's/Bcc: *//p' -e q -e '}'` X shift X recv=`echo $@ | sed -e 's/ *(.*)//g'` X for i in $recv X do X testaddr $i X if [ $addrok = "no" ]; then break; fi X done X if [ $addrok = "yes" ]; then X rmail $recv < $f X status=$? X if [ $status -eq 0 ] X then X rm -f $f X else X mv $f ../bad X fi X else X mv $f ../bad X fi X fi done X Xexit 0 SHAR_EOF chmod 0755 frecv.sh || echo 'restore of frecv.sh failed' Wc_c="`wc -c < 'frecv.sh'`" test 1722 -eq "$Wc_c" || echo 'frecv.sh: original size 1722, current size' "$Wc_c" fi # ============= config.h ============== if test -f 'config.h' -a X"$1" != X"-c"; then echo 'x - skipping config.h (File already exists)' else echo 'x - extracting config.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'config.h' && /*:ts=4*/ /***************************************************************************** X * FIDOGATE --- Gateway software UNIX <-> FIDO X * X * $Id: config.h,v 1.17 91/05/22 22:14:08 mj Exp $ X * X * Configuration header file X * X * $Log: config.h,v $ X * Revision 1.17 91/05/22 22:14:08 mj X * Some clean-up for new release. X * X * Revision 1.16 91/03/29 18:08:11 mj X * New #define for generation of special Reply-To: adresses. X * X * Revision 1.15 91/01/28 19:32:34 mj X * New #define ERRORS_TO: return address for bounced mail. X * X * Revision 1.14 91/01/05 13:05:29 mj X * Changed domain name to ".dfv.rwth-aachen.de" X * X * Revision 1.13 90/12/10 16:33:31 mj X * Moved define of LOCK_LOCKF from Makefile to config.h. X * X * Revision 1.12 90/12/09 17:32:03 mj X * New #define's for mail forwarding in rmail (UUCPFEED). Removed X * GATEWAY definition. X * X * Revision 1.11 90/12/02 21:21:44 mj X * Changed program header to mention both authors of the original X * software posted to alt.sources. X * X * Revision 1.10 90/12/01 17:48:26 mj X * Removed unnecessary #defines of JUNK and JUNK_AREA. X * X * Revision 1.9 90/11/23 21:51:19 mj X * Removed #define's of INT16 and SWAB_BYTES. Not necessary any more X * because of the rewrite of fpack. X * X * Revision 1.8 90/11/05 20:49:31 mj X * Changed my signature in all program headers. X * X * Revision 1.7 90/09/16 17:35:27 mj X * Changed FIDODOMAIN to ".fidonet.org". X * X * Revision 1.6 90/09/03 17:50:45 mj X * Changed to new address. X * 2:242/6.1 aka 6000/1 X * X * Revision 1.5 90/08/12 14:13:31 mj X * Added definition for FIDO MSGID sequencer (MSGIDSEQ). X * X * Revision 1.4 90/07/30 20:00:16 mj X * Added support for new style FIDO addresses: X * p<point>.f<node>.n<net>.z<zone>.FIDODOMAIN X * FIDODOMAIN is defined in config.h X * X * Revision 1.3 90/07/15 10:22:15 mj X * Changed MAX_LINELEN to 80. X * X * Revision 1.2 90/06/28 22:03:53 mj X * Much rework of the sources, no more hsu.h and other clean up. X * rmail improved, now handles special XENIX quirks. X * X * Revision 1.1 90/06/21 21:06:05 mj X * Everything seems to work, so this delta was made. X * X * Revision 1.0 90/06/21 18:52:36 mj X * Initial revision X * X * X ***************************************************************************** X * This version hacked and maintained by: X * _____ _____ X * | |___ | Martin Junius FIDO: 2:242/6.1 2:242/6.0 X * | | | | | | Republikplatz 3 DOMAIN: mju@dfv.rwth-aachen.de X * |_|_|_|_____| D-5100 Aachen Tel. (Voice) 0241-86931 X * X * Original version of these programs and files: X * X * Teemu Torma X * Heikki Suonsivu FIDO: 2:504/1 UUCP: ...!mcsun!santra!hsu X * X *****************************************************************************/ X /* X * This is our net and node number X * X * We're 2:242/6.1 with fake address 2:6000/1 X */ #define REAL_ZONE 2 #define REAL_REGION 24 #define REAL_NET 242 #define REAL_NODE 6 #define REAL_POINT 1 X #define MY_ZONE 2 #define MY_REGION 24 #define MY_NET 6000 #define MY_NODE 1 #define MY_POINT 0 X #define MY_NAME "Hipposoft" X X /* X * This is where our mail goes to ... X */ #define REM_ZONE 2 #define REM_REGION 24 #define REM_NET 242 #define REM_NODE 6 #define REM_POINT 0 #define REM_NAME "Bossnode" X /* X * Echo feed (currently not used) X */ #define ECHOFEED_NET 242 #define ECHOFEED_NODE 6 X /* X * Domain suffix (added to hostname) X */ #define MY_HOSTNAME "hippo" #define MY_DOMAIN ".dfv.rwth-aachen.de" X /* X * UUCP feed (i.e. system we send UUCP mail to) X */ #define UUCPFEED "slcdec" #define UUCPFEED_DOMAIN ".dfv.rwth-aachen.de" X /* X * Domain suffix for FIDO net addresses X */ #define FIDODOMAIN ".fidonet.org" X /* X * Enable generation of Reply-To addresses X */ #define LOCAL_REPLY_TO /**/ X /* X * Return address for bounced mail. An `Errors-To:' header will X * be inserted for mail addressed via `To:' from FIDO if defined. X */ #define ERRORS_TO "root@hippo.dfv.rwth-aachen.de" X X X /* X * Directories the various programs work on X */ X #define SPOOL "/u/spool/fidonet" /* main spool directory */ #define SPOOL_BAD "/u/spool/fidonet/bad" /* rejected by rnews/rmail */ #define SPOOL_IN "/u/spool/fidonet/in" /* incoming packets */ #define SPOOL_OUT "/u/spool/fidonet/out" /* outgoing mail */ #define SPOOL_UNPACKED "/u/spool/fidonet/unpacked" /* output of funpack */ #define SPOOL_SENT "/u/spool/fidonet/sent" /* sent packets */ X #define LIBDIR "/u/lib/fidonet" /* config files / progs */ #define LOGFILE "/u/lib/fidonet/log" /* log file */ #define IDSEQUENCE "/u/lib/fidonet/idseq" /* message id sequence */ #define IPACKETSEQUENCE "/u/lib/fidonet/ipacketseq" /* input packet sequence */ #define OPACKETSEQUENCE "/u/lib/fidonet/opacketseq" /* output packet sequence */ #define BADSEQ "/u/lib/fidonet/badseq" /* bad messages sequence */ #define JOBSEQ "/u/lib/fidonet/seq" /* job number sequence */ #define MSGIDSEQ "/u/lib/fidonet/msgidseq" /* for generating ^AMSGID:*/ #define ALIAS "/u/lib/fidonet/Alias" /* alias file */ #define AREAS "/u/lib/fidonet/Areas" /* areas file */ X X /* X * Enable nodelist support X */ /*#define NODELIST_SUPPORT /* Use FIDO nodelist */ X X /* X * mail receiver for fidonet X */ #define RFMAIL "/u/lib/fidonet/rfmail" /* fido mail receiver */ /*#define RFMAIL "/u/mj/news/fidogate/rfmail" /* test version */ X /* X * Program which receives unpacked news articles X */ #define RNEWS "/bin/rnews" /* News receiver */ X /* X * Program which receives mail from fido net X */ #define RMAIL "/usr/bin/rmail" /* Mail receiver */ /* X * There is a replacement for rmail X * included in this package, which accepts fido net X * domain addresses and feeds this mail to rfmail. X * If you use the included rmail, you must rename X * the old rmail to ormail and install the included X * rmail as /usr/bin/rmail. X */ /*#define RECVMAIL "/usr/bin/ormail" /* Mail receiver */ #define RECVMAIL "/usr/lib/mail/execmail" /* XENIX */ /* X * Define this if you want rfmail to return underlivered mail. You do X * not need this if you are running sendmail or similiar which returns X * undelivered mail. X */ #define RETURN_FAILED_MAIL /**/ X X /* X * Lowest user id X */ #define USERUID 50 X /* X * System dependend configuration X */ X /***** Operating system *****/ #define USG /* System V */ /*#define BSD /* BSD 4.2+ */ X /***** File locking *****/ #define LOCK_LOCKF /* Use lockf(), else locking() */ X X /* X * parameters for fcall X */ X /* How many seconds wait before starting up fidonet handshake */ #define PREWAIT 5 X /* How many seconds to wait for line to clear */ #define WAITCLEAR 2 X /* How many tries to give for xmodem startup in send. This should be low X value, it just gives possibility to retry xmodem startup if modems X handshaked too fast (really a acu configuration problems, dial should X return after it has a working line available!) */ #define MAX_SEND_RETRIES 1 X /* Maximum baud rate to use when calling out */ #define MAXBAUD 1200 X /* Define minimum baud rate to use when calling out */ #define MINBAUD 300 X /* Width of formatted messages. Lines will be wrapped to be less X than this. If word is longer than 2/3s of MAX_LINELEN, it will be X cut instead of correct wrapping. */ #define MAX_LINELEN 80 X /* Dial translation table. first string stripped out, second one replaced */ X #define DIALTABLE "358-0-", "", "358-", "9", "", "990" SHAR_EOF chmod 0644 config.h || echo 'restore of config.h failed' Wc_c="`wc -c < 'config.h'`" test 7440 -eq "$Wc_c" || echo 'config.h: original size 7440, current size' "$Wc_c" fi # ============= packet.h ============== if test -f 'packet.h' -a X"$1" != X"-c"; then echo 'x - skipping packet.h (File already exists)' else echo 'x - extracting packet.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'packet.h' && /*:ts=4*/ /***************************************************************************** X * FIDOGATE --- Gateway software UNIX <-> FIDO X * X * $Id: packet.h,v 1.3 90/12/09 18:36:16 mj Exp $ X * X * FIDOnet packet definitions X * X * $Log: packet.h,v $ X * Revision 1.3 90/12/09 18:36:16 mj X * Reformatted code and added #define's for sizes of FIDO header fields. X * X * Revision 1.2 90/12/02 21:22:20 mj X * Changed program header to mention both authors of the original X * software posted to alt.sources. X * X * Revision 1.1 90/11/05 20:50:53 mj X * Changed my signature in all program headers. X * X * Revision 1.0 90/06/21 19:15:14 mj X * Initial revision X * X * X ***************************************************************************** X * This version hacked and maintained by: X * _____ _____ X * | |___ | Martin Junius FIDO: 2:242/6.1 2:242/6.0 X * | | | | | | Republikplatz 3 DOMAIN: mju@dfv.rwth-aachen.de X * |_|_|_|_____| D-5100 Aachen Tel. (Voice) 0241-86931 X * X * Original version of these programs and files: X * X * Teemu Torma X * Heikki Suonsivu FIDO: 2:504/1 UUCP: ...!mcsun!santra!hsu X * X *****************************************************************************/ X /* Structure for packet header. */ X typedef struct _packet { X short orig_node; /* originating node */ X short dest_node; /* destinating mode */ X short year; /* packing year (e.g. 1986) */ X short month; /* 0-11 for Jan - Dec */ X short day; /* 1-31 */ X short hour; /* 0-23 */ X short minute; /* 0-59 */ X short second; /* 0-59 */ X short rate; /* maximum baud rate */ X short ver; /* header version */ X short orig_net; /* originating net */ X short dest_net; /* destination net */ X char product; /* product */ X char x1; /* Extra byte */ #ifdef FIDO_V11w X short fill[16]; /* extra space */ #else X char pwd_kludge[8]; X short orig_zone; X short dest_zone; X char B_fill2[16]; X long B_fill3; #endif } Packet; X /* Attributes tranferred via mail. */ X #define ATTR_PRIVATE 0000001 /* private msg */ #define ATTR_CRASH 0000002 /* crash mail */ #define ATTR_FILE 0000020 /* files attached */ #define ATTR_UNUSED 0002000 /* unused */ #define ATTR_RRR 0010000 /* SEAdog only */ #define ATTR_IRR 0020000 /* SEAdog only */ #define ATTR_AUDREQ 0040000 /* SEAdog only */ X /* Packet and message types. */ X #define HDRVER 2 #define MSGTYPE 2 X /* Sizes of to/from/subject/date field */ #define SIZE_FROM 36 #define SIZE_TO 36 #define SIZE_SUBJECT 72 #define SIZE_DATE 20 SHAR_EOF chmod 0644 packet.h || echo 'restore of packet.h failed' Wc_c="`wc -c < 'packet.h'`" test 2561 -eq "$Wc_c" || echo 'packet.h: original size 2561, current size' "$Wc_c" fi # ============= shuffle.h ============== if test -f 'shuffle.h' -a X"$1" != X"-c"; then echo 'x - skipping shuffle.h (File already exists)' else echo 'x - extracting shuffle.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'shuffle.h' && /*:ts=4*/ /***************************************************************************** X * FIDOGATE --- Gateway software UNIX <-> FIDO X * X * $Id: shuffle.h,v 1.3 90/12/02 21:22:39 mj Exp $ X * X * Something very special ... ;-) X * X * $Log: shuffle.h,v $ X * Revision 1.3 90/12/02 21:22:39 mj X * Changed program header to mention both authors of the original X * software posted to alt.sources. X * X * Revision 1.2 90/11/05 20:51:08 mj X * Changed my signature in all program headers. X * X * Revision 1.1 90/06/28 22:05:04 mj X * Much rework of the sources, no more hsu.h and other clean up. X * rmail improved, now handles special XENIX quirks. X * X * Revision 1.0 90/06/21 19:08:09 mj X * Initial revision X * X * X ***************************************************************************** X * This version hacked and maintained by: X * _____ _____ X * | |___ | Martin Junius FIDO: 2:242/6.1 2:242/6.0 X * | | | | | | Republikplatz 3 DOMAIN: mju@dfv.rwth-aachen.de X * |_|_|_|_____| D-5100 Aachen Tel. (Voice) 0241-86931 X * X * Original version of these programs and files: X * X * Teemu Torma X * Heikki Suonsivu FIDO: 2:504/1 UUCP: ...!mcsun!santra!hsu X * X *****************************************************************************/ X #define loop_increment(x,y) (x = (++x >= (y)) ? 0 : x) #define loop_decrement(x,y) (x = (--x < 0) ? (y)-1 : x) X #define MAX_CONVERT_BUFFERS 40 #define MAX_CONVERT_BUFLEN 80 X static char bufs[MAX_CONVERT_BUFFERS][MAX_CONVERT_BUFLEN], *tcharp; static int bflag; X #define SHUFFLEBUFFERS \ loop_increment(bflag, MAX_CONVERT_BUFFERS); tcharp = bufs[bflag] SHAR_EOF chmod 0644 shuffle.h || echo 'restore of shuffle.h failed' Wc_c="`wc -c < 'shuffle.h'`" test 1637 -eq "$Wc_c" || echo 'shuffle.h: original size 1637, current size' "$Wc_c" fi # ============= sysexits.h ============== if test -f 'sysexits.h' -a X"$1" != X"-c"; then echo 'x - skipping sysexits.h (File already exists)' else echo 'x - extracting sysexits.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sysexits.h' && /*:ts=4*/ /***************************************************************************** X * FIDOGATE --- Gateway software UNIX <-> FIDO X * X * $Id: sysexits.h,v 1.2 90/12/02 21:22:44 mj Exp $ X * X * Exit statuses for systems that doesn't have /usr/include/sysexits.h X * X * $Log: sysexits.h,v $ X * Revision 1.2 90/12/02 21:22:44 mj X * Changed program header to mention both authors of the original X * software posted to alt.sources. X * X * Revision 1.1 90/11/05 20:51:12 mj X * Changed my signature in all program headers. X * X * Revision 1.0 90/06/21 19:12:34 mj X * Initial revision X * X * X ***************************************************************************** X * This version hacked and maintained by: X * _____ _____ X * | |___ | Martin Junius FIDO: 2:242/6.1 2:242/6.0 X * | | | | | | Republikplatz 3 DOMAIN: mju@dfv.rwth-aachen.de X * |_|_|_|_____| D-5100 Aachen Tel. (Voice) 0241-86931 X * X * Original version of these programs and files: X * X * Teemu Torma X * Heikki Suonsivu FIDO: 2:504/1 UUCP: ...!mcsun!santra!hsu X * X *****************************************************************************/ X #define EX_OK 0 /* successful termination */ #define EX_USAGE 64 /* command line usage error */ #define EX_DATAERR 65 /* data format error */ #define EX_NOINPUT 66 /* cannot open input */ #define EX_NOHOST 68 /* host name unknown */ #define EX_UNAVAILABLE 69 /* service unavailable */ #define EX_SOFTWARE 70 /* internal software error */ #define EX_OSERR 71 /* system error (e.g., can't fork) */ #define EX_OSFILE 72 /* critical OS file missing */ #define EX_CANTCREAT 73 /* can't create (user) output file */ #define EX_IOERR 74 /* input/output error */ SHAR_EOF chmod 0644 sysexits.h || echo 'restore of sysexits.h failed' Wc_c="`wc -c < 'sysexits.h'`" test 1760 -eq "$Wc_c" || echo 'sysexits.h: original size 1760, current size' "$Wc_c" fi # ============= nodelist.h ============== if test -f 'nodelist.h' -a X"$1" != X"-c"; then echo 'x - skipping nodelist.h (File already exists)' else echo 'x - extracting nodelist.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'nodelist.h' && /*:ts=4*/ /***************************************************************************** X * FIDOGATE --- Gateway software UNIX <-> FIDO X * X * $Id: nodelist.h,v 1.2 90/12/02 21:22:18 mj Exp $ X * X * Structures and definitions for nodelist. X * X * $Log: nodelist.h,v $ X * Revision 1.2 90/12/02 21:22:18 mj X * Changed program header to mention both authors of the original X * software posted to alt.sources. X * X * Revision 1.1 90/11/05 20:50:51 mj X * Changed my signature in all program headers. X * X * Revision 1.0 90/06/21 19:14:27 mj X * Initial revision X * X * X ***************************************************************************** X * This version hacked and maintained by: X * _____ _____ X * | |___ | Martin Junius FIDO: 2:242/6.1 2:242/6.0 X * | | | | | | Republikplatz 3 DOMAIN: mju@dfv.rwth-aachen.de X * |_|_|_|_____| D-5100 Aachen Tel. (Voice) 0241-86931 X * X * Original version of these programs and files: X * X * Teemu Torma X * Heikki Suonsivu FIDO: 2:504/1 UUCP: ...!mcsun!santra!hsu X * X *****************************************************************************/ X /* Change these if you wish. */ X /* Name of nodelist in LIBDIR */ #define NODELIST "nodelist" X /* Name of nodelist index file in LIBDIR */ #define INODELIST "nodelist.idx" X /* Name of sysop name index file in LIBDIR */ #define NAMELIST "name.idx" X /* Compare two node entried to see if they are same node (ignoring X possible other information */ #define samenode(n1, n2) ((n1).zone == (n2).zone && (n1).net == (n2).net && \ X (n1).node == (n2).node && (n1).point == (n2).point) X /* Structure for nodelist entry. Routines to get one node from nodelist X will return this structure. */ X typedef struct _node { X int type; /* type of entry (see below) */ X int region; /* region (not necessarily used/set) */ X int net; /* net/region of node */ X int zone; /* Zone of node (not really supported yet) */ X int node; /* number of node */ X int point; /* Point of node (not really supported yet) */ X char name[20]; /* name of fido */ X char city[40]; /* city */ X char sysop[36]; /* name of sysop */ X char phone[40]; /* phone-number */ X int speed; /* speeds */ X char flags[60]; /* flags-string */ } Node; X typedef struct _indexnode { X int zone; X int net; X int node; X long offset; } NODEINDEX; X typedef struct _indexname { X char name[36]; /* Sysop name */ X long offset; /* Refers to nodelist index entry */ X int zone; X int net; } NAMEINDEX; X /* Entry types. */ X #define REGION (1) /* region-host */ #define HOST (2) /* net-host */ #define HUB (3) /* local-host */ #define PVT (4) /* private node */ #define HOLD (5) /* no mail to this node */ #define DOWN (6) /* node is down */ #define KENL (7) /* should not be comminucated */ #define NORMAL (8) /* normal node */ #define ZONE (9) /* Zone */ #define POINT (10) /* point (points are not in nodelist but this is used X elsewhere. */ X /* Declarations for routines. */ X Node *node_entry(); /* get entry from nodelist */ char *update_index(); /* update index-file */ extern Node *parse_entry(); X extern Node originnode; extern NODEINDEX *nodeindex; extern NAMEINDEX *nameindex; extern int nodes; SHAR_EOF chmod 0644 nodelist.h || echo 'restore of nodelist.h failed' Wc_c="`wc -c < 'nodelist.h'`" test 3209 -eq "$Wc_c" || echo 'nodelist.h: original size 3209, current size' "$Wc_c" fi # ============= fidogate.h ============== if test -f 'fidogate.h' -a X"$1" != X"-c"; then echo 'x - skipping fidogate.h (File already exists)' else echo 'x - extracting fidogate.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'fidogate.h' && /*:ts=4*/ /***************************************************************************** X * FIDOGATE --- Gateway software UNIX <-> FIDO X * X * $Id: fidogate.h,v 1.10 91/05/07 23:58:10 mj Exp $ X * X * Common header file X * X * $Log: fidogate.h,v $ X * Revision 1.10 91/05/07 23:58:10 mj X * Changed declaration for function parse_address() from address.c, new X * function isfido(). X * X * Revision 1.9 91/03/29 18:09:11 mj X * Some changes. (what?) X * X * Revision 1.8 90/12/02 21:21:47 mj X * Changed program header to mention both authors of the original X * software posted to alt.sources. X * X * Revision 1.7 90/12/01 17:48:52 mj X * Fixed an extern function declaration of ascnoden(). X * X * Revision 1.6 90/11/20 21:08:13 mj X * Changed some extern definitions. X * X * Revision 1.5 90/11/05 20:49:34 mj X * Changed my signature in all program headers. X * X * Revision 1.4 90/09/08 18:45:08 mj X * Added definition of strsaveline() in xalloc.c X * X * Revision 1.3 90/07/01 13:45:19 mj X * Removed all calls to alloca(). All unsave malloc()'s without X * checking the returned pointer are now done via xmalloc(). X * Fixed a malloc() error in rmail. X * X * Revision 1.2 90/06/28 22:04:01 mj X * Much rework of the sources, no more hsu.h and other clean up. X * rmail improved, now handles special XENIX quirks. X * X * Revision 1.1 90/06/21 21:08:29 mj X * Everything seems to work, so this delta was made. X * X * Revision 1.0 90/06/21 18:56:20 mj X * Initial revision X * X * X ***************************************************************************** X * This version hacked and maintained by: X * _____ _____ X * | |___ | Martin Junius FIDO: 2:242/6.1 2:242/6.0 X * | | | | | | Republikplatz 3 DOMAIN: mju@dfv.rwth-aachen.de X * |_|_|_|_____| D-5100 Aachen Tel. (Voice) 0241-86931 X * X * Original version of these programs and files: X * X * Teemu Torma X * Heikki Suonsivu FIDO: 2:504/1 UUCP: ...!mcsun!santra!hsu X * X *****************************************************************************/ X #include "config.h" X /* X * default level of debug output X */ #ifndef INIT_VERBOSE # ifdef DEBUG # define INIT_VERBOSE 3 /*20*/ # else # define INIT_VERBOSE 0 # endif #endif X X /* X * heavy includin' ... X */ X /***** System *****/ #include <stdio.h> #include <ctype.h> #include <string.h> #include <sys/types.h> #include <time.h> #include <errno.h> #ifdef M_XENIX # include <sys/ndir.h> # define dirent direct #else # include <dirent.h> #endif X /***** Local *****/ #include "packet.h" /* FIDO mail packet definition */ #include "nodelist.h" /* nodelist definitions */ #include "sysexits.h" /* EX_* defines */ X X X /* X * Config file sections X */ #define SECT_NETNODE 1 /* Net/node for receiving node */ #define SECT_NG_AREA 2 /* Newsgroup -> area conversions */ #define SECT_HEADERS 3 /* Header-field definitions */ #define SECT_ENDMSG 4 /* Text to be placed at the end of msg */ #define SECT_AREA_NG 5 /* Area -> newsgroup conversions */ X X X /* X * External functions and variables X */ X /***** System *****/ extern char *mktemp(), *getenv(); extern long time(); extern unsigned short getuid(); extern unsigned short geteuid(); extern unsigned short getgid(); extern unsigned short getegid(); X /***** errno *****/ extern int errno; extern char *strerror(); X X X /* X * Defines X */ #define TRUE 1 #define FALSE 0 #define BUFLEN 256 #define OK 0 #define ERROR (-1) X #define bool int X /* Global variables. */ X extern bool verbose; extern int line; extern int receiving_data; X /* Function declarations. */ X /* address.c */ extern int parse_address(); extern int isfido(); extern int parseinternode(); extern int parsefnetaddress(); extern char *ascnode(); extern char *ascnoden(); extern char *internode(); extern char *internodex(); extern char *ascnodei(); X extern int fine_convert(); extern char *ascii_convert(); extern int stricmp(); extern int strnicmp(); extern time_t getdate(); extern void flush(); extern void sendline(); extern char *getcl(); extern void section(); extern void log(); extern void debug(); extern int lock(); extern int unlock(); extern char *spoolfile(); extern int quit(); extern char *basename(); extern FILE *pfopen(); extern char *date(); extern long job_number(); extern long sequencer(); extern char *mheader(); X /* sprintfs.c */ extern char *sstrcat(), *sprintfs(); X /* strempty.c */ extern char *strclean(), *strsclean(); X /* xalloc.c */ extern char *xmalloc(), *xrealloc(), *strsave(), *strsaveline(); SHAR_EOF chmod 0644 fidogate.h || echo 'restore of fidogate.h failed' Wc_c="`wc -c < 'fidogate.h'`" test 4512 -eq "$Wc_c" || echo 'fidogate.h: original size 4512, current size' "$Wc_c" fi true || echo 'restore of rfmail.c failed' echo End of part 2, continue with part 3 exit 0 -- _____ _____ | |___ | Martin Junius FIDO: 2:242/6.1 2:242/6.0 | | | | | | Republikplatz 3 DOMAIN: mj@dfv.rwth-aachen.de |_|_|_|_____| D-5100 Aachen Tel. (Voice) 0241-86931