spawn.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 1985 AT&T
* All Rights Reserved
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <signal.h>
#include <errno.h>
#include <stdarg.h>
#include "wish.h"
#include "moremacros.h"
#include "sizes.h"
#define RETVALSIZE 50
#define EXECERROR 1000
int set_ret_val();
int error_exec();
int
char *file;
char *arglist[];
{
register int fd;
alarm(0);
case -1:
break;
case 0:
(void) error_exec(errno);
_exit(127);
default:
break;
}
return pid;
}
{
char *arglist[20];
register char **p;
break;
}
sysspawn(s)
char *s;
{
char *arglist[4];
arglist[0] = "sh";
arglist[2] = s;
}
{
int status;
break;
/* examine child status more carefully */
return(set_ret_val(waitcode));
}
/*
* SET_RET_VAL will return the exit value of the child
* process given "status" (result of a "wait" system call).
* It will also set the environment variable "RET" to
* this exit value OR an "errno" string if an error is
* encountered during exec).
*/
int
int status;
{
char retval_str[RETVALSIZE];
int retval;
if (!Retpath) {
}
} else {
}
} else {
/*
* if Retpath is not accessable and status is
* non zero, query status to discover what
* went wrong.
*/
if ((status & 0377) != 0) {
if (status & 0200) {
} else
}
}
return(retval);
}
/*
* ERROR_EXEC will store "str" in a temporary file, typically
* this string will correspond to the "errno" of a failed
* exec attempt
*/
int
int val;
{
if (!Retpath) {
}
return(FAIL);
return(SUCCESS);
}