Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!ukma!rutgers!mcnc!ecsvax!dukeac!rsb
From: rsb@dukeac.UUCP (R. Scott Bartlett)
Newsgroups: comp.sys.amiga.tech
Subject: Re: problems with forkv (lattice) (long)
Keywords: Please help!!
Message-ID: <1135@dukeac.UUCP>
Date: 29 Nov 88 20:43:47 GMT
References:  <167@fishpond.UUCP>
Reply-To: rsb@dukeac.UUCP (R. Scott Bartlett)
Organization: Center for Demographic Studies, Duke University, Durham, NC
Lines: 115

[aliens ate my line eater]

In article <167@fishpond.UUCP> fnf@fishpond.UUCP (Fred Fish) writes:
>In article  bader+@andrew.cmu.edu (Miles Bader) writes:
>>Despite many re-readings of the manual section, and talking to
>>lattice technical support, I STILL can't forkv to work as advertised.
>
>Forkv only works when the forked program is a C program.  This restriction
>did not make it into the manual, but is apparently in one of the README
>files supplied with the compiler (or so I've been informed, read the README
>files?  never...  :-).
>-Fred


I have forkv() call csh2.07m (thanks Matt & Steve), the shell gets loaded, but
bombs before it does anything. (Guru #0000000B(or 03) #20382038 when run from a
CLtd harddrive (old fs/driver); Guru #00000003(or 0B) #00032075 when from ram:)

News Flash!!  I just tried the program from RAM: on my roomate's 500:
Guru #00000003 #00032075    AARGH!!!  The shell loaded fine, but when it sourced
the file root:us1/rsb/.profile it crashed (root: assigned to ram:).  If that
file was not there, csh would complain that it couldn't find the file and leave
me at that shell's prompt.  Why the different behavior?

What gives??

						rsb

BTW:  ROOT:us1/rsb/.profile contained:

A1000-> pwd
	cd root:us1/rsb
	set _path c:,UUCP:c,df1:c,df0:c
	alias pg type
	endcli

A500->	cd root:us1/rsb
	echo hi


System:

A1000	1.3KS and WB (WB not loaded)
	2Mb Microbotics w/ MFM
	old CLtd harddrive /* Do they have an uucp-able email address? */
	PopCLI & MemWatch  /* 'cus I want to upgrade so i can use FFS  */

A500	1.2KS and WB (WB not loaded)
	A501 mem expansion
	PopCLI

Code segment below:

/* ************************************************************************* */
/* v0.1		11/16/88	it's a start.				     */
/* by R. Scott Bartlett							     */
/* ************************************************************************* */

/* Note that this is only part of the program!!! for posting purposes only */
/* (C)1988 R. Scott Bartlett	It's not PD (yet ;-)			   */

#include 
#include 
#include 
#include 
#include 
#include 
#define		ROOT_DIR	"ROOT:"
#define 	CLI		CommandLineInterface

struct ProcID	child;

main()
{

struct Process	*myProc;
struct CLI	*my_CLI;
struct FORKENV	child_env;

char		*child_argv[3],
		home_dir[80],
		shell_name[80],

  printf("HOME:	'%s'\n",home_dir);
  printf("Shell:  '%s'\n",shell_name);
  child_argv[0] = shell_name;
  child_argv[1] = home_dir;
  child_argv[2] = NULL;

  Forbid();
  myProc = (struct Process *)FindTask(0L);
  my_CLI = (struct CLI *)BADDR(myProc->pr_CLI);
  Permit();
  child_env.priority = 0;
  child_env.stack = 25000;	/* STACK SIZE */
  child_env.std_in = my_CLI->cli_StandardInput;
  child_env.std_out = my_CLI->cli_StandardOutput;
  child_env.console = (BPTR)myProc->pr_WindowPtr;
  child_env.msgport = NULL;

  if (forkv(child_argv[0],child_argv,&child_env,&child) == -1) {
	perror("Error in fork!!!\n");
	perror("Goodbye\n");
	}
  else {
	perror("Hello\n");
	wait(&child);
	return(0);
	}

-- 
rsb@dukeac.ac.duke.edu		///	"Amigas do it with hardware."-- Me
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^	       ///     "Sycamore is open."-- Negativ Land
Note the shorter addr	   \\\///     "I luv S&M!!!"   "No geeks here!!"
Disclaimer NOT included!    \XX/     "This space for rent"