home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume6
/
shadow-2.pt3
/
shell.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-02-03
|
573b
|
38 lines
#include <stdio.h>
#include <string.h>
#include "config.h"
extern char *newenvp[];
void shell (file)
char *file;
{
char arg0[BUFSIZ];
#ifndef SU
char *path;
#endif
char *strrchr ();
extern int errno;
if (file == (char *) 0)
exit (1);
#ifndef SU
if (path = strrchr (file, '/'))
path++;
else
path = file;
(void) strcpy (arg0 + 1, path);
arg0[0] = '-';
#else
(void) strcpy (arg0, "-su");
#endif
#ifndef NDEBUG
printf ("Executing shell %s\n", file);
#endif
execle (file, arg0, (char *) 0, newenvp);
printf ("Can't execute %s\n", file);
exit (errno);
}