%%s 7/3/546 %%d D 1.3 09-Apr-82 14:38:12 tools 3 2 %%c Modified mail.w`mail.r`pstmrk to look for the first blank character in %%c the buffer returned by mailid. If one is found, it is replaced by an %%c EOS character. This is to ensure that the format of the From: string %%c in the message is compatible with msg's answer command. %%s 1/2/548 %%d D 1.2 05-Apr-82 19:44:26 tools 2 1 %%c Eliminate definition of USERSIZE in `mailsym'. USERSIZE is now defined %%c in symbols. %%s 0/0/0 %%d D 1.1 25-Mar-82 12:08:44 v1.1 1 0 %%c Version 1.1 is the Spring 1982 Distribution of the LBL/Hughes release %%c of the Software Tools Virtual Operating System software and documentation. %%T %%I 1 %%D 2 #-h- mailsym 352 asc 25-mar-82 08:07:50 v1.1 (sw-tools v1.1) %%E 2 %%I 2 #-h- mailsym 331 asc 05-apr-82 19:43:17 tools (lblh csam sventek) %%E 2 # symbol definitions used by: mail, postmn # should be placed on a file named mailsym # define(UNKNOWN,-1) %%D 2 define(USERSIZE,40) %%E 2 define(TERMEOF,"^Z") define(TIMEZONE,"PST") define(RIGHTMARGIN,72) ifdef(LARGE_ADDRESS_SPACE) define(MEM_SIZE,16000) elsedef define(MEM_SIZE,4000) # size of dynamic storage in integers (dpm 10-Jun-81) enddef #-h- cmail 445 asc 25-mar-82 08:07:50 v1.1 (sw-tools v1.1) # common block used by: mail # should be placed on a file named cmail # common / cmail / nusers, regist, edit, temp1(FILENAMESIZE), temp2(FILENAMESIZE) integer nusers # number of validated users to send mail to integer regist # whether mail is registered or not integer edit # whether to invoke editor to generate mail to send character temp1 # name of mail temporary file character temp2 # name of mail temporary file %%D 3 #-h- mail.r 9460 asc 25-mar-82 08:07:53 v1.1 (sw-tools v1.1) %%E 3 %%I 3 #-h- mail.r 9535 asc 09-apr-82 14:36:47 tools (lblh csam sventek) %%E 3 #-h- main 838 asc 25-mar-82 08:07:27 v1.1 (sw-tools v1.1) DRIVER(mail) include mailsym character arg(FILENAMESIZE), buf(MAXLINE), file(FILENAMESIZE) integer i, int, n, junk integer getarg, equal, open, getlin, index, getwrd include cmail string all "all" string flags "+-?" call query("usage: mail [-er] [-llistfile] ... [addressee] ...") call malint(arg, file, buf) for (i=1; getarg(i, arg, FILENAMESIZE) != EOF; i=i+1) { call fold(arg) if (equal(arg, all) == YES) { call adrfil(file) int = open(file, READ) if (int != ERR) { while (getlin(buf, int) != EOF) { n = 1 junk = getwrd(buf, n, arg) if (junk > 0) call addusr(arg, buf) } call close(int) } } else if (index(flags, arg(1)) > 0) call malcmd(arg, file, buf) else call addusr(arg, buf) } if (nusers != 0) call sdmail(buf, arg, file) DRETURN end #-h- addusr 686 asc 25-mar-82 08:07:28 v1.1 (sw-tools v1.1) # addusr -- subroutine to add user to stack of users for mail subroutine addusr(arg, temp) character arg(USERSIZE), temp(FILENAMESIZE) integer int, init integer create, tblook include cmail string t1 "mt1" string t2 "mt2" data init /YES/ if (init == YES) { call scratf(t1, temp1) call scratf(t2, temp2) int = create(temp1, WRITE) if (int == ERR) call merror(temp1) init = NO } if (arg(1) == EOS) call close(int) else if (tblook(arg, temp) == YES) { nusers = nusers + 1 call putlin(arg, int) call putch('@n', int) } else { call putlin("Invalid user name: ", ERROUT) call remark(arg) } return end #-h- badarg 130 asc 25-mar-82 08:07:28 v1.1 (sw-tools v1.1) subroutine badarg(arg) character arg(ARB) call putlin("Ignoring invalid argument: ", ERROUT) call remark(arg) return end #-h- cleanf 133 asc 25-mar-82 08:07:29 v1.1 (sw-tools v1.1) subroutine cleanf integer junk integer remove include cmail junk = remove(temp1) junk = remove(temp2) call endst(OK) end #-h- dotost 661 asc 25-mar-82 08:07:29 v1.1 (sw-tools v1.1) subroutine dotost(out, user) integer out, in, i, j, n integer open, length, getlin character user(USERSIZE) include cmail string tos "To: " string bls " " in = open(temp1, READ) if (in == ERR) call merror(temp1) call putlin(tos, out) j = 9 for (i=getlin(user,in); i != EOF; i=getlin(user,in)) { user(i) = EOS n = j + length(user) + 1 if (n > RIGHTMARGIN) { call putch(',', out) call putch('@n', out) call putlin(bls, out) j = 9 } if (j > 9) call putch(',', out) call putch(' ', out) call putlin(user, out) j = j + length(user) + 2 } call putch('@n', out) call close(in) return end #-h- editit 473 asc 25-mar-82 08:07:30 v1.1 (sw-tools v1.1) subroutine editit(file, buf) character file(FILENAMESIZE), buf(ARB), proc(FILENAMESIZE), pid(PIDSIZE) integer i, spawn, loccom string suffix IMAGE_SUFFIX string ed "ed" call impath(buf) if (loccom(ed, buf, suffix, proc) != BINARY) call error("Cannot locate ed image file.") i = 1 call stcopy(ed, 1, buf, i) call chcopy(' ', buf, i) call scopy(file, 1, buf, i) if (spawn(proc, buf, pid, WAIT) == ERR) call error("Error in spawning ed!") return end #-h- gsbjct 277 asc 25-mar-82 08:07:31 v1.1 (sw-tools v1.1) subroutine gsbjct(buf) character buf(MAXLINE) integer n integer isatty, prompt string subjct "Subject: " if (isatty(STDIN) == YES) { n = prompt(subjct, buf, STDIN) if (n >= 1) buf(n) = EOS else buf(1) = EOS } else buf(1) = EOS return end #-h- malcmd 917 asc 25-mar-82 08:07:31 v1.1 (sw-tools v1.1) ## malcmd -- interprets command selectes for mail subroutine malcmd(iarg, out, buf) character iarg(FILENAMESIZE), mllist(FILENAMESIZE), out(FILENAMESIZE), buf(MAXLINE) integer i, int, open, getlin, getwrd, index include cmail if (iarg(1) == '-' & iarg(2) == 'l') { call scopy(iarg, 3, mllist, 1) int = open(mllist, READ) if (int != ERR) { while (getlin(buf, int) != EOF) { i = index(buf, '#') # pound sign signals start of comment if (i > 0) buf(i) = EOS # terminate scan for users there i = 1 while (getwrd(buf, i, out) > 0) call addusr(out, iarg) } call close(int) } else { call putlin("Error in opening mailing list file: ", ERROUT) call remark(mllist) } } else if (iarg(1) == '-') { if (index(iarg, 'r') > 0) regist = YES if (index(iarg, 'e') > 0) edit = YES } else call badarg(iarg) return end #-h- malinp 1285 asc 25-mar-82 08:07:32 v1.1 (sw-tools v1.1) subroutine malinp(temp, file, buf, edit) integer edit, int, open, isatty, create, getlin, inp, fsize, prompt integer junk, remove character file(FILENAMESIZE), buf(MAXLINE), clower, temp(FILENAMESIZE) string mts "mts" int = create(temp, WRITE) if (int == ERR) call merror(temp) call gsbjct(buf) call pstmrk(int, buf) inp = STDIN if (isatty(STDIN) == YES) { if (edit == YES) { call scratf(mts, file) call remark("You are now entering ed to create your mail") call remark("Please wait for ed to respond with 0") call editit(file, buf) inp = open(file, READ) if (inp == ERR | fsize(file) == 0) { call close(inp) junk = remove(file) call close(int) call cleanf } } else { call putlin("Input message: (q to quit or ", ERROUT) call putlin(TERMEOF, ERROUT) call remark(" to send)") } } while (getlin(buf, inp) != EOF) if (clower(buf(1)) == 'q' & buf(2) == '@n' & edit == NO) { call close(int) call cleanf } else call putlin(buf, int) call close(int) if (inp != STDIN) { call close(inp) junk = remove(file) } return end #-h- malint 583 asc 25-mar-82 08:07:33 v1.1 (sw-tools v1.1) subroutine malint(arg, file, buf) character arg(FILENAMESIZE), file(FILENAMESIZE), buf(MAXLINE) integer int, i, junk integer open, getlin, getwrd include cmail DS_DECL(Mem,MEM_SIZE) # dynamic storage region for symbol table nusers = 0 regist = NO edit = NO call adrfil(file) call tbinit(MEM_SIZE) int = open(file, READ) if (int != ERR) { while (getlin(buf, int) != EOF) { i = 1 junk = getwrd(buf, i, arg) junk = getwrd(buf, i, file) call tbinst(arg, file) } call close(int) } else call error("Cannot open local users file.") return end #-h- merror 149 asc 25-mar-82 08:07:33 v1.1 (sw-tools v1.1) subroutine merror(buf) character buf(ARB) call putlin("Cannot open mail temporary file: ", ERROUT) call remark(buf) call cleanf return end #-h- notify 354 asc 25-mar-82 08:07:34 v1.1 (sw-tools v1.1) ### Notify Send message to all terminals user is logged in on. subroutine notify( user, msg) character msg(ARB), user(ARB), term(FILENAMESIZE), tlist(MAXLINE) integer i integer getwrd, trmlst # function(s) if( trmlst( user, tlist) == 0 ) return # not logged in. for( i = 1 ; getwrd( tlist, i, term) != 0 ; ) call brdcst( msg, term) return end %%D 3 #-h- pstmrk 810 asc 25-mar-82 08:07:34 v1.1 (sw-tools v1.1) %%E 3 %%I 3 #-h- pstmrk 880 asc 09-apr-82 14:36:37 tools (lblh csam sventek) %%E 3 subroutine pstmrk(int, subjct) character idate(10), itime(10), user(USERSIZE), cupper character hdrpat(4), subjct(ARB) %%D 3 integer int, now(7) %%E 3 %%I 3 integer int, now(7), i integer index %%E 3 string dates "Date: " string dashst " - " string timzon TIMEZONE string froms "From: " string subjs "Subject: " data hdrpat/1, 1, '@n', EOS/ call mailid(user) %%I 3 i = index(user, ' ') if (i > 0) user(i) = EOS %%E 3 user(1) = cupper(user(1)) call getnow(now) call fmtdat(idate, itime, now, LETTER) call putlin(hdrpat, int) call putlin(dates, int) call putlin(idate, int) call putch(' ', int) call putlin(itime, int) call putlin(dashst, int) call putlin(timzon, int) call putch('@n', int) call putlin(froms, int) call putlin(user, int) call putch('@n', int) call putlin(subjs, int) call putlin(subjct, int) call putch('@n', int) call dotost(int, user) call putch('@n', int) return end #-h- sdmail 1142 asc 25-mar-82 08:07:35 v1.1 (sw-tools v1.1) subroutine sdmail(buf, file, user) character buf(MAXLINE), file(FILENAMESIZE), user(FILENAMESIZE) integer inp, int, n, junk, out integer open, getlin, tblook, create, note linepointer topfil include cmail string mymail "mymail" string uhave "[You have new mail]@007" call addusr(EOS) call malinp(temp2, file, buf, edit) inp = open(temp2, READ) if (inp == ERR) call merror(temp2) junk = note(topfil, inp) int = open(temp1, READ) if (int == ERR) { call close(inp) call merror(temp1) } for (n=getlin(buf,int); n != EOF; n=getlin(buf,int)) { buf(n) = EOS junk = tblook(buf, file) call concat(file, mymail, file) call seek(topfil, inp) out = create(file, APPEND) if (out == ERR) { call putlin("Cannot send mail to ", ERROUT) call remark(buf) } else { call fcopy(inp, out) call close(out) call notify( buf, uhave) if (regist == YES) { call putlin("Mail posted to ", ERROUT) call remark(buf) } } } call close(int) call close(inp) call cleanf return end #-h- mail.fmt 2287 asc 25-mar-82 08:07:56 v1.1 (sw-tools v1.1) .so ~bin/manhdr .hd Mail (1) 11-Nov-81 utility for sending mail to local users .sy mail [-er] [-llistfile] ... [addressee] ... .ds mail is a tool designed to allow the user to send mail to fellow users of any system which supports the software tools. It operates as follows: .in +5 .rm -2 The addressees specified in the command line and in any mailing list files specified are validated. If there were any valid users, the standard input is read up to an end-of-file and then mailed to each valid user with an appropriate postmark. (Note: if one wishes to terminate the mail session without sending any mail, type a line consisting of only the letter q [for quit] during the input of mail.) Mailing list files are specified with the -l switch in the command line. The structure of the mailing list files is described below. The -r switch indicates to mail that the user wishes to be notified as the mail is posted to each addressee ('posted' implying that the mail has been appended successfully to the addressee's mail file). The names of valid users may be obtained by prior invocation of the users command. The -e flag will cause the editor "ed" to be invoked, allowing the user to perform complex mail composition. .sp .in -5 .rm +2 The mailing list files have a very simple structure: user names separated by blanks and tabs, with as many users per line as desired. A pound sign (#) appearing anywhere on a line indicates the start of a comment field, and the rest of the line is ignored by mail. This allows the user complete flexibility in commenting her/his mailing lists for informational purposes. .sp Broadcast mailings are supported, also. One must merely specify `all' as an addressee in the command line. .sp If the persons you are sending mail to are currently logged in, they will receive the message .sp .ti +5 [You have new mail] .sp if it is possible to support this feature on your system. .sp .fl mymail - file for storage of each users mail .br mbox - file for storage of saved mail .br three temporary files are used by mail .sa users - a program to list users on current host .br postmn - a program which notifies user of existence of mail .br msg - the utility for reading and sorting one's mail .br sndmsg - expanded mail utility .au Joe Sventek .bu %%E 1