Hello.
Sergey Suleymanov wrote:
> I've used cmdline.exe and anything work fine. But now
> cmdline.com (link to generic.com ) doesn't do his work. Has
> something broken?
Seems like that. The forgotten braces and other wierd things indicates that
the code was never executed since porting to coopthreads (or am I missing
something?).
Try the attached patch.
I don't know whether it fixes all the problems, but at least it makes
cmdline.com to work for me.
--- src/plugin/commands/cmdline.c Sat Nov 17 05:40:34 2001
+++ src/plugin/commands/cmdline.c Sat Dec 1 20:34:40 2001
@@ -23,23 +23,27 @@
int msetenv(char *,char *);
-#define CMDBUFFSIZE 10000
+#define CMDBUFFSIZE 256
/* This program just reads stdin... */
int cmdline_main()
{
char *buff = malloc(CMDBUFFSIZE), *p, *q, *endb;
- if (!buff)
+ if (!buff) {
perror("malloc failure");
return(1);
+ }
*(endb = buff + read(0,buff,CMDBUFFSIZE)) = '\0';
for (p = buff; p < endb; p = q + strlen(q)+1)
if (*p != '-' && ((q = strchr(p,'='))!=0)) {
*q++ = '\0';
- if (msetenv(p,q))
+ if (msetenv(p,q)) {
+ free(buff);
return (1);
}
+ }
else q = p;
+ free(buff);
return 0;
}