Code: Select all
syntax: (exec str-process)
syntax: (exec str-process [str-stdin])
There is caused by strlen function which treat as a NULL terminator character.
newLISP's cell string has own length. I think this problem can be avoided, if use it.
For instance, patch is here:
Code: Select all
--- nl-filesys.orig.c. Mon Apr 19 07:29:16 2010
+++ nl-filesys.c Sun May 30 23:07:09 2010
@@ -958,10 +957,11 @@
CELL * p_exec(CELL * params)
{
-CELL * lineList;
+ CELL * cell;
char * line;
-char * command, * data;
+ char * command;
FILE * handle;
+ size_t nwrite;
params = getString(params, &command);
if(params == nilCell)
@@ -969,21 +969,26 @@
if((handle = popen(command , "r")) == NULL)
return(nilCell);
- lineList = getCell(CELL_EXPRESSION);
+ cell = getCell(CELL_EXPRESSION);
while((line = readStreamLine(&readLineStream, handle)) != NULL)
- addList(lineList, stuffString(line));
+ addList(cell, stuffString(line));
pclose(handle);
- return(lineList);
+ return(cell);
}
-getString(params, &data);
+ /* getString(params, &data); */
+ cell = evaluateExpression(params);
+ if (cell->type != CELL_STRING)
+ return(errorProcExt(ERR_STRING_EXPECTED, params));
if((handle = popen(command, "w")) == NULL)
return(nilCell);
-if(fwrite(data, sizeof(char), strlen(data), handle) < strlen(data))
- return(nilCell);
+ /* if(fwrite(data, sizeof(char), strlen(data), handle) < strlen(data)) */
+ nwrite = fwrite((char *)cell->contents, sizeof(char), cell->aux -1, handle);
+ if (nwrite < (cell->aux -1))
+ return nilCell;
pclose(handle);
return(trueCell);
Code: Select all
[~/src/newlisp-10.2.4]$ ./newlisp -C
newLISP v.10.2.4 on Win32 IPv4, execute 'newlisp -h' for more info.
> (exec "sha1sum -" (get-url "http://www.newlisp.org/downloads/UTF-8_win32/newlisp.exe"))
db2c8f9161993bd965dd8efd75d3aa6f22f71c6f *-
true
> !curl http://www.newlisp.org/downloads/UTF-8_win32/SHA1.txt
SHA1(newlisp.dll)= 145bb1a411dd12c9e43ea052014038fd383f95ed
SHA1(newlisp.exe)= db2c8f9161993bd965dd8efd75d3aa6f22f71c6f