[comp.unix.xenix] Help with execl

corwin@polari.UUCP (Don Glover) (09/14/89)

I have a program that I have just compiled, in it does
execl(emprog[1],"Empire",cnumbuf,"","1","\0377",0); 
when run it returns a -1 and errno is set to 14.  this error is defined
as EFAULT Bad Address, for the life of me I can not figure out why I am
getting this.   I have printf'd all the arguements and they look fine.

Any suggestions will be appreciated.  I am doing this on 286 xenix 2.2.3
with the 2.2.1 development system.

daveh@marob.masa.com (Dave Hammond) (09/15/89)

In article <1049@polari.UUCP> corwin@polari.UUCP (Don Glover) writes:
>
>I have a program that I have just compiled, in it does
>execl(emprog[1],"Empire",cnumbuf,"","1","\0377",0); 
>when run it returns a -1 and errno is set to 14.  this error is defined
>as EFAULT Bad Address, for the life of me I can not figure out why I am
>getting this.   I have printf'd all the arguements and they look fine.
>
>Any suggestions will be appreciated.  I am doing this on 286 xenix 2.2.3
>with the 2.2.1 development system.

The 286 will segment fault every time if null is not cast properly.
Try casting the terminating null arg to (char *):

execl(emprog[1],"Empire",cnumbuf,"","1","\0377",(char *)0); 

BTW, I'm curious about the "\0377" arg.  Does empire have a command line
option which takes a 1 char string with -1 as its contents ?

--
Dave Hammond
daveh@marob.masa.com

daveh@marob.masa.com (Dave Hammond) (09/15/89)

In article <251031D1.4B47@marob.masa.com> I wrote :
>BTW, I'm curious about the "\0377" arg.  Does empire have a command line
>option which takes a 1 char string with -1 as its contents ?

Oops.  Mild brain-blip.  Turn that sideways:

BTW, I'm curious about the "\0377" arg.  Does empire have a command line
option which is the 2 char string "^_7" (Ctrl-underscore, "7") ?

--
Dave Hammond
daveh@marob.masa.com