├── .gitignore ├── BUGS.FUNET ├── ChangeLog ├── MVS.NJEIP ├── Makefile ├── README.FUNET ├── README.INSTALL ├── README.md ├── __fopen.c ├── acctcat ├── acctcat.c ├── ad.c ├── bcb_crc.c ├── bintree.c ├── bintree.h ├── bitreceive.c ├── bitsend ├── bitsend.c ├── bmail ├── bmail.c ├── bmail.sh ├── clientutils.h ├── cmd-help.txt ├── consts.h ├── detach.c ├── ebcdic.h ├── ebcdicinv.c ├── etbwrite.c ├── etbwrite2.c ├── file-exit.cf ├── file_queue.c ├── finfiles.cf ├── finfiles.header ├── finfiles.netinit ├── finutu.cf ├── funetnje ├── funetnje.texinfo ├── funetnje_linux_32-bit_bin.tgz ├── funetnje_linux_32-bit_source.tgz ├── gone_server.c ├── headers.c ├── headers.h ├── io.c ├── libasc2ebc.c ├── libdondata.c ├── libebc2asc.c ├── libetbl.c ├── libexpnhome.c ├── libhdrtbx.c ├── liblstr.c ├── libmcuserid.c ├── libndfuncs.c ├── libndparse.c ├── libpadbla.c ├── libreadcfg.c ├── libreceive.c ├── libsendcmd.c ├── libstrsave.c ├── libsubmit.c ├── liburead.c ├── libustr.c ├── libuwrite.c ├── logger.c ├── mailify ├── mailify.c ├── mailify.sh ├── main.c ├── man ├── bitcat.1 ├── bitspool.5 ├── bitspool.5.ps ├── bmail.8 ├── bmail.8.ps ├── ebcdictbl.5 ├── ebcdictbl.5.ps ├── funetnje.8 ├── funetnje.8.ps ├── mailify.8 ├── mailify.8.ps ├── ndparse.1 ├── njeroutes.8 ├── njeroutes.8.ps ├── print.1 ├── punch.1 ├── qrdr.8 ├── qrdr.8.ps ├── receive.1 ├── receive.1.ps ├── send.1 ├── send.1.ps ├── sendfile.1 ├── sendfile.1.ps ├── submit.1 ├── sysin.8 ├── transfer.1 ├── ucp.8 ├── ucp.8.ps └── ygone.1 ├── msg-exit.cf ├── namesfilter ├── namesfilter.c ├── namesparser.c ├── ndlib.h ├── netdata.descript ├── netinit.sh ├── newtags.descript ├── nje-finger.sh ├── nje.route ├── njeroutes ├── njeroutes.c ├── nmr.c ├── nmr_unix.c ├── nmr_vms.c ├── protocol.c ├── prototypes.h ├── qrdr ├── qrdr.c ├── quickdf.c ├── read_config.c ├── receive ├── receive.c ├── recv_file.c ├── rprint ├── rprint.sh ├── rscsacct.c ├── rscsacct.format ├── rscsacct.h ├── send.c ├── send_file.c ├── sendfile ├── sendfile.c ├── sendmail-configs ├── file-exit.cf.add ├── maketable ├── peb.mail └── sendmail.cf.uksage ├── site_consts.h ├── sizeof.c ├── smail-configs ├── bitearn ├── bitmethods ├── bsmtp3 ├── bsmtp3nd ├── config ├── defrt1 ├── paths ├── routers └── transports ├── spool.cmsnote ├── spool.dshodd2 ├── spool.listserv ├── spool.longtag ├── spool.mvslog ├── spool.mvsnd ├── spool.mvsnd2 ├── spool.mvsout2 ├── spool.mvsout3 ├── spool.mvsout4 ├── spool.sysinjob ├── spool.uxpasa ├── spool.vmprint ├── stdxlat.default ├── stdxlat.ger ├── sysexits.h ├── sysin.sh ├── tell ├── transfer ├── transfer.c ├── transfer.sh ├── ucp ├── ucp.c ├── unix.c ├── unix_brdcst.c ├── unix_files.c ├── unix_msgs.c ├── unix_msgs.h ├── unix_route.c ├── unix_tcp.c ├── util.c ├── version.c ├── version.sh ├── vogon.cf ├── who.c ├── ygone ├── ygone.c └── zmailer-configs ├── router.cf ├── scheduler.conf └── sm.conf /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | -------------------------------------------------------------------------------- /BUGS.FUNET: -------------------------------------------------------------------------------- 1 | BUGS / Checkme / Missing features / TO-DO / Open Issues / ... 2 | 3 | - Active open towards a JNET (OpenVMS) is problematic, it usually 4 | will abort immediately, and soon try itself to open connection to 5 | our end. Log-browsing on the JNET seems to indicate that it 6 | receives invalid BCB sequence number, but there are no problems 7 | with VM/SP, nor with FUNETNJE on Linux :-/ (950610) 8 | 9 | Possible explanation: JNET is broken :-( 10 | 11 | - Timestamps on DEC OSF/1 AXP version do vary in mysterious ways. 12 | A set of files which in reality is transmitted at 25-35 kB/s 13 | gets reported as having been sent at the rate of 100-200 kB/s 14 | (The line allows 95 kB/s as theoretical max..) 15 | 16 | At the same time a similar set of files is sent from Linux 1.2.9 17 | to the DEC OSF/1, and those appear with correct speed indications.. 18 | 19 | - TeXinfo manual is in the begin -- docs are not complete 20 | Once it is done, release 3.0 is done. 21 | 22 | - Line-oriented operator-commands should be per link NAME, 23 | not its number! ("Wasn't that link number 5 ? Aargh...") 24 | 25 | - bmail.c, et.al.: Have common library routine that will ensure 26 | that BITNET addresses follow strict 8+8 rule. 27 | (10 or so lines of code on each program now.) 28 | 29 | - Message exits need to be implemented 30 | 25-Jan-93: "first cut".. 31 | 32 | - An "IUCVTRAP" mechanism is needed 33 | 34 | - A cluster mode ? (Esp. messages) 35 | Thinking as binding multiple machines into single NJE-node 36 | by allowing transparent NMR relaying. File-spool is simple 37 | to share. 38 | 39 | - send.c/io.c: need more complete tests on what user (even SU) has put 40 | on the 'sender address'.. A "send -u @ addr@somenode text" should not 41 | produce totally void NMR.. 42 | 43 | - bitsend/bitrcv to be brought up to date 44 | 45 | - We need a transit-file trapping mechanism, not only for 1986 XMAS EXEC 46 | like things, but also for transit node processing in places which 47 | have for example one public NJE node, and a bunch of private ones.. 48 | 49 | - A tool to edit/create user ASCII <-> EBCDIC tables 50 | 51 | - SYSIN exit program (even a sample one) needs to be written 52 | 53 | - Better queue management -- when primary link to system X 54 | goes down, all files destined to it should be redirected 55 | to a POSSIBLE secondary link, and when the primary link 56 | comes back up again, files should be returned to it.. 57 | (Gerald's idea: link activation should do 'debug_rescan_queue()'..) 58 | Keep in mind the system non-performance when there are N-links, and 59 | M-files in queues.. 60 | (Apr95: Now file and link state information is kept in-core 61 | and such queue state-change initiated rescan happens 62 | FAST!) 63 | Link start-time automatic "debug rescan" appears to be a bit too much.. 64 | (It frees the queue when link is started, however it could differ..) 65 | 66 | - Route-finding is problematic, in some cases alternates are desirable, 67 | but loops in the database must be avoided -- or detected. 68 | A generic spanning-tree problem ? 69 | 70 | - sendfile's usage() needs to be rewritten ! (about done, now man-pages..) 71 | 72 | - Native Solaris 2.3 has no "select()" -- or rather the select(2) is 73 | replaced with a select(3n) wrapper which calls poll(2), later one is 74 | somewhat more versatile, but ah so cumbersome... 75 | Well, the code works with "-lsocket -lnsl", but need to create a fully 76 | native system -- sleeker.. 77 | -------------------------------------------------------------------------------- /MVS.NJEIP: -------------------------------------------------------------------------------- 1 | 2 | 3 | NJEIP for MVS 4 | 5 | Author: Anthony Fitzgerald 6 | Addr: JAF@UNB.CA, T4710@UNBMVS1.BITNET 7 | FTP: unbmvs1.csd.unb.ca 8 | 9 | For those who need VMNET on MVS 10 | 11 | -------------------------------------------------------------------------------- /README.FUNET: -------------------------------------------------------------------------------- 1 | README.FUNET about FUNET-NJE 3.0/mea 2 | 3 | 4 | About modifications made on the HUJI-NJE at FINFILES by Matti Aarnio 5 | (aka: mea@nic.funet.fi) -- changes are so large, that 6 | we eventually started to call this with different name: FUNET-NJE 7 | 8 | Overall philosophy: 9 | FUNET-NJE is TRANSPORTER, and thus all features that 10 | within it handle things like NETDATA processing, or 11 | feeding files to system mailer via an SMTP session, 12 | those are harmfull, and have been weed out, and 13 | replaced with something what I consider better. 14 | 15 | As FUNET-NJE is a TRANSPORT system, files received by it will get 16 | processed by various user programs at their leisure. To facilitate 17 | that, it was necessary to implement a spooling scheme with easily 18 | configurable "exits". ("exit" mechanism is described the best in 19 | the "file-exit.cf" -file.) 20 | 21 | The File-Exit file configures things like: 22 | - location of user spool directories 23 | (Requirement: Must be on the same physical disk, as system 24 | "bitnet" spool. Files are moved there by 25 | rename() -library/system call.) 26 | - Postmaster spool directory 27 | - Disposition of a file, which contains: 28 | - defining system mailer 29 | - handling of obvious incoming mail 30 | - creating pseudo-servers 31 | 32 | 33 | When files are spooled into those dirs for user perursal, they 34 | are in there with a plain-ascii header, and binary body. 35 | The spool file format is described in bitspool.5 -manpage. 36 | Below a sort of summary. 37 | 38 | 39 | Of security aspects: 40 | 41 | FUNET's NJE uses named pipe (FIFO) for inter-module 42 | communication channel, but there are other options as well. 43 | Only programs/users who have a need to communicate with the 44 | main-module need write-access to the `CMDMAILBOX' (see 45 | /etc/funetnje.cf) -pipe, and its associated access key 46 | (see funetnje.8.) 47 | 48 | The `CMDMAILBOX' gets its group-id from the `QUEUE' directory 49 | (or where-ever it resides in - within `QUEUE' is most convinient), 50 | and therefore all programs that need to write to it shall have 51 | `setgid' capability -- AVOID SUID PROGRAMS! SGID is bad enough.. 52 | 53 | Every sent command must contain valid `socket key', which is 54 | owner+group readable in `QUEUE'/.socket.key -file. (4 bytes) 55 | Said key is a generated at main module startup time, and is 56 | a random number.. 57 | 58 | File submissions (by sendfile(1), and bmail(1)) are done into 59 | the `QUEUE' directory with (initially) filenames that start 60 | with `.' Once the file is written in full, file is renamed 61 | to be something without the starting `.', and is submitted 62 | via client-library submit_file() routine. 63 | 64 | The NJE-CP -control program (ucp) is not sgid, as only user(s) 65 | with real reason for being able to use it will need to use it, 66 | and they can be equiped with proper ancilliary group(s) for 67 | doing the access. 68 | 69 | Summary of BITSPOOL data: 70 | 71 | When files are spooled into those dirs for user perusal, they 72 | are in there with a plain-ascii header, and binary body. The 73 | body contains records of a two-byte record length (in network 74 | byte order facilitating sharing via NFS, for example), and 75 | then -bytes of data in the "network line format". (This 76 | makes store & forward to be a simple thing.) 77 | 78 | Locally generated files shall not contain anything but 79 | PUNCH, or PRINT records, and mark their format as: 80 | FMT: BINARY 81 | 82 | Externally arrived files are represented as 83 | FMT: EBCDIC 84 | and they contain original RSCS headers, and trailers. 85 | 86 | 87 | When a user-program wants to create a PUNCH file for 88 | sending out, it shall be coded as follows: 89 | ASCII headers: 90 | FRM: USERNAME@HOSTNAME <- Real sender, please.. Uppercase only 91 | TOA: USERNAME@HOSTNAME <- Recipient, uppercase only 92 | FMT: BINARY <- MANDATORY 93 | FNM: FILENAME <- 8 characters, uppercase only 94 | EXT: FILEEXTN <- 8 characters, uppercase only 95 | FOR: FORMNAME <- "QUxxxxxx" if you want silence.. 96 | CLS: P <- 1 uppercase alpha, default is `A' 97 | FID: 0000 <- just that string, system uses it.. 98 | OID: 0000 <- just that string, system uses it.. 99 | TAG: xxxxxx <- 136 characters of RSCS TAG, optional 100 | DIS: 88888888 <- RSCS DIST, optional, 8 chars 101 | REC: nnnnnnnn <- Record count of actual data 102 | END: <- the header ends here ("END:\n") 103 | Binary body containing length-tagged records of: 104 | 0x80, 80, /* line header; 0x80=PUNCH FMT, 80=len */ 105 | <80 bytes EBCDIC/whatever> /* the content */ 106 | thus each record is 82(+2) bytes long. 107 | 108 | For more detailed info, see man-page: bitspool(5) 109 | 110 | Modification summary: 111 | See ChangeLog 112 | -------------------------------------------------------------------------------- /README.INSTALL: -------------------------------------------------------------------------------- 1 | Guide to install FUNET-NJE software into UNIX systems. 2 | 3 | by Matti Aarnio 4 | 5 | 6 | READ THE README.FUNET FILE! 7 | READ THE funetnje.info / funetnje.ps DOCUMENT! 8 | 9 | The configuration and installation is covered on the 10 | funetnje.info/funetnje.ps -document, this file is from 11 | the older era... 12 | 13 | 14 | 15 | This version of software does not support any kind of 16 | BISYNC-adapters available for various systems. Mainly 17 | because I didn't have such interface available for testing... 18 | 19 | However: TCP-IP interface works well (one of rare features 20 | that are ALMOAST identical among various UNIXes). 21 | 22 | 23 | When starting to do installation, you must determine few 24 | system dependent features: 25 | 26 | 27 | In Makefile: 28 | 29 | Well, dependencies should be all right, some external defines 30 | and route + install phases propably need an update. 31 | 32 | Usage of `ranlib' depends upon your system, same with `install' 33 | 34 | Choise of group-name used on client-program installation. 35 | 36 | In detach.c: 37 | 38 | See & try which setup works best. Quite well documented in there. 39 | 40 | 41 | 42 | CONFIGURING SYSTEM: 43 | 44 | 45 | Create a new group for FUNET-NJE internal use, say `bitnet'. 46 | Decide and create your BITNET spool directory: 47 | /usr/spool/bitnet 48 | set its protection to be 2775 (or 2770), group-write is 49 | needed. Set its group to be abovementioned `bitnet'. 50 | (Mode 2xxx attempts to do BSD directory semantics on group 51 | inheritance) 52 | 53 | Decide where you put your user spool directories, exaple: 54 | /usr/spool/bitspool 55 | However HAVE THEM ON SAME PHYSICAL DEVICE so that rename(2) 56 | (or rename(3)) can be used successfully to place files into 57 | there. Directory can have protection 111, or 555. Nobody 58 | (but root) need to have write-permission there. 59 | 60 | 61 | Programs used for sending BITNET files are configured to 62 | do a set-gid operation, and then write file to be spooled 63 | into the `QUEUE' directory, and finally sending a submission 64 | signal to the transporter. 65 | 66 | 67 | More information from funetnje(8) 68 | 69 | Sample version of /etc/funetnje.cf : 70 | 71 | # 72 | # Configuration file for FUNET-NJE program 73 | # 74 | 75 | NAME HAMSTER 76 | IPADDRESS 128.214.6.100 77 | QUEUE /usr/spool/bitnet 78 | CMDMAILBOX /usr/spool/bitnet/.cmdpipe 79 | LOG /usr/adm/bitnet.log 80 | # this table is DBM/NDBM/GDBM binary file. 81 | TABLE /usr/lib/funetnje.route 82 | INFORM MEA@HAMSTER 83 | USEREXITS /usr/local/lib/funetnje/file-exit.cf 84 | MSGEXITS /usr/local/lib/funetnje/msg-exit.cf 85 | LLEVEL 2 86 | DEFAULT-ROUTE FIGBOX 87 | 88 | LINE 0 SEARN 89 | TYPE UNIX_TCP 90 | BUFSIZE 1024 91 | TIMEOUT 10 92 | IPPORT 175 93 | TCPNAME searn.sunet.se 94 | TCP-SIZE 8192 95 | MAX-STREAMS 7 96 | 97 | LINE 1 FINTEST1 98 | TYPE UNIX_TCP 99 | BUFSIZE 1024 100 | TIMEOUT 10 101 | IPPORT 175 102 | TCPNAME mea.utu.fi 103 | TCP-SIZE 8192 104 | MAX-STERAMS 7 105 | 106 | 107 | Comments start with '#' or '*' on first column. 108 | Otherwise white space (blanks and/or tabs) are freely usable. 109 | Completely WHITE lines are suggested not to include anything but 110 | newline. 111 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | NJE for UNIX 3 | ============= 4 | 5 | 6 | 7 | This NJE repo is is the third incarnation of the Hebrew University of Jersualem NJE protocol for UNIX and VMS. The original VMS repo is here: https://github.com/moshix/HUJInje 8 | 9 | In this new version, it's been made to compile cleanly on Linux, BSD (including latest Macos!), as well as with the latest gcc and glibc systems present in Ubuntu 22.04 [thanks wschaub!] 10 | 11 | You will need to ask to peer with somebody on HNET to use this protocol. Contact me if you have a 24/7 Linux server and you want to peer with my HNET main node RELAY (which is also based on UNIXNJE). See more: www.moshix.tech 12 | 13 | UnixNJE is fully compatible with the NJE protocol and connects effortlessly to VM/SP or z/VM RSCS, NJE38 for MVS 3.8, SineNomine NJE, JNET for openVMS, NJE for Windows. 14 | 15 | 16 | 17 | INSTALL 18 | ------ 19 | 20 | get repo to your Linux/BSD/Macos (anything from the last 6-7 years should work) 21 | 22 | then type "make" and watch it compile 23 | 24 | Configuration 25 | ------------- 26 | 27 | In /etc/funetnje create a file called funetnje.cf like this (just an example): 28 |
29 | #       Configuration file for FUNET-NJE program
30 | #
31 | NAME            SELXM1
32 | IPADDRESS       111.111.111.195  #my IP address
33 | QUEUE           /var/spool/bitnet # where my work spool is
34 | CMDMAILBOX      U 127.0.0.1 175   #my port 175
35 | LOG             /var/log/bitnet.log #log location
36 | TABLE           /usr/local/funetnje/binroutes  #location of routes information (see below)
37 | INFORM          MAINT@NODE1    # who will be informed of issues
38 | USEREXITS       /usr/local/funetnje/file-exit.cf  #see my video (link below)
39 | MSGEXITS        /usr/local/funetnje/msg-exit.cf   # see y video (link below)
40 | LLEVEL          5                                      # log level
41 | #LLEVELCLIENT    1
42 | DEFAULT-ROUTE   NODE1 # defaultr route for all nodes
43 | 
44 | LINE 0          NODE1
45 |  TYPE           UNIX_TCP
46 |  BUFSIZE        8192
47 |  TIMEOUT        10
48 |  IPPORT         1175
49 |  TCPNAME        222.222.222.30
50 |  TCP-SIZE       8192
51 |  MAX-STREAMS     7
52 | 
53 | 54 | in file /usr/local/funetnje/header.txt: 55 |
56 | ROUTE SELXM1 LOCAL ASCII
57 | 
58 | In file /usr/local/funetnje/routes.txt: 59 |
60 | ROUTE MOSHIX2       NODE1 ETHNET   CH
61 | ROUTE MOSHIX4       NODE1 ETHNET   CH
62 | ROUTE MOSHIX3       NODE1 ETHNET   CH
63 | ROUTE MOSHIX5       NODE1 ETHNET   CH
64 | ROUTE MOSHIX        NODE1 ETHNET   CH
65 | 
66 | 67 | 68 | 69 | Running It 70 | ---------- 71 | 72 | To execute it you need sudo privileges, or need to be root. 73 | 74 | Run the binroutes command to create /usr/local/funetnje/binroutes, then start funetnje as a daemon 75 | 76 | Enable "mesg yes" for your shell session to receive messages from other nodes. 77 | 78 | Commands available send to sendfiles or messages or commands. "qrdr" to see the file queue. See my video (link below) 79 | 80 | Watch this video to see how to get this to works: https://youtu.be/1iHrNNH7plY 81 | 82 | 83 | Enjoy 84 | 85 | moshix 86 | Moscow, January 2025 87 | -------------------------------------------------------------------------------- /__fopen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifndef DEBUG_FOPEN 5 | 6 | FILE *_nje_fopen(filename, type) 7 | char *filename, *type; 8 | { 9 | return fopen(filename, type); 10 | } 11 | 12 | FILE *_nje_freopen(filename,type,stream) 13 | char *filename, *type; 14 | FILE *stream; 15 | { 16 | return freopen(filename,type,stream); 17 | } 18 | 19 | FILE *_nje_fdopen(fd,type) 20 | int fd; 21 | char *type; 22 | { 23 | return fdopen(fd,type); 24 | } 25 | 26 | int _nje_fclose(stream) 27 | FILE *stream; 28 | { 29 | return fclose(stream); 30 | } 31 | 32 | 33 | #else 34 | 35 | 36 | static FILE *fileptrs[512]; 37 | static int topfp = 0; 38 | int calls_fopen = 0; 39 | int calls_fdopen = 0; 40 | int calls_freopen = 0; 41 | int calls_fclose = 0; 42 | static int initialized = 0; 43 | static FILE *fopenlog = NULL; 44 | 45 | extern int errno; 46 | 47 | static void fopen_init() 48 | { 49 | fopenlog = stderr; 50 | initialized = 1; 51 | } 52 | 53 | static void fopenerr(name,msg,dumpfps,oerrno) 54 | char *name, *msg; 55 | int dumpfps, oerrno; 56 | { 57 | extern char *sys_errlist[]; 58 | 59 | if (!fopenlog) abort(); 60 | 61 | fprintf(fopenlog,"_nje_%s() : %s",name,msg); 62 | 63 | if (oerrno != 0) 64 | fprintf(fopenlog,", errno=%d (%s)",oerrno,sys_errlist[oerrno]); 65 | 66 | if (dumpfps) { 67 | int i; 68 | fprintf(fopenlog," fps in use:"); 69 | for (i = 0; i < topfp; ++i) 70 | if (fileptrs[i] != NULL) 71 | fprintf(fopenlog," %d",i); 72 | } 73 | fprintf(fopenlog,"\n"); 74 | } 75 | 76 | 77 | FILE *_nje_fopen(filename, type) 78 | char *filename, *type; 79 | { 80 | FILE *fp = fopen(filename, type); 81 | int i; 82 | int oerrno = errno; 83 | 84 | if (!initialized) fopen_init(); 85 | ++calls_fopen; 86 | 87 | if (fp) { 88 | int freefp = -1; 89 | for (i=0; i < topfp; ++i) 90 | if (freefp < 0 && fileptrs[i] == NULL) freefp = i; 91 | if (fileptrs[i] == fp) { 92 | fopenerr("fopen","reissued fp",0,0); 93 | return fp; 94 | } 95 | if (freefp < 0) freefp = topfp++; 96 | fileptrs[freefp] = fp; 97 | } else 98 | fopenerr("fopen", "failed", 1, oerrno); 99 | 100 | errno = oerrno; 101 | return fp; 102 | } 103 | 104 | FILE *_nje_freopen(filename,type,stream) 105 | char *filename, *type; 106 | FILE *stream; 107 | { 108 | FILE *fp = freopen(filename, type, stream); 109 | int i; 110 | int oerrno = errno; 111 | 112 | if (!initialized) fopen_init(); 113 | ++calls_freopen; 114 | 115 | if (fp) { 116 | int freefp = -1; 117 | for (i=0; i < topfp; ++i) 118 | if (freefp < 0 && fileptrs[i] == NULL) freefp = i; 119 | if (fileptrs[i] == fp) { 120 | fopenerr("freopen","reissued fp",0,0); 121 | return fp; 122 | } 123 | if (freefp < 0) freefp = topfp++; 124 | fileptrs[freefp] = fp; 125 | } else 126 | fopenerr("freopen", "failed", 1, oerrno); 127 | 128 | errno = oerrno; 129 | return fp; 130 | } 131 | 132 | FILE *_nje_fdopen(fd,type) 133 | int fd; 134 | char *type; 135 | { 136 | FILE *fp = fdopen(fd,type); 137 | int i; 138 | int oerrno = errno; 139 | 140 | if (!initialized) fopen_init(); 141 | ++calls_fdopen; 142 | 143 | if (fp) { 144 | int freefp = -1; 145 | for (i=0; i < topfp; ++i) 146 | if (freefp < 0 && fileptrs[i] == NULL) freefp = i; 147 | if (fileptrs[i] == fp) { 148 | fopenerr("fdopen","reissued fp",0,0); 149 | return fp; 150 | } 151 | if (freefp < 0) freefp = topfp++; 152 | fileptrs[freefp] = fp; 153 | } else 154 | fopenerr("fdopen", "failed", 1, oerrno); 155 | 156 | errno = oerrno; 157 | return fp; 158 | } 159 | 160 | int _nje_fclose(stream) 161 | FILE *stream; 162 | { 163 | int i; 164 | 165 | if (!initialized) fopen_init(); 166 | ++calls_fclose; 167 | 168 | if (stream) 169 | for (i = 0; i < topfp; ++i) 170 | if (stream == fileptrs[i]) { 171 | fileptrs[i] = NULL; 172 | return fclose(stream); 173 | } 174 | 175 | fopenerr("fclose","unknown stream", 1, 0); 176 | 177 | return fclose(stream); 178 | } 179 | 180 | 181 | 182 | #endif 183 | -------------------------------------------------------------------------------- /acctcat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/acctcat -------------------------------------------------------------------------------- /acctcat.c: -------------------------------------------------------------------------------- 1 | /* acctcat -- Sample RSCS Accounting file processor for FUNET-NJE. 2 | By Matti Aarnio 3 | (c) 1993, 1994 Finnish University and Research Network, FUNET 4 | */ 5 | 6 | 7 | #include "prototypes.h" 8 | #include "rscsacct.h" 9 | #include "clientutils.h" 10 | 11 | char LOCAL_NAME[80]; 12 | char BITNET_QUEUE[80]; 13 | 14 | void 15 | usage() 16 | { 17 | fprintf(stderr,"Usage: acctcat /path/to/rscs/acct-file\n"); 18 | exit(2); 19 | } 20 | 21 | int 22 | main(argc,argv) 23 | const int argc; 24 | const char *argv[]; 25 | { 26 | struct RSCSLOG RL,RLa; 27 | FILE *logfil = NULL; 28 | 29 | if (argc != 2) usage(); 30 | 31 | logfil = fopen(argv[1],"r"); 32 | if (!logfil) usage(); 33 | 34 | read_configuration(); 35 | read_etable(); 36 | 37 | while (fread(&RL,1,sizeof(RL),logfil) == sizeof(RL)) { 38 | /* See that it is RSCS accounting entry (EBCDIC "C0") */ 39 | if (RL.ACNTTYPE[0] != 0xC3 || RL.ACNTTYPE[1] != 0xF0) continue; 40 | 41 | EBCDIC_TO_ASCII(&RL,&RLa,sizeof RL); 42 | 43 | /* Early on there was a mistake, and seconds were lost.. */ 44 | if (RLa.ACNTDATE[10] < '0' || RLa.ACNTDATE[10] > '9' || 45 | RLa.ACNTDATE[11] < '0' || RLa.ACNTDATE[11] > '9') { 46 | RLa.ACNTDATE[10] = '0'; 47 | RLa.ACNTDATE[11] = '0'; 48 | } 49 | 50 | printf("%c %-12.12s %04d %-8.8s %-8.8s %04d -> %-8.8s %-8.8s %s %c %5ld recs\n", 51 | (RL.ACNTCODE == 1) ? 'T' : 'R', RLa.ACNTDATE, 52 | ntohs(RL.ACNTID), 53 | RLa.ACNTUSER, RLa.ACNTILOC, 54 | ntohs(RL.ACNTOID), 55 | RLa.ACNTTOVM, RLa.ACNTDEST, 56 | (RL.ACNTINDV & 0xF0) == 0x80 ? "PUN" : "PRT", RLa.ACNTCLAS, 57 | ntohl(RL.ACNTRECS)); 58 | } 59 | fclose(logfil); 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /ad.c: -------------------------------------------------------------------------------- 1 | #include 2 | #define MAIN -1 3 | #include "ebcdic.h" 4 | 5 | unsigned char prttable[256]; 6 | int HUJI = 0; /* Show EBCDIC... after header */ 7 | 8 | 9 | main(argc, argv) 10 | int argc; 11 | char *argv[]; 12 | { 13 | FILE *fp; 14 | int i; 15 | 16 | /* for(i=0;i<256;++i) prttable[i] = '.'; 17 | for(i=32;i<127;++i) prttable[i] = i; 18 | for(i=128;i<176;++i) prttable[i] = i; 19 | for(i=224;i<254;++i) prttable[i] = i;*/ 20 | #define isprint(c) ( ((c) >=32) && ((c) <= 126) ) 21 | for(i=0;i<256;++i) { prttable[i] = '.'; 22 | if (isprint(i)) prttable[i] = i; } 23 | 24 | if (argc > 1) 25 | if (strcmp(argv[1],"-H")==0) { 26 | HUJI += 1; 27 | ++argv; 28 | --argc; 29 | } 30 | if (argc > 1) 31 | if (strcmp(argv[1],"-H")==0) { 32 | HUJI += 1; 33 | ++argv; 34 | --argc; 35 | } 36 | 37 | if (argc == 1) { 38 | dofile(stdin); 39 | exit (0); 40 | } 41 | while (--argc) { 42 | argv++; 43 | if ((fp = fopen(*argv, "r")) == NULL) { 44 | perror(*argv); 45 | continue; 46 | } 47 | dofile(fp); 48 | fclose(fp); 49 | } 50 | exit(0); 51 | } 52 | 53 | dofile (fp) 54 | FILE *fp; 55 | { 56 | int adr, n, i; 57 | unsigned char buf[16]; 58 | int EbcdicDump = 0; 59 | unsigned char ENDM[4],c; 60 | 61 | if (HUJI>1) EbcdicDump = 1; 62 | 63 | adr = 0; 64 | while (1) { 65 | if ((n = fread(buf, 1, 16, fp)) != 16) 66 | break; 67 | 68 | printf ("%05x ", adr); 69 | for (n=0; n<16; n++) 70 | printf ("%02x ", buf[n] & 0xff); 71 | 72 | printf (" +"); 73 | if (!EbcdicDump) 74 | for (n=0; n<16; n++) 75 | printf( "%c",prttable[buf[n]] ); 76 | else 77 | for (n=0; n<16; n++) { 78 | c = prttable[EBCDIC_ASCII[buf[n]]]; 79 | if (!isprint(c)) c = '.'; 80 | printf( "%c",c ); 81 | } 82 | 83 | printf ("+\n"); 84 | adr += 16; 85 | if (HUJI && (EbcdicDump == 0)) { 86 | if (adr > 130 ) EbcdicDump = 1; 87 | } 88 | 89 | } 90 | if ((n > 0) && (n < 16)) { 91 | printf ("%05x ", adr); 92 | for (i=0; i0 8 | 9 | struct Bintree *bintree_open(char *filename, short eltsize, 10 | int (*eltcompare)()); 11 | -- The usual thing.. 12 | 13 | int bintree_close(struct Bintree *BT); 14 | 15 | 16 | -- Feed in the new entry 17 | 18 | int bintree_insert(struct Bintree *BT, void *datum); 19 | 20 | -- Find an entry, and delete it 21 | 22 | int bintree_delete(struct Bintree *BT, void *datum); 23 | 24 | 25 | -- Find an entry, and return pointer to it 26 | 27 | void *bintree_find(struct Bintree *BT, void *datum); 28 | 29 | -- With found pointer, had the data updated, and now 30 | tell the system to update it also on the disk 31 | 32 | int bintree_update(struct Bintree *BT, void *datumptr); 33 | 34 | */ 35 | 36 | #ifndef __BINTREE_H_ 37 | # define __BINTREE_H_ 38 | 39 | #ifndef __ 40 | # ifdef __STDC__ 41 | # define __(x) x 42 | # else 43 | # define __(x) () 44 | # endif 45 | #endif 46 | 47 | struct Bintree { void *dummy; }; 48 | 49 | extern struct Bintree *bintree_open __((const char *filename, const int eltsize, int (*eltcompare)())); 50 | extern int bintree_close __((struct Bintree *BT)); 51 | extern int bintree_insert __((struct Bintree *BT, const void *datum)); 52 | extern int bintree_delete __((struct Bintree *BT, const void *datum)); 53 | extern void *bintree_find __((struct Bintree *BT, const void *datum)); 54 | extern int bintree_update __((struct Bintree *BT, const void *datum)); 55 | 56 | #endif /* __BINTREE_H_ */ 57 | -------------------------------------------------------------------------------- /bitsend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/bitsend -------------------------------------------------------------------------------- /bmail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/bmail -------------------------------------------------------------------------------- /bmail.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Test program.. 4 | 5 | LOGFILE=/usr/tmp/bmail.log 6 | 7 | touch $LOGFILE 8 | echo "---------- bmail ------" >>$LOGFILE 9 | set >>$LOGFILE 10 | echo $* >>$LOGFILE 11 | echo >>$LOGFILE 12 | /usr/local/bin/bmail $* 2>&1 >>$LOGFILE 13 | -------------------------------------------------------------------------------- /clientutils.h: -------------------------------------------------------------------------------- 1 | /* HUJI-NJE Client utilities Header file 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 12-Feb-1991, 1993, 1994 8 | */ 9 | 10 | #ifndef __ 11 | # ifdef __STDC__ 12 | # define __(x) x 13 | # else 14 | # define __(x) () 15 | # define volatile /*K&R has no volatile */ 16 | # define const /*K&R has no const */ 17 | # endif 18 | #endif 19 | 20 | #ifndef CMD_SHUTDOWN_ABRT /* Copied from consts.h */ 21 | /* The command mailbox messages' codes */ 22 | 23 | #define CMD_SHUTDOWN_ABRT 1 /* Shutdown the NJE emulator immediately */ 24 | #define CMD_SHUTDOWN 14 /* Shut down after all lines are idle. */ 25 | #define CMD_SHOW_LINES 2 /* Show lines status */ 26 | #define CMD_QUEUE_FILE 3 /* Add a file to the queue */ 27 | #define CMD_SHOW_QUEUE 4 /* Show the files queued */ 28 | #define CMD_SEND_MESSAGE 5 /* Send NMR message */ 29 | #define CMD_SEND_COMMAND 6 /* Send NMR command */ 30 | #define CMD_START_LINE 7 /* Start an INACTIVE or SIGNOFF line */ 31 | #define CMD_STOP_LINE 8 /* Stop the line after the current file.*/ 32 | #define CMD_START_STREAM 9 /* Start a REFUSED stream */ 33 | #define CMD_FORCE_LINE 11 /* Shut that line immediately. */ 34 | #define CMD_FORCE_STREAM 12 /* Shut this stream immediately */ 35 | #define CMD_DEBUG_DUMP 15 /* DEBUG - Dump all buffers to logfile */ 36 | #define CMD_DEBUG_RESCAN 16 /* DEBUG - Rescan queue diretory 37 | (to be used when manually rerouting 38 | files to another line) */ 39 | #define CMD_LOGLEVEL 17 /* Change log level during run */ 40 | #define CMD_CHANGE_ROUTE 18 /* Change the route in database */ 41 | #define CMD_GONE_ADD 19 /* Register a user in GONE database by YGONE */ 42 | #define CMD_GONE_DEL 20 /* Remove a user from GONE database by YGONE */ 43 | #define CMD_GONE_ADD_UCP 21 /* Register a user in GONE database by UCP */ 44 | #define CMD_GONE_DEL_UCP 22 /* Remove a user from GONE database by UCP */ 45 | #define CMD_MSG_REGISTER 23 /* An MSG-registry command */ 46 | #define CMD_EXIT_RESCAN 24 /* Do a exit-rescan w/o sending SIGHUP */ 47 | #define CMD_ROUTE_RESCAN 25 /* Do a exit-rescan w/o sending SIGHUP */ 48 | 49 | /* The codes that a message can be in */ 50 | #define ASCII 0 51 | #define EBCDIC 1 52 | #define BINARY 2 53 | 54 | /* The file's type (Bitmask) */ 55 | #define F_MAIL 0x0 /* Mail message */ 56 | #define F_FILE 0x0001 /* File - send it in NETDATA format */ 57 | #define F_PUNCH 0x0002 /* File - send it in PUNCH format */ 58 | #define F_PRINT 0x0004 /* File - send it in PRINT format */ 59 | #define F_ASA 0x0008 /* ASA carriage control */ 60 | #define F_JOB 0x0010 /* SYSIN job! */ 61 | #define F_NOQUIET 0x0080 /* Don't use the QUIET form code */ 62 | 63 | /* SRCB types: */ 64 | #define NJH_SRCB 0xC0 /* Job Header */ 65 | #define DSH_SRCB 0xE0 /* Data set header */ 66 | #define NJT_SRCB 0xD0 /* Job trailer */ 67 | #define DSHT_SRCB 0xF0 /* Data set trailer. Not used */ 68 | #define CC_NO_SRCB 0x80 /* No carriage control record */ 69 | #define CC_MAC_SRCB 0x90 /* Machine carriage control record */ 70 | #define CC_ASA_SRCB 0xA0 /* ASA carriage control */ 71 | #define CC_CPDS_SRCB 0xB0 /* CPDS carriage control */ 72 | 73 | #endif /* ---- end of 'copied from consts.h' ---- */ 74 | 75 | extern char *upperstr __((char *str)); 76 | extern char *lowerstr __((char *str)); 77 | extern char *strsave __((char *str)); 78 | extern int send_cmd_msg __((const void *cmdbuf,const int cmdlen, 79 | const int offlineok)); 80 | 81 | extern int LuserUidLevel; 82 | extern int read_configuration __((void)); 83 | extern void read_etable __((void)); 84 | extern void ASCII_TO_EBCDIC __(( const void *InString, void *OutString, const int Size )); 85 | extern void EBCDIC_TO_ASCII __(( const void *InString, void *OutString, const int Size )); 86 | extern void PAD_BLANKS __(( void *String, const int StartPos, const int FinalPos )); 87 | extern int Uwrite __(( FILE *outfil, const void *buf, const int outsize )); 88 | extern int Uread __(( void *buf, const int maxsize, FILE *infil )); 89 | extern int submit_file __(( const char *FileName, const int FileSize )); 90 | extern int parse_header __(( FILE *fd, char *Frm, char *Toa, char *Fnm, 91 | char *Ext,int *Typ, char *Cls, char *For, 92 | int *Fmt, char *Tag, int *Fid )); 93 | extern char *ExpandHomeDir __((const char *PathOrDir, const char *HomeDir, 94 | const char *ToUser, char *path)); 95 | extern void logger __((int lvl, ...)); 96 | extern void trace __(( const void *ptr, const int n, const int lvl )); 97 | extern char *local_time __(( void )); 98 | extern volatile void bug_check __(( const char *text )); 99 | extern char *mcuserid __((char *from )); 100 | -------------------------------------------------------------------------------- /cmd-help.txt: -------------------------------------------------------------------------------- 1 | Commands available for FUNET-NJE emulator: 2 | Help / HILfe / SOS - Three commands to ask for this info 3 | Query SYStem - Show line status summary report, and activity 4 | Query SYStem S - Same as "Q SYS", but with extra activity data 5 | Query STATs - Show line statictics 6 | Query Nodename - Show the route entry to that node 7 | Query linkname A/F - Available via Query SYStem 8 | Query linkname Q - Show 30 first files in queue on the link 9 | CPQuery Names - List all users logged on 10 | CPQuery User - Tell how many users are logged on 11 | CPQuery User username - Look for a specific username 12 | CPQuery LOG - Send the WELCOME message 13 | CPQuery CPU, CPLEVEL, IND, T - Machine type and time 14 | MSG node user text.. - A way to send a NMR to some node via msg relay. 15 | CMD node text.. - A way to send a NMR to some node via cmd relay. 16 | This system has also NMR responding servers at addresses: 17 | ECHO@FINFILES -- throws the NMRs back to you. 18 | MAILSERV@FINFILES -- ask for HELP 19 | FINGER@FINFILES -- Usage: tell finger@finfiles address@internet 20 | -------------------------------------------------------------------------------- /detach.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Detach a daemon process from whoever/whatever started it. 3 | * Mostly lifted from an article in the July/August 1987 ;login:, 4 | * by Dave Lennert (hplabs!hpda!davel). Blame bugs on me. 5 | */ 6 | /* 7 | | [mea@nic.funet.fi] Lifted this from Rayan Zachariassens 8 | | ZMailer support library. Handy. 9 | */ 10 | 11 | #include "prototypes.h" 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #if defined(sun) || defined(BSD) || defined(__svr4__) 18 | #define USE_BSDSETPGRP 19 | #endif 20 | 21 | 22 | 23 | void 24 | detach() 25 | { 26 | /* 27 | * If launched by init (process 1), there's no need to detach. 28 | * 29 | * Note: this test is unreliable due to an unavoidable race 30 | * condition if the process is orphaned. 31 | */ 32 | if (getppid() == 1) 33 | goto out; 34 | /* Ignore terminal stop signals */ 35 | #ifdef SIGTTOU 36 | (void) signal(SIGTTOU, SIG_IGN); 37 | #endif /* SIGTTOU */ 38 | #ifdef SIGTTIN 39 | (void) signal(SIGTTIN, SIG_IGN); 40 | #endif /* SIGTTIN */ 41 | #ifdef SIGTSTP 42 | (void) signal(SIGTSTP, SIG_IGN); 43 | #endif /* SIGTSTP */ 44 | /* 45 | * Allow parent shell to continue. 46 | * Ensure the process is not a process group leader. 47 | */ 48 | if (fork() != 0) 49 | exit(0); /* parent */ 50 | /* child */ 51 | /* 52 | * Disassociate from controlling terminal and process group. 53 | * 54 | * Ensure the process can't reacquire a new controlling terminal. 55 | * This is done differently on BSD vs. AT&T: 56 | * 57 | * BSD won't assign a new controlling terminal 58 | * because process group is non-zero. 59 | * 60 | * AT&T won't assign a new controlling terminal 61 | * because process is not a process group leader. 62 | * (Must not do a subsequent setpgrp()!) 63 | */ 64 | #ifdef _POSIX_SOURCE 65 | (void) setsid(); 66 | { 67 | int fd; /* file descriptor */ 68 | 69 | if ((fd = open("/dev/tty", O_RDWR, 0)) >= 0) { 70 | ioctl(fd, TIOCNOTTY, 0); /* lose controlling terminal */ 71 | close(fd); 72 | } 73 | } 74 | #else /* !_POSIX_SOURCE */ 75 | #ifdef USE_BSDSETPGRP 76 | #if defined(__svr4__) || defined(__DARWIN_UNIX03) 77 | setpgrp(); 78 | #else /* not __svr4__ */ 79 | (void) setpgrp(0, getpid()); /* change process group */ 80 | { 81 | int fd; /* file descriptor */ 82 | 83 | if ((fd = open("/dev/tty", O_RDWR, 0)) >= 0) { 84 | ioctl(fd, TIOCNOTTY, 0); /* lose controlling terminal */ 85 | close(fd); 86 | } 87 | } 88 | #endif /* not __svr4__ */ 89 | #else /* !USE_BSDSETPGRP */ 90 | /* lose controlling terminal and change process group */ 91 | setpgrp(); 92 | signal(SIGHUP, SIG_IGN); /* immunge from pgrp leader death */ 93 | if (fork() != 0) /* become non-pgrp-leader */ 94 | exit(0); /* first child */ 95 | /* second child */ 96 | #endif /* USE_BSDSETPGRP */ 97 | #endif /* !_POSIX_SOURCE */ 98 | 99 | out: 100 | (void) close(0); 101 | (void) close(1); 102 | (void) close(2); 103 | (void) umask(022); /* clear any inherited file mode creation mask */ 104 | 105 | /* Clean out our environment from personal contamination */ 106 | /* cleanenv(); */ 107 | 108 | #if defined(USE_RLIMIT) || defined(sun) || defined(__svr4__) 109 | /* In case this place runs with cpu limits, remove them */ 110 | { 111 | struct rlimit rl; 112 | rl.rlim_cur = RLIM_INFINITY; 113 | rl.rlim_max = RLIM_INFINITY; 114 | setrlimit(RLIMIT_CPU, &rl); 115 | } 116 | #endif /* USE_RLIMIT */ 117 | return; 118 | } 119 | 120 | 121 | #ifdef USE_NOFILE 122 | #ifndef NOFILE 123 | #define NOFILE 20 124 | #endif /* NOFILE */ 125 | 126 | int 127 | getdtablesize() 128 | { 129 | return NOFILE; 130 | } 131 | 132 | #endif /* USE_NOFILE */ 133 | -------------------------------------------------------------------------------- /ebcdicinv.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ASCII_EBCDIC table verify & interter -- tool 3 | */ 4 | 5 | #include 6 | #define MAIN 7 | #include "ebcdic.h" 8 | 9 | 10 | int 11 | main(argc,argv) 12 | int argc; 13 | char *argv[]; 14 | { 15 | int i, c; 16 | for (i=0; i < 256; ++i) 17 | EBCDIC_ASCII[i] = 0; 18 | 19 | for (i=0; i < 256; ++i) { 20 | c = ASCII_EBCDIC[i]; 21 | if (EBCDIC_ASCII[c] != 0) { 22 | printf("Duplicate map: A=%03o->E=%03o & A=%03o->E=%03o\n", 23 | i,c,EBCDIC_ASCII[c],c); 24 | } 25 | EBCDIC_ASCII[c] = i; 26 | } 27 | 28 | for (i=0; i < 256; ) { 29 | printf("\t"); 30 | for (c = 0; c < 8; ++c) 31 | printf("0x%02x, ",EBCDIC_ASCII[i+c]); 32 | printf("\t\t/* %03o .. %03o */\n",i,i+7); 33 | i += 8; 34 | } 35 | for (i=1; i<256; ++i) 36 | if (EBCDIC_ASCII[i] == 0) 37 | printf("Inversion failure - EBCDIC-code 0x%02x not listed on ASCII->EBCDIC table\n",i); 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /etbwrite.c: -------------------------------------------------------------------------------- 1 | /* etbwriter -- FUNET-NJE 3.0 2 | -- quick hack to write to a file the current ASCII-EBCDIC tables 3 | 4 | Copyright (C) :-) Finnish University and Research Network, FUNET 5 | */ 6 | 7 | #include 8 | #define MAIN -1 9 | #include "ebcdic.h" 10 | 11 | main() 12 | { 13 | fprintf(stdout,"ASC<=>EBC\n"); 14 | fwrite(ASCII_EBCDIC,1,256,stdout); 15 | fwrite(EBCDIC_ASCII,1,256,stdout); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /etbwrite2.c: -------------------------------------------------------------------------------- 1 | /* etbwriter2 -- FUNET-NJE 3.0 2 | -- quick hack to write the current ASCII-EBCDIC tables into nroff 3 | format for making man-pages.. 4 | 5 | Copyright (C) :-) Finnish University and Research Network, FUNET 6 | */ 7 | 8 | #include 9 | #define MAIN -1 10 | #include "ebcdic.h" 11 | 12 | main() 13 | { 14 | int i; 15 | 16 | for (i=0; i<256; ++i) { 17 | if ((i % 8) == 0) printf("\\f4 0x%02X |",i); 18 | printf("0x%02X|",ASCII_EBCDIC[i]); 19 | if ((i % 8) == 7) printf("\n"); 20 | } 21 | for (i=0; i<256; ++i) { 22 | if ((i % 8) == 0) printf("\\f4 0x%02X |",i); 23 | printf("0x%02X|",EBCDIC_ASCII[i]); 24 | if ((i % 8) == 7) printf("\n"); 25 | } 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /file-exit.cf: -------------------------------------------------------------------------------- 1 | # FILE-EXIT.CF -- Configure file handling on FUNET-NJE 2 | # 3 | # Rule for spool disposition path, defines also system default 4 | # user spool directory for those who don't have specially set 5 | # something else. 6 | # Possibilities: ~/bitspool -- real user's only! (~/ == users home) 7 | # /usr/path/path/ -- append 'touser' as subdir, 8 | # it is spool dir. 9 | # Valid for Exits and real users. 10 | # /usr/path/path -- explicite directory. 11 | # /dev/null -- explicite file (special case). 12 | # When directory isn't present, it is built from upmost present level 13 | # down to users bottommost level hmm... 14 | # Question about ownership of directory/files... 15 | # Real users: real protections, programs start with setuid() user. 16 | # Exit users: POSTMAST (exits start as root anyway.) 17 | # Exited reals: real protections, programs start with setuid() user. 18 | 19 | Spool-Dir: /usr/spool/bitspool/ 20 | Postmast-Dir: /usr/spool/bitspool/POSTMAST 21 | 22 | # Now list of things to match and then what to do 23 | # To do keywords: DISCARD to /dev/null. 24 | # KEEP just so. Into default or given spool. 25 | # NOTIFY send an NJE message to someone. 26 | # RUN starts arbitary program with arbitary 27 | # arguments telling about file location 28 | # and its properties. 29 | # If fails, well.. 30 | 31 | # Defining SpoolDir which shall not be attached ToUser must not be done 32 | # with trailing "/", (and vice versa) 33 | # /usr/spool/bitnet/SYSIN-JOB 34 | 35 | # Exit table begin keyword: 36 | Exit-Table: 37 | 38 | # Args: 39 | # touser8 tonode8 fname8 ftype8 pun? class fruser8 frnode8 dist8 SpoolDir action ExtraArguments 40 | # 41 | # Several special handlings (tests/illustriations) 42 | # 43 | #MEA FINFILES * * * * HKS SEARN * default DISCARD 44 | NOBODY FINFILES * * * * * * * default DISCARD 45 | FOOBAT FINFILES * * * * * * * default RUN /usr/local/lib/huji/transfer MEA@$TONODE $SPOOL 46 | ECHO FINFILES * * * * * * * default RUN /usr/local/lib/huji/transfer NOBODY@$FRNODE $SPOOL 47 | #LPR FINFILES * * * * * * * default RUN /usr/local/lib/huji/rprint $SPOOL lpr $FRUSER $FRNODE $TOUSER $FID 48 | # 49 | # Define what we do with the SYSINs 50 | # 51 | . * * * SYSIN * * * * /usr/spool/bitnet/SYSIN-JOB RUN /usr/local/lib/huji/sysin $SPOOL 52 | # 53 | # Define a MAILER for our node! 54 | # And also handle directly sent mail from nodes without mailers... 55 | # 56 | MAILER FINFILES * * PUN M * * * default RUN /usr/local/lib/huji/mailify $SPOOL 57 | * * * MAIL PUN M * * * default RUN /usr/local/lib/huji/mailify $SPOOL 58 | # 59 | # NETINIT is pseudo id for automatically re-generating routing tables 60 | # This is done with netinit.sh which must be configured by hand. 61 | # 62 | NETINIT FINFILES * * * * * * * default KEEP 63 | # 64 | # Finally a `catch them all' default handling case. 65 | # 66 | * * * * * * * * * default KEEP 67 | -------------------------------------------------------------------------------- /finfiles.cf: -------------------------------------------------------------------------------- 1 | * 2 | * Configuration file for HUJI-NJE program 3 | * 4 | 5 | NAME FINFILES 6 | ALIAS HAMSTER 7 | *IPADDRESS nic.funet.fi 8 | IPADDRESS 128.214.248.6 9 | QUEUE /usr/spool/bitnet 10 | *CMDMAILBOX F /usr/spool/bitnet/.cmdfifo 11 | *CMDMAILBOX S /usr/spool/bitnet/.cmdsocket 12 | CMDMAILBOX U 127.0.0.1 175 13 | LOG /usr/adm/bitnet.log 14 | RSCSACCT /usr/adm/bitnet.acct 15 | * this table is a binary file. 16 | TABLE /l/funetnje/finfiles.routes 17 | INFORM MEA@FINFILES 18 | FILEEXITS /l/funetnje/file-exit.cf 19 | MSGEXITS /l/funetnje/msg-exit.cf 20 | DEFFORM STANDARD 21 | LLEVEL 2 22 | *DEFAULT-ROUTE FINHUTC 23 | *DEFAULT-ROUTE FIGBOX 24 | 25 | LINE 0 FIPORT 26 | TYPE UNIX_TCP 27 | BUFSIZE 4096 28 | TIMEOUT 3 29 | IPPORT 500 30 | * TCPNAME fiport.funet.fi 31 | TCPNAME 128.214.109.150 32 | TCP-SIZE 8192 33 | MAX-STREAMS 7 34 | 35 | LINE 1 ALIJKU65 36 | TYPE UNIX_TCP 37 | BUFSIZE 1024 38 | TIMEOUT 3 39 | IPPORT 175 40 | *TCPNAME alijku65.edvz.uni-linz.ac.at 41 | TCPNAME 140.78.4.34 42 | * TCP-SIZE 8192 43 | TCP-SIZE 3100 44 | SLOW-INTERLEAVE 45 | MAX-STREAMS 7 46 | 47 | LINE 2 ALIJKU64 48 | TYPE UNIX_TCP 49 | BUFSIZE 1024 50 | TIMEOUT 3 51 | IPPORT 175 52 | *TCPNAME alijku64.edvz.uni-linz.ac.at 53 | TCPNAME 140.78.3.22 54 | TCP-SIZE 8192 55 | MAX-STREAMS 7 56 | 57 | LINE 3 FINHUTC 58 | TYPE UNIX_TCP 59 | BUFSIZE 1024 60 | TIMEOUT 3 61 | IPPORT 175 62 | *TCPNAME finhutc.hut.fi 63 | TCPNAME 130.233.224.4 64 | TCP-SIZE 8192 65 | SLOW-INTERLEAVE 66 | MAX-STREAMS 7 67 | 68 | LINE 4 MEA 69 | TYPE UNIX_TCP 70 | BUFSIZE 8192 71 | TIMEOUT 3 72 | IPPORT 175 73 | TCPNAME 130.232.1.11 74 | TCP-SIZE 8192 75 | MAX-STREAMS 7 76 | 77 | *LINE 5 FINFAN 78 | * TYPE UNIX_TCP 79 | * BUFSIZE 8192 80 | * TIMEOUT 3 81 | * IPPORT 175 82 | * TCPNAME convex.csc.fi 83 | * TCP-SIZE 8192 84 | * MAX-STREAMS 7 85 | * 86 | *LINE 6 FINUTU 87 | * TYPE UNIX_TCP 88 | * BUFSIZE 1024 89 | * TIMEOUT 3 90 | * IPPORT 175 91 | ** TCPNAME castor.utu.fi 92 | * TCPNAME 130.232.1.14 93 | * TCP-SIZE 8192 94 | * MAX-STREAMS 7 95 | * 96 | * LINE 7 OJ287 97 | * TYPE UNIX_TCP 98 | * BUFSIZE 1024 99 | * TIMEOUT 3 100 | * IPPORT 175 101 | * TCPNAME oj287.astro.utu.fi 102 | * TCP-SIZE 8192 103 | * MAX-STREAMS 7 104 | -------------------------------------------------------------------------------- /finfiles.header: -------------------------------------------------------------------------------- 1 | * 2 | * Header of FUNET-NJE/HUyNJE package routing table 3 | * 4 | * Generic format: 5 | * SITE LINE FORMAT 6 | * 7 | * ROUTE FINFILES LOCAL ASCII 8 | * ROUTE HAMSTER LOCAL ASCII 9 | * ROUTE FINFTP LOCAL ASCII 10 | * ROUTE FINUTU FINUTU EBCDIC 11 | * ROUTE ALIJKU65 ALIJKU65 EBCDIC 12 | * ROUTE ALIJKU64 ALIJKU65 EBCDIC 13 | * ROUTE FINHUTC FINHUTC EBCDIC 14 | ROUTE YAGI LOCAL ASCII 15 | ROUTE DRBVM3 DRBVM3 EBCDIC 16 | -------------------------------------------------------------------------------- /finfiles.netinit: -------------------------------------------------------------------------------- 1 | ROUTE VERS1305 YAGI EARN NL 2 | -------------------------------------------------------------------------------- /finutu.cf: -------------------------------------------------------------------------------- 1 | * 2 | * Configuration file for FUNET-NJE program 3 | * 4 | 5 | NAME FINUTU 6 | *ALIAS HAMSTER 7 | *IPADDRESS nic.funet.fi 8 | IPADDRESS 130.232.1.14 9 | QUEUE /usr/spool/bitnet 10 | CMDMAILBOX /usr/spool/bitnet/.cmdpipe 11 | LOG /usr/adm/bitnet.log 12 | * this table is DBM/GDBM binary file. 13 | TABLE /usr/local/huji/huji_nje.route 14 | INFORM MEA@FINUTU 15 | USEREXITS /usr/local/huji/file-exit.cf 16 | MSGEXITS /usr/local/huji/msg-exit.cf 17 | LLEVEL 2 18 | *DEFAULT-ROUTE FIGBOX 19 | 20 | LINE 2 FIGBOX 21 | TYPE UNIX_TCP 22 | BUFSIZE 1024 23 | TIMEOUT 3 24 | IPPORT 502 25 | * TCPNAME figbox.funet.fi 26 | TCPNAME 128.214.6.7 27 | TCP-SIZE 8192 28 | MAX-STREAMS 7 29 | 30 | LINE 2 FINFILES 31 | TYPE UNIX_TCP 32 | BUFSIZE 1024 33 | TIMEOUT 3 34 | IPPORT 175 35 | * TCPNAME nic.funet.fi 36 | TCPNAME 128.214.6.100 37 | TCP-SIZE 8192 38 | MAX-STREAMS 7 39 | 40 | * REAL line 2.. 41 | 42 | LINE 2 ALIJKU65 43 | TYPE UNIX_TCP 44 | BUFSIZE 400 45 | TIMEOUT 3 46 | IPPORT 175 47 | * TCPNAME alijku65.edvz.uni-linz.ac.at 48 | TCPNAME 140.78.3.34 49 | TCP-SIZE 500 50 | MAX-STREAMS 7 51 | -------------------------------------------------------------------------------- /funetnje: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/funetnje -------------------------------------------------------------------------------- /funetnje_linux_32-bit_bin.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/funetnje_linux_32-bit_bin.tgz -------------------------------------------------------------------------------- /funetnje_linux_32-bit_source.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/funetnje_linux_32-bit_source.tgz -------------------------------------------------------------------------------- /headers.c: -------------------------------------------------------------------------------- 1 | /* HEADERS.C V1.6-mea 2 | | Copyright (c) 1988,1989,1990,1991,1992,1993 by 3 | | The Hebrew University of Jerusalem, Computation Center. 4 | | 5 | | This software is distributed under a license from the Hebrew University 6 | | of Jerusalem. It may be copied only under the terms listed in the license 7 | | agreement. This copyright message should never be changed or removed. 8 | | This software is gievn without any warranty, and the Hebrew University 9 | | of Jerusalem assumes no responsibility for any damage that might be caused 10 | | by use or misuse of this software. 11 | | 12 | | All the headers and fixed transmission blocks used by NJE. 13 | | The structure fields are defined in HEADERS.H 14 | | Currently, all records, lines, etc counts are intialized to the default. 15 | | Currently, the program supports only NJH, DSH & NJT control records. 16 | | WARNING: The headers contain uninitialized fields. These fields are 17 | | marked with M in front of the lines. The various routines change 18 | | these fields inside the skeleton structure (to reduce run time). 19 | | Hence, each routine MUST initialize these values. 20 | */ 21 | #include "consts.h" 22 | #include "headers.h" 23 | #include "prototypes.h" 24 | 25 | /* The Enquiry block */ 26 | INTERNAL struct ENQUIRE Enquire = { SOH, ENQ, PAD }; 27 | 28 | /* The negative ACK block */ 29 | INTERNAL struct NEGATIVE_ACK NegativeAck = { NAK, PAD }; 30 | 31 | /* The positive ACK */ 32 | INTERNAL struct POSITIVE_ACK PositiveAck = { DLE, ACK0, PAD }; 33 | 34 | /* The signoff record */ 35 | INTERNAL struct SIGN_OFF SignOff = { 0xf0, E_B, PAD }; 36 | 37 | /* The end of block record */ 38 | /* struct EOF_BLOCK EOFblock = { SYSOUT_0, CC_NO_SRCB, 0, 0 }; */ 39 | INTERNAL struct EOF_BLOCK EOFblock = { SYSOUT_0, CC_NO_SRCB, 0, 0 }; 40 | 41 | /* File xmit permission/rejection: */ 42 | INTERNAL struct PERMIT_FILE PermitFile = { PERMIT_RCB, SYSOUT_0, 0, 0}; 43 | INTERNAL struct REJECT_FILE RejectFile = { CANCEL_RCB, SYSOUT_0, 0, 0}; 44 | INTERNAL struct COMPLETE_FILE CompleteFile = { COMPLETE_RCB, SYSOUT_0, 0, 0}; 45 | 46 | /* The job header */ 47 | INTERNAL struct JOB_HEADER NetworkJobHeader = { 48 | 0, 49 | 0, 0, 50 | 0, 51 | 0, 0, 52 | 0, /* Job ID */ 53 | E_A, /* Job class */ 54 | E_A, /* Message class */ 55 | 0, /* Flag */ 56 | 7, /* Priority */ 57 | 1, /* Origin system qualifier */ 58 | 1, /* Job copies */ 59 | 0, /* Lines per page (default) */ 60 | 0,0,0, /* Reserved */ 61 | "", "", "", "", "", 62 | {0,0}, /* Time */ 63 | "", "", "", "", "", 64 | "", "", "", "", 65 | 0, 0, 0, 0, /* lines, records, etc */ 66 | "", "", "", "", 67 | 0 /* Records count */ 68 | }; 69 | 70 | /* The dataset header */ 71 | INTERNAL struct DATASET_HEADER NetworkDatasetHeader = { 72 | 0, 73 | 0, 0, 74 | { 75 | /* General section */ 76 | 0, 77 | 0, 0, 78 | "", "", "", "", "", 79 | 1, 0, 80 | E_A, /* Class (A =files, M = Mail */ 81 | 0, 0, 82 | 0x80, /* Record format */ 83 | 0, 84 | 1, /* NDHGDSCT */ 85 | 0, 0, 86 | 0, /* Reserved */ 87 | "", "", "", "", 88 | "", /* Reserved */ 89 | 0x40, 0, "", 90 | "" 91 | }, { 92 | /* RSCS section */ 93 | 0, 94 | 0x87, 0, 95 | /* M */ 0, E_A, /* Job class */ 96 | /* M */ 0x82, /* CP device type */ 97 | 0, 98 | /* M */ "", "", "", 99 | 0, 100 | RSCS_VERSION, RSCS_RELEASE, 101 | "" 102 | } 103 | }; 104 | 105 | /* The job trailer */ 106 | INTERNAL struct JOB_TRAILER NetworkJobTrailer = { 107 | 0, 108 | 0, 0, 109 | 0, 110 | 0, 0, 111 | 0, E_A, { 0,0 }, 112 | { 0,0 }, { 0,0 }, 0, 113 | 0, /* Number of lines */ 114 | 0, /* Number of crads */ 115 | 0, 116 | 0, 0, 0, 0 117 | } ; 118 | 119 | /* The initial signon record */ 120 | INTERNAL struct SIGNON InitialSignon = { 121 | 0xf0, /* RCB */ 122 | E_I, /* SRCB */ 123 | 0x25, 124 | "", /* Node name */ 125 | 1, 126 | 0, 0, 127 | 0, /* Buffer size */ 128 | "", "", /* Passwrods */ 129 | 0, 0 /* Features are none... */ 130 | }; 131 | 132 | 133 | /* The response signon record */ 134 | INTERNAL struct SIGNON ResponseSignon = { 135 | 0xf0, /* RCB */ 136 | E_J, /* SRCB */ 137 | 0x25, 138 | "", /* Node name */ 139 | 0x1, 140 | 0xffffffff, 0, 141 | 0, /* Buffer size */ 142 | "", "", /* Passwrods */ 143 | 0 144 | }; 145 | 146 | void 147 | init_headers() 148 | { 149 | NetworkJobHeader.LENGTH = htons(sizeof(struct JOB_HEADER)); 150 | NetworkJobHeader.LENGTH_4 = htons(sizeof(struct JOB_HEADER) - 4); 151 | NetworkJobTrailer.LENGTH = htons(sizeof(struct JOB_TRAILER)); 152 | NetworkJobTrailer.LENGTH_4 = htons(sizeof(struct JOB_TRAILER) - 4); 153 | } 154 | -------------------------------------------------------------------------------- /libasc2ebc.c: -------------------------------------------------------------------------------- 1 | /* FUNET-NJE/HUJI-NJE Client utilities 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 12-Feb-1991, 26-Sep-1993 8 | */ 9 | 10 | 11 | #include 12 | #include "clientutils.h" 13 | #include "ebcdic.h" 14 | 15 | extern int EtblAltered; 16 | 17 | void 18 | ASCII_TO_EBCDIC(INSTRING, OUTSTRING, LENGTH) 19 | const void *INSTRING; 20 | void *OUTSTRING; 21 | const int LENGTH; 22 | { 23 | int TempVar; 24 | unsigned char *op = OUTSTRING; 25 | const unsigned char *ip = INSTRING; 26 | 27 | if (!EtblAltered) read_etable(); 28 | 29 | 30 | for (TempVar = 0; TempVar < LENGTH; TempVar++) 31 | op[TempVar] = ASCII_EBCDIC[ ip[TempVar] ]; 32 | } 33 | -------------------------------------------------------------------------------- /libdondata.c: -------------------------------------------------------------------------------- 1 | /* FUNET-NJE/HUJI-NJE Client utilities 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 12-Feb-1991, 26-Sep-1993 8 | */ 9 | 10 | 11 | #include 12 | #include "prototypes.h" 13 | #include "clientutils.h" 14 | #include "ndlib.h" 15 | 16 | int 17 | do_netdata(infile, PUNCH, From, To, fname, ftype, lrecl, recfm, binary, askack) 18 | FILE *infile; 19 | struct puncher *PUNCH; 20 | char *From, *To, *fname, *ftype, *askack; 21 | int lrecl, recfm, binary; 22 | { 23 | char *linebuf = malloc(lrecl+8); 24 | int inputsize = 0; 25 | 26 | /* ================ Make INMR headers ================ */ 27 | 28 | if (!fill_inmr01(PUNCH, infile, From, To, 29 | fname, ftype, lrecl, recfm, askack)) 30 | return 0; 31 | 32 | /* ================ While there is input.. ================ */ 33 | 34 | while (!feof(infile) && !ferror(infile)) { 35 | 36 | /* ================ Collect one datarecord ================ */ 37 | 38 | if (binary) { 39 | if ((inputsize = fread(linebuf+2,1,lrecl,infile)) == 0) 40 | break; /* Read until EOF */ 41 | } else { 42 | if (!fgets(linebuf+2,lrecl,infile)) break; /* Read until EOF */ 43 | inputsize = strlen(linebuf+2); 44 | if (inputsize) /* ASCII: Zap trailing newline.. */ 45 | if (linebuf[inputsize-1+2] == '\n') 46 | --inputsize; 47 | linebuf[inputsize+2] = ' '; 48 | if (inputsize == 0) { /* Must have at least one byte! */ 49 | inputsize = 1; 50 | linebuf[0+2] = ' '; 51 | } 52 | ASCII_TO_EBCDIC(linebuf+2,linebuf+2,inputsize); 53 | } 54 | 55 | /* ================ Output that record ================ */ 56 | 57 | if (!punch_nddata(PUNCH,linebuf,inputsize)) 58 | return 0; 59 | 60 | } 61 | 62 | /* ================ Data done, EOF record ================ */ 63 | 64 | if (!fill_inmr06(PUNCH)) return 0; 65 | 66 | free(linebuf); 67 | return 1; /* Punched it ok. */ 68 | } 69 | -------------------------------------------------------------------------------- /libebc2asc.c: -------------------------------------------------------------------------------- 1 | /* FUNET-NJE/HUJI-NJE Client utilities 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 12-Feb-1991, 26-Sep-1993 8 | */ 9 | 10 | 11 | #include 12 | #include "clientutils.h" 13 | #include "ebcdic.h" 14 | 15 | extern int EtblAltered; 16 | 17 | void 18 | EBCDIC_TO_ASCII(INSTRING, OUTSTRING, LENGTH) 19 | const void *INSTRING; 20 | void *OUTSTRING; 21 | const int LENGTH; 22 | { 23 | int TempVar; 24 | unsigned char *op = OUTSTRING; 25 | const unsigned char *ip = INSTRING; 26 | 27 | if (!EtblAltered) read_etable(); 28 | 29 | for(TempVar = 0; TempVar < LENGTH; TempVar++) 30 | op[TempVar] = EBCDIC_ASCII[ ip[TempVar] ]; 31 | } 32 | -------------------------------------------------------------------------------- /libetbl.c: -------------------------------------------------------------------------------- 1 | /* FUNET-NJE Client utilities 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 12-Feb-1991, 26-Sep-1993 8 | */ 9 | 10 | #include "prototypes.h" 11 | 12 | # define MAIN -1 /* We compile EBCDIC tables inline */ 13 | #include "ebcdic.h" 14 | 15 | extern char DefaultEBCDICTBL[]; 16 | 17 | int EtblAltered = 0; 18 | 19 | void 20 | read_etable() 21 | { 22 | char *etablep; 23 | int fd; 24 | unsigned char ebuf[8+512+10]; 25 | int rc; 26 | char *ecvar = "Environment"; 27 | 28 | if (EtblAltered) return; 29 | EtblAltered = 1; 30 | 31 | /* If environment says there is a table, try to read it in.. */ 32 | if (!(etablep = getenv("EBCDICTBL"))) { 33 | if (*DefaultEBCDICTBL == 0) 34 | return; 35 | etablep = DefaultEBCDICTBL; 36 | ecvar = "Configuration"; 37 | } 38 | 39 | fd = open(etablep,O_RDONLY,0); 40 | if (fd < 0) { 41 | fprintf(stderr,"LIBETBL: %s variable EBCDICTBL defined, but its value `%s' can't be opened as a file.\n",ecvar,etablep); 42 | return; 43 | } 44 | rc = read(fd,ebuf,sizeof(ebuf)); 45 | close(fd); 46 | if (rc != 522 || 47 | memcmp("ASC<=>EBC\n",ebuf,10) != 0) { 48 | fprintf(stderr,"LIBETBL: %s variable EBCDICTBL defined, but file pointed by it is not of proper format.\n",ecvar); 49 | return; 50 | } 51 | memcpy(ASCII_EBCDIC,ebuf+10, 256); 52 | memcpy(EBCDIC_ASCII,ebuf+10+256,256); 53 | } 54 | -------------------------------------------------------------------------------- /libexpnhome.c: -------------------------------------------------------------------------------- 1 | /* FUNET-NJE Client utilities 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 12-Feb-1991, 26-Sep-1993 8 | */ 9 | 10 | 11 | #include "prototypes.h" 12 | #include "clientutils.h" 13 | 14 | #include 15 | #include 16 | 17 | /* ExpandHomeDir() -- taken from unix_files.c -- by */ 18 | 19 | extern char DefaultSpoolDir[256]; 20 | 21 | char * 22 | ExpandHomeDir( PathOrDir,HomeDir,ToUser,path ) 23 | const char *PathOrDir,*HomeDir,*ToUser; 24 | char *path; 25 | { 26 | struct stat fstats; 27 | int plen; 28 | struct passwd *passwds; 29 | 30 | char *s; 31 | char path2[512],path3[512]; 32 | 33 | if (strcmp(PathOrDir,"default")==0 || *PathOrDir == 0) { 34 | PathOrDir = DefaultSpoolDir; 35 | } 36 | 37 | if (*PathOrDir == '~') { 38 | if (PathOrDir[1] != '/') { 39 | /* Uh.. ~/ would have been easy... */ 40 | strcpy( path2,PathOrDir+1 ); 41 | if ((s = strchr(path2,'/'))) *s = 0; 42 | if ((passwds = getpwnam( path2 ))) { 43 | strcpy( path,passwds->pw_dir ); 44 | *s = '/'; 45 | strcat( path,s ); 46 | } else { 47 | return NULL; 48 | /* Uhh... Wasn't real user... */ 49 | } 50 | } else { /* ~/... */ 51 | strcpy( path3,PathOrDir ); /* Now that our 'home' isn't blank... */ 52 | strcpy( path,HomeDir ); 53 | strcat( path,path3+1 ); 54 | } 55 | } else 56 | if (path != PathOrDir) 57 | strcpy( path,PathOrDir ); /* Jeeks, they may be different ones */ 58 | 59 | plen = strlen(path); 60 | s = path + plen - 1; 61 | 62 | /* A '/' terminating dir path ? */ 63 | if ((plen > 0) && (*s != '/') ) { 64 | if (stat(path,&fstats) == 0) { /* Ok, file does exist */ 65 | if ((fstats.st_mode & S_IFMT) == S_IFDIR) { /* Ok, directory */ 66 | *++s = '/'; 67 | *s = 0; 68 | plen += 1; /* Then fall to create unique fileid. */ 69 | } else { /* Not directory, but exists */ 70 | return path; 71 | } 72 | } else { /* Ok, file does not exist */ 73 | if (errno != ENOENT) { 74 | /* XXX: stating failed, and not because nonexistent file. 75 | This calls for stronger measures, or nice fault ? 76 | Invent something ! */ 77 | return NULL; 78 | } 79 | } 80 | } else { /* A '/' -terminated path. */ 81 | strcat( path,ToUser ); 82 | strcat( path,"/" ); 83 | } 84 | return path; 85 | } 86 | -------------------------------------------------------------------------------- /libhdrtbx.c: -------------------------------------------------------------------------------- 1 | /* FUNET-NJE Client utilities 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 12-Feb-1991, 26-Sep-1993 8 | */ 9 | 10 | 11 | #include "prototypes.h" 12 | #include "clientutils.h" 13 | 14 | extern char LOCAL_NAME[]; 15 | 16 | /*----------------------------------------------------------------------* 17 | | Header_Toolbox Reads FUNET-NJE spool header and analyzes it. | 18 | | | 19 | | By Matti Aarnio | 20 | *----------------------------------------------------------------------*/ 21 | 22 | /* 0 == ok, !0 == error somewhere */ 23 | int 24 | parse_header( fd,Frm,Toa,Fnm,Ext,Typ,Cls,For,Fmt,Tag,Fid ) 25 | FILE *fd; /* 'fopen()'ed file for reading. In begin of file 26 | When returning, fd points to begin of file data. */ 27 | /* Rest are for returning values */ 28 | char *Frm, *Toa, *Fnm, *Ext, *Cls, *For, *Tag; 29 | int *Typ, *Fid, *Fmt; 30 | { 31 | char buf[1024]; /* Total ASCII header space reservation.. */ 32 | register char *p,*q; 33 | int i; 34 | long filepos; 35 | 36 | /* First, zero out all fields! */ 37 | *Frm = 0; *Toa = 0; *Fnm = 0; *Ext = 0; 38 | *Cls = 0; *For = 0; *Tag = 0; 39 | /* From, To, FileName, FileExt, Class, Form */ 40 | *Typ = 0xFF; *Fid = -1; *Fmt = -1; 41 | 42 | for(;;) { 43 | filepos = ftell(fd); 44 | if( fgets(buf, sizeof buf, fd) == NULL ) return 1; /* Error! */ 45 | /* Sudden EOF, illegal state here! */ 46 | 47 | if((p = strchr(buf,'\n')) != NULL ) *p = 0; /* Zap \n */ 48 | p = &buf[4]; /* First char after space */ 49 | if (*p == ' ') ++p; 50 | /* Skip over leading spaces (and I saw null filename which was 51 | 2-3 spaces and causes RSCS to refuse the file... */ 52 | while(*p && *p == ' ') ++p; 53 | /* And hunt over next token, until find first space or NULL */ 54 | /* Some data fields have fixed SPACE padded size - to help to 55 | rewrite them on reroute. This parser must drop off those 56 | spaces when analysing... */ 57 | q = buf + strlen(buf) -1; 58 | while(q > p && (*q == ' ')) --q; 59 | if (++q > p && *q == ' ') *q = 0; /* Stomp it! */ 60 | 61 | if (strncmp("FRM:",buf,4)==0) { 62 | if((strlen(p) >= 20) || (*p == '\0')) 63 | sprintf(Toa, "MAILER@%s",LOCAL_NAME); 64 | else 65 | strcpy(Frm, p); 66 | } else if (strncmp("TOA: ",buf,5)==0) { 67 | strcpy(Toa,p); 68 | } else if (strncmp("FNM:",buf,4)==0) { 69 | if(*p != '\0') { 70 | p[12] = '\0'; /* Delimit length */ 71 | strcpy(Fnm, p); 72 | } 73 | } else if (strncmp("EXT:",buf,4)==0) { 74 | if(*p != '\0') { 75 | p[12] = '\0'; /* Delimit length */ 76 | strcpy(Ext, p); 77 | } 78 | } else if (strncmp("TYP:",buf,4)==0) { 79 | if (strcasecmp(p, "JOB") == 0) { 80 | *Typ = F_JOB; 81 | } else if ((strcasecmp(p, "MAIL") == 0) || 82 | (strcasecmp(p, "BSMTP") == 0)) { 83 | *Typ = F_MAIL; 84 | *Cls = 'M'; /* M class */ 85 | } else { /* It is a file - parse the format */ 86 | *Cls = 'A'; /* A class */ 87 | if (strcasecmp(p, "PRINT") == 0) 88 | *Typ = F_PRINT; 89 | else if (strcasecmp(p, "PUNCH") == 0) 90 | *Typ = F_PUNCH; 91 | else if (strcasecmp(p, "PASA") == 0) 92 | *Typ = F_ASA | F_PRINT; 93 | else if (strcasecmp(p, "FASA") == 0) 94 | *Typ = F_ASA; 95 | else 96 | *Typ = F_FILE; /* Default */ 97 | } 98 | } else if (strncmp("CLS:",buf,4)==0) { 99 | *Cls = *p; 100 | } else if (strncmp("FOR:",buf,4)==0) { 101 | p[8] = '\0'; 102 | strcpy(For, p); 103 | if( strncmp("QU",p,2) != 0 ) 104 | *Typ |= F_NOQUIET; 105 | else 106 | *Typ &= ~F_NOQUIET; 107 | } else if (strncmp("FMT:",buf,4)==0) { 108 | if(strcmp(p,"BINARY")==0) 109 | *Fmt = BINARY; 110 | else 111 | *Fmt = EBCDIC; /* DEFAULT */ 112 | } else if (strncmp("FID:",buf,4)==0) { 113 | i = atoi(p); 114 | if((i > 0) && (i <= 9900)) /* Inside the range */ 115 | *Fid = (short)(i); 116 | } else if (strncmp("OID:",buf,4)==0) { 117 | /* Internal for transport.. */ 118 | } else if (strncmp("DIS:",buf,4)==0) { 119 | /* Well, nothing.. RSCS DIST */ 120 | } else if (strncmp("JNM:",buf,4)==0) { 121 | /* Well, nothing.. NJH JOBNAME */ 122 | } else if (strncmp("PUN:",buf,4)==0) { 123 | /* Well, nothing.. NJH PUNCH -- for SYSIN especially */ 124 | } else if (strncmp("PRT:",buf,4)==0) { 125 | /* Well, nothing.. NJH PRINT -- for SYSIN especially */ 126 | } else if (strncmp("VIA:",buf,4)==0) { 127 | /* Well, nothing.. */ 128 | } else if (strncmp("REC:",buf,4)==0) { 129 | /* Well, nothing.. */ 130 | } else if (strncmp("TAG:",buf,4)==0) { 131 | p[136] = '\0'; /* Delimit length */ 132 | strcpy(Tag, p); 133 | } else if (strcmp("END:",buf)==0) { 134 | return 0; /* All ok. */ 135 | } else { 136 | fprintf(stderr, "parse_header(): Mystic tag: `%-8.8s...', Line start offset=%ld\n", buf, filepos); 137 | return 1; /* Some error! */ 138 | } 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /liblstr.c: -------------------------------------------------------------------------------- 1 | /* FUNET-NJE Client utilities 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 12-Feb-1991, 26-Sep-1993 8 | */ 9 | 10 | 11 | #include 12 | #include "clientutils.h" 13 | #include 14 | 15 | /* Always usefull: upperstr() */ 16 | 17 | char *lowerstr(str) 18 | char *str; 19 | { 20 | char *s = str; 21 | while (s && *s) { 22 | if (isupper(*s)) 23 | *s = tolower(*s); 24 | ++s; 25 | } 26 | return str; 27 | } 28 | -------------------------------------------------------------------------------- /libmcuserid.c: -------------------------------------------------------------------------------- 1 | #include "prototypes.h" 2 | #include "clientutils.h" 3 | 4 | char * 5 | mcuserid(from) 6 | char *from; 7 | { 8 | char *USER = getenv("USER"); 9 | char *LOGNAME = getenv("LOGNAME"); 10 | uid_t uid = getuid(); 11 | 12 | if (USER == NULL) USER = LOGNAME; 13 | if (USER != NULL) { 14 | struct passwd *pw = getpwnam(USER); 15 | if (pw != NULL && 16 | (uid == 0 || uid == pw->pw_uid)) { 17 | strcpy(from,USER); 18 | } else { 19 | #ifndef UNIX 20 | cuserid(from); 21 | #endif 22 | } 23 | } else { 24 | #ifndef UNIX 25 | cuserid(from); 26 | #endif 27 | } 28 | return from; 29 | } 30 | -------------------------------------------------------------------------------- /libpadbla.c: -------------------------------------------------------------------------------- 1 | /* FUNET-NJE/HUJI-NJE Client utilities 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 12-Feb-1991, 26-Sep-1993 8 | */ 9 | 10 | 11 | #include 12 | #include "clientutils.h" 13 | #include "ebcdic.h" 14 | 15 | void 16 | PAD_BLANKS(STRING, ORIG_SIZE, FINAL_SIZE) 17 | void *STRING; 18 | const int ORIG_SIZE, FINAL_SIZE; 19 | { 20 | int TempVar; 21 | unsigned char *s = (unsigned char *)STRING; 22 | 23 | for (TempVar = ORIG_SIZE; TempVar < FINAL_SIZE; TempVar++) 24 | s[TempVar] = E_SP; 25 | } 26 | -------------------------------------------------------------------------------- /libsendcmd.c: -------------------------------------------------------------------------------- 1 | /* FUNET-NJE/HUJI-NJE Client utilities 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 12-Feb-1991, 26-Sep-1993 8 | */ 9 | 10 | /* Slightly edited copy of this is inside the file_queue.c! */ 11 | 12 | #include 13 | #include 14 | #include "consts.h" 15 | #include "prototypes.h" 16 | #include "clientutils.h" 17 | 18 | #ifdef AF_UNIX 19 | #include 20 | #endif 21 | #include 22 | 23 | #if 0 24 | typedef enum { CMD_FIFO, CMD_SOCKET, CMD_UDP, CMD_UNKNOWN } cmdbox_t; 25 | static cmdbox_t cmdbox = CMD_UNKNOWN; 26 | #endif 27 | static int gotalarm = 0; 28 | 29 | static void send_alarm() 30 | { 31 | gotalarm = 1; 32 | } 33 | 34 | int send_cmd_msg(cmdbuf,cmdlen,offlineok) 35 | const void *cmdbuf; 36 | const int cmdlen, offlineok; 37 | { 38 | u_int32 accesskey; 39 | int oldgid, rc = 0, fd; 40 | char buf[LINESIZE]; 41 | char buflen = cmdlen+4; 42 | FILE *pidfile; 43 | int hujipid = 0; 44 | extern int errno; 45 | char *socknam = COMMAND_MAILBOX; 46 | 47 | /* Skip the initial token.. */ 48 | while (*socknam != ' ' && *socknam != '\t' && *socknam != 0) 49 | ++socknam; 50 | while (*socknam == ' ' || *socknam == '\t') 51 | ++socknam; 52 | 53 | gotalarm = 0; 54 | 55 | oldgid = getgid(); 56 | setgid(getegid()); 57 | 58 | if ((pidfile = fopen(PID_FILE,"r"))) { 59 | fscanf(pidfile,"%d",&hujipid); 60 | fclose(pidfile); 61 | } 62 | 63 | /* XX: Multi-machine setups ??? */ 64 | 65 | if (!hujipid ||( kill(hujipid,0) && errno == ESRCH)) { 66 | if (offlineok) return 0; 67 | logger(1,"NJECLIENTLIB: NJE transport module not online!\n"); 68 | return EX_CANTCREAT; 69 | } 70 | 71 | 72 | sprintf(buf,"%s/.socket.key",BITNET_QUEUE); 73 | accesskey = 0; 74 | if ((fd = open(buf,O_RDONLY,0)) >= 0) { 75 | read(fd,(void*)&accesskey,4); 76 | close(fd); 77 | } else { 78 | logger(1,"NJECLIENTLIB: Can't read access key, errno=%s\n",PRINT_ERRNO); 79 | /* DON'T QUIT QUITE YET! */ 80 | } 81 | *(u_int32*)&buf[0] = accesskey; 82 | memcpy(buf+4,cmdbuf,cmdlen); 83 | 84 | if (*COMMAND_MAILBOX == 'F' || /* FIFO */ 85 | *COMMAND_MAILBOX == 'f') { 86 | 87 | int fd; 88 | 89 | 90 | signal(SIGALRM, send_alarm); 91 | alarm(60); /* 60 seconds.. */ 92 | 93 | fd = open(socknam,O_WRONLY,0); 94 | if (fd < 0) { 95 | if (errno == EACCES) { 96 | logger(1,"NJECLIENTLIB: No permission to open W-only the `%s'\n", 97 | socknam); 98 | return EX_NOPERM; 99 | } else { 100 | logger(1,"NJECLIENTLIB: Failed to open CMDMAILBOX into WRONLY mode! Error: %s\n",PRINT_ERRNO); 101 | if (offlineok) 102 | return 0; 103 | else 104 | return EX_CANTCREAT; 105 | } 106 | } 107 | 108 | write(fd, buf, buflen); 109 | close(fd); 110 | 111 | } else if (*COMMAND_MAILBOX == 'S') /* SOCKET */ { 112 | 113 | #ifndef AF_UNIX 114 | logger(1,"NJECLIENTLIB: This platform does not support AF_UNIX SOCKET-type IPC\n"); 115 | return EX_SOFTWARE; 116 | #else 117 | 118 | int Socket, i; 119 | struct sockaddr_un SocketName; 120 | 121 | /* Create a local socket */ 122 | if ((Socket = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { 123 | perror("Can't create command socket"); 124 | return(errno); 125 | } 126 | 127 | memset((void *) &SocketName, 0, sizeof(SocketName)); 128 | 129 | /* Create the connect request. We connect to our local machine */ 130 | SocketName.sun_family = AF_UNIX; 131 | strcpy(SocketName.sun_path, socknam); 132 | 133 | i = sizeof(SocketName.sun_family) + strlen(SocketName.sun_path); 134 | 135 | signal(SIGALRM, send_alarm); 136 | alarm(60); /* 60 seconds.. */ 137 | 138 | if (connect(Socket, (struct sockaddr *)&SocketName, i) < 0) { 139 | perror("Access not permitted"); 140 | } else if (write(Socket, buf, buflen) < 0) { 141 | perror("Can't send command"); 142 | if (offlineok) 143 | return 0; 144 | return EX_CANTCREAT; 145 | } 146 | close(Socket); 147 | 148 | #endif 149 | 150 | } else if (*COMMAND_MAILBOX == 'U') { /* UDP */ 151 | 152 | int Socket; 153 | int portnum = 175; 154 | u_int32 ui; 155 | struct sockaddr_in SocketName; 156 | 157 | /* Create a local socket */ 158 | if ((Socket = socket( AF_INET, SOCK_DGRAM, 0)) == -1) { 159 | perror("Can't create command socket"); 160 | if (offlineok) 161 | return 0; 162 | else 163 | return EX_IOERR; 164 | } 165 | 166 | /* Create the connect request. We connect to our local machine */ 167 | memset((void *) &SocketName, 0, sizeof(SocketName)); 168 | SocketName.sin_family = AF_INET; 169 | ui = inet_addr(socknam); 170 | portnum = 175; /* The VMNET port - except on UDP.. */ 171 | sscanf(socknam,"%*s %d",&portnum); /* Fail or no.. */ 172 | SocketName.sin_port = htons(portnum); 173 | if (ui == 0xFFFFFFFF) ui = INADDR_LOOPBACK; 174 | SocketName.sin_addr.s_addr = ui; /* Configure if you can */ 175 | 176 | rc = 0; 177 | if (sendto(Socket, buf, buflen, 0, 178 | (struct sockaddr *)&SocketName,sizeof(SocketName)) == -1) { 179 | perror("Can't send command"); 180 | if (!offlineok) 181 | rc = EX_IOERR; 182 | } 183 | 184 | close(Socket); 185 | 186 | } else { 187 | logger(1,"NJECLIENTLIB: The CMDMAILBOX is not configured properly, known interface-types are (Socket, Fifo, UDP)!\n"); 188 | setgid(oldgid); 189 | return EX_SOFTWARE;; 190 | } 191 | 192 | alarm(0); 193 | setgid(oldgid); 194 | return rc; 195 | } 196 | -------------------------------------------------------------------------------- /libstrsave.c: -------------------------------------------------------------------------------- 1 | /* FUNET-NJE Client utilities 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 12-Feb-1991, 26-Sep-1993 8 | */ 9 | 10 | 11 | #include 12 | #include "prototypes.h" 13 | #include "clientutils.h" 14 | 15 | /* Always usefull: strsave() */ 16 | 17 | char *strsave(str) 18 | char *str; 19 | { 20 | int len = strlen(str); 21 | char *ss = (char*)malloc(len+1); 22 | 23 | if (ss) 24 | memcpy(ss,str,len+1); 25 | 26 | return ss; 27 | } 28 | -------------------------------------------------------------------------------- /libsubmit.c: -------------------------------------------------------------------------------- 1 | /* FUNET-NJE/HUJI-NJE Client utilities 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 12-Feb-1991, 26-Sep-1993 8 | */ 9 | 10 | 11 | #include "prototypes.h" 12 | #include "clientutils.h" 13 | 14 | int 15 | submit_file(FileName, FileSize) 16 | const char *FileName; 17 | int FileSize; 18 | { 19 | unsigned char line[512]; 20 | long size; 21 | 22 | FileSize /= 512; /* system will multiply it again.. */ 23 | 24 | *line = CMD_QUEUE_FILE; 25 | /* Send file size */ 26 | line[1] = (unsigned char)((FileSize & 0xff00) >> 8); 27 | line[2] = (unsigned char)(FileSize & 0xff); 28 | strcpy(&line[3], FileName); 29 | size = strlen(&line[3]) + 4; /* Include terminating NULL */ 30 | 31 | return send_cmd_msg(line, size, 1); /* Offline is ok */ 32 | } 33 | -------------------------------------------------------------------------------- /liburead.c: -------------------------------------------------------------------------------- 1 | /* FUNET-NJE/HUJI-NJE Client utilities 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 12-Feb-1991, 26-Sep-1993 8 | */ 9 | 10 | 11 | #include "prototypes.h" 12 | #include "clientutils.h" 13 | 14 | /* Uread() -- for a couple of external routines of HUJI-NJE */ 15 | int 16 | Uread( buf,size,fd) 17 | void *buf; 18 | const int size; 19 | FILE *fd; 20 | { 21 | short NewSize; 22 | long filepos = ftell(fd); 23 | 24 | if (fread(&NewSize, sizeof(NewSize), 1, fd) != 1) 25 | return 0; /* Probably end of file */ 26 | NewSize = ntohs(NewSize); 27 | if (NewSize > size) { /* Can't reduce size, so can't recover */ 28 | logger(1, "UREAD: have to read %d into a buffer of only %d, filepos=%d\n", 29 | NewSize, size, filepos); 30 | bug_check("Uread - buffer too small"); 31 | } 32 | if (fread(buf, NewSize, 1, fd) == 1) { 33 | return NewSize; 34 | } 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /libustr.c: -------------------------------------------------------------------------------- 1 | /* FUNET-NJE Client utilities 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 12-Feb-1991, 26-Sep-1993 8 | */ 9 | 10 | 11 | #include 12 | #include "clientutils.h" 13 | #include 14 | 15 | /* Always usefull: upperstr() */ 16 | 17 | char *upperstr(str) 18 | char *str; 19 | { 20 | register char *s = str; 21 | while (s && *s) { 22 | if (islower(*s)) 23 | *s = toupper(*s); 24 | ++s; 25 | } 26 | return str; 27 | } 28 | -------------------------------------------------------------------------------- /libuwrite.c: -------------------------------------------------------------------------------- 1 | /* FUNET-NJE/HUJI-NJE Client utilities 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 12-Feb-1991, 26-Sep-1993 8 | */ 9 | 10 | 11 | #include "prototypes.h" 12 | #include "clientutils.h" 13 | 14 | /* 15 | | Write the given string into the file. 16 | */ 17 | 18 | int 19 | Uwrite(outfil, string, size) 20 | FILE *outfil; 21 | const void *string; /* Line descption */ 22 | const int size; 23 | { 24 | unsigned short Size = htons(size); 25 | 26 | if(fwrite(&Size, 1, sizeof(Size), outfil) != sizeof(Size)) { 27 | logger(1, "UWRITE: Can't fwrite, error: %s\n", PRINT_ERRNO); 28 | return 0; 29 | } 30 | if(fwrite(string, 1, size, outfil) != size) { 31 | logger(1, "UWRITE: Can't fwrite, error: %s\n", PRINT_ERRNO); 32 | return 0; 33 | } 34 | return 1; /* Done ok */ 35 | } 36 | -------------------------------------------------------------------------------- /logger.c: -------------------------------------------------------------------------------- 1 | /*============================ LOGGER =================================*/ 2 | /* Part of HUJI-NJE -- lifted from main.c */ 3 | /* 4 | | Write a logging line in our logfile. If the loglevel is 1, close the file 5 | | after writing, so we can look in it at any time. 6 | */ 7 | 8 | #include 9 | #include "consts.h" 10 | #include "prototypes.h" 11 | #include "ebcdic.h" 12 | #include 13 | #include 14 | 15 | extern int LogLevel; /* In main() source module of each program */ 16 | extern FILE *LogFd; /* In main() source module of each program */ 17 | 18 | /*============================ LOGGER =================================*/ 19 | /* 20 | | Write a logging line in our logfile. If the loglevel is 1, close the file 21 | | after writing, so we can look in it at any time. 22 | */ 23 | void 24 | logger(int lvl, ...) 25 | { 26 | char *local_time(); 27 | char *fmt; 28 | va_list pvar; 29 | 30 | va_start(pvar, lvl); 31 | /* lvl = va_arg(pvar,int); */ 32 | va_end(pvar); 33 | 34 | /* Do we have to log it at all ? */ 35 | if (lvl > LogLevel) { 36 | return; 37 | } 38 | 39 | /* Open the log file */ 40 | if (LogFd == 0) { /* Not opened before */ 41 | if (strcmp(LOG_FILE,"-")==0) LogFd = stderr; 42 | else if ((LogFd = fopen(LOG_FILE, "a")) == NULL) { 43 | LogFd = NULL; 44 | return; 45 | } 46 | } 47 | 48 | va_start(pvar, lvl); 49 | /* lvl = va_arg(pvar,int); */ 50 | fmt = va_arg(pvar,char*); 51 | 52 | fprintf(LogFd, "%s, ", local_time()); 53 | vfprintf(LogFd, fmt, pvar); 54 | va_end(pvar); 55 | fflush(LogFd); 56 | 57 | if (LogLevel == 1) { /* Normal run - close file after loging */ 58 | if (LogFd != stdout) 59 | fclose(LogFd); 60 | LogFd = 0; 61 | } 62 | } 63 | 64 | 65 | /* 66 | | Return the time in a printable format; to be used by Bug-Check and Logger. 67 | */ 68 | char * 69 | local_time() 70 | { 71 | static char TimeBuff[80]; 72 | struct tm *tm, *localtime(); 73 | time_t clock; 74 | 75 | time(&clock); /* Get the current time */ 76 | tm = localtime(&clock); 77 | sprintf(TimeBuff, "%04d-%02d-%02d %02d:%02d:%02d", 78 | tm->tm_year+1900, (tm->tm_mon + 1), tm->tm_mday, 79 | tm->tm_hour, tm->tm_min, tm->tm_sec); 80 | return TimeBuff; 81 | } 82 | 83 | 84 | /* 85 | | Write a hex dump of the buffer passed. Do it only if the level associated 86 | | with it is lower or equal to the current one. After the dump write the 87 | | text of the message in ASCII. WE always try to convert from EBCDIC to 88 | | ASCII as most traces are done at the network level. 89 | */ 90 | #define ADD_TEXT { /* Add the printable text */ \ 91 | NextLinePosition = &line[count * 3]; \ 92 | *NextLinePosition++ = ' '; \ 93 | *NextLinePosition++ = '|'; \ 94 | *NextLinePosition++ = ' '; \ 95 | while(q <= (unsigned char *)p) { \ 96 | c = EBCDIC_ASCII[*q++]; \ 97 | if((c >= 32) && (c <= 126)) /* Printable */ \ 98 | *NextLinePosition++ = c; \ 99 | else \ 100 | *NextLinePosition++ = '.'; \ 101 | } \ 102 | *NextLinePosition = '\0'; \ 103 | } 104 | 105 | void 106 | trace(p, n, lvl) 107 | const void *p; 108 | const int n, lvl; 109 | { 110 | register int count, i; 111 | char line[LINESIZE]; 112 | unsigned char c; /* Point to the beginning of this buffer */ 113 | char *line2; 114 | 115 | if (lvl > LogLevel) return; 116 | logger(lvl, "Trace called with data size=%d\n", n); 117 | 118 | count = 0; /* save beginning of buffer */ 119 | i = 0; 120 | while(i < n) { 121 | for (count = 0; count < 12; ++count) { 122 | if (count+i < n) 123 | sprintf(line+count*3, "%02x ", *(((unsigned char *)p)+i+count)); 124 | else 125 | strcpy(line+count*3, " "); 126 | } 127 | strcat(line, " | "); 128 | line2 = strlen(line)+line; 129 | for (count = 0; count < 12; ++count) { 130 | if (count+i < n) { 131 | c = EBCDIC_ASCII[*(((unsigned char *)p)+i+count)]; 132 | if ((c >= 32) && (c <= 126)) 133 | line2[count] = c; 134 | else 135 | line2[count] = '.'; 136 | } else 137 | line2[count] = 0; 138 | } 139 | line2[12] = 0; 140 | logger(lvl, "%3d: %s\n", i, line); 141 | i += 12; 142 | } 143 | } 144 | 145 | -------------------------------------------------------------------------------- /mailify: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/mailify -------------------------------------------------------------------------------- /mailify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # mailify.sh -- do it simple mailify utility by using intelligent 4 | # subprograms - and letting mailer do most... 5 | # Copyright (c) Finnish University and Research Network, FUNET 1991, 1993,1994 6 | # 7 | 8 | nodel=0 9 | TMPFILE=/usr/tmp/mlfy$$.tmp 10 | TMPLOG=/dev/null 11 | TMPLOG=/usr/tmp/mailify.runlog 12 | #touch $TMPLOG 13 | 14 | if [ "x$1" = "x-n" ]; then 15 | shift; nodel=1 16 | fi 17 | 18 | telusage=0 19 | if [ "x$1" != "x" ]; then 20 | if [ ! -r $1 ]; then 21 | telusage=1 22 | fi 23 | else 24 | telusage=1 25 | fi 26 | if [ $telusage = 1 ]; then 27 | echo "MAILIFY - program for HUJI-NJE incoming mail processing" 28 | echo " Not for casual users invocation." 29 | echo "Args: [-n] spoolfilepath" 30 | echo " -n for no original file removal." 31 | exit 3 32 | fi 33 | ( 34 | echo "Mailify: $*" 35 | /usr/local/bin/receive -a -n -o $TMPFILE $1 36 | rc=$? 37 | if [ $rc != 0 ]; then exit $rc; fi 38 | headword="`head -1 $TMPFILE|cut -c-5`" 39 | if [ "$headword" = "HELO " ]; then 40 | # Zmailer interface module, your mileage may vary.. 41 | /usr/lib/sendmail -v -bs 2>&1 < $TMPFILE 42 | else 43 | /usr/lib/sendmail -bm 2>&1 < $TMPFILE 44 | fi 45 | rc=$? 46 | 47 | rm $TMPFILE 48 | 49 | if [ $nodel = 1 ]; then exit 0; fi 50 | if [ $rc != 0 ]; then exit $rc; fi 51 | 52 | /bin/rm -f $1 53 | exit 0 54 | ) >> $TMPLOG 55 | 56 | exit $? 57 | -------------------------------------------------------------------------------- /man/bmail.8: -------------------------------------------------------------------------------- 1 | .\" $Header$ 2 | .\" 3 | .\" Man page for HUJI-NJE/FUNET-NJE on UNIX system. 4 | .\" 5 | .\" Written by Matti Aarnio 6 | .\" 7 | .\" Date: 27-Dec-1990, 18-Sep-1993 8 | .\" 9 | .ds ]W Funet-Nje 1 UNIX 3.0 10 | .TH BMAIL 8 11 | .SH NAME 12 | `NJELIB'/bmail \- bitnet mail send tool 13 | .SH SYNOPSIS 14 | .IP bmail 0.6i 0 15 | .RB [ " \-nd Gateway-address " ] 16 | .RB [ " \-b(smtp) Gateway-address " ] 17 | .RB [ " \-tag RSCS-TAG " ] 18 | .RB [ " \-u origuser " ] 19 | .if n .br 20 | .I FromUser@FromNode 21 | .I ToUser@ToNode 22 | .RI [ " ToUser@ToNode... " ] 23 | .SH DESCRIPTION 24 | .IX "bitnet" 25 | .IX "funetnje" 26 | .IX "bmail" 27 | .LP 28 | .I bmail 29 | command is actually a special purpose \fIsendfile\fR 30 | (Historically: code of \fIsendfile\fR reused a lot of \fIbmail\fR code) 31 | for mail transport, and thus is not a general user program. 32 | Its input is a ready-made mail file, and it generates a BSMTP envelope, 33 | when so requested. 34 | .LP 35 | Options for 36 | .I bmail 37 | are: 38 | .IP "\fB\-b(smtp) gateway@host\fR" 1.8i 0 39 | informing that the feed in mail shall be wrapped into a BSMTP/PUNCH envelope 40 | with "MAIL FROM:<>" getting the first argument, and "RCPT TO:<>" getting 41 | the rest (1 to many..) 42 | This option has two alternate names: "\fB-b\fR", and "\fB-bsmtp\fR". 43 | .I Line length is limited to 80 chars on this mode! Wrapping of longer lines 44 | .I is attempted, but it might not always be successfull. 45 | .IP "\fB\-nd gateway@host\fR" 1.8i 0 46 | informing that the feed in mail shall be wrapped into a BSMTP/NETDATA envelope 47 | with "MAIL FROM:<>" getting the first argument, and "RCPT TO:<>" getting 48 | the rest (1 to many..) 49 | .I This accept indefinite length lines, minimum being 80 chars, true value 50 | .I is calculated while preparing the BSMTP envelope into a temporary file. 51 | .IP "\fB\-tag RSCS-TAG\fR" 1.8i 0 52 | defines the 136 bytes (padded/truncated to that length) RSCS TAG data. 53 | Usually not needed with 54 | .IR bmail . 55 | .IP "\fB\-u origuser\fR" 1.8i 0 56 | Can be used to define local mail-sender pseudo-id. 57 | For 58 | .SM BSMTP 59 | modes the default value is 60 | .BR MAILER . 61 | For others it is local user. 62 | .LP 63 | When 64 | .IR bmail's 65 | `From' argument contains a `.' in it, the file sender is changed to 66 | be "MAILER@localname", however possible BSMTP will contain entered 67 | `From' information. 68 | .SH INTERFACING TO SYSTEM MAILER 69 | In case of 70 | .BR zmailer (8z) 71 | by Rayan Zachariassen, interface goes as follows: 72 | .LP 73 | .nf 74 | .ft CW 75 | $MAILSHARE/db/routes.bitnet contains: 76 | academic bsmtp3!mailer!academic 77 | acmvm bsmtp3!mailer!acmvm 78 | acusd defrt1!acusd 79 | finhutc bsmtp3nd!mailer!finhutc 80 | 81 | $MAILSHARE/sm.conf contains: 82 | # 83 | # bitnet stuff F=hu not set 84 | # 85 | bsmtp3 snmSX /usr/local/lib/huji/bmail bmail -b $h -u MAILER $g $u 86 | bsmtp3nd snmSX /usr/local/lib/huji/bmail bmail -nd $h -u MAILER $g $u 87 | defrt1 snS /usr/local/lib/huji/bmail bmail $g $u 88 | bitnet2 snS /usr/local/lib/huji/bmail bmail $g $u 89 | 90 | $MAILSHARE/scheduler.cf contains: 91 | defrt1/* 92 | command="sm -c $channel defrt1" 93 | bsmtp3/* 94 | command="sm -c $channel bsmtp3" 95 | bsmtp3nd/* 96 | command="sm -c $channel bsmtp3nd" 97 | .ft R 98 | .fi 99 | .LP 100 | Getting this installed into a BSD 101 | .BR sendmail (8) 102 | should not be very difficult, but definitely different.. 103 | Propably `mailer' definitions resemble `sm.conf' above. 104 | .LP 105 | .SH ENVIRONMENT 106 | With environment variable 107 | .B EBCDICTBL 108 | user can select alternate EBCDIC <\-> ASCII translation 109 | tables. For more info, see 110 | .BR ebcdictbl (5). 111 | .LP 112 | .SH FILES 113 | .I /etc/funetnje.cf 114 | .br 115 | .I /etc/name.bitnet 116 | (For system mailer) 117 | .SH SEE ALSO 118 | .BR bitspool (5), 119 | .BR ebcdictbl (5), 120 | .BR funetnje (8), 121 | .BR mailify (1), 122 | .BR qrdr (8), 123 | .BR receive (1), 124 | .BR sendfile (1), 125 | .BR transfer (1) 126 | .SH BUGS 127 | .LP 128 | None that we know. 129 | .LP 130 | .SH DIAGNOSTICS 131 | These programs show their usage summary, when there is something 132 | wrong with input parameters. Subtle usage bugs might not be detected! 133 | .SH WARNINGS 134 | When BSMTP envelope address overflows to longer than 80-characters, 135 | and NETDATA is not used, there is no check at it, nor folding... 136 | (There is a deliberate TRUNCATE at 80 cols, though..) 137 | With the NETDATA the input can be of arbitary long lines (up to 64000 138 | characters each). 139 | .LP 140 | .SH AUTHORS 141 | .LP 142 | Yehavi Bourvine, Hebrew University of Yerusalem, Israel 143 | .I . 144 | .LP 145 | Matti Aarnio, Finnish University and Research Network \- FUNET, Finland 146 | .I . 147 | .LP 148 | Original (VMS oriented package) software by Yehavi Bourvine, 149 | UNIX features, plenty of modifications, man-pages by Matti Aarnio. 150 | -------------------------------------------------------------------------------- /man/ebcdictbl.5: -------------------------------------------------------------------------------- 1 | .\" $Header$ 2 | .\" 3 | .\" Man page for FUNET-NJE on UNIX system. 4 | .\" 5 | .\" Written by Matti Aarnio 6 | .\" 7 | .\" Date: 5-Nov-93 8 | .\" 9 | .ds ]W Funet-Nje 5 UNIX 3.0 10 | .TH EBCDICTBL 5 11 | .SH NAME 12 | ebcdictbl \- environment variable, and format of ASCII<\->EBCDIC tables 13 | .SH SYNOPSIS 14 | .nf 15 | Environment variable: 16 | .ft B 17 | EBCDICTBL=/path/of/table/file 18 | .ft R 19 | 20 | File content format: 21 | .ft B 22 | "ASC<=>EBC\\n" 23 | <256 bytes of ASCII -> EBCDIC mapping> 24 | <256 bytes of EBCDIC -> ASCII mapping> 25 | .ft R 26 | .fi 27 | .SH AVAILABILITY 28 | .LP 29 | Systems running 30 | .BR funetnje (8) 31 | sofware. 32 | .SH DESCRIPTION 33 | .IX "bitnet" 34 | .IX "funetnje" 35 | .IX "sendfile" 36 | .IX "netdata" 37 | .IX "receive" 38 | .IX "mailify" 39 | .IX "bitspool" 40 | .LP 41 | The magic 10 byte header is an ASCII string: 42 | .LP 43 | \f4 ASC<=>EBC\\n 44 | .LP 45 | and is used for checking the input to be valid. 46 | Another check is file size, which must be 522 bytes. 47 | .LP 48 | Table usage is simple: 49 | Unsigned character (say, in ASCII) is used to index 50 | a translation table (say, ASCII_EBCDIC) to obtain 51 | the translated character. 52 | .LP 53 | .SH SAMPLE TABLES 54 | .LP 55 | Sample 56 | .SM ASCII\->EBCDIC 57 | table: 58 | .LP 59 | .in +0.5i 60 | .fp 4 CW 61 | .fz 4 -2 62 | .nf 63 | \f4 HEX |0x*0|0x*1|0x*2|0x*3|0x*4|0x*5|0x*6|0x*7| ASCII chars 64 | \f4 HEX |0x*8|0x*9|0x*A|0x*B|0x*C|0x*D|0x*E|0x*F| 65 | \f4 66 | \f4 0x00 |0x00|0x01|0x02|0x03|0x37|0x2D|0x2E|0x2F| 67 | \f4 0x08 |0x16|0x05|0x25|0x0B|0x0C|0x0D|0x0E|0x0F| 68 | \f4 0x10 |0x10|0x11|0x12|0x13|0x3C|0x3D|0x32|0x26| 69 | \f4 0x18 |0x18|0x19|0x3F|0x27|0x22|0x1D|0x35|0x1F| 70 | \f4 0x20 |0x40|0x5A|0x7F|0x7B|0x5B|0x6C|0x50|0x7D| SP ! " @ $ % & ' 71 | \f4 0x28 |0x4D|0x5D|0x5C|0x4E|0x6B|0x60|0x4B|0x61| ( ) * + , - . / 72 | \f4 0x30 |0xF0|0xF1|0xF2|0xF3|0xF4|0xF5|0xF6|0xF7| 0 1 2 3 4 5 6 7 73 | \f4 0x38 |0xF8|0xF9|0x7A|0x5E|0x4C|0x7E|0x6E|0x6F| 8 9 : ; < = > ? 74 | \f4 0x40 |0x7C|0xC1|0xC2|0xC3|0xC4|0xC5|0xC6|0xC7| @ A B C D E F G 75 | \f4 0x48 |0xC8|0xC9|0xD1|0xD2|0xD3|0xD4|0xD5|0xD6| H I J K L M N O 76 | \f4 0x50 |0xD7|0xD8|0xD9|0xE2|0xE3|0xE4|0xE5|0xE6| P Q R S T U V W 77 | \f4 0x58 |0xE7|0xE8|0xE9|0xAD|0xE0|0xBD|0x5F|0x6D| X Y Z [ \\ ] ^ _ 78 | \f4 0x60 |0x79|0x81|0x82|0x83|0x84|0x85|0x86|0x87| ` a b c d e f g 79 | \f4 0x68 |0x88|0x89|0x91|0x92|0x93|0x94|0x95|0x96| h i j k l m n o 80 | \f4 0x70 |0x97|0x98|0x99|0xA2|0xA3|0xA4|0xA5|0xA6| p q r s t u v w 81 | \f4 0x78 |0xA7|0xA8|0xA9|0xC0|0x6A|0xD0|0xA1|0x07| x y z { | } ~ DEL 82 | \f4 0x80 |0x41|0x42|0x43|0x44|0x45|0x46|0x47|0x48| 83 | \f4 0x88 |0x49|0x51|0x52|0x53|0x54|0x55|0x56|0x57| 84 | \f4 0x90 |0x58|0x59|0x62|0x63|0x64|0x65|0x66|0x67| 85 | \f4 0x98 |0x68|0x69|0x71|0x00|0x00|0x00|0x00|0x00| 86 | \f4 0xA0 |0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00| 87 | \f4 0xA8 |0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00| 88 | \f4 0xB0 |0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00| 89 | \f4 0xB8 |0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00| 90 | \f4 0xC0 |0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00| 91 | \f4 0xC8 |0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00| 92 | \f4 0xD0 |0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00| 93 | \f4 0xD8 |0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00| 94 | \f4 0xE0 |0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00| 95 | \f4 0xE8 |0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00| 96 | \f4 0xF0 |0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00| 97 | \f4 0xF8 |0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00| 98 | .fi 99 | .LP 100 | Sample 101 | .SM EBCDIC\->ASCII 102 | table: 103 | .LP 104 | .in +0.5i 105 | .fp 4 CW 106 | .fz 4 -2 107 | .nf 108 | \f4 HEX |0x*0|0x*1|0x*2|0x*3|0x*4|0x*5|0x*6|0x*7| ASCII chars 109 | \f4 HEX |0x*8|0x*9|0x*A|0x*B|0x*C|0x*D|0x*E|0x*F| 110 | \f4 111 | \f4 0x00 |0x00|0x01|0x02|0x03|0x00|0x09|0x00|0x7F| 112 | \f4 0x08 |0x00|0x00|0x00|0x0B|0x0C|0x0D|0x0E|0x0F| 113 | \f4 0x10 |0x10|0x11|0x12|0x13|0x00|0x00|0x08|0x00| 114 | \f4 0x18 |0x18|0x19|0x00|0x00|0x00|0x1D|0x00|0x1F| 115 | \f4 0x20 |0x00|0x00|0x1C|0x00|0x00|0x0A|0x17|0x1B| 116 | \f4 0x28 |0x00|0x00|0x00|0x00|0x00|0x05|0x06|0x07| 117 | \f4 0x30 |0x00|0x00|0x16|0x00|0x00|0x1E|0x00|0x04| 118 | \f4 0x38 |0x00|0x00|0x00|0x00|0x14|0x15|0x00|0x1A| 119 | \f4 0x40 |0x20|0x80|0x81|0x82|0x83|0x84|0x85|0x86| SP 120 | \f4 0x48 |0x87|0x88|0x5B|0x2E|0x3C|0x28|0x2B|0x7C| [ . < ( + | 121 | \f4 0x50 |0x26|0x89|0x8A|0x8B|0x8C|0x8D|0x8E|0x8F| & 122 | \f4 0x58 |0x90|0x91|0x21|0x24|0x2A|0x29|0x3B|0x5E| ! $ * ) ; ^ 123 | \f4 0x60 |0x2D|0x2F|0x92|0x93|0x94|0x95|0x96|0x97| - / 124 | \f4 0x68 |0x98|0x99|0x7C|0x2C|0x25|0x5F|0x3E|0x3F| | , % _ > ? 125 | \f4 0x70 |0x00|0x9A|0x00|0x00|0x00|0x00|0x00|0x00| 126 | \f4 0x78 |0x00|0x60|0x3A|0x23|0x40|0x27|0x3D|0x22| ` : # @ ' = " 127 | \f4 0x80 |0x00|0x61|0x62|0x63|0x64|0x65|0x66|0x67| a b c d e f g 128 | \f4 0x88 |0x68|0x69|0x00|0x00|0x00|0x00|0x00|0x00| h i 129 | \f4 0x90 |0x00|0x6A|0x6B|0x6C|0x6D|0x6E|0x6F|0x70| j k l m n o p 130 | \f4 0x98 |0x71|0x72|0x00|0x00|0x00|0x00|0x00|0x00| q r 131 | \f4 0xA0 |0x00|0x7E|0x73|0x74|0x75|0x76|0x77|0x78| ~ s t u v w x 132 | \f4 0xA8 |0x79|0x7A|0x00|0x00|0x00|0x5B|0x00|0x00| y z [ 133 | \f4 0xB0 |0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00| 134 | \f4 0xB8 |0x00|0x00|0x00|0x00|0x00|0x5D|0x00|0x00| ] 135 | \f4 0xC0 |0x7B|0x41|0x42|0x43|0x44|0x45|0x46|0x47| { A B C D E F G 136 | \f4 0xC8 |0x48|0x49|0x00|0x00|0x00|0x00|0x00|0x00| H I 137 | \f4 0xD0 |0x7D|0x4A|0x4B|0x4C|0x4D|0x4E|0x4F|0x50| } J K L M N O P 138 | \f4 0xD8 |0x51|0x52|0x00|0x00|0x00|0x00|0x00|0x00| Q R 139 | \f4 0xE0 |0x5C|0x00|0x53|0x54|0x55|0x56|0x57|0x58| \\ S T U V W X 140 | \f4 0xE8 |0x59|0x5A|0x00|0x00|0x00|0x00|0x00|0x00| Y Z 141 | \f4 0xF0 |0x30|0x31|0x32|0x33|0x34|0x35|0x36|0x37| 0 1 2 3 4 5 6 7 142 | \f4 0xF8 |0x38|0x39|0x00|0x00|0x00|0x00|0x00|0x00| 8 9 143 | .fi 144 | .LP 145 | .SH "SEE ALSO" 146 | .BR bitsend (1), 147 | .BR bmail (8), 148 | .BR funetnje (8), 149 | .BR ndparse (1), 150 | .BR qrdr (8), 151 | .BR receive (1), 152 | .BR sendfile (1) 153 | .SH AUTHORS 154 | .LP 155 | Yehavi Bourvine, Hebrew University of Yerusalem, Israel 156 | .I . 157 | .LP 158 | Matti Aarnio, Finnish University and Research Network \- FUNET, Finland 159 | .I . 160 | .LP 161 | Original (VMS oriented package) software by Yehavi Bourvine, 162 | UNIX features including spool mechanism, plenty of other modifications, 163 | man-pages by Matti Aarnio. 164 | -------------------------------------------------------------------------------- /man/mailify.8: -------------------------------------------------------------------------------- 1 | .\" $Header$ 2 | .\" 3 | .\" Man page for FUNET-NJE on UNIX system. 4 | .\" 5 | .\" Written by Matti Aarnio 6 | .\" 7 | .\" Date: 27-Dec-1990, 4-Oct-1993 8 | .\" 9 | .fp 4 CW 10 | .ds ]W Funet-Nje 8 UNIX 3.0 11 | .TH MAILIFY 8 12 | .SH NAME 13 | mailify, sysin 14 | \- bitnet incoming file processing programs 15 | .SH SYNOPSIS 16 | .LP 17 | /usr/lib/huji/mailify 18 | .RB [ " \-n " ] 19 | .I filepath 20 | .LP 21 | /usr/lib/huji/sysin 22 | .RB [ " \-n " ] 23 | .I filepath 24 | .LP 25 | .SH DESCRIPTION 26 | .IX "bitnet" 27 | .IX "funetnje" 28 | .IX "mailify" 29 | .IX "sysin" 30 | .LP 31 | .I Mailify 32 | is a special purpose program to receive BSMTP 33 | .\" and plain mail files (hdr+body, 34 | .\" which is within BSMTP envelope anyway). 35 | Transport system launches this program 36 | .\" (usually implemented as a script) 37 | to handle incoming mail. 38 | Reception of PROFS NOTES 39 | and DEFRT1 plain mail-files (non BSMTP) 40 | is left for further study. 41 | .LP 42 | .I Sysin 43 | is a special purpose program for receiving RJE jobs from the network. 44 | Actual operation is subject for further study. 45 | .SH OPTIONS 46 | .IP -n 1.0i 0 47 | Original `spool' file should \fBnot\fR be removed after successfull 48 | file processing is done. 49 | .SH FILES 50 | .nf 51 | .I /etc/funetnje.cf 52 | .RI "File processing exit config file, which is defined in " funetnje.cf. 53 | .fi 54 | .SH SEE ALSO 55 | .BR funetnje (8), 56 | .BR bitspool (5), 57 | .BR send (1), 58 | .BR sendfile (1), 59 | .BR bmail (8), 60 | .BR transfer (1), 61 | .BR qrdr (8), 62 | .BR receive (1), 63 | .BR rdrlist (1) 64 | .SH DIAGNOSTICS 65 | When any of these programs is fed a file containing errorneous 66 | data (not 67 | .BR funetnje (8) 68 | spool file,) these mostly recover with a burp, sometimes these 69 | might even drop a core on pathological input case. 70 | .SH AUTHORS 71 | .LP 72 | Yehavi Bourvine, Hebrew University of Yerusalem, Israel 73 | .I . 74 | .LP 75 | Matti Aarnio, Finnish University and Research Network \- FUNET, Finland 76 | .I . 77 | .LP 78 | Original (VMS oriented package) software by Yehavi Bourvine, 79 | UNIX features, plenty of modifications, man-pages by Matti Aarnio. 80 | -------------------------------------------------------------------------------- /man/ndparse.1: -------------------------------------------------------------------------------- 1 | .so man1/bitcat.1 2 | -------------------------------------------------------------------------------- /man/njeroutes.8: -------------------------------------------------------------------------------- 1 | .\" $Header$ 2 | .\" 3 | .\" Man page for HUJI-NJE/FUNET-NJE on UNIX system. 4 | .\" 5 | .\" Written by Matti Aarnio 6 | .\" 7 | .\" Date: 27-Dec-1990, 18-Sep-1993, 22-Oct-1993 8 | .\" 9 | .fp 4 CW 10 | .ds ]W Funet-Nje 8 UNIX 3.0 11 | .TH NJEROUTES 8 12 | .SH NAME 13 | njeroutes \- FUNETNJE bitnet software routing database generator. 14 | .SH SYNOPSIS 15 | njeroutes 16 | .I header.filename 17 | .I routes.filename 18 | .I database.filename 19 | .SH DESCRIPTION 20 | .IX "bitnet" 21 | .IX "funetnje" 22 | .IX "njeroutes" 23 | .LP 24 | .I Net_routes 25 | builds routing database of BITNET nodes for 26 | .I funetnje 27 | program internal usage. 28 | If no 29 | \f4DEFAULT-ROUTE 30 | has been defined in 31 | .I /etc/funetnje.cf 32 | (see 33 | .BR funetnje (8)) 34 | then this is ONLY way to route messages and files from local node 35 | to anywhere. 36 | .LP 37 | Example of 38 | .I header.file 39 | for node \f4FINFILES\fR having alias name \f4HAMSTER\fR. 40 | .LP 41 | .nf 42 | \f4* 43 | \f4* Header of HUyNJE/FUNETNJE package routing table 44 | \f4* 45 | \f4* Generic format: 46 | \f4* SITE LINE (FORMAT/INFO) 47 | \f4* 48 | \f4 ROUTE FINFILES LOCAL ASCII 49 | \f4 ROUTE HAMSTER LOCAL ASCII 50 | .fi 51 | .LP 52 | It may also be usefull to define alternate routes just in 53 | case the direct link doesn't work: 54 | .LP 55 | .nf 56 | \f4 ROUTE FIGBOX FIGBOX 57 | \f4 ROUTE FINHUTC FIGBOX 58 | .fi 59 | .LP 60 | First one defines that \f4FIGBOX\f4 has no alternatives, while 61 | \f4FINHUTC\fR can get routed via \f4FIGBOX\fR in case direct 62 | link to it is not active. 63 | .LP 64 | Example routing data for same node. Used format is same as 65 | IBM RSCS v1 uses, thus it is easily obtainable using common BITNET 66 | tools. 67 | Next step connection of the example node is \f4FIGBOX\fR. 68 | .LP 69 | .nf 70 | \f4* * The position of the network name and country * 71 | \f4* * assumes that the RSCS ROUTE command does not * 72 | \f4* * have more than two parameters. * 73 | \f4ROUTE VERS9012 FIGBOX EARN NL 74 | \f4ROUTE LINKS012 FIGBOX BITNET US 75 | \f4ROUTE FINABO FIGBOX EARN FI 76 | \f4ROUTE FINALKO FIGBOX EARN FI 77 | \f4ROUTE FINFUN FIGBOX EARN FI 78 | \f4ROUTE FINGATE FIGBOX EARN FI 79 | \f4ROUTE FINHUT FIGBOX EARN FI 80 | .fi 81 | .LP 82 | .SH SEE ALSO 83 | .BR funetnje (8), 84 | .BR send (1), 85 | .BR sendfile (1), 86 | .BR bmail (8), 87 | .BR ucp (8). 88 | .SH BUGS 89 | .LP 90 | None, we hope. 91 | .SH DIAGNOSTICS 92 | All error conditions are reported with self explanatory text messages. 93 | .LP 94 | If multiple entries of same node are attempted (for example one in 95 | header, other in routes), first one stays as routing definition, rest 96 | are reported as duplicates. 97 | .SH WARNING 98 | It is not adviced to create output on same 99 | .BR file , 100 | as the current database is, although they will not be intermixed, as 101 | if there is a file with the target name, it will be unlinked before 102 | the processing starts. 103 | .LP 104 | Once the database is generated, and placed (with 105 | .BR mv (1), 106 | for example) on place of the active database, a 107 | .RB ` ucp "(8) " "rescan route" ' 108 | -command is suggested (or full restart of the emulator.) 109 | .SH AUTHORS 110 | .LP 111 | Yehavi Bourvine, Hebrew University of Yerusalem, Israel 112 | .I . 113 | .LP 114 | Matti Aarnio, Finnish University and Research Network \- FUNET, Finland 115 | .I . 116 | .LP 117 | Original (VMS oriented package) software by Yehavi Bourvine, 118 | UNIX features, plenty of modifications, man-pages by Matti Aarnio. 119 | -------------------------------------------------------------------------------- /man/print.1: -------------------------------------------------------------------------------- 1 | .so man1/sendfile.1 2 | -------------------------------------------------------------------------------- /man/punch.1: -------------------------------------------------------------------------------- 1 | .so man1/sendfile.1 2 | -------------------------------------------------------------------------------- /man/qrdr.8: -------------------------------------------------------------------------------- 1 | .\" $Header$ 2 | .\" 3 | .\" Man page for FUNET-NJE on UNIX system. 4 | .\" 5 | .\" Written by Matti Aarnio 6 | .\" 7 | .\" Date: 27-Dec-1990, 18-Sep-1993 8 | .\" 9 | .fp 4 CW 10 | .ds ]W Funet-Nje 8 UNIX 3.0 11 | .TH QRDR 8 12 | .SH NAME 13 | qrdr \- incoming bitnet queue peeking tool 14 | .SH SYNOPSIS 15 | .IP qrdr 0.5i 0 16 | .RB [ " \-u \fIuser\fR " ] 17 | .RB [ " \-n " ] 18 | .RB [ " \-l " ] 19 | .RI [ " dirpaths\fR,\fI filepaths " ] 20 | .SH DESCRIPTION 21 | .IX "qrdr" 22 | .IX "bitnet" 23 | .IX "funetnje" 24 | .IX "mailify" 25 | .IX "receive" 26 | .LP 27 | .I Qrdr 28 | gives users a tool to see what they have in their incoming BITNET spool 29 | queues. 30 | Depending on protection it also lets others to see what user XYZ has in 31 | his/her queue, or ANY directory possibly containing BITNET spool files, 32 | or just any specified files... 33 | .LP 34 | When 35 | .RB ` "\-u \fIuser" ' 36 | has not been used, default behaviour of 37 | .I qrdr 38 | is to find out who user is making query by asking `whoami', 39 | eg getting value of 40 | .B LOGNAME 41 | environment variable. 42 | (In SysV this is 43 | .B USER 44 | variable.) 45 | If environment doesn't give answer, 46 | .I /etc/passwd 47 | file is consulted with 48 | effective uid. 49 | .LP 50 | Spool directory is determined using same mechanism as in 51 | .I funetnje 52 | main program. Sample configuration of file procesing exits gives directory 53 | .RI ` /usr/spool/bitspool ' 54 | in which UPPERCASE userids (or pseudoids - MAILER is one such) are `user' 55 | specific subdirectories containing individual spooled files. 56 | .LP 57 | Option 58 | .BR ` \-l ' 59 | gives file paths to spool files, and some heuristics of file contents 60 | for 61 | .IR rdrlist (1) 62 | program. 63 | For program-parsing the 64 | .BR ` \-l ' 65 | option uses singular 66 | tabulator to separate output fields. 67 | .LP 68 | Example of 69 | .I qrdr 70 | output for user 71 | .RB ` mea ': 72 | .LP 73 | .nf 74 | .fz 4 -2 75 | \f4QRDR: Spool dir: `/usr/spool/bitspool/MEA/' 76 | \f4From: To: FName: FExt: Type Form: SpoolID 77 | \f4NETSERV@FINHUT MEA@FINFILES NETSERV NOTE PUN A QUFINHUT 0002 78 | \f4NETSERV@FINHUT MEA@FINFILES NETSERV NOTE PUN A QUFINHUT 0004 79 | \f4MEA@FINFILES MEA@FINFILES STANDARD INPUT PUN C STANDARD 0006 80 | \f4NETSERV@FINHUT MEA@FINFILES NETSERV NOTE PUN A QUFINHUT 0003 81 | \f4ZEHAVI@ISRAEARN MEA@FIRIEN ZEHAVI NOTE PUN A STANDARD 0005 82 | \f4... 83 | \f4LISTSERV@SEARN MEA@FINFILES INFO FILELIST PUN N QULISTSV 0023 84 | \f4LISTSERV@FINHUTC MEA@FINFILES LISTOWNR REFCARD PUN N QULISTSV 0024 85 | \f4CMS1@ALIJKU11 MEA@FINFILES CMS1 NOTE PUN A STD 0025 86 | \f4Found 23 files. 87 | .fi 88 | .LP 89 | For the 90 | .B \-l 91 | option, recognized data types are: 92 | NETDATA, VMSDUMP, CARD (Cornell CARD), and PUNCH when none of 93 | the previous ones match to input punch records. 94 | For three PRINT formats there are: 95 | PRINT (Machine Carriage Control), PASA (ANSI Carriage Control), and 96 | PCPDS for rare 3rd alternative. 97 | .SH FILES 98 | .nf 99 | .I /etc/funetnje.cf 100 | .I /etc/funetnje.pid 101 | .RI "File processing exit config file, which is defined in " funetnje.cf 102 | .fi 103 | .SH ENVIRONMENT 104 | .IP LOGNAME 1.0i 0 105 | Primary way to find who I am. (BSD) 106 | .IP USER 1.0i 0 107 | Secondary way to find who I am. (SysV) 108 | .SH SEE ALSO 109 | .BR funetnje (8), 110 | .BR rdrlist (1), 111 | .BR receive (1), 112 | .BR mailify (8), 113 | .BR send (1), 114 | .BR sendfile (1), 115 | .BR bmail (8), 116 | .SH AUTHORS 117 | .LP 118 | Yehavi Bourvine, Hebrew University of Yerusalem, Israel 119 | .I . 120 | .LP 121 | Matti Aarnio, Finnish University and Research Network \- FUNET, Finland 122 | .I . 123 | .LP 124 | Original (VMS oriented package) software by Yehavi Bourvine, 125 | UNIX features, plenty of modifications, man-pages by Matti Aarnio. 126 | -------------------------------------------------------------------------------- /man/send.1: -------------------------------------------------------------------------------- 1 | .\" $Header$ 2 | .\" 3 | .\" Man page for HUJI-NJE/FUNET-NJE on UNIX system. 4 | .\" 5 | .\" Written by Matti Aarnio 6 | .\" 7 | .\" Date: 27-Dec-1990, 18-Sep-1993, 10-Oct-1993 8 | .\" 9 | .ds ]W Funet-Nje 1 UNIX 3.0 10 | .TH SEND 1 11 | .SH NAME 12 | send, ygone \- bitnet message send tools 13 | .SH SYNOPSIS 14 | .IP send 0.5i 0 15 | .RB [ "\-s|\-u username" ] 16 | .BI "\-c{ommand}" " host " 17 | [ text of command ] 18 | .IP send 0.5i 0 19 | .RB [ "\-s|\-u username" ] 20 | .RB [ "\-c\fR{\fBommand" }] 21 | .I " @host " 22 | [ text of command ] 23 | .IP send 0.5i 0 24 | .RB [ "\-s|\-u username" ] 25 | .RB [ "\-m\fR{\fBessage" }] 26 | .I " user@host " 27 | [ text of message ] 28 | .IP ygone 0.8i 0 29 | .BR [ " \-d " ] 30 | .SH DESCRIPTION 31 | .IX "send" 32 | .IX "bitnet" 33 | .IX "funetnje" 34 | .IX "sendfile" 35 | .IX "submit" 36 | .IX "netdata" 37 | .IX "ygone" 38 | .LP 39 | .I send 40 | sends NMR messages over RSCS network to target 41 | .I host/user. 42 | Only necessary argument is the first one telling if this is 43 | .I command 44 | to be sent to a hostname without giving 45 | .RB ` @ ' 46 | in its name. 47 | Commands go to (usual name) `RSCS' subsystem at each host, 48 | Messages to specificied users. 49 | .LP 50 | Examples: 51 | .LP 52 | .nf 53 | .fp 4 CW 54 | \f4send @bitnic cpq time 55 | \f4send -c bitnic cpq time 56 | \f4 \fR(Sends a "CPQ TIME" to BITNIC) 57 | \f4send user@bitnic hello 58 | \f4 \fR(Sends a "hello" to user@bitnic) 59 | \f4send -u foo user@bitnic hello 60 | \f4 \fR(Sends a "hello" to user@bitnic from user foo@) 61 | \f4send -s user@bitnic hello 62 | \f4 \fR(Sends a "hello" to user@bitnic from local system: "@") 63 | .fi 64 | .LP 65 | When 66 | .I send 67 | is left without 68 | .RI [ "text of message" ] 69 | portion of arguments, it prompts that from user giving target address 70 | as prompt string. Hit empty line or EOF to quit. 71 | .LP 72 | If no 73 | .RI [ "text of message" ] 74 | is given, 75 | .I STDIN 76 | is used as an input for 77 | .IR send , 78 | thus IO redirection can be used. 79 | .LP 80 | When 81 | .I send 82 | is left without target address, that too is asked from the user. 83 | .LP 84 | .I Ygone 85 | controls temporary disposition of incoming NMR-messages into 86 | a personal logfile. In UNIX systems that file is 87 | .I .ygone.messages 88 | in user's home directory. 89 | This association is broken when 90 | .BR funetnje (8) 91 | is restarted, as the list of service requesters is kept only in core.. 92 | .LP 93 | With option 94 | .B -d 95 | user can disable 96 | .IR ygone , 97 | and look at latest set of arrived messages (if any). 98 | .LP 99 | .SH ENVIRONMENT 100 | With environment variable 101 | .B EBCDICTBL 102 | user can select alternate EBCDIC <\-> ASCII translation 103 | tables. For more info, see 104 | .BR ebcdictbl (5). 105 | .LP 106 | .SH FILES 107 | .I /etc/funetnje.cf 108 | .SH SEE ALSO 109 | .BR bitspool (5), 110 | .BR bmail (8), 111 | .BR ebcdictbl (5), 112 | .BR funetnje (8), 113 | .BR mailify (8), 114 | .BR qrdr (8), 115 | .BR receive (1), 116 | .BR sendfile (1) 117 | .SH BUGS 118 | Doesn't always 119 | .LP 120 | .SH DIAGNOSTICS 121 | These programs show their usage summary, when there is something 122 | wrong with input parameters. Subtle usage bugs might not be detected! 123 | .SH NOTES 124 | .I Ygone 125 | is subject to further developement. 126 | .SH AUTHORS 127 | .LP 128 | Yehavi Bourvine, Hebrew University of Yerusalem, Israel 129 | .I . 130 | .LP 131 | Matti Aarnio, Finnish University and Research Network \- FUNET, Finland 132 | .I . 133 | .LP 134 | Gerald Hanusch, Johannes Kepler Universitaet/Universitaet Linz, Austria 135 | . 136 | .LP 137 | Original (VMS oriented package) software by Yehavi Bourvine, 138 | UNIX features, plenty of modifications, file handling exits, 139 | man-pages by Matti Aarnio. 140 | Port of ygone to FUNET's version by Gerald Hanusch. 141 | -------------------------------------------------------------------------------- /man/sendfile.1: -------------------------------------------------------------------------------- 1 | .\" $Header$ 2 | .\" 3 | .\" Man page for HUJI-NJE on UNIX system. 4 | .\" 5 | .\" Written by Matti Aarnio 6 | .\" 7 | .\" Date: 27-Dec-1990, 20-Oct-1993 8 | .\" 9 | .ds ]W Funet-Nje 1 UNIX 1.1 10 | .TH SENDFILE 1 11 | .SH NAME 12 | sendfile, submit, punch, print \- bitnet file send tools 13 | .SH SYNOPSIS 14 | .IP sendfile 0.8i 0 15 | .I ToUser@ToNode 16 | .RB [ " \-fix | \-raw " ] 17 | .RB [ " \-bin " ] 18 | .RB [ " \-lrecl nn " ] 19 | .RB [ " \-fn \fIfname ftype " ] 20 | .RB [ " \-class N " ] 21 | .RB [ " \-form \fIFromName " ] 22 | .RB [ " \-dist \fIDistribution " ] 23 | .RB [ " \-tag \fIRSCS-TAG " ] 24 | .RI [ filepath ] 25 | .IP punch 0.8i 0 26 | .I ToUser@ToNode 27 | .RB [ " \-rawpun " ] 28 | .RB [ " \-fix | \-raw " ] 29 | .RB [ " \-fn \fIfname ftype " ] 30 | .RB [ " \-class N " ] 31 | .RB [ " \-form \fIFromName " ] 32 | .RB [ " \-dist \fIDistribution " ] 33 | .RB [ " \-tag \fIRSCS-TAG " ] 34 | .RI [ filepath ] 35 | .IP print 0.8i 0 36 | .I ToUser@ToNode 37 | .RB [ " -asa " ] 38 | .RB [ " \-fix | \-raw " ] 39 | .RB [ " \-bin " ] 40 | .RB [ " \-fn \fIfname ftype " ] 41 | .RB [ " \-class N " ] 42 | .RB [ " \-form \fIFromName " ] 43 | .RB [ " \-dist \fIDistribution " ] 44 | .RB [ " \-tag \fIRSCS-TAG " ] 45 | .RI [ filepath ] 46 | .IP submit 0.8i 0 47 | .I ToUser@ToNode 48 | .RB [ " \-fix | \-raw " ] 49 | .RB [ " \-form \fIFromName " ] 50 | .RI [ filepath ] 51 | .SH DESCRIPTION 52 | .IX "bitnet" 53 | .IX "funetnje" 54 | .IX "sendfile" 55 | .IX "submit" 56 | .IX "netdata" 57 | .LP 58 | .I Sendfile 59 | command sends out 60 | .SM NETDATA 61 | encoded file 62 | with given 63 | .I "fname + ftype" 64 | and 65 | .I "FormName," 66 | if they are specified. 67 | .LP 68 | .I Punch 69 | command sends out 80-chars per record punch-card images 70 | with given 71 | .I "fname + ftype" 72 | and 73 | .I "FormName," 74 | if they are specified. 75 | .LP 76 | .I Submit 77 | command sends out a punch with special flags directing it to be 78 | a NJE SYSIN job. 79 | .LP 80 | When a file is defined, 81 | .I reallylongfilename.really-long-extension.more.dots 82 | maps to: 83 | .I "reallylongfile + really-long-" 84 | (12 + 12 chars.) 85 | Default filename (when nothing is defined) is: 86 | .IR "STANDARD INPUT" . 87 | .LP 88 | Default for 89 | .I form 90 | is 91 | .IR STANDARD . 92 | .LP 93 | When no input file is defined, 94 | .I STDIN 95 | is assumed 96 | .LP 97 | Options for 98 | .BR punch , 99 | .BR print , 100 | .BR sendfile , 101 | and 102 | .B submit 103 | are: 104 | .IP "\fB\-asa\fR" 1.8i 0 105 | For 106 | .IR print ", and " sendfile . 107 | A print format which expects to get 108 | .SM FORTRAN 109 | carriage control style input. 110 | .IP "\fB\-bin\fR" 1.8i 0 111 | For 112 | .BR sendfile (1) 113 | only. 114 | Defines binary transmission, and defaults class `N', if nothing 115 | else is defined. 116 | .IP "\fB\-class C\fR" 1.8i 0 117 | Defines single uppercase alpha letter for the NJE spool 118 | class of the file. For 119 | .B sendfile 120 | the 121 | \-bin 122 | option defaults class to be `N', otherwise default is `A'. 123 | .IP "\fB\-fix\fR" 1.8i 0 124 | Makes padded records of native width; 80 for punch, and submit, 125 | 132+1 for print. 126 | On sendfile it asks output to be of fixed size. On such cases 127 | input lines get padded by the receiver to the fixed format. 128 | .IP "\fB\-fn fname ftype\fR" 1.8i 0 129 | For 130 | .BR sendfile "(1), " punch "(1), " print "(1) only." 131 | Defines NJE level \fI`file name'\fR and \fI`file type'\fR strings. 132 | Default values are: `STANDARD', and `INPUT'. 133 | .IP "\fB\-form FormName\fR" 1.8i 0 134 | Defines NJE level \fI`file form name'\fR to be used. 135 | Default value is `STANDARD'. 136 | .IP "\fB-lrecl ##\fR" 1.8i 0 137 | For 138 | .BR sendfile (1) 139 | defines logical record length. 140 | Defaults are: binary: 1022, others: 132. 141 | If your ASCII input is wider (or narrower), do consider using this 142 | option to optimize receiver performance. 143 | .IP "\fB\-rawpun\fR" 1.8i 0 144 | For 145 | .BR punch (1) 146 | only. 147 | Outputs fixed 80 chars per record lines, and expects same from input. 148 | (No cr/lfs wanted, just 80 bytes for each record.) 149 | .IP "\fB\-dist Distribution\fR" 1.8i 0 150 | Defines the RSCS Distribution code (max. 8 characters) which may be 151 | used to identify printed outputs. Defaults to user name of the sender 152 | translated to upper case. If not set here, the emulator inserts the 153 | default SYSTEM. 154 | .IP "\fB\-tag RSCS-TAG\fR" 1.8i 0 155 | Defines NJE RSCS TAG (136 characters) which is used to carry various 156 | informations especially at RJE applications. 157 | .LP 158 | Default behaviour is to read in lines, and convert them from 159 | .SM ASCII 160 | to 161 | .SM EBCDIC 162 | and pad or truncate to 80 char (132 for print) records 163 | which get spooled for transmission. 164 | .LP 165 | .SH ENVIRONMENT 166 | With environment variable 167 | .B EBCDICTBL 168 | user can select alternate EBCDIC <\-> ASCII translation 169 | tables. For more info, see 170 | .BR ebcdictbl (5). 171 | .LP 172 | .SH FILES 173 | .I /etc/funetnje.cf 174 | .SH SEE ALSO 175 | .BR bitspool (5), 176 | .BR bmail (8), 177 | .BR ebcdictbl (5), 178 | .BR funetnje (8), 179 | .BR mailify (8), 180 | .BR qrdr (8), 181 | .BR receive (1), 182 | .BR send (1), 183 | .BR transfer (1) 184 | .SH BUGS 185 | .LP 186 | Sendfile should figure out the lrecl in text files by smart pre-scanning 187 | of the file -- doable if sending real files ? 188 | .LP 189 | .SH DIAGNOSTICS 190 | These programs show their usage summary, when there is something 191 | wrong with input parameters. Subtle usage bugs might not be detected! 192 | .SH NOTES 193 | This program quartet is actually same program with 4 different 194 | invocation names, and therefore 4 (slightly) different functions. 195 | .SH AUTHORS 196 | .LP 197 | Yehavi Bourvine, Hebrew University of Yerusalem, Israel 198 | .I . 199 | .LP 200 | Matti Aarnio, Finnish University and Research Network \- FUNET, Finland 201 | .I . 202 | .LP 203 | Gerald Hanusch, Johannes Kepler Universitaet/Universitaet Linz, Austria 204 | . 205 | .LP 206 | Original (VMS oriented package) software by Yehavi Bourvine, 207 | UNIX features, plenty of modifications, file handling exits, 208 | man-pages by Matti Aarnio. 209 | Batch (SYSIN) facilities, and bug fixes prompted by Gerald Hanush, 210 | and in large part implemented by Matti Aarnio. 211 | -------------------------------------------------------------------------------- /man/submit.1: -------------------------------------------------------------------------------- 1 | .so man1/sendfile.1 2 | -------------------------------------------------------------------------------- /man/sysin.8: -------------------------------------------------------------------------------- 1 | .so man8/mailify.8 2 | -------------------------------------------------------------------------------- /man/transfer.1: -------------------------------------------------------------------------------- 1 | .so man1/bitcat.1 2 | -------------------------------------------------------------------------------- /man/ucp.8: -------------------------------------------------------------------------------- 1 | .\" $Header$ 2 | .\" 3 | .\" Man page for HUJI-NJE/FUNET-NJE on UNIX system. 4 | .\" 5 | .\" Written by Matti Aarnio 6 | .\" 7 | .\" Date: 27-Dec-1990, 18-Sep-1993, 11-Feb-1994 8 | .\" 9 | .fp 4 CW 10 | .ds ]W Funet-Nje 8 UNIX 3.0 11 | .TH "FUNET-NJE on UNIX" 8 "11-Feb 1994" 12 | .SH NAME 13 | ucp \- FUNETNJE bitnet communication program control function interface. 14 | .SH SYNOPSIS 15 | ucp 16 | .RB [ " command to be issued " ] 17 | .SH DESCRIPTION 18 | .IX "ucp" 19 | .IX "bitnet" 20 | .IX "funetnje" 21 | .LP 22 | .I Ucp 23 | command lets system manager to control 24 | .BR funetnje (8) 25 | functionality and modify some of parameters given on 26 | configuration file (which usually is 27 | .IR /etc/funetnje.cf .) 28 | .LP 29 | .I Ucp 30 | can be started without any command line arguments, and then 31 | it asks commands with 32 | \f4NJE-CP> 33 | prompt. 34 | .LP 35 | \f4ucp help\fR gives list of commands that 36 | .I ucp 37 | understands. 38 | .SH SEE ALSO 39 | .BR funetnje (8), 40 | .BR mailify (1), 41 | .BR send (1), 42 | .BR sendfile (1), 43 | .BR receive (1), 44 | .BR bmail (8), 45 | .SH DIAGNOSTICS 46 | Obscure. Most return results come with `mesg' facility, and user 47 | .B must 48 | have 49 | .RB ` mesg (1) " y" ' 50 | to be able to receive those messages. 51 | .SH NOTE 52 | To be able to use this facility, you must have write permission to 53 | the 54 | .SM FUNET-NJE 55 | inter-module communications `mailbox', which is implemented as 56 | owner/group writable FIFO. 57 | This program 58 | .B should not 59 | be turned into a SUID/SGID program, rather those who must be able 60 | to command the funetnje shall be either super-user capable, or have 61 | the access-group of the communications pipe. 62 | See 63 | .BR funetnje (8) 64 | for more. 65 | .SH AUTHORS 66 | .LP 67 | Yehavi Bourvine, Hebrew University of Yerusalem, Israel 68 | .I . 69 | .LP 70 | Matti Aarnio, Finnish University and Research Network \- FUNET, Finland 71 | .I . 72 | .LP 73 | Original (VMS oriented package) software by Yehavi Bourvine, 74 | UNIX features, plenty of modifications, man-pages by Matti Aarnio. 75 | -------------------------------------------------------------------------------- /man/ygone.1: -------------------------------------------------------------------------------- 1 | .so man1/send.1 2 | -------------------------------------------------------------------------------- /msg-exit.cf: -------------------------------------------------------------------------------- 1 | # 2 | # MSG-EXIT.CF for FUNET-NJE 3 | # 4 | # Some first ideas about patterns, et.al.: 5 | # 6 | # Actions: CMD: BUILTIN, RUN 7 | # MSG: BRCAST, DISCARD, RUN, (PIPE) 8 | # Argument tokens for 'RUN': TOUSER, TONODE, FRUSER, FRNODE, TEXT, ARGS 9 | # Arguments for 'BUILTIN': "HELP", "HARDCODED", "ERROR"/ERROR msg-string", 10 | # "ALIAS remap-pattern" 11 | # Patterns work as follows: 12 | # TO*KEN -- match (only) any of input words: TO TOK TOKE TOKEN 13 | # * -- match any token, (but not blank) 14 | # ** -- match any number of tokens, including nothing. 15 | # Remap-patterns work as follows: 16 | # $nn -- substitute nn:th text token into this place 17 | # ANYSTRING -- copy it verbatim 18 | # 19 | # 20 | 21 | CmdHelpFile: /usr/local/lib/huji/cmd-help.txt 22 | 23 | #$TOUSER $TONODE $FRUSER $FRNODE C pattern ACTION args 24 | # Actually TOUSER is not tested on commands, it will be blank anyway.. 25 | . FINFILES * * C "HIL*FE" BUILTIN HELP English quick document is available via 'HELP' command. 26 | . FINFILES * * C "SOS" BUILTIN HELP English quick document is available via 'HELP' command. 27 | . FINFILES * * C "H*ELP" BUILTIN HELP 28 | . FINFILES * * C "M * * * **" BUILTIN HARDCODED 29 | . FINFILES * * C "MSG * * * **" BUILTIN HARDCODED 30 | . FINFILES * * C "M*SG **" BUILTIN ERROR Too few arguments for the MSG 31 | . FINFILES * * C "CMD * * **" BUILTIN HARDCODED 32 | . FINFILES * * C "CMD **" BUILTIN ERROR Too few arguments for the CMD 33 | . FINFILES * * C "Q*UERY SYS*TEM S" BUILTIN HARDCODED 34 | . FINFILES * * C "Q*UERY SYS*TEM" BUILTIN HARDCODED 35 | . FINFILES * * C "Q*UERY STAT*S" BUILTIN HARDCODED 36 | . FINFILES * * C "Q*UERY *" BUILTIN HARDCODED 37 | . FINFILES * * C "Q*UERY * Q*UEUE" BUILTIN HARDCODED 38 | . FINFILES * * C "CPQ*UERY N*AMES" BUILTIN HARDCODED 39 | . FINFILES * * C "CPQ*UERY U*SER *" BUILTIN HARDCODED 40 | . FINFILES * * C "CPQ*UERY U*SER" BUILTIN HARDCODED 41 | . FINFILES * * C "CPQ*UERY LOG" BUILTIN HARDCODED 42 | . FINFILES * * C "CPQ*UERY CPU" BUILTIN HARDCODED 43 | . FINFILES * * C "CPQ*UERY CP*LEVEL" BUILTIN HARDCODED 44 | . FINFILES * * C "CPQ*UERY IND*ICATE" BUILTIN HARDCODED 45 | . FINFILES * * C "CPQ*UERY T*IME" BUILTIN HARDCODED 46 | . FINFILES * * C "CP*QUERY T*IME" BUILTIN ALIAS CPQ $2 47 | . FINFILES * * C "EC*HO **" RUN /usr/local/bin/send -s $FRUSER@$FRNODE *CMD was '$TEXT' 48 | # The default 49 | . FINFILES * * C "**" BUILTIN ERROR 50 | 51 | #$TOUSER $TONODE $FRUSER $FRNODE M ACTION args 52 | # "." == FRUSER is blank, that is from some 'SYSTEM'.. 53 | VMNET * * * M DISCARD 54 | MAILER * * * M DISCARD 55 | MAILSERV FINFILES . * M DISCARD 56 | MAILSERV FINFILES * * M RUN /usr/local/lib/mailserver/nje-msg $FRUSER $FRNODE $TEXT 57 | LISTSERV FINFILES . * M DISCARD 58 | LISTSERV FINFILES * * M RUN /usr/local/bin/send -u MAILSERV $FRUSER@$FRNODE *Sorry, we do not have LISTSERV here, try MAILSERV. 59 | ECHO FINFILES . * M DISCARD 60 | ECHO FINFILES * * M RUN /usr/local/bin/send -u echo $FRUSER@$FRNODE *Got Message: '$TEXT' 61 | FINGER FINFILES . * M DISCARD 62 | FINGER FINFILES * * M RUN /usr/local/lib/huji/nje-finger $FRUSER $FRNODE $ARGS 63 | 64 | # The default 65 | * * * * M BRCAST 66 | -------------------------------------------------------------------------------- /namesfilter: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/namesfilter -------------------------------------------------------------------------------- /namesfilter.c: -------------------------------------------------------------------------------- 1 | /* 2 | * namesfilter -- generate Zmailer's routes.bitnet database 3 | * by parsing BITEARN.NODES node database 4 | * 5 | * Matti Aarnio 1994-Sep-27 6 | * 7 | * Format of the BITEARN NODES -file is described (well, partially) 8 | * in the NEWTAGS DESCRIPT available from your nearest NETSERV.. 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include "sysexits.h" 15 | 16 | extern char **namesparse(/*FILE *namesfile, char **picktags, char *selector*/); 17 | 18 | char *progname = ""; 19 | 20 | void 21 | usage(msg) 22 | char *msg; 23 | { 24 | if (msg) { 25 | fprintf(stderr,"%s: %s\n",progname,msg); 26 | exit(EX_USAGE); 27 | } 28 | fprintf(stderr,"\ 29 | %s: Filters BITEARN.NODES data to mailer databases\n\ 30 | namesfilter -zmailer < bitearn.nodes | sort > bitnet.routes\n\ 31 | namesfilter -smail < bitearn.nodes | sort > bitnet.routes\n\ 32 | namesfilter -sendmail < bitearn.nodes | sort > bitnet.routes\n\ 33 | namesfilter -netsoft < bitearn.nodes | sort > netsoft.list\n", 34 | progname); 35 | exit(EX_USAGE); 36 | } 37 | 38 | /* extern char *strchr(), *strrchr(); 39 | extern int strncmp(); */ 40 | 41 | #define FMT_ZMAILER 1 42 | #define FMT_SENDMAIL 2 43 | #define FMT_SMAIL 3 44 | #define FMT_NETSOFT 4 45 | 46 | void strlower(s) 47 | char *s; 48 | { 49 | while (*s != 0) { 50 | if (*s >= 'A' && *s <= 'Z') 51 | *s += ('a' - 'A'); 52 | ++s; 53 | } 54 | } 55 | 56 | int 57 | main(argc,argv) 58 | int argc; 59 | char *argv[]; 60 | { 61 | char **np; 62 | static char *picklist[] = { "node.","internet.", 63 | "servers1.", "servers2.", "servers3.", 64 | "servers4.", "servers5.", "servers6.", 65 | "servers7.", "servers8.", "servers9.", 66 | "servers10.","servers11.","servers12.", 67 | NULL }; 68 | static char *selector = ":type.NJE"; 69 | char *node; 70 | char *mailer; 71 | char *internet; 72 | char *netsoft; 73 | int i; 74 | int outfmt; 75 | char *smailtail = ""; 76 | 77 | node = (char*)strrchr(argv[0],'/'); 78 | if (node) progname = node+1; 79 | 80 | if (argc != 2) usage(NULL); 81 | if (strcmp(argv[1],"-zmailer")==0) { 82 | outfmt = FMT_ZMAILER; 83 | } else if (strcmp(argv[1],"-smail")==0) { 84 | outfmt = FMT_SMAIL; 85 | } else if (strcmp(argv[1],"-sendmail")==0) { 86 | outfmt = FMT_ZMAILER; /* At least P.Bryant uses this same format.. */ 87 | } else if (strcmp(argv[1],"-netsoft")==0) { 88 | outfmt = FMT_NETSOFT; 89 | /* picklist[0] == "node." */ 90 | picklist[1] = "netsoft."; 91 | picklist[2] = NULL; 92 | } else { 93 | usage("Unknown format specifier! Valid ones: -zmailer, -sendmail, -smail"); 94 | } 95 | 96 | if (outfmt == FMT_SMAIL) 97 | smailtail = "!%s"; 98 | else 99 | smailtail = ""; 100 | 101 | /* The FIRST one is a version stamp, we skip it.. */ 102 | np = namesparse(stdin,picklist,NULL); 103 | 104 | while (!feof(stdin) && !ferror(stdin)) { 105 | np = namesparse(stdin,picklist,selector); 106 | if (!np) break; 107 | 108 | node = NULL; 109 | mailer = NULL; 110 | internet = NULL; 111 | netsoft = NULL; 112 | for (i=0; np[i] != NULL; ++i) { 113 | if (strncmp(np[i],":node.",6)==0) 114 | node = np[i]+6; 115 | else if (strncmp(np[i],":internet.",10)==0) 116 | internet = np[i]+10; 117 | else if (strncmp(np[i],":servers",8)==0) { 118 | /* There can be a LOT of ":serversN." -tags */ 119 | char *s = np[i]+8; 120 | while ((*s >= '0' && *s <= '9') || *s == '.') ++s; 121 | mailer = s; 122 | while (*s != 0) { 123 | /* Server's that are OUTONLY shall not be used 124 | for destination.. */ 125 | if (*s == 'O') { 126 | if (strncmp("OUTONLY",s,7)==0) { 127 | mailer = NULL; 128 | break; 129 | } 130 | } 131 | ++s; 132 | } 133 | } else if (strncmp(np[i],":netsoft.",9)==0) 134 | netsoft = np[i]+9; 135 | } 136 | strlower(node); 137 | printf("%s\t",node); 138 | if (strlen(node)<8) 139 | putc('\t',stdout); 140 | 141 | if (outfmt == FMT_NETSOFT) { 142 | 143 | if (netsoft == NULL) 144 | netsoft = "(unlisted)"; 145 | printf("%s\n",netsoft); 146 | 147 | } else { /* All MAILER formats */ 148 | 149 | if (!mailer) { 150 | printf("defrt1!%s%s\n",node,smailtail); 151 | } else { 152 | /* Some mailer defined, what it is ? */ 153 | char *m0, *m1, *m2, *m3, *m4; 154 | int netdata = 0; 155 | int rfc822 = 0; 156 | m0 = mailer; /* The MAILER definition! */ 157 | while (*mailer != 0 && *mailer != '(') ++mailer; 158 | if (*mailer == '(') *mailer++ = 0; 159 | m1 = strchr(m0,'@'); if (m1 != NULL) *m1 = '!'; 160 | m1 = mailer; /* "MAIL", ignored.. */ 161 | while (*mailer != 0 && *mailer != ',') ++mailer; 162 | if (*mailer == ',') *mailer++ = 0; 163 | m2 = mailer; /* PU, ND, LP .. format, default: PU */ 164 | while (*mailer != 0 && *mailer != ',') ++mailer; 165 | if (*mailer == ',') *mailer++ = 0; 166 | m3 = mailer; /* Class, ignored */ 167 | while (*mailer != 0 && *mailer != ',') ++mailer; 168 | if (*mailer == ',') *mailer++ = 0; 169 | m4 = mailer; /* BSMTP, BSMTP RFC822, default: BSMTP */ 170 | while (*mailer != 0 && *mailer != ',' && *mailer != ')') ++mailer; 171 | /* It is split.. */ 172 | while (*m2 != 0) { 173 | if (strncmp(m2,"ND",2)==0) { 174 | netdata = 1; 175 | ++m2; 176 | } 177 | ++m2; 178 | } 179 | while (*m4 != 0) { 180 | if (strncmp(m4,"BSMTP",5)==0) { 181 | m4 += 4; 182 | } else if (strncmp(m4,"RFC822",6)==0) { 183 | rfc822 = 1; 184 | m4 += 5; 185 | } 186 | ++m4; 187 | } 188 | strlower(m0); 189 | /* The entry is parsed, output it.. */ 190 | 191 | if (netdata == 0 && rfc822 == 0) 192 | printf("bsmtp3!%s%s\n",m0,smailtail); 193 | else if (netdata == 0 && rfc822 != 0) 194 | printf("bsmtp3rfc!%s%s\n",m0,smailtail); 195 | else if (netdata != 0 && rfc822 == 0) 196 | printf("bsmtp3nd!%s%s\n",m0,smailtail); 197 | else 198 | printf("bsmtp3ndrfc!%s%s\n",m0,smailtail); 199 | } 200 | } 201 | } 202 | return 0; 203 | } 204 | -------------------------------------------------------------------------------- /namesparser.c: -------------------------------------------------------------------------------- 1 | /* namesparse -- parse IBM VM/SP "NAMES DATA" entries. 2 | 3 | :. :. .. 4 | :.info... 5 | 6 | Feed this routine: 7 | FILE *namesfile; 8 | char *picktags[]; (NULL means EVERYTHING, "tag." !) 9 | char *selector; (A ":." which identifies records to accept, 10 | a NULL means ANY.) 11 | 12 | returns: 13 | NULL -- end of file, no data found 14 | char *results[]; (A NULL terminated array of pointers to strings) 15 | 16 | By Matti Aarnio 14-Feb-1994 */ 17 | 18 | #include 19 | #include 20 | #include 21 | /* extern char *malloc(); 22 | extern char *realloc(); 23 | extern void free(); 24 | extern char *strchr(); */ 25 | 26 | char *MEMFAIL[] = { ":failure.MALLOC FAILED",NULL }; 27 | 28 | 29 | char ** 30 | namesparse(namesfile,picktags,selector) 31 | FILE *namesfile; 32 | char *picktags[]; 33 | char *selector; 34 | { 35 | int linesize = 256; /* Our advanced knowledge.. */ 36 | char *linebuf = NULL; 37 | char *s, *s1, *s2; 38 | char **results = NULL; 39 | int resultspc = 0; 40 | int resultcnt = 0; 41 | int first_char; 42 | int pick_this; 43 | int comp_len; 44 | int select_len = 0; 45 | int select_taglen = 0; 46 | int selector_matched = (selector == NULL); /* No selector == match */ 47 | int pick_len; 48 | int begin_found = 0; /* Found a line starting with ':' */ 49 | 50 | linebuf = malloc(linesize); 51 | if (!linebuf) return NULL; 52 | 53 | if (selector) { 54 | select_len = strlen(selector); 55 | s1 = selector + 1; 56 | while (*s1 != 0 && *s1 != '.') ++s1; 57 | select_taglen = (s1 - selector); 58 | } 59 | 60 | while (1) { 61 | /* Look for them... */ 62 | if (feof(namesfile) || ferror(namesfile)) { 63 | free(linebuf); 64 | return results; 65 | } 66 | 67 | /* First begin, or continuation of more ? */ 68 | first_char = getc(namesfile); 69 | ungetc(first_char,namesfile); 70 | if (first_char == ':' && begin_found) { 71 | if (selector_matched && results != NULL) 72 | return results; 73 | /* Didn't match the select, but MAY have data in the results[], 74 | scratch it.. */ 75 | if (results != NULL) { 76 | while (resultcnt > 0) 77 | free(results[--resultcnt]); 78 | results[0] = NULL; 79 | } 80 | resultcnt = 0; 81 | } 82 | if (first_char == ':') /* Ok, found it */ 83 | begin_found = 1; 84 | 85 | s = linebuf; 86 | if (fgets(linebuf,linesize-1,namesfile) == NULL) { 87 | free(linebuf); 88 | return results; 89 | } 90 | while ((s = strchr(linebuf+linesize-256,'\n')) == NULL) { 91 | char *newbuf; 92 | if (feof(namesfile) || ferror(namesfile)) 93 | break; /* EOF w/o newline at the end ? */ 94 | linesize += 256; 95 | newbuf = realloc(linebuf,linesize); 96 | if (!newbuf) { 97 | free(linebuf); 98 | return results; 99 | } 100 | linebuf = newbuf; 101 | if (fgets(linebuf+linesize-256-1,256,namesfile) == NULL) 102 | break; /* EOF while scanning it in */ 103 | } 104 | if (s) *s = 0; /* We have valid 's', when we have the 105 | terminating newline. Zap the newline. */ 106 | 107 | /* Ok, we have an input line, now get it split.. */ 108 | s = linebuf; 109 | while (*s == ' ') ++s; /* Skip the initial blanks */ 110 | 111 | while (*s != 0) { 112 | int tag_len; 113 | char *t; 114 | int prev_char; 115 | 116 | s1 = s; /* This position SHOULD contain a colon.. we don't 117 | check it, though.. */ 118 | prev_char = *s++; 119 | /* Scan until next colon, or end of string */ 120 | while (*s != 0 && !(*s == ':' && prev_char == ' ')) 121 | prev_char = *s++; 122 | 123 | /* Chop trailing spaces */ 124 | s2 = s-1; 125 | while (s2 > s1 && *s2 == ' ') *s2-- = 0; 126 | 127 | /* Total component length */ 128 | comp_len = (s2 - s1) +1; 129 | 130 | /* Size of the tag in it; ":." */ 131 | t = s1 + 1; 132 | while (*t != ' ' && *t != 0 && *t != '.') ++t; 133 | /* :. -> *s1 == ':', *t == '.' */ 134 | tag_len = (t - s1); /* INCLUDE the terminating "." ! */ 135 | 136 | if (selector != NULL && 137 | tag_len == select_taglen && comp_len == select_len) { 138 | if (strncmp(selector,s1,comp_len)==0) 139 | selector_matched = 1; 140 | } 141 | 142 | if (picktags) { /* See if we take only some entries */ 143 | char **picks = picktags; 144 | pick_this = 0; 145 | while (*picks != NULL) { 146 | if (strncmp(s1+1,*picks,tag_len)==0) { 147 | pick_this = 1; 148 | break; 149 | } 150 | ++picks; 151 | } 152 | } else 153 | pick_this = 1; 154 | 155 | /* If we pick it, put it into "results" */ 156 | if (pick_this) { 157 | if (results == NULL) { 158 | resultspc = 8; 159 | results = (char**)malloc(sizeof(char*)*(resultspc+1)); 160 | } 161 | if (results == NULL) return MEMFAIL; 162 | if (resultcnt >= resultspc) { 163 | resultspc += 8; 164 | results = (char**)realloc(results,sizeof(char*)*(resultspc+1)); 165 | } 166 | if (results == NULL) return MEMFAIL; 167 | results[resultcnt] = malloc(comp_len+1); 168 | if (results[resultcnt] == NULL) return MEMFAIL; 169 | memcpy(results[resultcnt],s1,comp_len+1); 170 | ++resultcnt; 171 | results[resultcnt] = NULL; 172 | } 173 | } /* .. while on line */ 174 | } /* .. While (1) on record */ 175 | } 176 | 177 | 178 | #ifdef TEST 179 | int 180 | main(argc,argv) 181 | int argc; 182 | char *argv[]; 183 | { 184 | char *picklist[] = { 185 | "node.","internet.","servers1.","servers2.",NULL 186 | }; 187 | char **results; 188 | int i; 189 | 190 | while (!feof(stdin) && !ferror(stdin)) { 191 | results = namesparse(stdin,argc > 1 ? NULL : picklist,NULL); 192 | if (results == NULL) 193 | printf("RET=NULL\n"); 194 | else { 195 | printf("%s\n",results[0]); 196 | for (i=1; results[i] != NULL; ++i) 197 | printf("\t%s\n",results[i]); 198 | for (i=0; results[i] != NULL; ++i) 199 | free(results[i]); 200 | free(results); 201 | } 202 | } 203 | return 0; 204 | } 205 | #endif 206 | -------------------------------------------------------------------------------- /ndlib.h: -------------------------------------------------------------------------------- 1 | /* FUNET-NJE Client utilities Header file 2 | * 3 | * Common set of client used utility routines. 4 | * These are collected to here from various modules for eased 5 | * maintance. 6 | * 7 | * Matti Aarnio 14-Nov-1993 8 | */ 9 | /* NETDATA stuff.. */ 10 | 11 | #ifndef __ 12 | # ifdef __STDC__ 13 | # define __(x) x 14 | # else 15 | # define __(x) () 16 | # define volatile /*K&R has no volatile */ 17 | # define const /*K&R has no const */ 18 | # endif 19 | #endif 20 | 21 | struct puncher { 22 | FILE *fd; 23 | char buf[82]; 24 | int len; 25 | int punchcnt; 26 | }; 27 | 28 | extern int punch_buffered __((struct puncher *PUNCH, void *buf, 29 | int size, int flushflg)); 30 | 31 | /* Values of recfm for netdata generation, OR them together.. */ 32 | #define ND_VAR 0x4000 /* Records within block: Variable */ 33 | #define ND_VARY 0x0002 /* Varying length records w/o 4 byte length */ 34 | #define ND_FIXED 0x8000 /* Fixed length records */ 35 | #define ND_BLOCKED 0x1000 /* Blocked records */ 36 | #define ND_ASA_CC 0x4000 /* ASA carriage control */ 37 | 38 | extern int fill_inmr01 __((struct puncher *PUNCH, FILE *infile, 39 | char *From, char *To, char *fname, char *ftype, 40 | int lrecl, int recfm, char *askack)); 41 | extern int fill_inmr06 __((struct puncher *PUNCH)); 42 | extern int punch_nddata __((struct puncher *PUNCH, void *buf, int size)); 43 | 44 | extern int do_netdata __((FILE *infile, struct puncher *PUNCH, 45 | char *From, char *To, char *fname, char *ftype, 46 | int lrecl, int recfm, int binary,char *askack)); 47 | 48 | struct ndparam { 49 | FILE *outfile; 50 | char const *outname; 51 | char *defoutname; 52 | int profsnote; 53 | int ackwanted; 54 | char ACKKEY[40]; 55 | int ackkeylen; 56 | void (*outproc)(); 57 | void (*closeproc)(); 58 | char DSNAM[40]; 59 | char MEMBR[10]; 60 | char FTIMES[16]; 61 | time_t ftimet; 62 | char CTIMES[16]; 63 | time_t ctimet; 64 | int RecordsCount; 65 | }; 66 | 67 | extern int parse_netdata __((unsigned char *buffer, int size, 68 | struct ndparam *ndp, 69 | int binary, int debugdump)); 70 | -------------------------------------------------------------------------------- /netinit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # NETINIT processor 4 | # 5 | # This is run once a day, and when new data is available, 6 | # it is processed straight away. 7 | # 8 | # Part of FUNETNJE software package 9 | # 10 | 11 | #N=-n # Don't remove the file from the reader 12 | N= # Remove the file from the reader 13 | 14 | NJEDIR=/l/funetnje # Where FUNETNJE programs are 15 | export N NJEDIR 16 | nodename=finfiles # lowercase 17 | NODENAME=FINFILES # uppercase 18 | 19 | cd /l/mail/db # ZMailer router database directory 20 | 21 | PATH=/usr/local/bin:/usr/local/etc:$PATH # Dirs where qrdr, receive, 22 | export PATH # and ucp reside.. 23 | 24 | qrdr -u NETINIT -l | \ 25 | ( while read fname datatype src dest fn ft junk1 class junk 26 | do { 27 | if [ "$fn.$ft" = "${NODENAME}.NETINIT" ]; then 28 | echo "${NODENAME}.NETINIT: " $fname $datatype \ 29 | $src $dest $fn.$ft $class 30 | receive $N -a -o ${NJEDIR}/${nodename}.netinit $fname && \ 31 | { # Received most successfully the NETINIT file 32 | echo "Ndparse ok, generating routes.." 33 | ( 34 | cd ${NJEDIR} # Change the dir to NJEDIR.. 35 | ./njeroutes ${nodename}.header ${nodename}.netinit \ 36 | ${nodename}.routes 37 | ) 38 | # Routing regenerated, order route database reopen 39 | ucp rescan route 40 | } 41 | 42 | elif [ "$fn.$ft" = "BITEARN.NODES" ]; then 43 | echo "BITEARN.NODES: " $fname $datatype $src \ 44 | $dest $fn.$ft $class 45 | 46 | receive $N -a -o bitearn.nodes $fname && \ 47 | { # Received BITEARN.NODES successfully. 48 | ${NJEDIR}/namesfilter -zmailer < bitearn.nodes | \ 49 | sort > routes.bitnet 50 | /etc/zmailer router 51 | } 52 | else 53 | echo "Unknown file for NETINIT: " $fname \ 54 | $datatype $src $dest $fn.$ft $class 55 | fi 56 | } done 57 | ) 58 | 59 | exit 0 60 | -------------------------------------------------------------------------------- /nje-finger.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Sample nje-finger application for doing command 'FINGER' at FUNET-NJE 4 | # 5 | 6 | echo "NJEFINGER: '$*'" >> /tmp/nje.finger.log 7 | touser="$1" 8 | tonode="$2" 9 | shift; shift 10 | argstr="$*" 11 | echo "NJEFINGER: argstr='$argstr'" >> /tmp/nje.finger.log 12 | 13 | /usr/ucb/finger "$argstr" | 14 | /usr/local/bin/send -u finger "$touser@$tonode" 15 | -------------------------------------------------------------------------------- /nje.route: -------------------------------------------------------------------------------- 1 | xV4nje.routeDRBVM3DRBVM3EVERS1305YAGI3EYAGI+LOCALA -------------------------------------------------------------------------------- /njeroutes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/njeroutes -------------------------------------------------------------------------------- /njeroutes.c: -------------------------------------------------------------------------------- 1 | /* NJEROUTES.C 1.3-mea 2 | | 3 | | Build up the route database for FUNET-NJE. 4 | | Copyright (C) Finnish University and Research Network, FUNET 5 | | 1991,1993,1994 6 | | 7 | | There is marginal resemblance with original UNIX_BUILD of 8 | | HUJI-NJE, however this is no longer such a a primitive thing, 9 | | as that was... 10 | */ 11 | 12 | #include "consts.h" 13 | #include "prototypes.h" 14 | #include "bintree.h" 15 | 16 | /* extern char *sys_errlist[]; */ 17 | extern int errno; 18 | 19 | char *pname; 20 | 21 | int CompareRoute(r1,r2) 22 | struct ROUTE_DATA *r1, *r2; 23 | { 24 | return strcmp(r1->DestNode, r2->DestNode); 25 | } 26 | 27 | int 28 | main(argc,argv) 29 | int argc; 30 | char *argv[]; 31 | { 32 | char *c, line[132], 33 | site[21], LineName[21], format[20], 34 | temp_line[132]; /* Just a place holder */ 35 | char in_file[80], header_file[80], out_file[80]; 36 | FILE *Ifd, *fd, *Dup=NULL; 37 | int counter, Dcount, lines; 38 | struct ROUTE_DATA RouteRecord; 39 | struct Bintree *BT; 40 | 41 | if ((pname = strrchr(argv[0],'/')) != NULL) 42 | ++pname; 43 | else 44 | pname = argv[0]; 45 | 46 | /* Get files' names */ 47 | if (argc != 4) { 48 | printf("%s Creates FUNET-NJE routing tables.\n",pname); 49 | printf("%s Given 3 arguments the interactive mode is not activated:\n",pname); 50 | printf("%s Args are in order: Header-Fname, RoutingTbl-Fname, OutputFname\n",pname); 51 | 52 | 53 | printf("Header file: "); gets(header_file); 54 | printf("Routing table: "); gets(in_file); 55 | printf("Output file: "); gets(out_file); 56 | } else { 57 | strncpy( header_file,argv[1],sizeof header_file -1); 58 | strncpy( in_file,argv[2],sizeof in_file -1); 59 | strncpy( out_file,argv[3],sizeof out_file -1); 60 | } 61 | 62 | if ((c = strchr(header_file, '\n')) != NULL) *c = '\0'; 63 | if ((c = strchr(in_file, '\n')) != NULL) *c = '\0'; 64 | if ((c = strchr(out_file, '\n')) != NULL) *c = '\0'; 65 | 66 | if ((Ifd = fopen(header_file, "r")) == NULL) { 67 | printf("Can't open header file '%s'\n", header_file); 68 | exit(1); 69 | } 70 | if ((fd = fopen(in_file, "r")) == NULL) { 71 | printf("Can't open input file: %s\n", in_file); 72 | exit(1); 73 | } 74 | 75 | /* Open the database file */ 76 | 77 | /* Make sure it doesn't exist now.. */ 78 | unlink(out_file); 79 | BT = bintree_open(out_file, 80 | sizeof(struct ROUTE_DATA), 81 | CompareRoute); 82 | if (BT == NULL) { 83 | int oerrno = errno; 84 | fprintf(stderr,"%s: Open of `%s' database failed because of error: %s\n", 85 | pname,out_file,PRINT_ERRNO); 86 | exit(oerrno); 87 | } 88 | 89 | counter = 0; Dcount = 0; 90 | lines = 0; 91 | printf("Records read:\n"); 92 | 93 | /* The header file */ 94 | 95 | while (fgets(line, sizeof line, Ifd) != NULL) { 96 | ++lines; 97 | if ((c = strchr(line, '\n')) != 0) *c = 0; 98 | /*printf("Got line: '%s'\n",line);*/ 99 | if (*line == '*') continue; /* Comment line */ 100 | if (*line == '#') continue; /* Comment line */ 101 | if (*line == 0 ) continue; /* Empty line */ 102 | counter++; 103 | if (counter % 100 == 0) { 104 | printf("%d%s", counter,(counter%1000 == 0) ? "\n":" "); 105 | fflush(stdout); 106 | } 107 | if (sscanf(line, "%*s %s %s %s", 108 | site, LineName, format) < 3) { 109 | printf("Illegal line: %s\n", line); 110 | continue; 111 | } 112 | if (strcasecmp(LineName,"DEFAULT")==0 || 113 | strcasecmp(LineName,"SYSTEM")==0 || 114 | strcasecmp(LineName,"OFF")== 0) { 115 | printf("Bad route target: %d: '%s'\n",lines, line); 116 | continue; 117 | } 118 | 119 | memcpy(RouteRecord.DestNode,site,8); 120 | RouteRecord.DestNode[8] = 0; 121 | memcpy(RouteRecord.DestLink,LineName,8); 122 | RouteRecord.DestLink[8] = 0; 123 | RouteRecord.Fmt = *format; 124 | 125 | if (bintree_find(BT,&RouteRecord) == NULL) { 126 | /* Not found already, insert! */ 127 | bintree_insert(BT,&RouteRecord); 128 | } else { 129 | /* A duplicate ! */ 130 | ++Dcount; 131 | if (!Dup) Dup = fopen("DUPLICATES.TMP","w"); 132 | if (Dup) fprintf(Dup,"HdrDup: %d: %s\n",lines, line); 133 | } 134 | } 135 | 136 | printf("Processing routing table\n"); 137 | 138 | /* Now process the routing table */ 139 | 140 | lines = 0; 141 | while (fgets(line, sizeof line, fd) != NULL) { 142 | ++lines; 143 | if ((c = strchr(line, '\n')) != 0) 144 | *c = 0; 145 | /*printf("Got line: '%s'\n",line);*/ 146 | if (*line == '*') continue; /* Comment line */ 147 | if (*line == '#') continue; /* Comment line */ 148 | if (*line == 0 ) continue; /* Empty line */ 149 | counter++; 150 | if (counter % 100 == 0) { 151 | printf("%d%s", counter,(counter%1000 == 0) ? "\n":" "); 152 | fflush(stdout); 153 | } 154 | /* 'ROUTE node ToLink' */ 155 | if (sscanf(line, "%s %s %s", 156 | temp_line, site, LineName) < 2) { 157 | printf("Illegal line: %s\n", line); 158 | continue; 159 | } 160 | if (strcasecmp(LineName,"DEFAULT")==0 || 161 | strcasecmp(LineName,"SYSTEM")==0 || 162 | strcasecmp(LineName,"OFF")==0) { 163 | printf("Bad route target: '%s'\n",line); 164 | continue; 165 | } 166 | memcpy(RouteRecord.DestNode,site,8); 167 | RouteRecord.DestNode[8] = 0; 168 | memcpy(RouteRecord.DestLink,LineName,8); 169 | RouteRecord.DestLink[8] = 0; 170 | RouteRecord.Fmt = *format; 171 | 172 | if (bintree_find(BT,&RouteRecord) == NULL) { 173 | /* Not found already, insert! */ 174 | bintree_insert(BT,&RouteRecord); 175 | } else { 176 | /* A duplicate ! */ 177 | ++Dcount; 178 | if (!Dup) Dup = fopen("DUPLICATES.TMP","w"); 179 | if (Dup) fprintf(Dup,"RteDup: %d: %s\n",lines, line); 180 | } 181 | } 182 | 183 | fclose(fd); 184 | fclose(Ifd); 185 | bintree_close(BT); 186 | 187 | printf("\nTotal records inserted: %d, %d duplicates in DUPLICATE.TMP\n", 188 | counter, Dcount); 189 | if (Dup) fclose(Dup); 190 | return 0; 191 | } 192 | 193 | -------------------------------------------------------------------------------- /nmr_unix.c: -------------------------------------------------------------------------------- 1 | /* NMR.C V2.7-mea 2 | | Copyright (c) 1988,1989,1990 by 3 | | The Hebrew University of Jerusalem, Computation Center. 4 | | 5 | | This software is distributed under a license from the Hebrew University 6 | | of Jerusalem. It may be copied only under the terms listed in the license 7 | | agreement. This copyright message should never be changed or removed. 8 | | This software is gievn without any warranty, and the Hebrew University 9 | | of Jerusalem assumes no responsibility for any damage that might be caused 10 | | by use or misuse of this software. 11 | 12 | | UNIX environment specific versions of some routines. 13 | */ 14 | 15 | /* 16 | | Loop over all users in the system. Look for those that are interactive. 17 | | from those either list all of them (if UserName points to Null), or look for 18 | | a specific username (if UserName points to some string). 19 | | If a list of users is requested, we try to block 6 usernames in a single 20 | | line. 21 | */ 22 | 23 | #include "consts.h" 24 | #include "prototypes.h" 25 | #include 26 | #include 27 | 28 | #ifndef UTMP_FILE 29 | #define UTMP_FILE "/etc/utmp" 30 | #endif 31 | 32 | 33 | void 34 | list_users(Faddress, Taddress, cmd, UserName) 35 | const char *Faddress, *Taddress; 36 | char *UserName; 37 | const char cmd; 38 | { 39 | char line[LINESIZE]; 40 | int fd, lines; 41 | struct utmp Utmp; 42 | struct passwd *pwd; 43 | struct stat stats; 44 | time_t now; 45 | char tty[16]; 46 | char idle[8]; 47 | int idles; 48 | char *s; 49 | int users = 0; 50 | 51 | time(&now); 52 | 53 | if ((fd = open(UTMP_FILE,O_RDONLY,0600)) < 0) { 54 | sprintf(line, 55 | "Can't open `%s' for reading. No CPQ USER commands now.", 56 | UTMP_FILE); 57 | send_nmr(Faddress, Taddress, line, strlen(line),ASCII, CMD_MSG); 58 | } else { 59 | lines = 0; 60 | while (read(fd,(void*)&Utmp,sizeof Utmp) == sizeof Utmp) { 61 | char uname[9]; 62 | #ifdef LOGIN_PROCESS /* POSIX or what ?? */ 63 | if (Utmp.ut_type != LOGIN_PROCESS && 64 | Utmp.ut_type != USER_PROCESS) continue; 65 | #endif 66 | if (*Utmp.ut_name == 0) continue; /* Try next */ 67 | strncpy(uname,Utmp.ut_name,8); 68 | uname[8] = 0; 69 | pwd = getpwnam(uname); 70 | if (pwd == NULL) continue; /* Hmm ??? */ 71 | ++users; 72 | if (cmd == 'U' && (*UserName == 0 || 73 | strcasecmp(UserName,uname) != 0)) 74 | continue; /* It's CPQ U -command */ 75 | sprintf(tty,"/dev/%s",Utmp.ut_line); 76 | stats.st_mode = 0; 77 | stat(tty,&stats); 78 | ++lines; 79 | if (1 == lines) { 80 | strcpy(line,"Login Idle Terminal Name"); 81 | send_nmr(Faddress, Taddress, line, strlen(line), ASCII, CMD_MSG); 82 | } 83 | *idle = 0; 84 | idles = now - stats.st_atime; 85 | 86 | if (get_gone_user(uname,&s) >= 0) { 87 | strcpy(idle,"GONE"); 88 | } else if (idles > 86400) { 89 | sprintf(idle,"%dd%dh",idles/86400,(idles % 86400) / 3600); 90 | } else if (idles > 3599) { 91 | sprintf(idle,"%d:%02d",idles/3600,(idles/60)%60); 92 | } else if (idles > 59) { 93 | sprintf(idle,"%d",idles/60); 94 | } 95 | sprintf(line, "%-8s %6s %c%-12.12s %s", 96 | uname, idle, 97 | (stats.st_mode & 020) == 0 ? '*':' ', /* mesg n ? */ 98 | Utmp.ut_line, pwd->pw_gecos); 99 | send_nmr(Faddress, Taddress, line, strlen(line), ASCII, CMD_MSG); 100 | } 101 | if (cmd == 'U' && *UserName == 0) { 102 | sprintf(line,"CPQ: %4d USERS LOGGED ON",users); 103 | send_nmr(Faddress, Taddress, line, strlen(line), ASCII, CMD_MSG); 104 | } else if (lines == 0) { 105 | if (*UserName == 0) 106 | strcpy(line,"No one is logged on."); 107 | else 108 | sprintf(line, "User %s not logged on.", UserName); 109 | send_nmr(Faddress, Taddress, line, strlen(line), ASCII, CMD_MSG); 110 | } 111 | close (fd); 112 | } 113 | } 114 | 115 | /* 116 | | Send the /etc/motd file to the requestor. 117 | */ 118 | void 119 | send_welcome_message(Faddress, Taddress) 120 | const char *Faddress, *Taddress; 121 | { 122 | char *p, line[LINESIZE]; 123 | FILE *fd; 124 | 125 | if ((fd = fopen("/etc/motd", "r")) == NULL) { 126 | logger(1, "NMR, Can't open `/etc/motd' for CPQ LOG command\n"); 127 | sprintf(line, "LOG file not available"); 128 | send_nmr(Faddress, Taddress, line, strlen(line), ASCII, CMD_MSG); 129 | return; 130 | } 131 | while (fgets(line, sizeof line, fd) != NULL) { 132 | if ((p = strchr(line, '\n')) != NULL) *p = '\0'; 133 | send_nmr(Faddress, Taddress, line, strlen(line), ASCII, CMD_MSG); 134 | } 135 | fclose(fd); 136 | } 137 | 138 | 139 | /* 140 | | Send current time. (local time zone) 141 | */ 142 | void 143 | send_cpu_time(Faddress, Taddress) 144 | const char *Faddress, *Taddress; 145 | { 146 | char line[LINESIZE]; 147 | struct tm *tm, *localtime(); 148 | time_t clock; 149 | 150 | time(&clock); /* Get the current time */ 151 | tm = localtime(&clock); 152 | 153 | *line = 0; 154 | strftime(line,sizeof line,"CPQ: TIME IS %T %Z %A %D",tm); 155 | if (*line == 0) { 156 | strcpy(line,"Can't format date string for CPQ TIME reply!"); 157 | } 158 | 159 | send_nmr(Faddress, Taddress, line, strlen(line), ASCII, CMD_MSG); 160 | } 161 | -------------------------------------------------------------------------------- /qrdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/qrdr -------------------------------------------------------------------------------- /quickdf.c: -------------------------------------------------------------------------------- 1 | /* Quick DF 2 | -- Matti Aarnio 1993, 1994 3 | -- Pekka Kytolaakso 1994 4 | 5 | A Quicker way to do the DF -- system provided DF is fast, 6 | once the initial `sync(2)' -call has finished... 7 | (At least on SunOS systems, seems to happen elsewere too :-/ ) 8 | 9 | This is NOT a `df', as we wrote this for finding out, how 10 | much free-space there is for the given file/directory on 11 | an extremely busy system with 30+ GB disks which are in 12 | high-activity state all the time.. Try `sync()' on that.. 13 | 14 | Cnews news-inject is one such program, which actively peeks 15 | at system free disk space, and does it with `df' :-( 16 | 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | /* Now the important detail, what is your system's 26 | disk-space query method ? */ 27 | #if defined(sgi) || defined(USG) 28 | /* SYSV thingies have */ 29 | #include 30 | #define SYSV_STATFS 31 | #else 32 | /* BSD systems have (usually) */ 33 | #include 34 | #endif 35 | 36 | /* Actually adding facility to analyze existing 37 | mount-point list -- to make this a full `df' 38 | seems to be non-portable.. 39 | 40 | Some hints from machines on which [mea] has an 41 | access to... if somebody wants to do it: 42 | SysVr3: #include 43 | no apparent library support 44 | SunOS 4.1: #include 45 | getmntent(3) -library stuff 46 | 47 | #define _PATH_MTAB "/etc/mtab" 48 | 49 | */ 50 | 51 | #ifndef S_ISDIR 52 | # define S_ISDIR(x) (((x) & S_IFMT)==S_IFDIR) 53 | # define S_ISREG(x) (((x) & S_IFMT)==S_IFREG) 54 | #endif 55 | 56 | char *progname = "quickdf"; 57 | extern int errno; 58 | 59 | main(argc,argv) 60 | int argc; 61 | char *argv[]; 62 | { 63 | struct statfs fsstat; 64 | struct stat st; 65 | int fd; 66 | int rc; 67 | int i; 68 | 69 | if (argc < 2) { 70 | fprintf(stderr,"%s: missing argument: filesystem mountpoint, or any file/dir in it.\n",progname); 71 | exit(EX_USAGE); 72 | } 73 | 74 | for (i = 1; (i < argc) ; i++) { 75 | fd = open(argv[i],O_RDONLY|O_NOCTTY,0); 76 | if (fd < 0) { 77 | fprintf(stderr,"%s: argument not an openable file! errno=%d\n",progname,errno); 78 | exit(EX_DATAERR); 79 | } 80 | 81 | if (fstat(fd,&st) < 0) { 82 | fprintf(stderr,"%s: can't take fstat(2) from opened file??? errno=%d\n",progname,errno); 83 | exit(EX_OSERR); 84 | } 85 | if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode)) { 86 | fprintf(stderr,"%s: Must be a regular file, or dir! `.' is just fine!\n",progname); 87 | exit(EX_USAGE); 88 | } 89 | 90 | 91 | /* SysV statfs(2) differs from used BSD semantics.. */ 92 | #ifdef SYSV_STATFS 93 | if (fstatfs(fd,&fsstat,sizeof (struct statfs) , 0) < 0) { 94 | #else 95 | if (fstatfs(fd,&fsstat) < 0) { 96 | #endif 97 | fprintf(stderr,"%s: ??? Could not take fstatfs() from opened file ?? Not a regular file object ? errno=%d\n",progname,errno); 98 | exit(EX_OSERR); 99 | } 100 | 101 | close(fd); /* We have the data, close the file.. */ 102 | 103 | printf("File(system) `%s' size %d kB, used %d kB, avail %d kB %d%%\n", 104 | argv[i], 105 | (fsstat.f_blocks * fsstat.f_bsize)/1024, 106 | ((fsstat.f_blocks - fsstat.f_bfree) * fsstat.f_bsize)/1024, 107 | #ifdef SYSV_STATFS 108 | /* no fsstat.f_bavail on SGI -- or other SysV(r3)'s */ 109 | (fsstat.f_bfree * fsstat.f_bsize)/1024, 110 | (100*fsstat.f_bfree)/fsstat.f_bfree); 111 | #else 112 | (fsstat.f_bavail * fsstat.f_bsize)/1024, 113 | (100*fsstat.f_bavail)/fsstat.f_bfree); 114 | #endif 115 | }; 116 | exit (0); 117 | } 118 | -------------------------------------------------------------------------------- /receive: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/receive -------------------------------------------------------------------------------- /rprint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # A first-order approximation of remote printing in FUNET's NJE 4 | # 5 | # Add following into file-exit.cf (prefix it with PRT file matching) 6 | # RUN /path/rprint $SPOOL lpname $FRUSER $FRNODE $TOUSER $FID 7 | # 8 | # Written by Wilfried Maschtera 9 | # and somewhat edited (commented) by Matti Aarnio 10 | # 11 | HUJIBIN=/root/hujisrc-931116 12 | LPRBIN=/usr/bin/lpr 13 | pgname=`basename $0` 14 | locspid=`basename $1` 15 | $HUJIBIN/receive -o /tmp/$pgname.$$ $1 2> /dev/tty8 16 | $LPRBIN -P$2 -J $3 /tmp/$pgname.$$ 2> /dev/tty8 17 | rc=$? 18 | if [ $rc -eq 0 ] 19 | then 20 | $HUJIBIN/send $3@$4 "Sent file $locspid($6) on link $5 to $2(SYSTEM)" 21 | fi 22 | rm /tmp/$pgname.$$ 2> /dev/tty8 23 | -------------------------------------------------------------------------------- /rprint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # A first-order approximation of remote printing in FUNET's NJE 4 | # 5 | # Add following into file-exit.cf (prefix it with PRT file matching) 6 | # RUN /path/rprint $SPOOL lpname $FRUSER $FRNODE $TOUSER $FID 7 | # 8 | # Written by Wilfried Maschtera 9 | # and somewhat edited (commented) by Matti Aarnio 10 | # 11 | HUJIBIN=/usr/local/bin 12 | LPRBIN=/usr/ucb/lpr 13 | pgname=`basename $0` 14 | fid=$6 15 | $HUJIBIN/receive -o /tmp/$pgname.$$ $1 2> /dev/null 16 | $LPRBIN -P$2 -J $3 /tmp/$pgname.$$ 2> /dev/null 17 | rc=$? 18 | if [ $rc -eq 0 ] 19 | then 20 | $HUJIBIN/send $3@$4 "Sent file ($fid) on link $5 to $2(SYSTEM)" 21 | fi 22 | rm /tmp/$pgname.$$ 2> /dev/null 23 | -------------------------------------------------------------------------------- /rscsacct.c: -------------------------------------------------------------------------------- 1 | /* A module for HUJINJE/FUNET -- rscsacct.c 2 | 3 | Log NJE accountting record in same format as IBM RSCSv1 uses 4 | 5 | By Matti Aarnio, and Gerald Hanusch. 6 | 7 | */ 8 | 9 | #include 10 | #include "consts.h" 11 | #include "ebcdic.h" 12 | #include "prototypes.h" 13 | #include "rscsacct.h" 14 | 15 | 16 | 17 | /* File for logging */ 18 | static int rscslog = -1; 19 | 20 | static struct RSCSLOG RL; 21 | 22 | void 23 | rscsacct_open(logfilename) 24 | const char *logfilename; 25 | { 26 | if (rscslog >= 0) close(rscslog); 27 | 28 | rscslog = open(logfilename,O_RDWR|O_APPEND|O_CREAT,0644); 29 | 30 | /* logger(2,"RSCSACCT: open(%s) -> fd=%d\n",logfilename,rscslog); */ 31 | 32 | /* Preset what you can */ 33 | ASCII_TO_EBCDIC("HUJINJE ",RL.ACCTLOGU,8); 34 | memset(RL.filler, E_SP,2); 35 | memset(RL.filler2,E_SP,8); 36 | ASCII_TO_EBCDIC("UNIX ",RL.ACNTSYS,5); /* XX: Something portable ? */ 37 | ASCII_TO_EBCDIC("C0",RL.ACNTTYPE,2); 38 | } 39 | 40 | 41 | void 42 | rscsacct_close() 43 | { 44 | if (rscslog >= 0) close(rscslog); 45 | rscslog = -1; 46 | /* logger(2,"RSCSACCT: close()\n"); */ 47 | } 48 | 49 | 50 | void 51 | rscsacct_log(FileParams,xmit_or_recv) 52 | const struct FILE_PARAMS *FileParams; 53 | const int xmit_or_recv; 54 | { 55 | time_t now; 56 | struct tm *tm_var; 57 | char Abuf[20], *p; 58 | char frnode[10],frname[10],tonode[10],toname[10]; 59 | 60 | /* logger(2,"RSCSACCT: log=%d, From=%s, To=%s, recs=%d\n", 61 | rscslog,FileParams->From,FileParams->To,FileParams->RecordsCount); */ 62 | 63 | if (rscslog < 0) return; /* If no accounting file, quit.. */ 64 | 65 | strncpy(frname,FileParams->From,9); 66 | frname[8] = 0; 67 | *frnode = 0; 68 | if ((p = strchr(frname,'@')) != NULL) *p = 0; 69 | if ((p = strchr(FileParams->From, '@')) != NULL) { 70 | strncpy( frnode,p+1,sizeof(frnode)-1 ); 71 | } 72 | strncpy(toname,FileParams->To,9); 73 | toname[8] = 0; 74 | *tonode = 0; 75 | if ((p = strchr(toname,'@')) != NULL) *p = 0; 76 | if ((p = strchr(FileParams->To, '@')) != NULL) { 77 | strncpy( tonode,p+1,sizeof(tonode)-1 ); 78 | } 79 | 80 | time(&now); 81 | tm_var = localtime(&now); 82 | 83 | strftime(Abuf,13,"%m%d%y%H%M%S",tm_var); 84 | ASCII_TO_EBCDIC(Abuf,RL.ACNTDATE,12); 85 | 86 | sprintf(Abuf,"%-8s",frname); 87 | ASCII_TO_EBCDIC(Abuf,RL.ACNTUSER,8); 88 | sprintf(Abuf,"%-8s",frnode); 89 | ASCII_TO_EBCDIC(Abuf,RL.ACNTILOC,8); 90 | sprintf(Abuf,"%-8s",toname); 91 | ASCII_TO_EBCDIC(Abuf,RL.ACNTTOVM,8); 92 | sprintf(Abuf,"%-8s",tonode); 93 | ASCII_TO_EBCDIC(Abuf,RL.ACNTDEST,8); 94 | 95 | RL.ACNTCLAS = ASCII_EBCDIC[(unsigned)FileParams->JobClass]; 96 | RL.ACNTID = htons(FileParams->FileId); 97 | RL.ACNTOID = htons(FileParams->OurFileId); 98 | RL.ACNTINDV = (FileParams->type & F_PRINT) ? 0x41 : 0x81; 99 | RL.ACNTCODE = xmit_or_recv ? 1 : 2; 100 | 101 | RL.ACNTRECS = htonl(FileParams->RecordsCount); 102 | 103 | write(rscslog,(void*)&RL,80); 104 | } 105 | 106 | -------------------------------------------------------------------------------- /rscsacct.format: -------------------------------------------------------------------------------- 1 | From: root@alijku65.edvz.uni-linz.ac.at (Gerald Hanusch) 2 | Subject: ACCOUNTING records ... 3 | To: mea@nic.funet.fi 4 | Date: Thu, 4 Nov 1993 12:18:49 +0200 5 | 6 | Ok, here it is : 7 | 8 | position: contents: 9 | 0 ACCTLOGU CL8' ' logger userid ('RSCSEARN') 10 | 8 ACNTUSER CL8' ' originating location user id 11 | 16 ACNTDATE CL12' ' dat and time mmddyyhhmmss 12 | 28 ACNTOID XL2'00' origin spool file ID 13 | 30 ACNTID XL2'00' local spool file ID 14 | 32 ACNTILOC CL8' ' originating location id 15 | 40 ACNTDEST CL8' ' destination location id 16 | 48 ACNTCLAS CL1' ' Class letter 17 | 49 ACNTINDV XL1'00' origin device type; 0x8n = Punch, 18 | 0x4n = Printer 19 | 50 CL2' ' 2 filling blanks ... 20 | 52 ACNTRECS XL4'00' number of records in file 21 | 56 ACNTTOVM CL8' ' destination location user id 22 | 64 CL8' ' 8 filling blanks ... 23 | 72 ACNTSYS CL5' ' system id (serial + cpu model) 24 | 77 ACNTCODE XL1'01' Transmission code; 01 = send, 25 | 02 = receive 26 | 78 ACNTTYPE CL2'C0' the CP assigned record type 27 | for RSCS accounting 'C0' 28 | 80 - end 29 | 30 | Now you'd ask why these are not 80 characters - pos 0 - 69 are filled by rscs, 31 | cp appends an 8 character userid of the user producing these records in front 32 | of 0x0 above, in the sample file the RSCSEARN is this leading string, 33 | and actual start is behind this ... 34 | 35 | 36 | 37 | 00000 d9 e2 c3 e2 c5 c1 d9 d5 f0 f4 f0 f3 f0 f0 40 40 +RSCSEARN040300 + 38 | 00010 f1 f0 f1 f8 f9 f3 f0 f0 f0 f1 f0 f0 00 00 ef 4a +101893000100...[+ 39 | 00020 00 05 12 e8 00 02 86 cd 00 00 2c 9a 00 00 01 d2 +...Y..f........K+ 40 | 00030 00 01 42 2b 00 00 4b 29 00 00 16 3b 00 00 00 00 +................+ 41 | 00040 00 00 00 00 00 00 00 00 40 40 40 40 40 40 f0 f1 +........ 01+ 42 | 43 | 00050 d9 e2 c3 e2 c5 c1 d9 d5 f0 f4 f0 f3 f0 f0 40 40 +RSCSEARN040300 + 44 | 00060 f1 f0 f1 f8 f9 f3 f0 f0 f0 f1 f0 f0 00 00 00 00 +101893000100....+ 45 | 00070 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 +................+ 46 | 00080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +................+ 47 | 00090 00 00 00 00 00 00 00 00 40 40 40 40 40 40 f0 f1 +........ 01+ 48 | 49 | 000a0 d9 e2 c3 e2 c5 c1 d9 d5 d5 c5 e3 d5 c5 e6 e2 40 +RSCSEARNNETNEWS + 50 | 000b0 f1 f0 f1 f8 f9 f3 f0 f0 f0 f1 f2 f3 21 5c 21 5c +101893000123.*.*+ 51 | 000c0 c1 d3 c9 d1 d2 e4 f1 f1 c8 e4 c5 c1 d9 d5 40 40 +ALIJKU11HUEARN + 52 | 000d0 c1 82 40 40 00 00 00 36 d5 c5 e3 d5 c5 e6 e2 40 +Ab ....NETNEWS + 53 | 000e0 40 40 40 40 40 40 40 40 02 22 55 30 84 01 c3 f0 + ....d.C0+ 54 | 55 | 000f0 d9 e2 c3 e2 c5 c1 d9 d5 d5 c5 e3 d5 c5 e6 e2 40 +RSCSEARNNETNEWS + 56 | 00100 f1 f0 f1 f8 f9 f3 f0 f0 f1 f1 f4 f1 22 7f 00 00 +101893001141."..+ 57 | 00110 c2 d3 c5 d2 e4 d3 f1 f1 c1 d3 c9 d1 d2 e4 f1 f1 +BLEKUL11ALIJKU11+ 58 | 00120 c1 82 40 40 00 00 00 6c d5 c5 e3 d5 c5 e6 e2 40 +Ab ...%NETNEWS + 59 | 00130 40 40 40 40 40 40 40 40 02 22 55 30 84 02 c3 f0 + ....d.C0+ 60 | 61 | 02670 d9 e2 c3 e2 c5 c1 d9 d5 d4 c1 c9 d3 c5 d9 40 40 +RSCSEARNMAILER + 62 | 02680 f1 f0 f1 f8 f9 f3 f0 f4 f0 f1 f2 f2 24 5e 00 00 +101893040122.;..+ 63 | 02690 c1 e6 c9 e4 d5 c9 f1 f1 c1 d3 c9 d1 d2 e4 f1 f1 +AWIUNI11ALIJKU11+ 64 | 026a0 d4 82 40 40 00 00 00 25 d4 c1 c9 d3 c5 d9 40 40 +Mb ....MAILER + 65 | 026b0 40 40 40 40 40 40 40 40 02 22 55 30 84 02 c3 f0 + ....d.C0+ 66 | 67 | 02a80 d9 e2 c3 e2 c5 c1 d9 d5 e7 d4 c1 c9 d3 c5 d9 40 +RSCSEARNXMAILER + 68 | 02a90 f1 f0 f1 f8 f9 f3 f0 f4 f3 f6 f1 f0 23 b4 23 b4 +101893043610....+ 69 | 02aa0 c1 d3 c9 d1 d2 e4 f1 f1 c1 d3 c9 d1 d2 e4 f2 f1 +ALIJKU11ALIJKU21+ 70 | 02ab0 d4 82 40 40 00 00 00 2f d4 c1 c9 d3 c5 d9 40 40 +Mb ....MAILER + 71 | 02ac0 40 40 40 40 40 40 40 40 02 22 55 30 84 01 c3 f0 + ....d.C0+ 72 | -------------------------------------------------------------------------------- /rscsacct.h: -------------------------------------------------------------------------------- 1 | /* RSCS accounting record for FUNET-NJE */ 2 | 3 | /* Some hard-ware dependencies */ 4 | #ifndef __U_INT32 5 | #if defined(__alpha__) /* 64 bit.. */ 6 | #define __U_INT32 7 | typedef unsigned int u_int32; 8 | typedef int int32; 9 | typedef unsigned short u_int16; 10 | typedef short int16; 11 | #else 12 | #define __U_INT32 13 | typedef unsigned long u_int32; 14 | typedef long int32; 15 | typedef unsigned short u_int16; 16 | typedef short int16; 17 | #endif 18 | #endif 19 | 20 | 21 | struct RSCSLOG { 22 | /* 0 */ unsigned char ACCTLOGU[8]; /* Logger userid 'RSCSEARN' */ 23 | /* 8 */ unsigned char ACNTUSER[8]; /* originating location uid */ 24 | /* 16 */ unsigned char ACNTDATE[12]; /* yymmddhhmmss */ 25 | /* 28 */ short ACNTOID; /* Origin spool file ID */ 26 | /* 30 */ short ACNTID; /* Local spool file ID */ 27 | /* 32 */ unsigned char ACNTILOC[8]; /* originating location id */ 28 | /* 40 */ unsigned char ACNTDEST[8]; /* destination location id */ 29 | /* 48 */ unsigned char ACNTCLAS; /* class letter */ 30 | /* 49 */ unsigned char ACNTINDV; /* origin dev. type: 31 | 0x8n=Punch, 0x4n=Print */ 32 | /* 50 */ char filler[2]; /* 2 filling blanks */ 33 | /* 52 */ int32 ACNTRECS; /* Number of records in file*/ 34 | /* 56 */ unsigned char ACNTTOVM[8]; /* Destination location uid */ 35 | /* 64 */ char filler2[8]; /* 8 filling blanks */ 36 | /* 72 */ unsigned char ACNTSYS[5]; /* Sys id (serial+cpu model)*/ 37 | /* 77 */ unsigned char ACNTCODE; /* transmission code; 38 | 01 = send, 02 = receive */ 39 | /* 78 */ unsigned char ACNTTYPE[2]; /* the CP assigned record type 40 | for RSCS accounting C'C0'*/ 41 | /* 80 - end */ 42 | }; 43 | -------------------------------------------------------------------------------- /sendfile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/sendfile -------------------------------------------------------------------------------- /sendmail-configs/file-exit.cf.add: -------------------------------------------------------------------------------- 1 | file-exit.cf ############################################################# 2 | # 3 | # By Paul Bryant 4 | # 5 | # ( Note: Alternate way is to run netinit.sh from CRON ) 6 | 7 | part of 8 | 9 | # 10 | # NETINIT is pseudo id for automatically re-generating routing tables 11 | # This is done with netinit.sh which must be configured by hand. 12 | # 13 | NETINIT UKSAGE BITEARN NODES * * * * * default RUN /usr/local/nje/maketable $SPOOL UKSAGE 14 | # /usr/local/nje/maketable $SPOOL" 15 | # 16 | # Finally a `catch them all' default handling case. 17 | # 18 | * * * * * * * * * 19 | default KEEP 20 | -------------------------------------------------------------------------------- /sendmail-configs/maketable: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # By Paul Bryant 4 | # 5 | # - script to be called from file-exit.cf when BITEARN.NODES -file 6 | # arrives 7 | # 8 | 9 | NJEDIR=/usr/local/nje/huji 10 | NJEBINDIR=/usr/local/nje/bin 11 | PAROUTERDIR=/usr/local/nje/paroute 12 | 13 | MFLOG=/usr/tmp/maketable.log 14 | rm $MFLOG 15 | echo start maketable >> $MFLOG 16 | TMPFILE=/usr/tmp/maketable.tmp 17 | TMPFILE1=/usr/tmp/maketablex.tmp 18 | TMPFILE2=/usr/tmp/maketabley.tmp 19 | rm $TMPFILE 20 | rm $TMPFILE1 21 | rm $TMPFILE2 22 | 23 | $NJEBINDIR/receive -a -o $TMPFILE $1 24 | rc=$? 25 | 26 | if [ $rc != 0 ]; then 27 | echo "receive failed" >> $MFLOG 28 | exit $rc 29 | fi 30 | 31 | $NJEDIR/namesfilter -zmailer < $TMPFILE | sort > $TMPFILE2 32 | /newsendmail/makemap/makemap dbm /etc/bitnettable < $TMPFILE2 33 | rc=$? 34 | 35 | if [ $rc != 0 ]; then 36 | echo "namesfiilter failed" >> $MFLOG 37 | exit $rc 38 | fi 39 | 40 | $PAROUTEDIR/paroute -l $2 -k $PAROUTEDIR/paroute.conf $TMPFILE > $TMPFILE1 41 | $NJEDIR/njeroutes $NJEDIR/huji_nje.header $TMPFILE1 $NJEDIR/huji_nje.route >> $MFLOG 42 | rc=$? 43 | 44 | if [ $rc != 0 ]; then 45 | echo "njeroutes failed" $rc >> $MFLOG 46 | exit $rc 47 | fi 48 | 49 | rm $TMPFILE 50 | rm $TMPFILE1 51 | rm $TMPFILE2 52 | 53 | echo "end maketable" >> $MFLOG 54 | -------------------------------------------------------------------------------- /sendmail-configs/peb.mail: -------------------------------------------------------------------------------- 1 | From P.Bryant@rl.ac.uk Wed Apr 19 11:06:38 1995 2 | Received: from mailbox.rl.ac.uk ([130.246.9.65]) by nic.funet.fi with SMTP id <2870-3>; Wed, 19 Apr 1995 11:06:22 +0300 3 | Received: from peb-pc by mailbox.rl.ac.uk with SMTP 4 | id JAA24951; Wed, 19 Apr 1995 09:06:18 +0100 5 | Message-Id: <199504190806.JAA24951@mailbox.rl.ac.uk> 6 | X-Sender: peb@mailbox.rl.ac.uk (Unverified) 7 | Mime-Version: 1.0 8 | Content-Type: text/plain; charset="us-ascii" 9 | Date: Wed, 19 Apr 1995 09:06:19 +0100 10 | To: Matti Aarnio 11 | From: P.Bryant@rl.ac.uk (Paul Bryant) 12 | Subject: Re: Your comments on FUNETNJE bugs.. 13 | X-Mailer: 14 | Status: RO 15 | 16 | Many thanks for the useful comments on FUNETNJE. I will try the new code in 17 | a few days. I hope to put the system into service in July to replace the IBM 18 | (UKACRL). It all works very well and I am now working on automating the 19 | updateing of tables and automatic house keeping (claering out dead mail and 20 | producing statistics. I attach my sendmail.cf as requested. There is a 21 | serious flaw that I have just found in that mail addressed to a nonexistant 22 | user on the machine via NJE is not returned. I have not yet had time to 23 | chase this fault. I have recently obtained PAROUTE and it compiled OK. I 24 | will send you my version of file.cf and a script it calls, maketable. 25 | maketable receives bitearn.nodes and produces the tables needed by sendamail 26 | and funetnje. Both these are a bit primative - file.cf needs a bit more 27 | security when I decide where bitearn.nodes will come from and maketable 28 | needs a bit more checking that things have gone OK and to stop and restart 29 | sendmail and funetnje cleanly to bring the new tables into use .(The three 30 | files are concatinated and follow). I hope you find them useful and I would 31 | appreceiate any suggestions for improvments or bug fixes. 32 | Paul. 33 | 34 | ........... [ files taken out into separate pieces ] .............. 35 | 36 | Paul Bryant - Rutherford Appleton Laboratory, Chilton, Didcot, OX11 0QX, UK 37 | Mail P.Bryant@rl.ac.uk 38 | Tel.+44 1235 445 267 Fax. +44 1235 446 626 39 | 40 | 41 | -------------------------------------------------------------------------------- /site_consts.h: -------------------------------------------------------------------------------- 1 | /* SITE_CONSTS..H 2 | | The Hebrew University of Jerusalem, HUJIVMS. 3 | | 4 | | BEFORE COMPILATION: You must tailor this file to your system. The following 5 | | definitions are available (#define): 6 | | UNIX - This is compiled on a UNIX system. 7 | | NETWORK_ORDER - The internal number representation is the same as the 8 | | network's one. On VAXes do not define it. 9 | [mea] Symbol is now obsolete! 10 | 11 | | VMS - This program is compiled on VMS systems. 12 | | MULTINET - If you are going to use Multinet TcpIp package. 13 | | EXOS - If you are going to use EXOS TcpIp package. 14 | | MAX_LINES - How many lines you can define in the line's database. 15 | | MAX_INFORM - The maximum number (+1) of the users listed in INFORM command. 16 | | GDBM - If you use GDBM database instead of DBM. (recommended) 17 | | (You can have GDBM in Makefile as well.) 18 | | 19 | | Parameters that you might want to change (in CONSTS.H): 20 | | MAX_BUF_SIZE - The maximum buffer size that can be defined for a line. 21 | | MAX_ERRORS - After consequtive MAX_ERROR errors a line is restarted. 22 | | 23 | */ 24 | 25 | #define MAX_INFORM 8 26 | #define ABSMAX_LINES 10 /* Maximum 10 lines at present */ 27 | 28 | /* BITNET_HOST is a string needed in bmail.c */ 29 | /* #define BITNET_HOST "HUJIVMS" */ 30 | /* The read_config() routine gets this to LOCAL_NAME string from config file */ 31 | 32 | 33 | /* GMT_OFFSET is 5 character string telling local time offset from GMT */ 34 | /* #define GMT_OFFSET "+0200" */ 35 | /* Only needed on VMS version.. */ 36 | 37 | /* s_addr is needed if 's_addr' isn't known entity in 38 | file 'struct in_addr' structure. S_un.S_addr is obsolete old style 39 | format of arguments... (an union) */ 40 | /* That file is included in UNIXes in consts.h -file. */ 41 | /* #define s_addr S_un.S_addr */ 42 | 43 | /* Now: vs. vs. ... 44 | Also 'struct dirent' vs. 'struct direct' vs. possible others... 45 | Examples: 46 | #define DIRENTFILE 47 | #define DIRENTTYPE struct direct */ 48 | /* Note: SystemV r 3.2 compability relies that 'DIRBUF' preproc. symbol isn't 49 | found in BSD compatible systems (like Suns) */ 50 | 51 | #ifdef sun 52 | #define DIRENTFILE 53 | #define DIRENTTYPE struct dirent 54 | #else /* Well, [mea@nic.funet.fi] tries to get easy with two system environment.. */ 55 | #define DIRENTFILE 56 | #define DIRENTTYPE struct dirent 57 | #endif 58 | 59 | /* These can be used to override variables othervise defined in consts.h: 60 | #define CONFIG_FILE "/path/to/hujinje.cf" 61 | #define PID_FILE "/path/to/hujinje.pid" 62 | */ 63 | -------------------------------------------------------------------------------- /sizeof.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char *argv[]) 8 | 9 | { 10 | printf("short is %d chars\n", sizeof(short)); 11 | printf("int is %d chars\n", sizeof(int)); 12 | printf("unsigned int is %d chars\n", sizeof(unsigned int)); 13 | printf("long is %d chars\n", sizeof(long)); 14 | printf("float is %d chars\n", sizeof(float)); 15 | printf("double is %d chars\n", sizeof(double)); 16 | 17 | printf("in_addr_t is %d chars\n", sizeof(in_addr_t)); 18 | } 19 | -------------------------------------------------------------------------------- /smail-configs/bitearn: -------------------------------------------------------------------------------- 1 | alijku11 bsmtp3nd!mailer!alijku11!%s 2 | alijku21 bsmtp3!mailer!alijku21!%s 3 | alijku64 defrt1!alijku64!%s 4 | alijku65 %s 5 | finfiles bsmtp3nd!mailer!finfiles!%s 6 | -------------------------------------------------------------------------------- /smail-configs/bitmethods: -------------------------------------------------------------------------------- 1 | bsmtp3 bsmtp3 2 | bsmtp3nd bsmtp3nd 3 | defrt1 defrt1 4 | -------------------------------------------------------------------------------- /smail-configs/bsmtp3: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | from=$5 3 | ownnode=$4 4 | user=$3 5 | IFS='!' 6 | set $1 7 | mailer=$1 8 | node=$2 9 | IFS='<>' 10 | set $user 11 | if [ ${#1} -eq 0 ] 12 | then user=$2 13 | else user=$1 14 | fi 15 | IFS='@' 16 | set $from 17 | IFS=' ' 18 | if [ ${#2} -eq 0 ] 19 | then from=$1@$ownnode 20 | else from=$1@$2 21 | fi 22 | /usr/bin/bmail -b $mailer@$node -u MAILER $from $user 23 | exit 0 24 | -------------------------------------------------------------------------------- /smail-configs/bsmtp3nd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | from=$5 3 | ownnode=$4 4 | user=$3 5 | IFS='!' 6 | set $1 7 | mailer=$1 8 | node=$2 9 | IFS='<>' 10 | set $user 11 | if [ ${#1} -eq 0 ] 12 | then user=$2 13 | else user=$1 14 | fi 15 | IFS='@' 16 | set $from 17 | IFS=' ' 18 | if [ ${#2} -eq 0 ] 19 | then from=$1@$ownnode 20 | else from=$1@$2 21 | fi 22 | /usr/bin/bmail -nd $mailer@$node -u MAILER $from $user 23 | exit 0 24 | -------------------------------------------------------------------------------- /smail-configs/config: -------------------------------------------------------------------------------- 1 | domains=edvz.uni-linz.ac.at:bitnet 2 | postmaster=test@alijku65.edvz.uni-linz.ac.at 3 | #visible_domain=edvz.uni-linz.ac.at:bitnet 4 | #visible_name=alijku65.edvz.uni-linz.ac.at 5 | smart_path=alijku04.edvz.uni-linz.ac.at 6 | smart_transport=smtp 7 | -------------------------------------------------------------------------------- /smail-configs/defrt1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | from=$5 3 | user=$1 4 | IFS='@' 5 | set $from 6 | IFS=' ' 7 | if [ ${#2} -eq 0 ] 8 | then from=$1@alijku65 9 | else from=$1@$2 10 | fi 11 | /usr/bin/bmail $from $user 12 | exit 0 13 | -------------------------------------------------------------------------------- /smail-configs/paths: -------------------------------------------------------------------------------- 1 | #alijku11 alijku11!%s 2 | #alijku11.bitnet alijku11!%s 3 | alijku65 %s 4 | alijku65.bitnet %s 5 | alijku65.edvz.uni-linz.ac.at %s 6 | -------------------------------------------------------------------------------- /smail-configs/routers: -------------------------------------------------------------------------------- 1 | # @(#)samples/generic/routers 1.3 8/8/92 16:40:26 2 | 3 | # This file defines the configuration of the router subsystem as 4 | # compiled into the smail binary. By modifying the source files 5 | # conf/EDITME, src/config.h or src/default.c the actual internal 6 | # configuration can be changed. Thus, this should be matched up 7 | # against thes files before assuming this is completely correct. 8 | 9 | # force_paths - override file for routing 10 | # 11 | # This entry is not in the compiled-in routers, for now. However, 12 | # this entry can be very useful for adding temporary override routes, 13 | # if some paths are known to be useless for transient reasons, or for 14 | # organizing internal networks without the use of map files. It can 15 | # also be used to define UUCP sites that you MX for, if you are using 16 | # DNS with the bind router. In the MX case, add an entry to the file 17 | # /usr/lib/smail/forcepaths such as: 18 | # 19 | # .foo.org foo-uucp-gateway!%s 20 | # 21 | # to cause all E-mail to the foo.org domain to be sent to its uucp 22 | # gateway, rather than being matched by the MX router, which will 23 | # not correctly handle MX to UUCP gatewaying, if you use the bind 24 | # version of the inet_hosts router, below. 25 | # 26 | # The file is defined to be an unsorted ASCII file, so that direct 27 | # editing is possible and reasonable. The "always" attribute forces 28 | # use of the router even if a later router (such as the bind version 29 | # of inet_hosts) gets a better match (note that DNS wildcard matches 30 | # count as complete hostname matches). Thus, with the .foo.org 31 | # entry above, foo.foo.org would be matched here, even if foo.foo.org 32 | # were matched by inet_hosts or the regular paths router. 33 | # 34 | #force_paths: 35 | # driver=pathalias, 36 | # transport=uux, # deliver using uux to rmail 37 | # always; # force use even if some other 38 | # # router gets a more complete match 39 | # 40 | # file=forcepaths, # plain ASCII file (unsorted) 41 | # proto=lsearch, # use linear search 42 | # optional, # ignore if the file does not exist 43 | 44 | # inet_addrs and inet_hosts are only defined when BSD networking exists 45 | 46 | # inet_addrs - match domain literals containing literal IP addresses 47 | # 48 | # For example, [128.103.1.1] will match harvard.harvard.edu on the internet. 49 | # The library routine gethostbyaddr(3N) will be called to see if a reverse 50 | # mapping to the cononical hostname is available. 51 | inet_addrs: 52 | driver=gethostbyaddr, # router to match IP domain literals 53 | transport=smtp; # deliver using SMTP over TCP/IP 54 | 55 | fail_if_error, # fail malformed domain literal addrs 56 | check_for_local, # see if this is really the local host 57 | 58 | # inet_hosts - match hostnames with gethostbyname(3N) 59 | # 60 | # Comment this out if you wish to use the bind version below, instead. 61 | inet_hosts: 62 | driver=gethostbyname, # match hosts with the library function 63 | transport=smtp; # use default SMTP (may be UUCP-style) 64 | 65 | -required, # no required domains 66 | -domain, # no defined domain suffixes 67 | -only_local_domain, # don't restrict to defined domains 68 | 69 | # inet_hosts - alternate version using BIND to access the DNS 70 | # 71 | # This router is not compiled-in by default. It can be used as a 72 | # replacement for the above inet_hosts router, if your system supports 73 | # a bind compatible DNS resolver library. This should be used for 74 | # systems on the internet. 75 | #inet_hosts: 76 | # driver=bind, 77 | # transport=smtp; # use TCP/IP SMTP for delivery 78 | # 79 | # defnames, # use standard domain searching 80 | # defer_no_connect, # try again if the nameserver is down 81 | # -local_mx_okay, # fail (don't pass through) an MX 82 | # # to the local host 83 | 84 | # paths - route using a paths file, like that produced by the pathalias program 85 | paths: driver=pathalias, # general-use paths router 86 | transport=uux; # for matches, deliver over UUCP 87 | 88 | file=paths, # sorted file containing path info 89 | proto=bsearch, # use a binary search 90 | # proto=dbm, # use a dbm files 91 | optional, # ignore if the file does not exist 92 | -required, # no required domains 93 | domain=uucp, # strip ending ".uucp" before searching 94 | # 95 | 96 | bitnet: driver=pathalias, 97 | method=bitmethods; 98 | file=bitearn, 99 | proto=bsearch, 100 | -optional, 101 | -required, 102 | domain=bitnet, 103 | 104 | # uucp_neighbors - match neighbors accessible over UUCP 105 | uucp_neighbors: 106 | driver=uuname, # use a program which returns neighbors 107 | transport=uux; 108 | 109 | cmd=/usr/bin/uuname, # specifically, use the uuname program 110 | domain=uucp, # strip ending ".uucp" before searching 111 | 112 | # smart_host - a partically specified smarthost director 113 | # 114 | # If the config file attribute smart_path is defined as a path from the 115 | # local host to a remote host, then hostnames not matched otherwise will 116 | # be sent off to the stated remote host. The config file attribute 117 | # smart_transport can be used to specify a different transport. 118 | # 119 | # If the smart_path attribute is not defined, this router is ignored. 120 | smart_host: 121 | driver=smarthost, # special-case driver 122 | transport=uux; # by default deliver over UUCP 123 | 124 | -path, # use smart_path config file variable 125 | # path=uunet, # alternate, set path in this file 126 | -------------------------------------------------------------------------------- /spool.cmsnote: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/spool.cmsnote -------------------------------------------------------------------------------- /spool.dshodd2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/spool.dshodd2 -------------------------------------------------------------------------------- /spool.listserv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/spool.listserv -------------------------------------------------------------------------------- /spool.longtag: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/spool.longtag -------------------------------------------------------------------------------- /spool.mvslog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/spool.mvslog -------------------------------------------------------------------------------- /spool.mvsnd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/spool.mvsnd -------------------------------------------------------------------------------- /spool.mvsnd2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/spool.mvsnd2 -------------------------------------------------------------------------------- /spool.mvsout2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/spool.mvsout2 -------------------------------------------------------------------------------- /spool.mvsout3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/spool.mvsout3 -------------------------------------------------------------------------------- /spool.mvsout4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/spool.mvsout4 -------------------------------------------------------------------------------- /spool.sysinjob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/spool.sysinjob -------------------------------------------------------------------------------- /spool.uxpasa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/spool.uxpasa -------------------------------------------------------------------------------- /spool.vmprint: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/spool.vmprint -------------------------------------------------------------------------------- /stdxlat.default: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/stdxlat.default -------------------------------------------------------------------------------- /stdxlat.ger: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/stdxlat.ger -------------------------------------------------------------------------------- /sysexits.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1987 Regents of the University of California. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by the University of 16 | * California, Berkeley and its contributors. 17 | * 4. Neither the name of the University nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | * 33 | * @(#)sysexits.h 4.8 (Berkeley) 4/3/91 34 | */ 35 | 36 | #ifndef _SYSEXITS_H_ 37 | #define _SYSEXITS_H_ 38 | 39 | /* 40 | * SYSEXITS.H -- Exit status codes for system programs. 41 | * 42 | * This include file attempts to categorize possible error 43 | * exit statuses for system programs, notably delivermail 44 | * and the Berkeley network. 45 | * 46 | * Error numbers begin at EX__BASE to reduce the possibility of 47 | * clashing with other exit statuses that random programs may 48 | * already return. The meaning of the codes is approximately 49 | * as follows: 50 | * 51 | * EX_USAGE -- The command was used incorrectly, e.g., with 52 | * the wrong number of arguments, a bad flag, a bad 53 | * syntax in a parameter, or whatever. 54 | * EX_DATAERR -- The input data was incorrect in some way. 55 | * This should only be used for user's data & not 56 | * system files. 57 | * EX_NOINPUT -- An input file (not a system file) did not 58 | * exist or was not readable. This could also include 59 | * errors like "No message" to a mailer (if it cared 60 | * to catch it). 61 | * EX_NOUSER -- The user specified did not exist. This might 62 | * be used for mail addresses or remote logins. 63 | * EX_NOHOST -- The host specified did not exist. This is used 64 | * in mail addresses or network requests. 65 | * EX_UNAVAILABLE -- A service is unavailable. This can occur 66 | * if a support program or file does not exist. This 67 | * can also be used as a catchall message when something 68 | * you wanted to do doesn't work, but you don't know 69 | * why. 70 | * EX_SOFTWARE -- An internal software error has been detected. 71 | * This should be limited to non-operating system related 72 | * errors as possible. 73 | * EX_OSERR -- An operating system error has been detected. 74 | * This is intended to be used for such things as "cannot 75 | * fork", "cannot create pipe", or the like. It includes 76 | * things like getuid returning a user that does not 77 | * exist in the passwd file. 78 | * EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp, 79 | * etc.) does not exist, cannot be opened, or has some 80 | * sort of error (e.g., syntax error). 81 | * EX_CANTCREAT -- A (user specified) output file cannot be 82 | * created. 83 | * EX_IOERR -- An error occurred while doing I/O on some file. 84 | * EX_TEMPFAIL -- temporary failure, indicating something that 85 | * is not really an error. In sendmail, this means 86 | * that a mailer (e.g.) could not create a connection, 87 | * and the request should be reattempted later. 88 | * EX_PROTOCOL -- the remote system returned something that 89 | * was "not possible" during a protocol exchange. 90 | * EX_NOPERM -- You did not have sufficient permission to 91 | * perform the operation. This is not intended for 92 | * file system problems, which should use NOINPUT or 93 | * CANTCREAT, but rather for higher level permissions. 94 | */ 95 | 96 | #define EX_OK 0 /* successful termination */ 97 | 98 | #define EX__BASE 64 /* base value for error messages */ 99 | 100 | #define EX_USAGE 64 /* command line usage error */ 101 | #define EX_DATAERR 65 /* data format error */ 102 | #define EX_NOINPUT 66 /* cannot open input */ 103 | #define EX_NOUSER 67 /* addressee unknown */ 104 | #define EX_NOHOST 68 /* host name unknown */ 105 | #define EX_UNAVAILABLE 69 /* service unavailable */ 106 | #define EX_SOFTWARE 70 /* internal software error */ 107 | #define EX_OSERR 71 /* system error (e.g., can't fork) */ 108 | #define EX_OSFILE 72 /* critical OS file missing */ 109 | #define EX_CANTCREAT 73 /* can't create (user) output file */ 110 | #define EX_IOERR 74 /* input/output error */ 111 | #define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ 112 | #define EX_PROTOCOL 76 /* remote error in protocol */ 113 | #define EX_NOPERM 77 /* permission denied */ 114 | #define EX_CONFIG 78 /* configuration error */ 115 | 116 | #define EX__MAX 78 /* maximum listed value */ 117 | 118 | #endif /* !_SYSEXITS_H_ */ 119 | -------------------------------------------------------------------------------- /sysin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Pseudo-program for receiving SYSIN jobs from NJE network 5 | # 6 | 7 | exit 0 8 | # Yeah, do nothing.. 9 | -------------------------------------------------------------------------------- /tell: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/tell -------------------------------------------------------------------------------- /transfer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/transfer -------------------------------------------------------------------------------- /transfer.c: -------------------------------------------------------------------------------- 1 | /* TRANSFER.C - v 0.1 */ 2 | /* By , and */ 3 | /* 4 | FUNET-NJE companion program to transfer a spoolfile to arbitary 5 | destination - does NJE-header rewrite when necessary. 6 | */ 7 | 8 | 9 | /* 10 | Programs are executed with following ARGV: 11 | 0 = ProgPath 12 | 1 = Forward@Address 13 | 2 = FilePath 14 | */ 15 | 16 | #include "prototypes.h" 17 | #include "clientutils.h" 18 | 19 | #define isprint(c) ( ((c) >=32) && ((c) <= 126) ) 20 | 21 | char LOCAL_NAME [10]; 22 | char BITNET_QUEUE [80]; 23 | char LOG_FILE [80] = "-"; 24 | 25 | int LogLevel = 3; 26 | FILE *LogFd = NULL; 27 | 28 | 29 | /* ================================================================ */ 30 | 31 | void 32 | transfer( transparency,path,Destin ) 33 | const int transparency; 34 | const char *path; 35 | char *Destin; 36 | { 37 | 38 | FILE *TransferF; 39 | char ToA[80]; 40 | struct stat stats; 41 | /* unsigned char ToUser[9],ToNode[9]; */ 42 | unsigned char buf[512]; /* longest NJE header is 257... */ 43 | int ebcdic = 0; 44 | long FmTpos = -1; 45 | long ToApos = -1; 46 | long FiDpos = -1; 47 | long OiDpos = -1; 48 | long FrMpos = -1; 49 | long pos0; 50 | char newpath[200]; 51 | 52 | /* Now have changed a bit... */ 53 | /* Actual location of file is found from: path */ 54 | 55 | /* Send message to given user@node */ 56 | /* Action->Path -- This points to file+message recipient */ 57 | TransferF = fopen(path,"r+"); 58 | if (TransferF == NULL) { 59 | logger(1,"UNIX_FILES: TRANSFER-TO fopen('%s','r+') failed ! (%s)\n", 60 | path,PRINT_ERRNO); 61 | return; 62 | } 63 | pos0 = -1; 64 | *buf = 0; /* Pre-empt buffer contents */ 65 | while (!feof(TransferF) && !ferror(TransferF)) { 66 | pos0 = ftell( TransferF ); 67 | *buf = 0; /* Pre-empt buffer contents */ 68 | if (fgets( (void*)buf,sizeof buf,TransferF ) == NULL) 69 | break; /* File read failed! */ 70 | if (strcmp("FMT: EBCDIC\n",buf)==0) { 71 | FmTpos = pos0; 72 | ebcdic = 1; /* Right, we have NJE headers... */ 73 | } else if (!transparency && strncmp("FID: ",buf,5) == 0) 74 | FiDpos = pos0; 75 | else if (!transparency && strncmp("OID: ",buf,5) == 0) 76 | OiDpos = pos0; 77 | else if (!transparency && strncmp("FRM: ",buf,5)==0) 78 | FrMpos = pos0; 79 | else if (strncmp("TOA: ",buf,5) == 0) { 80 | strcpy( ToA,buf ); 81 | ToApos = pos0; 82 | } else if (strcmp("END:\n",buf) == 0) 83 | break; /* last entry on headers */ 84 | } 85 | if (ToApos < 0) { 86 | /* Something wrong ! */ 87 | logger(1,"UNIX_FILES: Parse of header for TRANSFER-TO faulted, didn't find TOA:!\n"); 88 | return; 89 | } 90 | 91 | if (ebcdic) { 92 | /* Rewrite FMT: BINARY */ 93 | fseek( TransferF,FmTpos,0 /* from begin of file */ ); 94 | fprintf( TransferF,"FMT: BINARY\n" ); 95 | } 96 | 97 | if (FiDpos >= 0) { 98 | fseek( TransferF,FiDpos,0 ); 99 | fputs( "FID: 0000", TransferF ); 100 | } 101 | if (OiDpos >= 0) { 102 | fseek( TransferF,OiDpos,0 ); 103 | fputs( "OID: 0000", TransferF ); 104 | } 105 | if (FrMpos >= 0) { 106 | char From[20]; 107 | 108 | if (mcuserid(From) == NULL) { 109 | fprintf(stderr,"Can't determine who you are. Aborting!\n"); 110 | exit(2); 111 | } 112 | upperstr(From); 113 | strcat(From,"@"); 114 | strcat(From,LOCAL_NAME); 115 | fseek(TransferF,FrMpos,0); 116 | fprintf(TransferF, "FRM: %-17.17s\n", From); 117 | } 118 | 119 | /* Rewrite TOA: record... */ 120 | fseek( TransferF,ToApos,0 /* from begin of file */ ); 121 | fprintf( TransferF,"TOA: %-17.17s\n",Destin ); 122 | fclose( TransferF ); 123 | 124 | stat(path,&stats); 125 | 126 | sprintf(newpath,"%s/BITtr%ld",BITNET_QUEUE,(long)stats.st_ino); 127 | if (rename( path,newpath ) == 0) 128 | path = newpath; 129 | 130 | /* Right, now TOA: is redirected. Lets send it forward... */ 131 | submit_file( path,(stats.st_size+511)/512 ); 132 | } 133 | 134 | 135 | /* ================================================================ */ 136 | 137 | int 138 | main(argc,argv) 139 | int argc; 140 | char *argv[]; 141 | { 142 | const char *path; 143 | char *Destin; 144 | int t_flag = 0; 145 | 146 | if (argc == 4 && strcmp(argv[1],"-t")==0 && 147 | getuid() == 0) { 148 | t_flag = 1; 149 | ++argv; 150 | --argc; 151 | } 152 | 153 | if (argc != 3) { 154 | printf( 155 | "TRANSFER - program for FUNET-NJE Spool Transfer processing.\n\ 156 | Not for casual users invocation.\n\ 157 | Args: [-t] Destin@Address absolute-filepath\n\ 158 | When file does have NJE headers, they are rewritten too to\n\ 159 | reflect new destination address. Else we would propably get\n\ 160 | forwarded file back very soon. Non-super-user can't do it\n\ 161 | transparently (-t).\n"); 162 | exit(3); /* Too few args... */ 163 | } 164 | 165 | Destin = argv[1]; 166 | path = argv[2]; 167 | 168 | if (*path != '/') { 169 | printf("TRANSFER: given file to be trasnferred is NOT an ABSOLUTE path: \"%s\"\n",path); 170 | exit(4); 171 | } 172 | 173 | read_configuration(); 174 | /* read_etable() */ /* Not needed if we don't mess 175 | with the real headers.. */ 176 | 177 | /*logger(2,"Argc=%d, Argv=[%s,%s,%s]\n",argc,argv[0],argv[1],argv[2]);*/ 178 | 179 | upperstr(Destin); 180 | transfer( t_flag, path, Destin ); 181 | 182 | return 0; 183 | } 184 | 185 | /* ================================================================ */ 186 | 187 | /* 188 | | Log the string, and then abort. 189 | */ 190 | volatile void 191 | bug_check(string) 192 | const char *string; 193 | { 194 | logger(1, "Bug check: %s\n", string); 195 | exit(100); 196 | } 197 | -------------------------------------------------------------------------------- /transfer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # transfer.sh 3 | 4 | # Testing call arguments, not for general production use.. 5 | 6 | ( echo "Argc= $#" 7 | echo "Argv= $0 $@" 8 | DESTNAME=`basename $1` 9 | /bin/mv $1 /usr/spool/bitnet/$DESTNAME 10 | /usr/local/lib/huji/transfer.exe /usr/spool/bitnet/$DESTNAME $2 ) >> /root/transfer.log 11 | -------------------------------------------------------------------------------- /ucp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/ucp -------------------------------------------------------------------------------- /unix_brdcst.c: -------------------------------------------------------------------------------- 1 | /* UNIX_BRDCST.C (formerly UNIX_BROADCAST.C) V1.1 2 | | Copyright (c) 1988,1989,1990 by 3 | | The Hebrew University of Jerusalem, Computation Center. 4 | | 5 | | This software is distributed under a license from the Hebrew University 6 | | of Jerusalem. It may be copied only under the terms listed in the license 7 | | agreement. This copyright message should never be changed or removed. 8 | | This software is gievn without any warranty, and the Hebrew University 9 | | of Jerusalem assumes no responsibility for any damage that might be caused 10 | | by use or misuse of this software. 11 | | 12 | | Sections: COMM - Communication with user and console. 13 | | 14 | | V1.1 - 22/3/90 - When cannot send message return 0 instead of -1 in order 15 | | to help the GONE section. 16 | */ 17 | 18 | #include "consts.h" 19 | #include "prototypes.h" 20 | 21 | #ifndef UTMP_FILE 22 | #define UTMP_FILE "/etc/utmp" 23 | #endif 24 | 25 | extern int alarm_happened; 26 | 27 | /* 28 | * Write the message msg to the user, on all ttys he is currently logged 29 | * in. 30 | * Returned value: 31 | * 0 in case of error, number of messages sent otherwise. 32 | * In case of error, errno can be examined. 33 | */ 34 | int 35 | send_user(User, msg) 36 | const char *User; 37 | char *msg; 38 | { 39 | int cnt = 0, fdutmp; 40 | int ftty; 41 | int msgsize; 42 | char buf[BUFSIZ]; 43 | char user[40]; 44 | int i, m, n = (BUFSIZ / sizeof(struct utmp)); 45 | int bufsiz = n * sizeof(struct utmp); 46 | char tty[16]; 47 | struct stat stats; 48 | 49 | strncpy( user,User,sizeof(user)-1 ); 50 | user[8] = 0; /* Sorry, UNIX max... */ 51 | 52 | 53 | msgsize = strlen(msg); 54 | 55 | lowerstr(user); 56 | despace(user,strlen(user)); 57 | 58 | if ((fdutmp = open(UTMP_FILE, O_RDONLY,0600)) <= 0) { 59 | return(0); 60 | } 61 | 62 | cnt = 0; 63 | 64 | while ((m = read(fdutmp, buf, bufsiz)) > 0) { 65 | m /= sizeof(struct utmp); 66 | for (i = 0; i < m; i++) { 67 | struct utmp *utp = &((struct utmp*)buf)[i]; 68 | #ifdef LOGIN_PROCESS /* POSIX or what ?? */ 69 | if (utp->ut_type != LOGIN_PROCESS && 70 | utp->ut_type != USER_PROCESS) continue; 71 | #endif 72 | if (utp->ut_name[0] == 0) 73 | continue; 74 | if (strncasecmp(user, utp->ut_name,8) != 0) 75 | continue; 76 | sprintf(tty, "/dev/%s", utp->ut_line); 77 | alarm_happened = 0; 78 | alarm(10); /* We are fast ? */ 79 | if ((ftty = open(tty, O_WRONLY,0600)) < 0) { 80 | alarm(0); 81 | continue; /* Some TTYs accept, some don't */ 82 | } 83 | if (fstat(ftty,&stats)!=0 || (stats.st_mode & 022)==0){ 84 | close(ftty); /* mesg -n! */ 85 | alarm(0); 86 | continue; /* Some TTYs accept, some don't */ 87 | } 88 | if (write(ftty, msg, msgsize) < msgsize) { 89 | alarm(0); 90 | close(ftty); 91 | continue; /* Some TTYs accept, some don't */ 92 | } 93 | alarm(0); 94 | close(ftty); 95 | ++cnt; 96 | } 97 | } 98 | close(fdutmp); 99 | 100 | if(cnt == 0) 101 | cnt = send_gone(user, msg); 102 | return(cnt); 103 | } 104 | -------------------------------------------------------------------------------- /unix_msgs.h: -------------------------------------------------------------------------------- 1 | /* unix_msgs.h -- FUNET-NJE NMR exit constants & structs */ 2 | 3 | enum msg_exit_actions { 4 | msg_discard, 5 | msg_inetudp 6 | }; 7 | 8 | struct msg_exit_req { 9 | short size; /* Size of this request */ 10 | char regflag; /* 0: deregister, 1: register */ 11 | char userid[9]; /* Userid (8 chars) */ 12 | enum msg_exit_actions action; /* method */ 13 | union { 14 | char none; 15 | struct { 16 | unsigned long key; 17 | pid_t remotepid; 18 | struct sockaddr_in addr; 19 | } udp; 20 | } u; 21 | }; 22 | 23 | struct msg_package { 24 | unsigned long key; 25 | short size; 26 | char fromnode[9], 27 | fromuser[9], 28 | tonode[9], 29 | touser[9]; 30 | char type; /* 'A', 'C', or 'M', or 'T' -- Time-stamped 'M' */ 31 | char message[1]; /* N chars.. */ 32 | }; 33 | -------------------------------------------------------------------------------- /unix_route.c: -------------------------------------------------------------------------------- 1 | /* UNIX_ROUTE.C (Formerly UNIX_SEARCH_ROUTE) V1.2-mea-1.4 2 | | Copyright (c) 1988,1989,1990 by 3 | | The Hebrew University of Jerusalem, Computation Center. 4 | | 5 | | This software is distributed under a license from the Hebrew University 6 | | of Jerusalem. It may be copied only under the terms listed in the license 7 | | agreement. This copyright message should never be changed or removed. 8 | | This software is gievn without any warranty, and the Hebrew University 9 | | of Jerusalem assumes no responsibility for any damage that might be caused 10 | | by use or misuse of this software. 11 | | 12 | | Full rewrite for FUNET-NJE package, and own `bintree' database by 13 | | (c) Finnish University and Research Network, FUNET, 1993, 1994. 14 | */ 15 | #include "consts.h" 16 | #include "prototypes.h" 17 | #include "bintree.h" 18 | 19 | extern int errno; 20 | extern int errno; 21 | #ifdef __DARWIN_UNIX03 22 | extern const int sys_nerr; /* Maximum error number recognised */ 23 | #else 24 | extern int sys_nerr; /* Maximum error number recognised */ 25 | #endif 26 | 27 | struct Bintree *routedb = NULL; 28 | 29 | /* Database needs this comparison routine.. */ 30 | int CompareRoute(r1,r2) 31 | struct ROUTE_DATA *r1, *r2; 32 | { 33 | return strcmp(r1->DestNode, r2->DestNode); 34 | } 35 | 36 | 37 | /* 38 | | Open the address file. 39 | */ 40 | int 41 | open_route_file() 42 | { 43 | 44 | routedb = bintree_open(TABLE_FILE, 45 | sizeof(struct ROUTE_DATA), 46 | CompareRoute); 47 | if (routedb == NULL) { 48 | logger(1, "UNIX_ROUTE: can't open Bintree database file `%s', error: %s\n", 49 | TABLE_FILE, PRINT_ERRNO); 50 | return 0; 51 | } 52 | return 1; /* Success */ 53 | } 54 | 55 | /* 56 | | Close the file. Since the descriptor is static, we need this routine. 57 | */ 58 | void 59 | close_route_file() 60 | { 61 | bintree_close(routedb); 62 | routedb = NULL; 63 | } 64 | 65 | 66 | /* 67 | | Get the record whose key is the node we look for. Return the line 68 | | which corresponds to it, and 1. Return 0, if nothing found, and no 69 | | 'defaultroute'. Flag 'defaultroute' by returning -1. 70 | */ 71 | int 72 | get_route_record(key, line, LineSize) 73 | const char *key; 74 | char *line; 75 | const int LineSize; 76 | { 77 | struct ROUTE_DATA Key, *Route; 78 | 79 | 80 | /* Copy the site name and pad it with blanks to 8 characters */ 81 | memcpy(Key.DestNode, key, 8); 82 | Key.DestNode[8] = 0; 83 | /* It is already in upper-case.. */ 84 | 85 | Route = bintree_find(routedb, &Key); 86 | if (Route == NULL) { 87 | /* Not found. If there is default route - use 88 | it now and return success */ 89 | if (*DefaultRoute != '\0') { 90 | #ifdef DEBUG 91 | logger(4, "Using default route for '%s'\n", key); 92 | #endif 93 | sprintf(line, "%s E", DefaultRoute); 94 | return -1; 95 | } 96 | #ifdef DEBUG 97 | logger(2,"Not found a route record for key: `%s'/\n",key); 98 | #endif 99 | return 0; /* Not found */ 100 | } 101 | 102 | sprintf(line, "%s %c", Route->DestLink, Route->Fmt); 103 | return 1; 104 | } 105 | 106 | 107 | 108 | /* 109 | | Change a route of node. If it exists, update its record. If not, add it. 110 | | If the node is not local, the format used is EBCDIC. 111 | */ 112 | void 113 | change_route(Node, Route) 114 | const char *Node; 115 | char *Route; 116 | { 117 | char line[LINESIZE]; 118 | struct ROUTE_DATA Key, *Routep; 119 | int delete; 120 | 121 | delete = (strcasecmp(Route, "DEFAULT")==0 || 122 | strcasecmp(Route, "OFF")==0); 123 | 124 | /* Convert to upper case and add trailing blanks. */ 125 | memcpy(Key.DestNode, Node, 8); 126 | Key.DestNode[8] = 0; 127 | upperstr(Key.DestNode); 128 | memcpy(Key.DestLink, Route, 8); 129 | Key.DestLink[8] = 0; 130 | upperstr(Key.DestLink); 131 | Key.Fmt = 'E'; 132 | 133 | /* Try retrieving it. If exists - use update */ 134 | 135 | Routep = bintree_find(routedb,&Key); 136 | 137 | *line = 0; 138 | if (Routep != NULL) { 139 | sprintf(line, "%s %s %c", 140 | Routep->DestNode, Routep->DestLink, Routep->Fmt); 141 | if (delete) { 142 | bintree_delete(routedb,&Key); 143 | logger(1, "CHANGE_ROUTE: Deleted route '%s'\n",line); 144 | return; 145 | } 146 | } 147 | if (delete) return; /* Already off.. */ 148 | 149 | if (strcmp(Route, "LOCAL") == 0) 150 | Key.Fmt = 'A'; 151 | else 152 | Key.Fmt = 'E'; 153 | 154 | if (Routep != NULL) { 155 | memcpy(Routep,&Key,sizeof(Key)); 156 | bintree_update(routedb,Routep); 157 | } else { 158 | bintree_insert(routedb,&Key); 159 | } 160 | if (*line == 0) /* New route */ 161 | logger(1, "CHANGE_ROUTE, New routing record added: '%s %s %c'\n", 162 | Key.DestNode, Key.DestLink, Key.Fmt); 163 | else /* Updated route - show the old one also */ 164 | logger(1, "CHANGE_ROUTE, New routing record added: '%s %s %c' instead of '%s'\n", 165 | Key.DestNode, Key.DestLink, Key.Fmt, line); 166 | } 167 | -------------------------------------------------------------------------------- /version.c: -------------------------------------------------------------------------------- 1 | /* versio.c -- autogenerated by version.sh at distribution creation */ 2 | char *version_time = "9603221351"; 3 | -------------------------------------------------------------------------------- /version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # New distribution version.. 4 | vers=`TZ=GMT date "+%y%m%d%H%M"` 5 | cat > version.c << EOF 6 | /* versio.c -- autogenerated by version.sh at distribution creation */ 7 | char *version_time = "$vers"; 8 | EOF 9 | -------------------------------------------------------------------------------- /vogon.cf: -------------------------------------------------------------------------------- 1 | * 2 | * Configuration file for FUNET-NJE program 3 | * 4 | 5 | NAME VOGON 6 | IPADDRESS 130.232.8.57 7 | QUEUE /usr/spool/bitnet 8 | CMDMAILBOX /usr/spool/bitnet/.cmdpipe 9 | LOG /usr/adm/bitnet.log 10 | *RSCSACCT /usr/adm/bitnet.acct 11 | * this table is a binary file. 12 | TABLE /usr/local/lib/huji/vogon.routes 13 | INFORM MEA@VOGON 14 | FILEEXITS /usr/local/lib/huji/file-exit.cf 15 | MSGEXITS /usr/local/lib/huji/msg-exit.cf 16 | DEFFORM STANDARD 17 | LLEVEL 1 18 | *DEFAULT-ROUTE FINHUTC 19 | *DEFAULT-ROUTE FIGBOX 20 | 21 | LINE 0 FINFILES 22 | TYPE UNIX_TCP 23 | BUFSIZE 1024 24 | TIMEOUT 3 25 | IPPORT 175 26 | TCPNAME nic.funet.fi 27 | TCP-SIZE 8192 28 | MAX-STREAMS 7 29 | -------------------------------------------------------------------------------- /who.c: -------------------------------------------------------------------------------- 1 | /* A UTMP reading demo hack.. */ 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #define UTMP_FILE "/etc/utmp" 10 | #define LINESIZE 512 11 | 12 | static void 13 | list_users(Faddress, Taddress, UserName) 14 | char *Faddress, *Taddress, *UserName; 15 | { 16 | char line[LINESIZE]; 17 | int fd, rc, lines; 18 | struct utmp Utmp; 19 | struct passwd *pwd; 20 | 21 | if ((fd = open(UTMP_FILE,O_RDONLY,0600)) < 0) { 22 | sprintf(line,"Can't open `%s' for reading. No CPQ USER commands now.",UTMP_FILE); 23 | } else { 24 | lines = 0; 25 | while (read(fd,&Utmp,sizeof Utmp) == sizeof Utmp) { 26 | if (*Utmp.ut_name == 0) continue; /* Try next */ 27 | pwd = getpwnam(Utmp.ut_name); 28 | if (pwd == NULL) continue; /* Hmm ??? */ 29 | ++lines; 30 | if (1 == lines) { 31 | strcpy(line,"Login Name"); 32 | printf("%s\n",line); 33 | } 34 | sprintf(line,"%-8s %s",Utmp.ut_name,pwd->pw_gecos); 35 | printf("%s\n",line); 36 | } 37 | close (fd); 38 | } 39 | } 40 | 41 | main() 42 | { 43 | list_users(0,0,0); 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /ygone: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshix/UnixNJE/dce92f67cda3e49c5d1da21f65a04f2216f334dd/ygone -------------------------------------------------------------------------------- /ygone.c: -------------------------------------------------------------------------------- 1 | /* YGONE.C V1.3 2 | | 3 | | It has two parts which are different in functionality: 4 | | YGONE/CONTINUE: Will trap all messages sent to the terminal into a file. 5 | | This is a general mechanism and the NJE emulator is not concerned. 6 | | The messages are appended to SYS$LOGIN:YGONE_MESSAGES.TXT, and the 7 | | terminal is left logged in but unuseable for any other thing, until 8 | | this program is aborted. When aborting the terminal is set to 9 | | Broadcast, disregarding its previous setup. 10 | | 11 | | YGONE - Inform the NJE emulator that you want to be added to the Gone list. 12 | | YGONE/DISABLE - Remove yourself from the gone list. 13 | | 14 | | V1.1 - 25/3/90 - Add support for Unix. 15 | | V1.2 - 28/3/90 - Account for long lines, thus not overflowing one screen 16 | | when long lines are displayed. 17 | | V1.3 - 15/10/90 - When called with /DISABLE call Mail_check() to inform 18 | | about new mails. 19 | | V2.0 - 1/10/93 - Ported to FUNET version K000165@ALIJKU11, and [mea] 20 | */ 21 | #include "consts.h" 22 | #include "prototypes.h" 23 | #include "clientutils.h" 24 | 25 | /* Hold the terminal characteristics in order to change and retore them: */ 26 | struct terminal_char { /* Terminal characteristics */ 27 | unsigned char class, type; 28 | unsigned short PageWidth; 29 | long BasicChars; 30 | long ExtChars; 31 | } TerChar; 32 | short TerminalMailboxChan, TerminalChan; 33 | int MessagesCount = 0; /* So we can inform user how many new messages */ 34 | 35 | char LOCAL_NAME [10]; 36 | char BITNET_QUEUE [80]; 37 | char LOG_FILE [80] = "-"; /* STDERR as the default */ 38 | 39 | int LogLevel = 1; 40 | FILE *LogFd =NULL; 41 | 42 | #ifdef UNIX 43 | #define MESSAGE_FILE ".ygone.messages" 44 | #else /* must be VMS.. */ 45 | #define MESSAGE_FILE "YGONE_MESSAGES.TXT" 46 | #endif 47 | 48 | 49 | /* The file descriptor to write messages on */ 50 | FILE *MessageFd; 51 | /*********************** NJE-GONE section *****************************/ 52 | /* 53 | | Get the user's login directory, create a command line which contains it and 54 | | the username and starts with the command code CMD_GONE_ADD, and then send 55 | | it to the NJE emulator. 56 | */ 57 | void add_gone() 58 | { 59 | char *LoginDirectory; 60 | char UserName[128], CommandLine[128]; 61 | struct passwd *UserEntry, *getpwnam(); 62 | 63 | mcuserid(UserName); 64 | if ((UserEntry = getpwnam(UserName)) == NULL) { 65 | perror("Getpwname"); exit(1); 66 | } 67 | LoginDirectory = UserEntry->pw_dir; 68 | 69 | *CommandLine = CMD_GONE_ADD; 70 | mcuserid(&CommandLine[1]); /* The username */ 71 | strcat(CommandLine, " "); /* A space to separate them */ 72 | strcat(CommandLine, LoginDirectory); /* And the login directory */ 73 | strcat(CommandLine, "/"); 74 | /* And send it to emulator */ 75 | send_cmd_msg(CommandLine, strlen(&CommandLine[1]) + 1, 0); /* Must be ONLINE! */ 76 | 77 | } 78 | 79 | /* 80 | | Inform the NJE emulator to remove the user from the gone list. 81 | */ 82 | void remove_gone() 83 | { 84 | char CommandLine[128]; 85 | 86 | *CommandLine = CMD_GONE_DEL; 87 | mcuserid(&CommandLine[1]); /* The username */ 88 | /* And send it to emulator */ 89 | send_cmd_msg(CommandLine, strlen(&CommandLine[1]) + 1, 0); /* Must be ONLINE! */ 90 | } 91 | 92 | 93 | void logout_process() 94 | { 95 | printf("Logout now!!!!\n"); 96 | } 97 | 98 | /* 99 | | Display the file on the screen, one screen at a time. Delete it after done. 100 | */ 101 | void display_file() 102 | { 103 | int counter; 104 | char line[256]; 105 | char FileName[128], UserName[128], *LoginDirectory; 106 | struct passwd *UserEntry, *getpwnam(); 107 | FILE *fd; 108 | 109 | mcuserid(UserName); 110 | if ((UserEntry = getpwnam(UserName)) == NULL) { 111 | perror("Getpwname"); exit(1); 112 | } 113 | LoginDirectory = UserEntry->pw_dir; 114 | 115 | sprintf(FileName, "%s/%s", LoginDirectory, MESSAGE_FILE); 116 | 117 | if((fd = fopen(FileName, "r")) == NULL) 118 | return; /* New new messages or user not subscribed */ 119 | counter = 0; 120 | 121 | if (fgets(line, sizeof line, fd) == NULL) { /* Empty file */ 122 | 123 | printf("No new messages have arrived!\n"); 124 | 125 | } else { 126 | 127 | printf("New messages have arrived:\n"); 128 | printf("-------------------------\n"); 129 | 130 | for(;;) { 131 | printf("%s", line); 132 | counter += (strlen(line) / 80); /* Add for lines longer than 80 */ 133 | if(counter++ > 20) { 134 | printf(" to continue, Anything else to abort: "); 135 | fgets(line, sizeof line, stdin); 136 | if((*line != '\n') && (*line != '\0')) break; 137 | counter = 0; 138 | printf("\033[2J\033[H"); /* Clear screen */ 139 | } 140 | if(fgets(line, sizeof line, fd) == NULL) break; /* End of file */ 141 | } 142 | 143 | } 144 | 145 | fclose(fd); 146 | unlink(FileName); 147 | } 148 | 149 | void 150 | usage() 151 | { 152 | printf("\ 153 | YGONE: Inform NJE transporter about your intention to disappear\n\ 154 | Options: mark up yourself as gone..\n\ 155 | -d disable to gone -- come back\n"); 156 | printf("\ 157 | Messages arrived while you were gone will be logged into your\n\ 158 | login directory file: %s, and displayed when you\n\ 159 | return and issue command: ygone -d\n",MESSAGE_FILE); 160 | exit(1); 161 | } 162 | 163 | /* 164 | | If there are no parameters - inform NJE and logout. If there is a parameter 165 | | named /CONTINUE - only trap terminal messages and do not logout; this is 166 | | general and have no special connection to the NJE emulator. 167 | */ 168 | void main(cc, vv) 169 | char **vv; 170 | int cc; 171 | { 172 | read_configuration(); 173 | if(cc == 1) { /* No parameters */ 174 | add_gone(); /* Inform emulator about it. */ 175 | printf("Your messages will be recorded while you are away.\n"); 176 | logout_process(); /* Send him home */ 177 | exit(0); 178 | } 179 | if (strcmp(vv[1], "-d") == 0) { /* YGONE/DISABLE */ 180 | remove_gone(); 181 | display_file(); 182 | exit(0); 183 | } 184 | usage(); 185 | } 186 | -------------------------------------------------------------------------------- /zmailer-configs/router.cf: -------------------------------------------------------------------------------- 1 | #!/l/mail/bin/router -dkf 2 | # 3 | # ZMailer 2 configuration file for a generic SMTP host (with UUCP links) 4 | # 5 | 6 | ZCONFIG=/etc/zmailer.conf 7 | 8 | . $ZCONFIG 9 | 10 | PATH=.:$MAILSHARE/cf:$MAILBIN/bin ; export PATH 11 | PS1=z$PS1 12 | # 13 | # Configure error logging (squirrel) 14 | # 15 | squirrel -breakin 16 | squirrel badheader 17 | 18 | # The transport preference order 19 | 20 | protocols='routes bitnet usenet smtp' # Local tables at first, then 21 | # the DNS interactions.. 22 | 23 | # We may want .forward and mailing list files to be private, i.e., we ignore 24 | # the current privileges when checking the privileges of such files. 25 | # Don't add 'include' to this list, since anyone can :include: any file. 26 | 27 | private='.forward maillist' 28 | 29 | # Set up the dependency checking 30 | 31 | . consist.cf 32 | require siteinfo router crossbar process server 33 | 34 | # The following are standard setup files and must be loaded in this order 35 | 36 | . standard.cf 37 | . trusted.cf 38 | 39 | # Load the databases so they and the variables defined (e.g. network-specific 40 | # node names for this host) can be used in the site specific configuration. 41 | 42 | for method in $protocols 43 | do 44 | test -f $MAILSHARE/cf/i-${method}.cf && . i-${method}.cf 45 | done 46 | 47 | # List of toplevel domains on which we DO canonicalize the hosts.. 48 | # These give a possibility to 49 | toplevels='-' 50 | 51 | mailconf () { 52 | local hname 53 | 54 | # My official hostname 55 | if [ -f /bin/hostname ]; then 56 | rawhostname=$(/bin/hostname) 57 | elif [ -f /etc/sys_id ]; then 58 | read rawhostname < /etc/sys_id 59 | else 60 | rawhostname=$(/bin/uname -n) 61 | fi 62 | 63 | hname=$(canon $rawhostname) 64 | 65 | # Try to discover the organizational domain name 66 | orgdomain=$hname 67 | sift $hname in 68 | $rawhostname\.(.+) 69 | orgdomain=\1 70 | ;; 71 | tfis 72 | hostname=$hname 73 | 74 | # This is what it will say on out mail 75 | mydomain=$hostname 76 | } 77 | 78 | orgdomains=x 79 | : ${MAILCONF:=/etc/mail.conf} 80 | if [ ! -r $MAILCONF ]; then 81 | echo "$0: missing $MAILCONF: using the following values:" 82 | mailconf 83 | echo orgdomain=$orgdomain 84 | echo hostname=$hostname 85 | echo mydomain=$mydomain 86 | provide siteinfo 87 | else 88 | . $MAILCONF && provide siteinfo 89 | fi 90 | world="" 91 | [ "$orgdomains" = x ] && orgdomains=$orgdomain 92 | 93 | # set hostname to enable message-id generation and checking 94 | hostname $hostname 95 | 96 | . aliases.cf 97 | . canon.cf 98 | . rrouter.cf 99 | . crossbar.cf 100 | 101 | for method in $protocols 102 | do 103 | . p-${method}.cf 104 | done 105 | 106 | . process.cf 107 | . server.cf 108 | 109 | consist || exit 1 110 | 111 | -------------------------------------------------------------------------------- /zmailer-configs/scheduler.conf: -------------------------------------------------------------------------------- 1 | # Do not edit this file, instead edit /home/polaris/mea/src/zmailer/proto/scheduler.conf 2 | # 3 | # Scheduler configuration file 4 | # 5 | # The scheduler reads this file on startup or when it receives a SIGUSR1 signal 6 | # 7 | # Every channel/host combination in recipient addresses will be sifted through 8 | # the clauses matched in this file, picking up parameters until a clause that 9 | # specifies a command. Everything is free-form with three requirements: 10 | # Clauses (i.e. the channel/host pattern) start at the beginning of a line. 11 | # Clause contents (i.e. the parameters) don't. 12 | # Components are separated by whitespace. 13 | # NB! For command paths, the "current directory" is MAILBIN/ta 14 | 15 | # Boilerplate default parameters 16 | */* interval=1m 17 | # expire messages after 3 days without full delivery 18 | expiry=3d 19 | # when the scheduler gets to the end of the retry sequence, 20 | # it starts over at some random point in the middle. The 21 | # numbers are factors of the scheduling interval. 22 | retries="1 1 2 3 5 8 13 21 34" 23 | # no default limits on simultaneous transport agents or 24 | # connections to a particular host 25 | maxchannel=0 26 | maxhosts=0 27 | # 28 | maxta=250 # SunOS has a limit of 256 FDs, don't overbook.. 29 | # 30 | # skew is maximum number of tries before the retry time is 31 | # aligned to a standard boundary (seconds modulo interval). 32 | skew=1 33 | # default uid/gid of transport agents 34 | user=root 35 | group=daemon 36 | 37 | # This is a FAST EXPIRY test case.. Will always cause bounce, btw.. 38 | smtp/*-gw.funet.fi 39 | maxchannel=0 40 | maxhosts=1 41 | expiry=1m 42 | interval=15s 43 | retries="1" 44 | skew=1 45 | command="smtp -sl /var/log/mail/smtp $host" 46 | 47 | # Within FUNET we have a bit longer expiry.. 48 | smtp/*funet.fi 49 | maxchannel=199 50 | maxhosts=1 51 | # maxta=2 52 | expiry=14d 53 | interval=10m 54 | retries="1 1 2 3 5 8 13 21 34" 55 | skew=1 56 | gangschedule 57 | byhost 58 | # Do FORCED MIME-decoding into C-T-E: 8BIT 59 | command="smtp -8sl /var/log/mail/smtp $host" 60 | 61 | # Within our organization we care more about speed and capacity than connections 62 | # The maxchannel value should be larger than the value used by smtp/*, to avoid 63 | # some potential state and phase problems in the queues. 64 | smtp/*.fi 65 | maxchannel=199 66 | maxhosts=2 67 | # maxta=4 68 | interval=10m 69 | retries="1 1 2 3 5 8 13 21 34" 70 | skew=1 71 | gangschedule 72 | byhost 73 | command="smtp -sl /var/log/mail/smtp $host" 74 | 75 | # Connections to the outside shouldn't duplicate effort so we only allow one 76 | # per destination. 77 | smtp/* 78 | maxchannel=199 79 | # maxta=25 80 | maxhosts=1 81 | gangschedule 82 | byhost 83 | command="smtp -sl /var/log/mail/smtp $host" 84 | 85 | # Error messages. Delivery can be retried at leisure. 86 | error/* interval=5m 87 | maxchannel=10 88 | command=errormail 89 | 90 | # UUCP delivery. The "sm" transport agent picks the first host it sees and 91 | # will select further recipient addresses with that host only. We tell 92 | # the scheduler this with the "byhost" boolean, to avoid a staggered delivery 93 | # effect if the scheduler has to discover this on its own. 94 | uucp/* maxchannel=5 95 | byhost 96 | command="sm -8c $channel uucp" 97 | 98 | # News delivery. Hostname is always the same here. 99 | usenet/* maxchannel=2 100 | command="sm -8c $channel usenet" 101 | 102 | # UBC EAN X.400 gateway. See comment at UUCP. 103 | ean/* maxchannel=1 104 | byhost 105 | command="sm -c $channel ean" 106 | 107 | # Deferred delivery is handled by this transport agent. Deferrals are low 108 | # priority, but they tend to bunch up. The 1 channel slot means there will 109 | # be lots of contention, and typical checking intervals will be a bit higher 110 | # than what is specified (due to waiting for a free slot). 111 | hold/* interval=5m 112 | maxchannel=1 113 | command=hold 114 | 115 | # BITNET delivery methods 116 | 117 | defrt1/* 118 | maxchannel=3 119 | maxhosts=1 120 | command="sm -c $channel defrt1" 121 | 122 | bsmtp3/* 123 | maxchannel=3 124 | maxhosts=1 125 | command="sm -c $channel bsmtp3" 126 | 127 | bsmtp3nd/* 128 | maxchannel=3 129 | maxhosts=1 130 | command="sm -c $channel bsmtp3nd" 131 | bsmtp3rfc/* 132 | maxchannel=3 133 | maxhosts=1 134 | command="sm -c $channel bsmtp3" 135 | 136 | bsmtp3ndrfc/* 137 | maxchannel=3 138 | maxhosts=1 139 | command="sm -c $channel bsmtp3nd" 140 | 141 | # Local delivery: user mail, files, processes 142 | local/* 143 | interval=10s 144 | expiry=3h 145 | maxhosts=20 146 | # want 2 channel slots in case of blockage on one 147 | maxchannel=2 148 | byhost 149 | # maxta=4 150 | # 151 | # Do MIME text/plain; Quoted-Printable -> text/plain; 8BIT 152 | # conversion on flight! 153 | command="mailbox -8 -h $host" 154 | -------------------------------------------------------------------------------- /zmailer-configs/sm.conf: -------------------------------------------------------------------------------- 1 | # Do not edit this file, instead edit /mnt/home/staff/mea/zmailer/proto/sm.conf 2 | # 3 | # M F = P = A = 4 | # the following entries are in active use at this site: 5 | #uucp U /usr/bin/uux uux - -r -a$g -gC $h!rmail ($u) 6 | usenet m /l/mail/bin/ta/usenet usenet $u 7 | # 8 | # bitnet stuff F=hu not set? 9 | # 10 | bsmtp3 snmSX /l/funetnje/bmail bmail -b $h $g $u 11 | bsmtp3nd snmSX /l/funetnje/bmail bmail -nd $h $g $u 12 | defrt1 snS /l/funetnje/bmail bmail $g $u 13 | # 14 | # the following entries are included to illustrate other possibilities 15 | # 16 | #local mS /usr/lib/mail/localm localm -r $g $u 17 | #prog - /bin/sh sh -c $u 18 | #tty rs /usr/local/to to $u 19 | #ean mn /local/lib/ean/mailer mailer -d $u 20 | #test n /local/lib/mail/bin/test test $u 21 | #netdata smnS /usr/local/lib/mail/bit/netdata-send netdata-send $h $g $u 22 | --------------------------------------------------------------------------------