forked from epics_driver_modules/require
remove last char in line only if it is '\n'
This commit is contained in:
+2
-2
@@ -194,7 +194,7 @@ int runScript(const char* filename, const char* args)
|
||||
if ((line_raw = realloc(line_raw, line_raw_size *= 2)) == NULL) goto error;
|
||||
if (fgets(line_raw + len, line_raw_size - len, file) == NULL) break;
|
||||
}
|
||||
line_raw[--len] = 0; /* get rid of '\n' */
|
||||
if (line_raw[len-1] == '\n') line_raw[--len] = 0; /* get rid of '\n' */
|
||||
if (runScriptDebug)
|
||||
printf("runScript raw line (%ld chars): '%s'\n", len, line_raw);
|
||||
/* expand and check the buffer size (different epics versions write different may number of bytes)*/
|
||||
@@ -221,7 +221,7 @@ int runScript(const char* filename, const char* args)
|
||||
/* find local variable assignments */
|
||||
{
|
||||
unsigned int vlen = 0;
|
||||
while (isalnum(p[vlen]) || p[vlen] == '_') vlen++;
|
||||
while (isalnum((unsigned char)p[vlen]) || p[vlen] == '_') vlen++;
|
||||
if (p[vlen] == '=')
|
||||
{
|
||||
const char* r;
|
||||
|
||||
Reference in New Issue
Block a user