How to execute 'sz' and 'rc' ?

Hermann Behrens nyse at nicedel.north.de
Tue Apr 30 08:18:12 AEST 1991


Hello.
I have problems to execute an external protocoll, in this case zmodem.
I open the device, let the programm call a mailbox(up to this point no
problems), but when i have to execute the sz, i get errors :-(

this is my routine to start sz:

int	zm_upload()
{
	int	pid, status;

	chdir("/somewhere");
	if((pid = fork()) == 0)  {
		close(fp);
		close(0);
		open("/dev/ttyF00", O_RDONLY | O_NDELAY);

		close(1);
		open("/dev/ttyF00", O_WRONLY | O_NDELAY);

/* I think, that the bug is in the redirecting of stdin and stdout,
but where is the bug?? */

		execl("/bin/sh", "sh", "-c", "sz a_file",NULL);
	}
	else
		wait(&status);
}

int	zm_download()
{
	int	pid, status;

	chdir("/somewhere");
	if((pid = fork()) == 0) {
		close(fp);
		close(0);
		open("/dev/ttyF00", O_RDONLY | O_NDELAY);

		close(1);
		open("/dev/ttyF00", O_RDONLY | O_NDELAY);

		execl("/bin/sh", "sh", "-c", "rz", NULL);
	}
	else
		wait(&status);
}

It would be great, if someone could help me ...

ciao, Hermann Behrens
-- 
Hermann Behrens|Bremerstr. 323|2870 Delmenhorst|04221/71931(DATA)71932(VOICE)



More information about the Comp.lang.c mailing list