--- parser3/src/main/pa_exec.C 2001/04/17 19:00:41 1.2 +++ parser3/src/main/pa_exec.C 2001/04/24 07:58:14 1.4 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_exec.C,v 1.2 2001/04/17 19:00:41 paf Exp $ + $Id: pa_exec.C,v 1.4 2001/04/24 07:58:14 paf Exp $ */ #include "pa_config_includes.h" @@ -108,7 +108,7 @@ static void read_pipe(String& result, HA ReadFile( hOutRead, buf, MAX_STRING, &size, NULL ); if(!size) break; - result.APPEND_CLEAN(buf, size, file_spec, 0); + result.APPEND_AS_IS(buf, size, file_spec, 0); } } @@ -116,17 +116,18 @@ static void read_pipe(String& result, HA static const char *buildCommand(Pool& pool, const String& origin_string, const char *file_spec_cstr, const Array *argv) { - FILE *f=fopen(file_spec_cstr, "r"); - if(f) { + if(FILE *f=fopen(file_spec_cstr, "r")) { char buf[MAX_STRING]; size_t size=fread(buf, 1, MAX_STRING-1, f); if(size>2) { buf[size]=0; if(strncmp(buf, "#!", 2)==0) { - char *atEOL=strchr(buf, '\n'); - if(atEOL) { + const char *begin=buf+2; + if(*begin==' ') // alx: were an old magic for some linux-es + begin++; + if(char *end=strchr(begin, '\n')) { String string(pool); - string.APPEND_CLEAN(buf+2, atEOL-(buf+2), + string.APPEND_AS_IS(begin, end-begin, origin_string.origin().file, 0); string << " " << file_spec_cstr; if(argv) @@ -261,7 +262,7 @@ static void read_pipe(String& result, in size_t size=read(file, buf, MAX_STRING); if(!size) break; - result.APPEND_CLEAN(buf, size, file_spec, 0); + result.APPEND_AS_IS(buf, size, file_spec, 0); } } @@ -272,7 +273,7 @@ static void append_env_pair(const Hash:: String& string=*static_cast(info); string << key << "=" << *static_cast(value); - string.APPEND_CLEAN("", 1, 0, 0); // zero byte + string.APPEND_AS_IS("", 1, 0, 0); // zero byte #else String string(key.pool()); string << key << "=" << *static_cast(value);