Subj : Re: Problem with JavaScript functions To : netscape.public.mozilla.jseng From : Brendan Eich Date : Mon Sep 29 2003 12:25 pm > char line[500]; > std::string cmd; > jsval rval; > JSString *str; > JSBool ok; > cmd = ""; > while(gets(line)) gets is a botch, it can result in buffer overflow -- don't use it (prefer fgets). That shouldn't be causing problems, but why not show the exact input you type, and debug the program to see how it breaks input up into lines. I'm wondering whether this part of the logic: > { > if (!*line) > { [evaluate the string in cmd] > cmd = ""; > } > else > { > cmd += "\n"; > cmd += line; > } > } might not be inserting extra newlines into the input, which can have unexpected effects due to automatic semi-colon insertion. But you will have to run under a debugger, or sprinkle printfs in the code, to say for sure. /be .