[comp.sources.bugs] Mail Users Shell

johng@ncoast.UUCP (09/27/87)

Is anyone having problems compiling MUSH under SYSV? 

I believe that all of the shar's are correct and don't know if it is a 
problem with my libraries or the source.

Using the included makefile.sys.v causes an error

mush.h  line 243 syntax error***

No place could I find the definition for ulong_t that earlier u_long gets
defined to. I took out ulong_t and replaced it with long but additional
errors crop up with _tty and sg_flags.

I am currently running a NCR Tower/32 with release 01.02.01 (SYSV) UNIX.

Any help would be appreciated...

Thanks in advance

John Gilbertson

tbertels@ncrlnk.Dayton.NCR.COM (Tom Bertelson CTSP) (09/28/87)

I was beginning to wonder if I was the only one having problems in this
regard...

The makefile.sys.v (and the corresponding SYSV #define's) are
apparently for XENIX.  I'm about 7/8 of the way through porting it,
if I could just get it to go into CRMODE without dumping core.  When
(if) I get it I'll send the diffs to Dan Heller, or anyone else who
drops me a line.
-- 
Tom Bertelson
Tom.Bertelson@Dayton.NCR.COM			...!ncr-sd!ncrlnk!tbertels

billw@killer.UUCP (Bill Wisner) (09/29/87)

John Gilbertson:

> Is anyone having problems compiling MUSH under SYSV? 

Yes.

> I believe that all of the shar's are correct and don't know if it is a 
> problem with my libraries or the source.

The source.

> Using the included makefile.sys.v causes an error
> 
> mush.h  line 243 syntax error***
> 
> No place could I find the definition for ulong_t that earlier u_long gets
> defined to. I took out ulong_t and replaced it with long but additional
> errors crop up with _tty and sg_flags.
> 

I haven't had time to play with mush, I'm busy with a hundred other projects.
(Ain't smail nice?) I am fairly sure, though, that the problems with _tty and
sg_flags are caused because mush is assuming termcap, and SysV uses terminfo.

A very similar thing happened when I was compiling NetHack.
-- 
Bill Wisner, HASA			..ihnp4!killer!billw

'An it harms none, do what thou will.'
Everything in this message may be wrong.

argv@garp.mit.edu (Dan Heller) (09/29/87)

In article <4759@ncoast.UUCP> johng@ncoast.UUCP (John Gilbertson) writes:
>Is anyone having problems compiling MUSH under SYSV? 
>
>I believe that all of the shar's are correct and don't know if it is a 
>problem with my libraries or the source.
>
>Using the included makefile.sys.v causes an error
>
>mush.h  line 243 syntax error***
>
>No place could I find the definition for ulong_t that earlier u_long gets
>defined to. I took out ulong_t and replaced it with long but additional
>errors crop up with _tty and sg_flags.

From the posted version of mush's mush.h,

#ifdef SYSV
#define L_SET	0
#define F_OK	000
#define R_OK	004
#define W_OK	002
#define E_OK	001
#define u_long  ulong_t
#define vfork   fork
#define SIGCHLD SIGCLD
#endif /*  SYSV */

It appears that if you have SYSV defined somewhere (makefile should suffice),
u_long should be defined to ulong_t.  Perhaps there is a system dependent
file that is undefining SYSV(?)  As for the problems with _tty and sg_flags,
this is curses/sgttyb dependent.  A couple of people have sent some diffs
that provide for the necessary macros/routines to port these routines (which
include the ECHO and CRMODE stuff) to real system v stuff (bell labs sys-v,
I presume).  Anyway, the routines/macros provided use the termio library, so
at least it sounds like we're on the right track :-)

These and other bugs have been or are going to be fixed and diffs will be
posted as soon as possible.

las@msudoc.ee.mich-state.edu (Larry A. Sheilds {runs Lunapark}) (09/29/87)

I'am having similar problems trying to compile in under SCO XENIX 2.2.
I suspect the problem is in one or more of the ifdef's, etc.  Looks
like it might be quite a job to track down the problem.

==larry

---------------------------
LARRY SHIELDS                        UUCP: ...!ihnp4!msudoc!lunapark!larry
P.O. Box 6159                        BIX:  lshields
E. Lansing, MI 48823                 Compuserve: 70277, 3677

BBS: lunapark 1200/2400 8-1-N  24hrs 7 days a week  (517) 337-3844 login: bbs

authorplaceholder@tiger.UUCP.UUCP (09/29/87)

In comp.srcs.bugs johng@ncoast.UUCP writes:

>Is anyone having problems compiling MUSH under SYSV? 
[ stuff deleted ]
>Using the included makefile.sys.v causes an error
>
>mush.h  line 243 syntax error***
>
>No place could I find the definition for ulong_t that earlier u_long gets
>defined to. I took out ulong_t and replaced it with long but additional
>errors crop up with _tty and sg_flags.
[ stuff deleted ]

I ran across the same problems as you.  No flame intended, but the 
author looks like he mixed BSD sgtty calls with the SYSV source.  The
<curses.h> header under SYSV will include <sgtty.h> if it is a non-SYSV
machine and call <termio.h> if it is a SYSV machine.  I am currently 
working on cleaning up the SYSV source and will post some diffs when 
I am done.  No promises as I have several programs and manuals to write 
myself.  If someone has already cleaned up the code and wishes to post 
the diffs, I would be *very* grateful.


J. Allen Schones -- AT&T Technologies -- Oklahoma City Works
UUCP: ...!ihnp4!occrsh!tiger!jal

larry@jc3b21.UUCP (09/29/87)

in article <4759@ncoast.UUCP>, johng@ncoast.UUCP (John Gilbertson) says:
> 
> Is anyone having problems compiling MUSH under SYSV? 
> 
There are some problems compiling mush under Sys V 2.0.2 and higher.  This
particularly applies to 3b2's and such.  Dan Heller has corrections for these
and will release them shortly (thanks Dan!).  I've been having similar probs
for my 3b2 and he has been extremely helpful!

-larry
-- 
+--------------------------------------+-- St. Petersburg Junior College --+
|        Lawrence F. Strickland        |   P.O. Box 13489                  |
| ...gatech!codas!usfvax2!jc3b21!larry |   St. Petersburg, FL 33733        |
+--------------------------------------+-- Phone: +1 813 341 4705 ---------+

guy%gorodish@Sun.COM (Guy Harris) (10/01/87)

> It appears that if you have SYSV defined somewhere (makefile should suffice),
> u_long should be defined to ulong_t.

In which case, any reference to "u_long" stands a good chance of failing,
because System V as distributed by AT&T doesn't define this "ulong_t" thing
*ANYWHERE* in any include file.  Try "#define u_long unsigned long", or
"#define u_long ulong" (assuming you include <sys/types.h>, which I assume you
do as you're using "u_long"), or *anything* other than "ulong_t"!
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com

jv@mhres.UUCP (10/02/87)

Here are the fixes I applied to MUSH to get it running on a System V
(HP-UX) machine.

Fixes are:

	eliminating _tty references
	using actual areas and kill characters
	add extra defines and declarations for types and locking
	
and also:

	re-open temp file after editing, in case your editor creates
	a new file instead of rewriting it.

---------------- CUT HERE or FEED TO PATCH ----------------
*** ../org/curs_io.c	Mon Sep 21 14:54:13 1987
--- curs_io.c	Mon Sep 21 13:50:08 1987
***************
*** 48,54
  	/* echo isn't set, so whatever the character, enter it */
  	if (ison(glob_flags, ECHO_FLAG) && count < length)
  	    String[count++] = c;
! 	else if (c == _tty.sg_erase || c == 8 || c == 127) {
  	    if (count) {
  		backspace() /* macro */
  		count--;

--- 48,54 -----
  	/* echo isn't set, so whatever the character, enter it */
  	if (ison(glob_flags, ECHO_FLAG) && count < length)
  	    String[count++] = c;
! 	else if (c == erasechar() || c == 8 || c == 127) {
  	    if (count) {
  		backspace() /* macro */
  		count--;
***************
*** 56,62
  		String[0] = '\0';
  		return -1;
  	    }
! 	} else if (c == _tty.sg_kill) {
  	    if (count) {
  		do
  		    backspace()  /* macro */

--- 56,62 -----
  		String[0] = '\0';
  		return -1;
  	    }
! 	} else if (c == killchar()) {
  	    if (count) {
  		do
  		    backspace()  /* macro */
*** ../org/curses.c	Mon Sep 21 07:59:44 1987
--- curses.c	Mon Sep 21 13:26:57 1987
***************
*** 10,15
  register char **argv;
  {
      char buf[80];
      extern char *UP, ttytype[];
  
      if (argv && *++argv && !strcmp(*argv, "-?"))

--- 10,19 -----
  register char **argv;
  {
      char buf[80];
+ 
+ #if 1
+     char *UP = "a"; extern char ttytype[];
+ #else
      extern char *UP, ttytype[];
  #endif
  
***************
*** 11,16
  {
      char buf[80];
      extern char *UP, ttytype[];
  
      if (argv && *++argv && !strcmp(*argv, "-?"))
  	return help(0, "curses", cmd_help);

--- 15,21 -----
      char *UP = "a"; extern char ttytype[];
  #else
      extern char *UP, ttytype[];
+ #endif
  
      if (argv && *++argv && !strcmp(*argv, "-?"))
  	return help(0, "curses", cmd_help);
***************
*** 50,55
      scrollok(stdscr, TRUE);
      /* if the user hasn't set his screen explicitely, set it for him */
      if (!do_set(set_options, "screen"))
  	switch (_tty.sg_ospeed) {
  	    case B300 : screen = min(LINES-2, 7);
  	    when B1200 : screen = min(LINES-2, 14);

--- 55,61 -----
      scrollok(stdscr, TRUE);
      /* if the user hasn't set his screen explicitely, set it for him */
      if (!do_set(set_options, "screen"))
+ #if 0
  	switch (_tty.sg_ospeed) {
  	    case B300 : screen = min(LINES-2, 7);
  	    when B1200 : screen = min(LINES-2, 14);
***************
*** 57,62
  	    otherwise : screen = LINES-2;
  	}
      else
  	screen = min(screen, LINES-2);
      crt = LINES;
      if (argc)

--- 63,69 -----
  	    otherwise : screen = LINES-2;
  	}
      else
+ #endif
  	screen = min(screen, LINES-2);
      crt = LINES;
      if (argc)
*** ../org/hdrs.c	Mon Sep 28 12:37:39 1987
--- hdrs.c	Mon Sep 28 12:37:47 1987
***************
*** 349,354
  	    }
  	else if (*p == '%') {
  	    int buffer_space = 0;
  	    register char *p2;
  
  	    if (isdigit(*++p))

--- 349,355 -----
  	    }
  	else if (*p == '%') {
  	    int buffer_space = 0;
+ 	    int sign = -1;
  	    register char *p2;
  
  	    if (*++p == '-')
***************
*** 351,357
  	    int buffer_space = 0;
  	    register char *p2;
  
! 	    if (isdigit(*++p))
  		p = my_atoi(p, &buffer_space);
  	    switch (*p) {
  		case 'f': p2 = from;

--- 352,360 -----
  	    int sign = -1;
  	    register char *p2;
  
! 	    if (*++p == '-')
! 		sign = 1, p++;
! 	    if (isdigit(*p))
  		p = my_atoi(p, &buffer_space);
  	    switch (*p) {
  		case 'f': p2 = from;
***************
*** 372,378
  	    }
  	    if (!buffer_space)
  		buffer_space = strlen(p2);
! 	    (void) sprintf(b, "%-*.*s", buffer_space, buffer_space, p2);
  	    cnt += buffer_space, b += buffer_space;
  	} else
  	    cnt++, *b++ = *p;

--- 375,381 -----
  	    }
  	    if (!buffer_space)
  		buffer_space = strlen(p2);
! 	    (void) sprintf(b, "%*.*s", sign * buffer_space, buffer_space, p2);
  	    cnt += buffer_space, b += buffer_space;
  	} else
  	    cnt++, *b++ = *p;
*** ../org/mail.c	Mon Sep 21 16:05:14 1987
--- mail.c	Mon Sep 21 16:34:36 1987
***************
*** 336,341
  	argv[2] = NULL;
  	print("Starting \"%s\"...\n", argv[0]);
  	in_editor = 1;
  	execute(argv);
  	in_editor = 0;
  	turnoff(flags, EDIT);

--- 336,342 -----
  	argv[2] = NULL;
  	print("Starting \"%s\"...\n", argv[0]);
  	in_editor = 1;
+ 	fclose (fp);
  	execute(argv);
  	in_editor = 0;
  	turnoff(flags, EDIT);
***************
*** 339,344
  	execute(argv);
  	in_editor = 0;
  	turnoff(flags, EDIT);
  	/* upon exit of editor, user must now type ^D or "." to send */
  	if (istool)
  	    return 0;

--- 340,350 -----
  	execute(argv);
  	in_editor = 0;
  	turnoff(flags, EDIT);
+ 	fp = fopen(edfile, "r+");
+ 	if (!fp) {
+ 	    error("can't reopen %s", edfile);
+ 	    return -1;
+ 	}
  	/* upon exit of editor, user must now type ^D or "." to send */
  	if (istool)
  	    return 0;
***************
*** 469,474
  #endif SUNTOOL
  			(void) fputs(buf, stdout);
  	    } else {
  		char *argv[3];
  		argv[0] = p;
  		argv[1] = edfile;

--- 475,481 -----
  #endif SUNTOOL
  			(void) fputs(buf, stdout);
  	    } else {
+ 	        int doedit = line[1] != 'p';
  		char *argv[3];
  		argv[0] = p;
  		argv[1] = edfile;
***************
*** 474,479
  		argv[1] = edfile;
  		argv[2] = NULL;
  		in_editor = 1;
  		execute(argv); /* page the message using pager */
  		in_editor = 0;
  		if (istool)

--- 481,488 -----
  		argv[1] = edfile;
  		argv[2] = NULL;
  		in_editor = 1;
+ 		if (doedit)
+ 			fclose (fp);
  		execute(argv); /* page the message using pager */
  		in_editor = 0;
  		if (doedit && !(fp = fopen (edfile, "r+"))) {
***************
*** 476,481
  		in_editor = 1;
  		execute(argv); /* page the message using pager */
  		in_editor = 0;
  		if (istool)
  		    return 1;
  	    }

--- 485,494 -----
  			fclose (fp);
  		execute(argv); /* page the message using pager */
  		in_editor = 0;
+ 		if (doedit && !(fp = fopen (edfile, "r+"))) {
+ 			error ("can't reopen %s", edfile);
+ 			return -1;
+ 		}
  		if (istool)
  		    return 1;
  	    }
*** ../org/main.c	Mon Sep 21 08:00:54 1987
--- main.c	Mon Sep 21 13:27:23 1987
***************
*** 50,55
  
      if (!isatty(0))
  	turnon(glob_flags, REDIRECT);
      f_flags[0] = '\0';
  
      n = 0; /* don't ignore no such file or directory */

--- 50,58 -----
  
      if (!isatty(0))
  	turnon(glob_flags, REDIRECT);
+     else
+ 	initscr ();
+ 
      f_flags[0] = '\0';
  
      n = 0; /* don't ignore no such file or directory */
*** ../org/msgs.c	Mon Sep 21 08:05:31 1987
--- msgs.c	Mon Sep 21 13:28:25 1987
***************
*** 2,8
  
  #include "mush.h"
  #ifdef SYSV
! #include <sys/locking.h>
  #endif SYSV
  
  void

--- 2,12 -----
  
  #include "mush.h"
  #ifdef SYSV
! /* #include <sys/locking.h> */
! #include <unistd.h>
! #define locking(a,b,c)	lockf(a,b,(long)(c))
! #define LK_LOCK		F_LOCK
! #define LK_UNLCK	F_ULOCK
  #endif SYSV
  
  void
*** ../org/mush.h	Mon Sep 21 08:10:17 1987
--- mush.h	Mon Sep 21 13:28:54 1987
***************
*** 94,99
  #define savetty()  (void) gtty(0, &_tty)
  #endif /* ~CURSES */
  
  #define echo_on()	\
      if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) echo(), nocrmode()
  #define echo_off()	\

--- 94,100 -----
  #define savetty()  (void) gtty(0, &_tty)
  #endif /* ~CURSES */
  
+ #if 0
  #define echo_on()	\
      if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) echo(), nocrmode()
  #define echo_off()	\
***************
*** 98,103
      if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) echo(), nocrmode()
  #define echo_off()	\
      if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) noecho(), crmode()
  
  #define strdup(dst, src) (xfree (dst), dst = savestr(src))
  #define Debug		if (debug) printf

--- 99,108 -----
      if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) echo(), nocrmode()
  #define echo_off()	\
      if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) noecho(), crmode()
+ #else
+ #define echo_on()	echo(),nocrmode()
+ #define echo_off()	noecho(),crmode()
+ #endif
  
  #define strdup(dst, src) (xfree (dst), dst = savestr(src))
  #define Debug		if (debug) printf
***************
*** 104,109
  
  #ifdef SYSV
  #define L_SET	0
  #define F_OK	000
  #define R_OK	004
  #define W_OK	002

--- 109,115 -----
  
  #ifdef SYSV
  #define L_SET	0
+ #ifndef F_OK
  #define F_OK	000
  #define R_OK	004
  #define W_OK	002
***************
*** 107,112
  #define F_OK	000
  #define R_OK	004
  #define W_OK	002
  #define E_OK	001
  #define u_long  ulong_t
  #define vfork   fork

--- 113,120 -----
  #define F_OK	000
  #define R_OK	004
  #define W_OK	002
+ #endif
+ #ifndef E_OK
  #define E_OK	001
  #endif
  typedef unsigned long ulong_t;
***************
*** 108,113
  #define R_OK	004
  #define W_OK	002
  #define E_OK	001
  #define u_long  ulong_t
  #define vfork   fork
  #define SIGCHLD SIGCLD

--- 116,123 -----
  #endif
  #ifndef E_OK
  #define E_OK	001
+ #endif
+ typedef unsigned long ulong_t;
  #define u_long  ulong_t
  #define vfork   fork
  #define SIGCHLD SIGCLD
---------------- END OF FIXES ----------------
-- 
Johan Vromans                              | jv@mh.nl via European backbone
Multihouse N.V., Gouda, the Netherlands    | uucp: ..{?????!}mcvax!mh.nl!jv
"It is better to light a candle than to curse the darkness"