{
int i;
- while ((i = nextopt("a")) != '\0') {
- if (i == 'a') {
- rmaliases();
- return 0;
- }
+ while (nextopt("a") != '\0') {
+ rmaliases();
+ return 0;
}
for (i = 0; *argptr; argptr++) {
if (unalias(*argptr)) {
static int FAST_FUNC
execcmd(int argc UNUSED_PARAM, char **argv)
{
- if (argv[1]) {
+ optionarg = NULL;
+ while (nextopt("a:") != '\0')
+ /* nextopt() sets optionarg to "-a ARGV0" */;
+
+ argv = argptr;
+ if (argv[0]) {
+ char *prog;
+
iflag = 0; /* exit on error */
mflag = 0;
optschanged();
/*setsignal(SIGTSTP); - unnecessary because of mflag=0 */
/*setsignal(SIGTTOU); - unnecessary because of mflag=0 */
- shellexec(argv[1], argv + 1, pathval(), 0);
+ prog = argv[0];
+ if (optionarg)
+ argv[0] = optionarg;
+ shellexec(prog, argv, pathval(), 0);
/* NOTREACHED */
}
return 0;