i91@nikhefh.hep.nl (Fons Rademakers) (11/17/88)
This is for Syd Weinstein to put in the ELM ditribution for everybody else who would like ELM on the Apollo. The Apollo port was straight forward. The only problems were with the builtin pager. Also the standard cpp does not like #define bsd4.1, it barfs on the '.'. Therefore use the /usr/lib/cpp by setting the compiler flag -Wp. Also don't use vi or emacs but the DM editor to compose your messages (if you want to edit your mailbox you have to add the call to dm_editor in the edit.c file yourself, just like in editmsg.c). Cheers, Fons Rademakers. =============cut here=========cut here========= *** Makefile.org Wed Nov 16 21:27:11 1988 --- Makefile Wed Nov 16 21:31:00 1988 *************** *** 35,41 opt_utils.c options.c out_utils.c pattern.c pmalloc.c \ quit.c read_rc.c remail.c reply.c returnadd.c save_opts.c \ savecopy.c screen.c showmsg.c showmsg_c.c signals.c softkeys.c \ ! sort.c string2.c strings.c syscall.c utils.c validname.c HEADERS=../hdrs/curses.h ../hdrs/defs.h ../hdrs/headers.h ../hdrs/sysdefs.h --- 35,41 ----- opt_utils.c options.c out_utils.c pattern.c pmalloc.c \ quit.c read_rc.c remail.c reply.c returnadd.c save_opts.c \ savecopy.c screen.c showmsg.c showmsg_c.c signals.c softkeys.c \ ! sort.c string2.c strings.c syscall.c utils.c validname.c dm_editor.c HEADERS=../hdrs/curses.h ../hdrs/defs.h ../hdrs/headers.h ../hdrs/sysdefs.h *************** *** 49,55 quit.o read_rc.o remail.o reply.o returnadd.o save_opts.o \ savecopy.o screen.o showmsg.o showmsg_c.o signals.o \ softkeys.o sort.o string2.o strings.o syscall.o utils.o \ ! validname.o BIN= ../bin --- 49,55 ----- quit.o read_rc.o remail.o reply.o returnadd.o save_opts.o \ savecopy.o screen.o showmsg.o showmsg_c.o signals.o \ softkeys.o sort.o string2.o strings.o syscall.o utils.o \ ! validname.o dm_editor.c BIN= ../bin *************** *** 55,61 BIN= ../bin LIBS= -ltermcap LARGE= ! CFLAGS= -O -I../hdrs LFLAGS= CC= /bin/cc RM= /bin/rm -f --- 55,61 ----- BIN= ../bin LIBS= -ltermcap LARGE= ! CFLAGS= -Wp -O -I../hdrs LFLAGS= CC= /bin/cc RM= /bin/rm -f *** curses.c.org Thu Nov 17 14:15:26 1988 --- curses.c Thu Nov 17 14:45:32 1988 *************** *** 317,325 return(-1); if (row == _line) { ! if (col == _col) ! return(0); /* already there! */ ! else if (abs(col - _col) < 5) { /* within 5 spaces... */ if (col > _col) CursorRight(col - _col); --- 317,328 ----- return(-1); if (row == _line) { ! if (col == _col) { ! stuff = tgoto(_moveto, col, row); /* force a moveto anyway (rdm) */ ! tputs(stuff, 1, outchar); ! fflush(stdout); ! return(0); /* already there! */ ! } else if (abs(col - _col) < 5) { /* within 5 spaces... */ if (col > _col) CursorRight(col - _col); *** editmsg.c.org Wed Nov 16 21:33:43 1988 --- editmsg.c Wed Nov 16 21:59:57 1988 *************** *** 83,89 if (cursor_control) transmit_functions(OFF); /* function keys are local */ ! if ((stat = system_call(buffer, SH)) != 0) { dprint(1,(debugfile, "System call failed with stat %d (edit_the_message)\n", stat)); --- 83,89 ----- if (cursor_control) transmit_functions(OFF); /* function keys are local */ ! if (stat = dm_editor(filename) == 2) { /* i91 rdm */ dprint(1,(debugfile, "System call failed with stat %d (edit_the_message)\n", stat)); *************** *** 87,94 dprint(1,(debugfile, "System call failed with stat %d (edit_the_message)\n", stat)); - dprint(1, (debugfile, "** %s - %s **\n", error_name(errno), - error_description(errno))); ClearLine(LINES-1); error1("Can't invoke editor '%s' for composition", editor); sleep(2); --- 87,92 ----- dprint(1,(debugfile, "System call failed with stat %d (edit_the_message)\n", stat)); ClearLine(LINES-1); error1("Can't invoke the DM editor for composition"); sleep(2); *************** *** 90,96 dprint(1, (debugfile, "** %s - %s **\n", error_name(errno), error_description(errno))); ClearLine(LINES-1); ! error1("Can't invoke editor '%s' for composition", editor); sleep(2); return_value = 1; } --- 88,94 ----- "System call failed with stat %d (edit_the_message)\n", stat)); ClearLine(LINES-1); ! error1("Can't invoke the DM editor for composition"); sleep(2); return_value = 1; } /**** new routine DM_EDITOR to open Apollo's DM editor */ #include "/sys/ins/base.ins.c" #include "/sys/ins/pad.ins.c" #include "/sys/ins/streams.ins.c" /* * Invoke the Apollo DM editor. * * dm_editor returns 0 when file has been edited * and 1 when file has NOT been edited * and 2 in case of an error * * written by: Fons Rademakers, 14-Nov-1988 rdm@cernapo */ int dm_editor(filename) char *filename; { int istat; status_$t status; stream_$id_t stream; pad_$window_desc_t window; window.top = 264; /* centered for 1280x1024 displays */ window.left = 304; /* may want to change this for 1024x800 displays */ window.width = 609; window.height = 496; pad_$create_window(*filename, (short)strlen(filename), pad_$edit, (short) 1, window, stream, status); if (status.all != status_$ok) { stream_$close(stream, status); return(2); } pad_$edit_wait(stream, status); if (status.all == status_$ok) istat = 0; else if (status.all == pad_$edit_quit) istat = 1; else istat = 2; stream_$close(stream, status); if (status.all != status_$ok) istat = 2; return(istat); } -- Org: NIKHEF-H, National Institute for Nuclear and High-Energy Physics. Mail: Kruislaan 409, P.O. Box 41882, 1009 DB Amsterdam, the Netherlands Phone: (20)5925018 or 5925003 Telex: 10262 (hef nl) UUCP: i91@nikhefh.hep.nl BITNET: nikhefh!i91@mcvax.bitnet