home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1989, 1990, John F. Haugh II
- * All rights reserved.
- *
- * Use, duplication, and disclosure prohibited without
- * the express written permission of the author.
- */
-
- #include <stdio.h>
- #ifndef BSD
- #include <string.h>
- #include <memory.h>
- #else
- #include <strings.h>
- #define strchr index
- #define strrchr rindex
- #endif
- #include "config.h"
-
- #ifndef lint
- static char _sccsid[] = "@(#)shell.c 2.2 19:24:15 7/29/90";
- #endif
-
- extern char *newenvp[];
-
- void shell (file)
- char *file;
- {
- char arg0[BUFSIZ];
- char *path;
- extern int errno;
-
- if (file == (char *) 0)
- exit (1);
-
- if (path = strrchr (file, '/'))
- path++;
- else
- path = file;
-
- (void) strcpy (arg0 + 1, path);
- arg0[0] = '-';
- #ifndef NDEBUG
- printf ("Executing shell %s\n", file);
- #endif
- execle (file, arg0, (char *) 0, newenvp);
- printf ("Can't execute %s\n", file);
- exit (errno);
- }
-