Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!ames!amdahl!oliveb!felix!preston From: preston@felix.UUCP (Preston Bannister) Newsgroups: comp.sys.atari.st Subject: Beckmeyer C-shell bug (was: Source for a system() routine needed) Message-ID: <13782@felix.UUCP> Date: Mon, 23-Nov-87 11:54:26 EST Article-I.D.: felix.13782 Posted: Mon Nov 23 11:54:26 1987 Date-Received: Sat, 28-Nov-87 07:41:34 EST References: <13021@felix.UUCP> <1845@chinet.UUCP> Sender: daemon@felix.UUCP Reply-To: preston@felix.UUCP (Preston Bannister) Organization: FileNet Corp., Costa Mesa, CA Lines: 62 In article <1845@chinet.UUCP> dag@chinet.UUCP (Daniel A. Glasser) writes: >In article <13021@felix.UUCP> preston@felix.UUCP (Preston Bannister) writes: >>Has anyone out there implemented a version of the system() library >>routine that uses the Mark Williams/Beckmeyer scheme for passing long >>argument lists? >>Unfortunately, the system() routine in the Mark Williams library does >>not. The argument list gets truncated after 127 characters. >Not true! The Mark Williams library DOES use the environment scheme >for system()... It calls up the shell, msh.prg, and msh calls up the >command. If you are getting truncated command lines, something is >screwing around with the "ARGV" or "IOVECT" environment string and >the runtime startup is not finding the parameters in the environment. On further investigation, you're right...sort of. The problem, as it turns out, is that the Beckmeyer C-shell does not handle very long single arguments. The MWC system() passes through the string given to it as a single argument. I.e. the call: system("foo bar baz"); Becomes a call to the default shell with the following MWC extended argument list appended to the environment (assume the SHELL environment variable is set to 'shell.prg', the iovector is approximate): ARGV=CCCA?????????????????? shell.prg -c foo bar baz Note that the string passed to the system() call is passed through as a single argument. I had the SHELL environment variable set to 'csh.prg', the Beckmeyer C-shell. When csh was given a single argument longer than 127 characters, it truncates the argument. The shell supplied with MWC (msh) can handle single arguments that are longer than 127 characters. So where does this leave us? 1. Use 'msh' for the default shell in makefiles where the argument list may be longer than 127 characters. (I set the environment variable SHELL to 'msh.prg' at boot time with GEMBOOT). 2. The system() function should be fixed to spilt up the command string passed to it into an argument list. (My opinion). 3. The Beckmeyer C-shell (and other shells :-) should be prepared to handle single arguments longer than 127 characters. (My opinion). -- Preston L. Bannister USENET : ucbvax!trwrb!felix!preston BIX : plb CompuServe : 71350,3505 GEnie : p.bannister