rsalz@uunet.uu.net (Rich Salz) (03/07/89)
Submitted-by: Heikki Suonsivu <hsu@santra.hut.fi> Posting-number: Volume 18, Issue 2 Archive-name: fnet/part01 This code implements a gateway between Usenet/UUCP/Mail and Fido. I haven't tried it. It's in ALPHA test. ---- Cut Here and unpack ---- #!/bin/sh # shar: Shell Archiver (v1.22) # # This is part 1 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # # Run the following text with /bin/sh to create: # README # HISTORY # INSTALL # LICENCE # NOTES # PROBLEMS # TODO # Alias # fnews.cf # notes # de # d # fcaller # Makefile # getdate.y # rfmail.c # funcs.c # rfnews.c # rmail.c # fpack.c # funpack.c # fcall.c # fio.c # xtsend.c # xtrec.c # nodelist.c # gethostname.c # dateconv.c # address.c # crc.c # lintlib.c # sprintfs.c # strempty.c # listscan.c # ftime.c # fnet.h # config.h # fpack.h # rmail.h # fio.h # crc.h # hsu.h # shuffle.h # sysexits.h # nodelist.h # fnews.h # if test -r s2_seq_.tmp then echo "Must unpack archives in sequence!" next=`cat s2_seq_.tmp`; echo "Please unpack part $next next" exit 1; fi echo "x - extracting README (Text)" sed 's/^X//' << 'SHAR_EOF' > README && XNOTE: I don't speak/write English very well so there are probably Xlots of strange sentences, feel free to mail me at mcvax!santra!hsu Xor mcvax!clinet!hsu to ask if you can't understand what I meant. X XThis program has been originally written by Teemu Torma. Teemu gave up Xdeveloping this for something like a year ago so I have continued his Xwork. Most of work probably is still from Teemu, I have done Xfidonet-pickup, nodelist indices (rewrote) some work on news-echo Xconversions, and most of debugging on receiver, news-echo-stuff and to Xget both directions to work with binkley. The only other mailer XI have tested this with is Dutchie. X XThis is still in alpha-state, I haven't done much testing on Xerror conditions, somewhere it may exit if something is wrong, somewhere Xit sends mail to root/uucp etc :) X XIf you think this is for you, check TODO for what you could Xdo for it, for partial (I'm lazy!) version-history you can check XHISTORY. For some info about what it does in certain conditions, you Xshould see NOTES. For installation, check INSTALL, but do it XAFTER reading all the other files. X XIf you find 'notes' in the archive, it's my comment file for my internal Xuse. Probably it doesn't help much unless you speak Finnish :-) X X XAbout testing X------------- X X*IMPORTANT* X XI have never tested this in a real news-environment, as getting news Xto local machine here in Finland is quite expensive and price is Xper-site, not per-feed. Plus the extra hard disk I would need to get Xnews fit on my machine. Currently I just have fidonet echomails. XBecause of this, be extremely careful when installing this thing, as Xsome mistake I or you made when installing could cause flood of Xunwanted stuff worldwide, and a big bill for you! I take no Xreponsibility whatever. X X SHAR_EOF chmod 0644 README || echo "restore of README fails" echo "x - extracting HISTORY (Text)" sed 's/^X//' << 'SHAR_EOF' > HISTORY && X0.3.3 X X- WAITCLEAR. X- PREWAIT, WAITCLEAR, MAX_SEND_RETRIES. Makes it more configureable, though Xconfiguration file would be far better for this kind of purpose. X X- Fixed bugs in sealink, which caused transfers on bad lines Xto stop with too many retries message. X X- Fixed bug in funpack which could cause terminating too early. It was Xa bug in get_string, which didn't read the terminating null char if Xstring was too long just equal to maximum length (someone had 35 char Xname :-), and it read one null more, thought it had no subject, sent Xsubject as message body to mail and got something else than message magic (2), Xand thought here is the end. Also now reports if it got something else Xthan 2, and stops then. X X0.3.2 X X- Receiver is now Sealink capable (if that means just adding blocknum Xand its complement after naks and acks?). It seems to work? I did it Xbecause I had problems when communicating with Binkley, which says X'timeout' in long transfers, with no apparent reason, message appears Xwithout any delay which could be the reason for such message? Maybe Xthis works better? Sender is not capable of Sealink, though it Xwouldn't be difficult? X X- Some minor changes. X X0.3.1 X X- Line wrap now according to FSC-0001.TXT. X X- rnews can be replaced by command in fnews.cf. This makes possible Xforwarding sysop-echos and such restricted echos to selected users or Xconverting echos to mailing lists. X X- 'of (node-specification)' will be now removed from name if it is Xthere and node-specification specified an existing node. This node-spec Xwill be saved and used if originator cannot be found for some reason Xfor reply-to path. Order to use is nodelist, orig in name, origin line Xin message, echo feed. X X- Zone support has gone giant step forward. For points I need more info, Xie where they are located in fidonet structures. There shouldn't be Xnet-node combinations anywhere, its all Node structures. X X- Packet names have been changed to a very strange format, and files Xare stored in in and out directories. Specially the name format may change Xin future again, now its really strange. X X- Special characters will be removed user names and scandinavian chars will Xbe converted to a and o. Neither conversion happens in usenet format Xmessages, but I'll work on it (news software may take care if it itself?). X X- REMOVE_ID_IN_PARENTHESIS and SEARCH_NAME_IN_NODELIST are no more Xoptions, they will be forced in this version. X X- Some bug fixes. X X- Maybe something else too but I dont remember what. X X0.2.3 X X- Echomail origin, seenby and so on will be partially printed by Xprogram, makes maintaining easier as admin doesn't need to change Xnode numbers in many places, and version number will be up to date. X X- Some bugs fixed. SHAR_EOF chmod 0644 HISTORY || echo "restore of HISTORY fails" echo "x - extracting INSTALL (Text)" sed 's/^X//' << 'SHAR_EOF' > INSTALL && XKind of an installation manual... X Xcopy/untar/unshar all the stuff in /usr/lib/fnet or any directory Xyou would like to use as lib dir. X XIf you haven't got any publicdomain dial package, I would recommend Xgetting one, I have never seen working version of SVR* dial package. XI tried using HDB, but its configuration happens same way the Xlogin handshake in Systems (expect-send-expect), which doesn't give Xmuch chance for regognizing different kind of responses etc, I would Xlike to continue redialing continuously if system is busy and so on. XI have been using dial package from Gene H. Olson, ihnp4!quest!gene, Xthanks for his nice work! I picked it up from local pay-unix-bbs X(City Lines Oy/mcvax!clinet, Teemu works there), so it may be Xa bit old version. X X Xconfig.h X-------- X XEdit config.h. It should (but maybe not) include all necessary Xinformation. X XNote: Use full pathnames, with no trailing slash! X X#define USG Xleave it there, unless you are on BSD, in which case you have Xlots of work to do, as both Teemu and me have to work on SYSV.* (which XI don't like at all, an operating system which cannot change file size Xto nothing else than 0? and more...:-). X X#define MY_ZONE 2 X#define MY_REGION 22 X#define MY_NET 504 X#define MY_NODE 7 X#define MY_POINT 0 XThis specifies your fidonet address. X XIf you don't know what should be here, you should contact with nearest XFidonet system and try to find out from sysop (fidonet)address of Xnearest fidonet network/region coordinator, who will assing you a node Xnumber, and ask him about how to arrange routing. He probably gives Xyou list of sysops to whom you should contact and ask if you can Xpoll echomails from, or tells you who to poll. It might be good Xidea if you get FSC*.TXT documents and bunch of fidonews which would Xgive you better idea what fidonet is. (Ok, I guess you know it already Xif you have come this far :-). X XAnd, the most important, you can contact IFNA, International FidoNet XAssociation, if you need more info. I recommend you to become a member Xif you have interest in this hobby. X X#define PREWAIT 2 XThis is time to be waited between connect and sending TSYNCH, ie start Xof fidonet handshake. Originally it was 5 but some binkleyterm users Xsqueeze time too short and this causes problems, so I have it as 2. X X#define WAITCLEAR 4 XAfter sending cr+sps to line, protocol waits for line to be cleared. This Xtime often depends on the modems, as some modems wait for error correction Xtimeout for long time. X X#define MAXBAUD 1200 XThis is used in creating packets and in dial, where dial baud/speed is Xset to either it or to speed of the system we are dialing at. X X#define MINBAUD 300 XIf speed of systems to be called is less than this, this will be Xused instead. I haven't used this, It's for people with constant-speed Xmodems. X X#define MAX_LINELEN 72 XThis tells the program how wide it should format the messages. Fidonet Xhas hairy message format, which varies a lot, as people use lots of Xdifferent 'soft' carriage returns for message formatting. Its nice for Xsome environments (like commode-64 :-), though. X X#define RECEIVE_PATH "emma" XThis will be added in the beginning of news messages, to make news Xnot to echo it back. This is same system name you must add to XNEWSLIB/sys file, I have the following in /usr/lib/news/sys Xemma:fidonet,to.emma::/usr/lib/fnet/rfnews X X#define DOMAIN ".UUCP" X.UUCP if not there. I haven't checked this out, but I guess its ok. X X#define SPOOL "/usr/spool/fnet" XPrepacked messages, send- and receive-bundles go here. X X#define LIBDIR "/usr/lib/fnet" XThis is where you have all the source and binaries. This should be Xchanged so that sources would be somewhere else. X X#define RNEWS "/usr/bin/rnews" XThis is rnews from news package. If you can't find it, you either Xaren't running news, or you are running some other news-handling Xprogram. This program should be capable of getting a message in Xnormal mail format, there is Newsgroups: line and so on, which would Xtell it to which newsgroup it belongs, and then put the message where Xit should be put. It also forwards the message to other systems if Xthey are redistributed, in which case it should check out the path so Xit won't send it back to fidonet, as that would produce a loop, which Xwouln't be funny for the sysop running the fido system :-) Remeber Xthat messages sent back to fidonet aren't probably any more so much Xlike originals that confmail etc would regognize them as duplicates! X X#define LOGFILE "/usr/lib/fnet/log" XLog file in which all kinds of messages are appended. You should check Xit out sometimes and clean it up, it grows for ever. X X#define IDSEQUENCE "/usr/lib/fnet/idseq" XThis is a file which includes seqence number for creating unique message Xid. X X#define USERUID 50 XI haven't checked out what this does? X X#define ALIAS "/usr/lib/fnet/Alias XSee comments in the file itself (should be in the distribution). X X#define RMAIL "/bin/rmail" XThis is probably ok for you system, it should be mail sender, just don't Xset it to mailer which can loop back to rfmail :-) XIf you dont want to be a gateway, just make it local-mailer. X X/* #define HAVE_SYSEXITS XDefine this if you have <sysexits.h> X X#define INT16 short XThis isn't used in all places where 16-bit int is wanted, so be Xcareful with this! Due to alignment problems I run into, I Xremoved structure writes and reads. X X#define SWAB_BYTES XDefine this on MC68* and so on which have most significant byte at Xlowest memory address (a mess dos has least significant byte there). XRemeber that if that one filler-long in header structure will be Xused some day, there is no swapper for that yet! (I hope I remember Xit too). X X#define RETURN_FAILED_MAIL XDefine this if you want rfmail to return underlivered mail. You do Xnot need this if you are running sendmail or similiar which returns Xundelivered mail. X XShortnames. XThis is for those idiot SV machines which don't accept more than 8 Xchars per name. You also need gnu cpp if your cpp doesn't have more Xthan 8 chars either. I have got a miniframe, so I need this. Note, Xthere might be more of those problem-causers crept in during time I Xhave been developing this on 386 microport machine now. X X#define DIALTABLE "358-0-", "", "358-", "9", "", "990" X XThis is for dialing, I did just a quick hack but it probably Xworks on most cases, originally it wanted phone number as a parameter, Xnow it picks up it from nodelist, so I needed some kind of Xtable here. XTrick is to compare string to the beginning of the phone number, Xand if it matches, replace it with string following. Last one, Xin which empty string would be checked for, must be there. X X XMakefile X-------- XENA should be something which allows you to change ownerships to something Xelse. I found it easier to make this work running under ena shell (I know, XI'm trying to commit a suicide :-), X XSHELL should be /bin/sh, ksh might work also if you have it. In fact, in Xthis Microport version of 386 I have there is a bug in /bin/sh which Xcauses problems when using it. X XCFLAGS X------ X-DLOCK_LOCKF means that this machine has lock function called lockf, Xotherwise it calls it locking (like in miniframe CTIX). If you don't Xhave either, you are in trouble. X XOWNER XGROUP XUucp and daemon or uucp and mail are good candidates? X XCheck out chmod's in Makefile, I have been probably too open with them. X(Single user 386 with no external logins :-) X XI don't use SCCS either, but maybe I start using it, I just have had Xso many things to think about so reading the manual is still waiting. X X XFiles and rest of work X---------------------- X Xchown all files for same groups you specified in Makefile, make the Xspool directory and other directories under it and chown them too. X XEdit the Areas, Aliases files following the instructions in them. XYou need to generate newsgroups for echomails using inews -C. XI have names groups as fidonet.something. X Xinstall it to crontab/etc so that it calls to fidonet host you Xshould be polling at. It should do X Xfpack -f your_boss_fidonet_address Xfcall -l /dev/ttysomething -m -d -f your_boss_fidonet_address Xfunpack X Xand put output to log (note: Log will be enormous if you don't Xcut debug values in distributed config.h, this alpha-version Xwill have debugs on ready for you to debug, as it probably won't Xrun as is anyway :-). X XGet new nodelist. Best place to hunt for it is nearest fidonet system. XConvert it to unix format before using it (just lfs, no cr+lf, no ^Z). X XModifying rn common.h (line 559 in version 4.3 I have) from X X# define NEWSHEADER "Newsgroups: %(%F=^$?%C:%F)\nSubject: % (%S=^$?%\"\n\nSubject: \":Re: %S)\nSummary: \nExpires: \n%(%R=^$?:References: %R\n)Sender: \nReply-To: %L@%H.UUCP (%N)\nFollowup-To: \nDistribution: % (%i=^$?%\"Distribution: \":%D)\nOrganization: %o\nKeywords: %[keywords]\n\n" X Xto X# define NEWSHEADER "Newsgroups: %(%F=^$?%C:%F)\nSubject: % (%S=^$?%\"\n\nSubject: \":Re: %S)\nSummary: \nExpires: \n%(%R=^$?:References: %R\n)Sender: \nReply-To: %L@%H.UUCP (%N)\nFollowup-To: \nDistribution: % (%i=^$?%\"Distribution: \":%D)\nOrganization: %o\nKeywords: %[keywords]\nComment-To: %t\n\n" X X(Just added Comment-To: %t\n in the end!) XIt adds name of recipent to news messsages, so it will be in fidonet Xecho replies, otherwise you need to type it hand or leave it out in which Xcase to-field be set to All. X XYou should arrange addresses which look like fidonet addresses, Xprobably everything of format huu@something.fidonet to be passed to Xrfmail. You could try rmail which comes with this software, though I Xhaven't tried it yet, better choice would be to use sendmail or Xanything which can forward certain kind of addresses to other mailer. X SHAR_EOF chmod 0644 INSTALL || echo "restore of INSTALL fails" echo "x - extracting LICENCE (Text)" sed 's/^X//' << 'SHAR_EOF' > LICENCE && XIf there is a COPYRIGHT file also, check it out. X XI have used getdate.y and ftime.c from news package, thanks for Steven XM. Bellovin (unc!smb) and Chapel Hill. I hope they don't mind even Xthough I didn't ask for it! X X------------------------------------------------------------------------- XThis software should be used in friendly and lawful manner! X XIf using this in Finland, I personally recommend joining network 504. X XYou may not sell this software, you must give it free! Idea is to keep Xthis and all derived versions as free and source-distributed. X XWe take absolutely no responsibility on any trouble caused by using this, Xso you are on your own risk if you use this. X XComments, new features and bug fixes can be sent to hsu@clinet, Xhsu@santra, 2:504/1, 2:504/7, ...!mcvax!santra!hsu, HSU@FINGATE.BITNET XHeikki Suonsivu / Kuutamokatu 5 A 7 / 02210 Espoo / FINLAND X X SHAR_EOF chmod 0644 LICENCE || echo "restore of LICENCE fails" echo "x - extracting NOTES (Text)" sed 's/^X//' << 'SHAR_EOF' > NOTES && XProblems with porting X--------------------- X XWhy all people can't make standards? Even names can be messed up with Xall kinds of fields, someone puts linefeeds there, fills it up with blanks, Xadds 'of net/node' or '(USERID)' or something like that. Linefeeds in Xmessages have several versions, cr+lf, lf, cr+seadogsoftcr, seadogsoftcr, Xcr+lf+cr_with_8bit_on and all other combinations of those :-) X X XChanges in message format X------------------------- X XFrom 0.3.1 line wraps should be correctly handled. X XSubject will be set to 'No subject' if its empty, as news doesn't accept Xmissing subject, it ignores the message without one. X XFSC controls (^Axxxx) are converted to FSC-control:xxxx, which Xprobably works better in ascii-environments line news. It also Xprevents terminals going nuts if there are terminals which do Xsomething about ^A. X XNeither is converted back when sending the message out, thouch making XNo subject back to empty string maybe would be reasonable? X XNumber of headers will be added to messages. X X XProgram structure X----------------- X XLooks like spaghetti? SHAR_EOF chmod 0644 NOTES || echo "restore of NOTES fails" echo "x - extracting PROBLEMS (Text)" sed 's/^X//' << 'SHAR_EOF' > PROBLEMS && XUsers in fidonet are allowed to enter private messages in echos, Xwhich causes trouble, how to handle those messages? X XPacket name can be longer than maximum filename length in system V, Xcould there be some really fancy idea of creating names or just make Xthem fido compatible, though that doesn't show zone and point in Xpacket name? SHAR_EOF chmod 0644 PROBLEMS || echo "restore of PROBLEMS fails" echo "x - extracting TODO (Text)" sed 's/^X//' << 'SHAR_EOF' > TODO && XIt probably needs complete rewrite :-) X XProtocol module seems to need improvement, specially startup sometimes Xseems to be rough. I also tried to work with opus without any kind of Xfront end as v32 modem I had took too long time to time out and Xbinkley started to opus, but protocol startup failed, it got one Xpacket but then started complaining about funny packet numbers and I Xhavent had time to check it out. X XBatching news would improve performance a lot, though I guess rewriting Xfunpack would save even more. X XPoint and zone addressing should be done. It knows zones but looses Xthe info when packing. I'll rewrite packer to get some routing stuff Xin and I try to get that done same time. If zones are important you might Xget around limitations with sendmail or customizing smail or like. X XForwarding to other fidonet nodes should be implemented? It would be Xbetter to pick message as is, just change from and destination node Xaddresses and stick it to packets needed, which would create blazing Xfast redistribution. Going through news would be cpu hogger never seen Xas theres very little advantage. X XFfgets still does need more tuneup: Sometimes I received messages with Xsoft crs and no blank. So, if lines get combined, a blank should be Xinserted if soft cr is found. I think according to fsc-001 its really Xthe problem in someone elses software, as fsc-001 says that soft crs Xetc should be ignored, not replaced with (single) blank. but I think Xit would be better to accept that format also. X XMessage-id should really be something which could allow noticing Xduplicates. maybe date and node number could be used. X XDate length problem is still open, is it 20 chars like in fsc-001 or X19 like in all messages I receive (via confmail)? X XFcall xmodem receive is horrible cpu hog. I have to profile it and see Xwhats happening, probably readline? X XI/P packets could be in subdirectories or even node structure X Xcould be built for spool directory like X X...fnet/I/2/504/1/0 2:504/1.0 X...fnet/I/2/504/26/0 2:504/26.0 X...fnet/I/2/504/26/2 2:504/26.2 X XMessage body should be checked out for control chars and ibmscii. I have Xa separate filter which takes care of that, I just have Xto install it, so wait for the next version. X XRECEIVE_PATH could be fidonet path, not symbolic as it is now, I have Xto check out if news, mail etc accept addresses which start with a number. X XIf fnews.cf has errors in newsgroup flags, it will coredump. One should Xcheck those strtoks there. X XWhen receiving new echo area, it should be automatically added Xto fnews.cf, and su newsuser /usr/lib/news/inews -C fidonet.echoareaname Xshould be called. X XHDB uucp seems to be able to kill fcall calling out? Lock file is uucp Xmail, is in /usr/spool/locks (svr3) and has process id in it with 10 chars Xand \n at end. X Xrfmail could accept any kind of fidonet address, like Xsysop-name.fidonet, system-name.fidonet and such things. Though, this Xwould require some artifical intelligence! X XProcessing private echo messages could be changed, now it tries to send Xthem to local user, failing in parsing address and sending the stuff to Xuucp or root. Use accept-private and trash-private to get around this. X XConfigure-script? have to check out it there is public domain one? XYes there is, it just came over usenet but I haven't tried it yet. X XThere should be a configuration file for everything, not it needs Xrecompilation for just about everything. X XNodelist and Index files are in memory, this will break up the roof in Xbrain-damaged architectures. There should be an option for making Xindices disk-resident if user wants it. Biggest problem is the name Xlist, it could be rewritten to use char * for names insted of Xconstant-length name. With current nodelist of about 4000 nodes, it Xwill be > 150 k. Disk-resident would be nice but I haven't got Xmergesort/disky qsort/disky bsearch around so I skipped it. X XFrom: field should really be identical to Reply-To: field and latter Xcould be removed. On the other hand, there would be info about from Xwhich echo feed it came from, but that should be separate field. I'll Xleave it as is now, comments? X XI will try to build routine capable of reading list of names with Xfidonet numbers to use for finding out mail address, so lists like XFFUA (Finnish Fido Users Association) membership list could be used. X XGenerally all fields could follow rfc822 spec from FSC documentation Xbut it has some problems with news: No spec for newsgroups statement Xand areas conversion. Most echomail names still are just names, like XC_ECHO and so on, if people had been using fidonet.something from the Xbeginning, things would be easier. I tried to push it through, so its Xused in Finland, and in some conferences in Europe, most notably in XEnet.sysop I started in Europe when I first time got my hands on Xechomail :-) X XIn-Reply-To: could be set to what is in FSC-Control: EID: xxxx , but I Xhave to find out more about EID: mechanism before I get into it. X XNow it uses Comment-To: to set up receiver field, node address is Xeither the one in nodelist or * origin. Origin probably bad guess but Xthat's all we have got! For this reason, storing information about Xreceved fidonet addresses would be good idea. X XSome people may get theirs reply-to field to point to node first found Xin nodelist, even if they want to get mail to some other node. X XThere would be another solution for reply-via mail. If it doesn't find Xcorrect node from origin line or nodelist, it should send the mail Xback to original echo as private message. clumsy, though. X XMan pages are completely missing, I haven't got experience on writing Xroff but maybe I have time to open the manual next week! X XFile requests and other fancy stuff. Never heard of :-) Xmodem7/telink is there, but haven't tried it yet. X XThere should be some kind of locking-mechanish using lock files, as Xnot all machines have lockf or locking. I try to hack on other things Xmyself as I have locking/lockf. X Xfgets in funpack.c looks for * Origin in both mails and echos, only Xechos are needed. X Xfcall should be modified to be capable of being slave like uucico. It Xcould try slave mode if no node is specified, but I need a getty which Xnotices TSYNC when someone calls in. X XAREA: fields and FSC-controls might be moved to message header, as Xthey could be removed when reading news easily with rn parameters, but Xconverting them back to their original places is a bit nasty, maybe I Xshould include some kind of line-number? On the other hand, is it Xnecessary to have them at their original places anyway, message format Xwill be changed a bit always? X Xfunpack: opens and closes config file for every message. Lots of other Xinefficiences all around. Parsing headers should really be rewritten, Xnow it makes number of passes through the message. X Xreaction to incorrect permissions etc can be fatal, rfmail just Xignores the message if log file could not be opened, though it says Xerror but cannot log it. It should at least send message to news admin Xand then maybe loop until it can read write log file... ok, getting too Xfancy. X XCurrently only one fidonet mail/echo feed is supported as receiver, Xbut several systems can be polled for mail. This could be reasonably Xeasy to correct, just make fpack ignore messages not destined to Xsystem specified, or even better, pack messages according to routing Xfiles, which could be simple. X XArcmail capability should be build, even one-directional Xwould be help, I just have to compile arc for this machine, running X(pk)arc under dosmerge isn't reliable with my beta-version of Xdosmerge, and people without 386 couldn't run it at all. X XNow there are routines in some programs which could be used (and be Xhelpful and cleaner) in other programs also, and sometimes code Xis really quick-hack-style. X XKeep in touch! X SHAR_EOF chmod 0644 TODO || echo "restore of TODO fails" echo "x - extracting Alias (Text)" sed 's/^X//' << 'SHAR_EOF' > Alias && X# X# @(#)%M% %I% Teemu Torma %H% X# X# File for aliases. X# X# Each line contains alias-name, followed by optional net/node information. X# If alias is followed by net/node information, alias is used only if X# mail is going to that net/node. There may be more than one net/node X# spesification for one alias, in that case they are separated by commas. X# X# If net is missing from net/node spesification, e.g. net/node is only X# single number, node is to be considered on our net. If node is missing, X# e.g. it is empty string, all nodes in that net are valid. X# X# First alias found will be used, so if there are aliases with same name, X# that alias that doesn't have net/node limits or has wider limits that X# some other alias, should ba after later alias. X# X# NOTE: sysop-aliases are not necessary, because rfmail uses normally X# name found from nodelist if mail is to sysop and alias settings X# overrides that. Only on some cases sysop-alias might be useful, e.g. X# if there are more than one sysop, you may want to use just Sysop or X# one of the sysops. X# X# These aliases are used when receiving mail from fidonet, to X# handle incoming news with private flag set. If no alias exist, X# forget about message. X# X# Alias for sysop in node 1 (our net, 504) Xsysop,1 Heikki Suonsivu X# Mail to tot in net 504 will be send to Teemu Torma Xtot,504/ Teemu Torma Xhsu,504/ Heikki Suonsivu SHAR_EOF chmod 0644 Alias || echo "restore of Alias fails" echo "x - extracting fnews.cf (Text)" sed 's/^X//' << 'SHAR_EOF' > fnews.cf && X# X# @(#)%M% %I% Teemu Torma %H% X# X# Configuration file for Usenet News <-> echomail programs. X# Each Section is separated by *-character at the first column. X# Lines beginning with #-character are considered as comments. X# X# Net/Node to send this article. Format is Net/Node, e.g 504/8. X# X504/26 X* X# X# Newsgroup -> echomail area conversions. First is newsgroup followed X# by area name to send it. If article is send to multiple newsgroups, X# it is send to first echomail area found. X# Xfidonet.504.sysop 504.SYSOP Xfidonet.binkley BINKLEY Xfidonet.c_echo C_ECHO Xfidonet.eech EECH Xfidonet.enet.sysop ENET.SYSOP Xfidonet.fin.airways FIN.AIRWAYS Xfidonet.fin.bbshelp FIN.BBSHELP Xfidonet.fin.computer FIN.COMPUTER Xfidonet.fin.culture FIN.CULTURE Xfidonet.fin.food FIN.FOOD Xfidonet.fin.sysop FIN.SYSOP Xfidonet.fin.general FIN.GENERAL Xfidonet.fin.bbs FIN.BBS Xfidonet.fin.games FIN.GAMES Xfidonet.fin.ham FIN.HAM Xfidonet.fin.market FIN.MARKET Xfidonet.fin.scifi FIN.SCIFI Xfidonet.fin.unix FIN.UNIX Xfidonet.fin.koulut FIN.KOULUT Xfidonet.ham HAM Xfidonet.hst HST Xfidonet.ifna IFNA Xfidonet.internat INTERNAT Xfidonet.net_dev NET_DEV Xfidonet.newopus NEWOPUS Xfidonet.penpal PENPAL Xfidonet.sffan SFFAN Xfidonet.zone2 ZONE2 X* X# X# Header field spesifications. Here are header-fields, one by line, X# and only those header-lines are put in the beginning of fidonet X# message. X# X# Newsgroups: XFrom: XDate: XSubject: XKeywords: XSummary: XLines: XComment-To: X# Organization: X* X# X# Information to put at the end of message, e.g. Origin-message and X# seen-by;s. Text is copied literally until *-character is found X# at the first column. You should have your echo feed there, even though X# news path mechanism will take care of its being posted just once. X# Fri Oct 28 02:42:08 1988 Version 0.2.3 X# First line should be Origin text, next line seen-by row without my node X# X# --- rfmail 0.2.2 X# * Origin: Missing Link (between usenet and fidonet) (2:504/7) X# SEEN-BY: 504/7 504/26 X# PATH: 504/7 XMissing Link (between usenet and fidonet) X504/7 26 X* X# X# Echomail -> newsgroup conversions. First field is area name, second X# is newsgroup and third distribution for that newsgroup. If distribution X# begins with "/" (slash), it is to be taken as program name to pipe X# this article. Article will contain all From, To and subject-lines, X# also Newsgroups: line will be present. X# Other flags whould follow, they include: X# accept-private private messages will be saved as news-articles, X# otherwise they will go to mail or /dev/null, X# depending if receiver exists is this system or not. X# command rest of line is interpreted as command to be X# execute, message text in stdin. X# X504.SYSOP fidonet.504.sysop fidonet accept-private XBINKLEY fidonet.binkley fidonet trash-private XC_ECHO fidonet.c_echo fidonet trash-private XEECH fidonet.eech fidonet accept-private XENET.SYSOP fidonet.enet.sysop fidonet accept-private XFIN.AIRWAYS fidonet.fin.airways fidonet trash-private XFIN.BBSHELP fidonet.fin.bbshelp fidonet trash-private XFIN.COMPUTER fidonet.fin.computer fidonet trash-private XFIN.CULTURE fidonet.fin.culture fidonet trash-private XFIN.FOOD fidonet.fin.food fidonet trash-private XFIN.SYSOP fidonet.fin.sysop fidonet accept-private XFIN.GENERAL fidonet.fin.general fidonet trash-private XFIN.BBS fidonet.fin.bbs fidonet trash-private XFIN.GAMES fidonet.fin.games fidonet trash-private XFIN.HAM fidonet.fin.ham fidonet trash-private XFIN.MARKET fidonet.fin.market fidonet trash-private XFIN.SCIFI fidonet.fin.scifi fidonet trash-private XFIN.UNIX fidonet.fin.unix fidonet trash-private XFIN.KOULUT fidonet.fin.koulut fidonet trash-private XHAM fidonet.ham fidonet trash-private XHST fidonet.hst fidonet trash-private XIFNA fidonet.ifna fidonet accept-private XINTERNAT fidonet.internat fidonet trash-private XNET_DEV fidonet.net_dev fidonet accept-private XNEWOPUS fidonet.newopus fidonet trash-private XPENPAL fidonet.penpal fidonet trash-private XSFFAN fidonet.sffan fidonet trash-private XZONE2 fidonet.zone2 fidonet accept-private X* SHAR_EOF chmod 0644 fnews.cf || echo "restore of fnews.cf fails" echo "x - extracting notes (Text)" sed 's/^X//' << 'SHAR_EOF' > notes && Xtsekkaa tuo sekvenssointi tarkkaan lapi, eli miten getsequence palauttaa Xja LAITA kaikkialle kutsut siihen, niita ei ole viela!!! X XNimen parsinta ei pelaa vielakaan, jos ei ole From rivia niin se Xluulee ekaa rivia nimeksi! X XNimesta pois (JJAZZ) X XMailin lahetys ei toimi, vaittaa ettei ole datea ja Reply-to pathia Xei ilmeisesti huomioida. X Xfunpack: Jos se toteaa etta kyseessa on newssi, se tunkee fileen Xsenderin sijaa temppifileeseen. Sitten kun se on siella, se etsii Xsielta ' * Origin: ... (z:n/n)' rivia, joista osoite etsitaan, ensisijaisesti XKummastakin huomioidaan Viimeinen rivi, eli koko viesti pitaa lukea Xlavitse. Homma tehdaan itse asiasssa fgetsissa, jos se huomee jomman Xkumman niin se asettaa Node originnode struktuuriin oikeat tiedot. XLopuksi looppi joka kirjoittaa viestin senderille ja muuttaa ohimennessaan XReply-To noden oikeaksi. Pirunmoinen homma ikaankuin turhan takia, mutta Xsellaista on elama. X XJuu, tuo yllaoleva on kokonaan pielessa, news-artikkeileissa ei saa Xparsia osoitetta vaan se from jne pitaa ottaa viestista itsestaan, Xdestination-osoite on vaan routtausta varten, keskustelijoitten Xnimilla ei valttamatta ole mitaan tekemista sen kanssa!!! X Xjos senderia ei loydy / ei aliasta euid, niin tutkippa real uid X X=------- X Xfunpackissa ja rfmailissa lgetdatet muutettava sellaisiksi Xetta ne kayttavat getdatea ja siten ehka tajuavat dateformaatit Xoikein, nyt syntyy hamminkia! X XMan page miniframesta. X XHamminkia mailin kanssa, miten vitussa ne newssit saadaan jakoon!! Tutki Xse vitun perkeleen sendbatch ja jos ei muu auta niin sitten ei voi Xmuuta kuin rakentaa se batch siihen rfnewssiin. readnewssin -c:ta Xei voi kayttaa kun se panee kaiken yhteen fileeseen. Milla vitulla se Xnormaalisti kaivaa esille sen mita pitaa lahettaa ja mita ei????? X X X SHAR_EOF chmod 0644 notes || echo "restore of notes fails" echo "x - extracting de (Text)" sed 's/^X//' << 'SHAR_EOF' > de && X: use /bin/sh Xfunpack > loki 2>&1 SHAR_EOF chmod 0755 de || echo "restore of de fails" echo "x - extracting d (Text)" sed 's/^X//' << 'SHAR_EOF' > d && X: use /bin/sh XDIALDEBUG=a Xexport DIALDEBUG Xfpack -f 504/26 2>&1 | tee loki Xfcall -l /dev/tty00 -m -d -s 1200 -b 1200 -f 2:504/26 2>&1 | tee -a loki X SHAR_EOF chmod 0755 d || echo "restore of d fails" echo "x - extracting fcaller (Text)" sed 's/^X//' << 'SHAR_EOF' > fcaller && X: use /bin/sh Xcd /u2/lib/fnet XDIALDEBUG=a Xexport DIALDEBUG Xfpack -f 504/26 > loki 2>&1 Xfcall -l /dev/tty00 -m -s 1200 -b 1200 -d -f 504/26 >> loki 2>&1 Xfunpack >> loki 2>&1 X SHAR_EOF chmod 0751 fcaller || echo "restore of fcaller fails" echo "x - extracting Makefile (Text)" sed 's/^X//' << 'SHAR_EOF' > Makefile && X# X# @(#)%M% %I% Teemu Torma %H% X# X# Makefile for FidoNet routines X# X# @(#)Copyright (C) Teemu Torma 1987 X# X# Use tab stops at every 4 columns. X# XENA = XSHELL = /bin/sh XINCLUDE = /usr/include XCFLAGS = -DLOCK_LOCKF -g XLNFLAGS = -DLOCK_LOCKF X# removed -O XFUNPACK = funpack.o funcs.o nodelist.o gethostname.o address.o \ X getdate.o ftime.o sprintfs.o listscan.o strempty.o XLFUNPACK= funpack.ln funcs.ln nodelist.ln gethostname.ln address.ln \ X ftime.ln sprintfs.ln listscan.ln strempty.ln XRMAIL = rmail.o address.o funcs.o sprintfs.o XLRMAIL = rmail.ln address.ln funcs.ln sprintfs.ln XRFMAIL = rfmail.o funcs.o nodelist.o gethostname.o address.o getdate.o \ X ftime.o sprintfs.o strempty.o XLRFMAIL = rfmail.ln funcs.ln nodelist.ln gethostname.ln address.ln \ X ftime.ln sprintfs.ln strempty.ln XRFNEWS = rfnews.o funcs.o nodelist.o address.o sprintfs.o XLRFNEWS = rfnews.ln funcs.ln nodelist.ln address.ln sprintfs.ln XFPACK = fpack.o funcs.o nodelist.o address.o sprintfs.o XLFPACK = fpack.ln funcs.ln nodelist.ln address.ln sprintfs.ln XFCALL = fcall.o funcs.o fio.o xtsend.o xtrec.o crc.o nodelist.o \ X address.o sprintfs.o XLFCALL = fcall.ln funcs.ln fio.ln xtsend.ln xtrec.ln crc.ln \ X nodelist.ln address.ln sprintfs.ln XCFILES = rfmail.c funcs.c rfnews.c rmail.c fpack.c funpack.c fcall.c \ X fio.c xtsend.c xtrec.c nodelist.c gethostname.c dateconv.c \ X address.c crc.c lintlib.c sprintfs.c \ X strempty.c listscan.c ftime.c XHFILES = fnet.h config.h fpack.h rmail.h fio.h crc.h hsu.h shuffle.h \ X sysexits.h nodelist.h fnews.h XOTHERFILES = README HISTORY INSTALL LICENCE NOTES PROBLEMS \ X TODO Alias fnews.cf notes de d fcaller Makefile \ X getdate.y XLIBS = -lPW -ldial XALL = funpack fcall fpack rfmail rfnews rmail hsu.h XOWNER = uucp XGROUP = mail X X.c.ln: $< X lint -c $(LNFLAGS) $< X X.SUFFIXES: .ln X Xall: ${ALL} X touch all X Xgetdate.o: getdate.y X @echo "expect 8 shift/reduce conflicts" X yacc getdate.y X mv y.tab.c getdate.c X $(CC) $(CFLAGS) -c getdate.c X -rm -f getdate.c X Xfunpack: ${FUNPACK} X cc ${LDFLAGS} -o funpack ${FUNPACK} ${LIBS} X $(ENA) chown ${OWNER} funpack X $(ENA) chgrp ${GROUP} funpack X $(ENA) chmod 4711 funpack X Xrfmail: ${RFMAIL} X cc ${LDFLAGS} -o rfmail ${RFMAIL} ${LIBS} X $(ENA) chown ${OWNER} rfmail X $(ENA) chgrp ${GROUP} rfmail X $(ENA) chmod 4711 rfmail X Xrfnews: ${RFNEWS} X cc ${LDFLAGS} -o rfnews ${RFNEWS} ${LIBS} X $(ENA) chown ${OWNER} rfnews X $(ENA) chgrp ${GROUP} rfnews X $(ENA) chmod 4711 rfnews X Xfpack: ${FPACK} X cc ${LDFLAGS} -o fpack ${FPACK} ${LIBS} X $(ENA) chown ${OWNER} fpack X $(ENA) chgrp ${GROUP} fpack X $(ENA) chmod 4711 fpack X Xfcall: ${FCALL} X cc ${LDFLAGS} -o fcall ${FCALL} ${LIBS} X $(ENA) chown ${OWNER} fcall X $(ENA) chgrp ${GROUP} fcall X $(ENA) chmod 4711 fcall X Xrmail: ${RMAIL} X cc ${LDFLAGS} -o rmail ${RMAIL} ${LIBS} X Xinstall: all X @for i in ${ALL}; \ X do \ X echo "Moving $$i into ${LIBDIR} ... \c"; \ X cp $$i ${LIBDIR}; \ X $(ENA) chown ${OWNER} ${LIBDIR}/$$i; \ X $(ENA) chgrp ${GROUP} ${LIBDIR}/$$i; \ X $(ENA) chmod 4111 ${LIBDIR}/$$i; \ X echo "done."; \ X done X Xlintlib.ln: lintlib.c X lint -c -x lintlib.c X Xlfunpack: $(LFUNPACK) lintlib.ln X lint $(LFUNPACK) lintlib.ln X touch lfunpack X Xlrmail: $(LRMAIL) lintlib.ln X lint $(LRMAIL) lintlib.ln X touch lrmail X Xlrfmail: $(LRFMAIL) lintlib.ln X lint $(LRFMAIL) lintlib.ln X touch lrfmail X Xlrfnews: $(LRFNEWS) lintlib.ln X lint $(LRFNEWS) lintlib.ln X touch lrfnews X Xlfpack: $(LFPACK) lintlib.ln X lint $(LFPACK) lintlib.ln X touch lfpack X Xlfcall: $(LFCALL) lintlib.ln X lint $(LFCALL) lintlib.ln X touch lfcall X Xlint: lfunpack lrmail lrfmail lrfnews lfpack lfcall X Xtar: X tar cvf - $(OTHERFILES) $(CFILES) $(HFILES) | compress > fnet.tar.Z X Xinitsccs: X @if [ -d SCCS ]; \ X then \ X echo "Directory SCCS/ already exist."; \ X exit 1; \ X fi; \ X echo "Creating directory SCCS/..."; \ X mkdir SCCS; \ X for file in ${SCCS}; \ X do \ X echo "Creating SCCS/s.$$file..."; \ X admin -i$$file SCCS/s.$$file; \ X if [ $$? -eq 0 ]; \ X then \ X echo "Getting file SCCS/s.$$file..."; \ X rm -f $$file; \ X get SCCS/s.$$file; \ X fi; \ X done X Xedit: X get -e $(OTHERFILES) $(CFILES) $(HFILES) X Xlook: X get $(OTHERFILES) $(CFILES) $(HFILES) X Xdelta: X delta $(OTHERFILES) $(CFILES) $(HFILES) X Xshar: X shar -v -c -l60 -ofnetdist. $(OTHERFILES) ${CFILES} ${HFILES} X Xclean: X -rm lfunpack lrmail lrfmail lrfnews lfpack lfcall X -rm funpack rfmail rfnews fpack fcall rmail X -rm *.ln *.o .make .funpack .lint log loki X -rm *.idx X Xdepend: X @echo '/^# DO NOT/+1,$$d\nw\nq' | ed - Makefile; \ X echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile; \ X for i in ${CFILES} ; \ X do \ X if [ -r $$i ]; \ X then \ X echo "Finding dependences for $$i ... \c"; \ X for j in `grep '^#[ ]*include[ ]*"[^"]*"' < $$i | \ X sed 's/^#[ ]*include[ ]*"\([^"]*\)".*/\1/'`; \ X do \ X if [ -r $$j ]; \ X then \ X echo "`basename $$i .c`.o: $$j" >> Makefile; \ X echo "`basename $$i .c`.ln: $$j" >> Makefile; \ X else \ X echo "`basename $$i .c`.o: ${HEADERS}/$$j" \ X >> Makefile; \ X echo "`basename $$i .c`.ln: ${HEADERS}/$$j" \ X >> Makefile; \ X fi; \ X done; \ X echo "done."; \ X else \ X echo "Can not open $$i." 1>&2; \ X fi; \ X done; \ X echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile; \ X echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile; \ X echo '# see make depend above' >> Makefile X X# DO NOT DELETE THIS LINE -- make depend uses it X# DEPENDENCIES MUST END AT END OF FILE Xrfmail.o: hsu.h Xrfmail.ln: hsu.h Xrfmail.o: config.h Xrfmail.ln: config.h Xrfmail.o: fnet.h Xrfmail.ln: fnet.h Xrfmail.o: nodelist.h Xrfmail.ln: nodelist.h Xfuncs.o: hsu.h Xfuncs.ln: hsu.h Xfuncs.o: config.h Xfuncs.ln: config.h Xfuncs.o: fnet.h Xfuncs.ln: fnet.h Xfuncs.o: sysexits.h Xfuncs.ln: sysexits.h Xfuncs.o: nodelist.h Xfuncs.ln: nodelist.h Xfuncs.o: shuffle.h Xfuncs.ln: shuffle.h Xrfnews.o: hsu.h Xrfnews.ln: hsu.h Xrfnews.o: config.h Xrfnews.ln: config.h Xrfnews.o: fnet.h Xrfnews.ln: fnet.h Xrfnews.o: fnews.h Xrfnews.ln: fnews.h Xrfnews.o: nodelist.h Xrfnews.ln: nodelist.h Xrmail.o: hsu.h Xrmail.ln: hsu.h Xrmail.o: rmail.h Xrmail.ln: rmail.h Xrmail.o: config.h Xrmail.ln: config.h Xrmail.o: sysexits.h Xrmail.ln: sysexits.h Xrmail.o: nodelist.h Xrmail.ln: nodelist.h Xrmail.o: fnet.h Xrmail.ln: fnet.h Xfpack.o: hsu.h Xfpack.ln: hsu.h Xfpack.o: config.h Xfpack.ln: config.h Xfpack.o: fnet.h Xfpack.ln: fnet.h Xfpack.o: fpack.h Xfpack.ln: fpack.h Xfpack.o: nodelist.h Xfpack.ln: nodelist.h Xfunpack.o: hsu.h Xfunpack.ln: hsu.h Xfunpack.o: config.h Xfunpack.ln: config.h Xfunpack.o: fnet.h Xfunpack.ln: fnet.h Xfunpack.o: fpack.h Xfunpack.ln: fpack.h Xfunpack.o: nodelist.h Xfunpack.ln: nodelist.h Xfunpack.o: sysexits.h Xfunpack.ln: sysexits.h Xfunpack.o: fnews.h Xfunpack.ln: fnews.h Xfcall.o: hsu.h Xfcall.ln: hsu.h Xfcall.o: config.h Xfcall.ln: config.h Xfcall.o: fnet.h Xfcall.ln: fnet.h Xfcall.o: fio.h Xfcall.ln: fio.h Xfcall.o: nodelist.h Xfcall.ln: nodelist.h Xfio.o: fnet.h Xfio.ln: fnet.h Xfio.o: fio.h Xfio.ln: fio.h Xxtsend.o: fnet.h Xxtsend.ln: fnet.h Xxtsend.o: fio.h Xxtsend.ln: fio.h Xxtsend.o: crc.h Xxtsend.ln: crc.h Xxtrec.o: hsu.h Xxtrec.ln: hsu.h Xxtrec.o: fnet.h Xxtrec.ln: fnet.h Xxtrec.o: fio.h Xxtrec.ln: fio.h Xxtrec.o: crc.h Xxtrec.ln: crc.h Xnodelist.o: hsu.h Xnodelist.ln: hsu.h Xnodelist.o: config.h Xnodelist.ln: config.h Xnodelist.o: fnet.h Xnodelist.ln: fnet.h Xnodelist.o: nodelist.h Xnodelist.ln: nodelist.h Xdateconv.o: fnet.h Xdateconv.ln: fnet.h Xaddress.o: hsu.h Xaddress.ln: hsu.h Xaddress.o: config.h Xaddress.ln: config.h Xaddress.o: fnet.h Xaddress.ln: fnet.h Xaddress.o: nodelist.h Xaddress.ln: nodelist.h Xaddress.o: shuffle.h Xaddress.ln: shuffle.h Xsprintfs.o: hsu.h Xsprintfs.ln: hsu.h Xlintlib.o: hsu.h Xlintlib.ln: hsu.h Xlintlib.o: config.h Xlintlib.ln: config.h Xgetdate.y.o: config.h Xgetdate.y.ln: config.h Xsprintfs.o: hsu.h Xsprintfs.ln: hsu.h Xstrempty.o: hsu.h Xstrempty.ln: hsu.h X# DEPENDENCIES MUST END AT END OF FILE X# IF YOU PUT STUFF HERE IT WILL GO AWAY X# see make depend above SHAR_EOF chmod 0644 Makefile || echo "restore of Makefile fails" echo "x - extracting getdate.y (Text)" sed 's/^X//' << 'SHAR_EOF' > getdate.y && X%token ID MONTH DAY MERIDIAN NUMBER UNIT MUNIT SUNIT ZONE DAYZONE AGO X%{ 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 X#include <sys/types.h> X#include "config.h" X#ifdef NEEDED X/* This is now in config.h */ X#ifdef USG Xstruct timeb X{ X time_t time; X unsigned short millitm; X short timezone; X short dstflag; X}; X#else X#include <sys/timeb.h> X#endif X#include <ctype.h> X#endif X X#if defined(BSD4_2) || defined (BSD4_1C) X#include <sys/time.h> X#else /* sane */ X#include <time.h> X#endif /* sane */ X X#define NULL 0 X#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, daylight; X static int dayord, dayreq; X static int month, day, year; X static int ourzone; X#define AM 1 X#define PM 2 X#define DAYLIGHT 1 X#define STANDARD 2 X#define MAYBE 3 X%} X X%% Xtimedate: /* empty */ X | timedate item; X Xitem: tspec = X {timeflag++;} X | zone = X {zoneflag++;} X | dtspec = X {dateflag++;} X | dyspec = X {dayflag++;} X | rspec = X {relflag++;} X | nspec; X Xnspec: NUMBER = X {if (timeflag && dateflag && !relflag) year = $1; X else {timeflag++;hh = $1/100;mm = $1%100;ss = 0;merid = 24;}}; X Xtspec: 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 daylight = 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 daylight = STANDARD; ourzone = -($6%100 + 60*($6/100));}; X Xzone: ZONE = X {ourzone = $1; daylight = STANDARD;} X | DAYZONE = X {ourzone = $1; daylight = DAYLIGHT;}; X Xdyspec: DAY = X {dayord = 1; dayreq = $1;} X | DAY ',' = X {dayord = 1; dayreq = $1;} X | NUMBER DAY = X {dayord = $1; dayreq = $2;}; X Xdtspec: 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 Xrspec: 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%% X Xstatic int mdays[12] = X {31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; X#define epoch 1970 X Xextern struct tm *localtime(); X Xtime_t Xdateconv(mm, dd, yy, h, m, s, mer, zone, dayflag) Xint mm, dd, yy, h, m, s, mer, zone, dayflag; X{ X time_t tod, jdate; X register int i; X time_t timeconv(); 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} X Xtime_t Xdayconv(ord, day, now) Xint ord, day; time_t now; X{ X register struct tm *loctime; X time_t tod; X time_t daylcorr(); 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} X Xtime_t Xtimeconv(hh, mm, ss, mer) Xregister int hh, mm, ss, mer; X{ 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} Xtime_t Xmonthadd(sdate, relmonth) Xtime_t sdate, relmonth; X{ X struct tm *ltime; X time_t dateconv(); X time_t daylcorr(); 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} X Xtime_t Xdaylcorr(future, now) Xtime_t future, now; X{ 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} X Xstatic char *lptr; X Xyylex() X{ 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} X Xstruct table { X char *name; X int type, value; X}; X Xstruct 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 X#define HRS *60 X#define HALFHR 30 Xstruct 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 Xstruct 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 Xstruct 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 Xstruct 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 Xlookup(id) Xchar *id; X{ X#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} X Xtime_t Xgetdate(p, now) Xchar *p; Xstruct timeb *now; X{ X#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 daylight = 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,daylight); 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} X Xyyerror(s) char *s; X{} SHAR_EOF chmod 0644 getdate.y || echo "restore of getdate.y fails" echo "x - extracting rfmail.c (Text)" sed 's/^X//' << 'SHAR_EOF' > rfmail.c && X#ifndef lint Xstatic char *sccsid = "@(#)%M% %I% Teemu Torma %H%"; X#endif X X/* Read mail from standard input and put it into spool-directory. X Usually this program is executed by our rmail, but it can be X excuted manually or put as external fidomailer. If our rmail is X not used (or some other modified rmail), mail from other UUCP X node can not be sent to fidonet, because (normally) the other X node sends mail in this site by using rmail. X X @(#)Copyright (c) 1987 by Teemu Torma X X Permission is given to distribute this program and alter this code as X needed to adapt it to forign systems provided that this header is X included and that the original author's name is preserved. */ X X#include <stdio.h> X#include <string.h> X#include <unistd.h> X#include <ctype.h> X#include <pwd.h> X#include <sys/types.h> X#include <time.h> X#include <varargs.h> X#include "hsu.h" X#include "config.h" X#include "fnet.h" X#include "nodelist.h" X Xextern struct passwd *getpwuid(); Xextern char *mktemp(); Xextern int getopt(); Xextern char *optarg; Xextern int optind; Xextern void exit(); Xextern char *spoolfile(), *basename(); Xextern char *regex(); Xextern time_t time(); Xextern FILE *popen(); Xextern int errno; Xextern char *sys_errlist[]; X X/* verbosity */ Xint verbose = INIT_VERBOSE; X X/* non-private mail */ Xbool public = False; X X/* News-article */ Xint newsmode = FALSE; X X/* version of rfmail */ Xchar *version = "%I%"; X X/* Our net/node information */ XNode this; X X/* Extract address from Reply-To or From field. Possible formats are: X - Full Name <address> X - address (Full Name) X - address */ X Xvoid Xget_address(field, address) X char *field, *address; X{ X register char *cp, *np; X X /* strip possible newline */ X if (cp = strchr(field, '\n')) X *cp = 0; X X if ((cp = strchr(field, '(')) && strchr(cp + 1, ')')) X { X /* format is 'address (full name)' */ X for (np = field; np < cp - 1; np++) X *address++ = *np; X *address = 0; X } X else X if ((cp = strchr(field, '<')) && (np = strchr(cp + 1, '>'))) X { X /* format is 'full name <address>' */ X while (cp < np) X *address++ = *cp++; X *address = 0; X } X else X /* line contains only address */ X (void) strcpy(address, field); SHAR_EOF echo "End of part 1" echo "File rfmail.c is continued in part 2" echo "2" > s2_seq_.tmp exit 0 -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.