[net.news.b] ifuncs.c fix to get noshell to work

martin@vax135.UUCP (06/30/83)

as well at the other bug/change that my previouse article talked about,
there is also a change to get the file name to execv to work.
the lines with the '!' are the ones that changes.

		if (pid = fork())
			fwait(pid);
		else {
			close(0);
			open(TRANS, 0);
!			if (*sp->s_xmit == '\0')		/* need bfp? */
!				ptr = bfr;
!			else
!				ptr = sp->s_xmit;
			for (pid = 0; pid < 19; pid++) {
				while (isspace(*ptr))
					*ptr++ = 0;
				argv[pid] = ptr;
				while (!isspace(*++ptr) && *ptr)
					;
				if (!*ptr)
					break;
			}
			argv[++pid] = 0;
!			/*execv(sp->s_xmit, argv);	use argv[0] */
!			execv(argv[0], argv);
			xerror("Can't execv\n");
		}
	} else
		system(bfr);

it's about line 190 in 2.10 ifuncs.c. the code works fine if the command is
just one program with no arguments, but otherwise it passes the whole string
(args as well) to the execv as a path.
the problems comes with the S flag and a supplied command, hence the if
statment to allow for when no command is supplied.

martin levy.