Use "strtok_r" instead of "strtok" to fix lexer issues.

master
Robert Kiraly 2021-05-19 00:20:43 -07:00
parent c199aa618b
commit 93a2e6144f
1 changed files with 335 additions and 279 deletions

View File

@ -15,24 +15,26 @@
#include "inc/network.h"
#include "inc/search.h"
#include "inc/inset.h"
// For slidescript compression algorithm
#include "inc/tar.h"
#include "inc/compression.h"
#define strtok_next(s) strtok_r (NULL, s, &strtok_save)
char *process_line (char *line)
{
char *strtok_save;
char *tok_srch, *retbuf, *filebuf, *compbuf, *loopbuf;
//printf("%s", &line[strlen(line)-2]);
static char dirpathbuf [MAX_STRING_BUFSIZE];
tok_srch = strtok(line, "=\" ;");
tok_srch = strtok_r (line, "=\" ;", &strtok_save);
/* reuse function */
/*else if (strncmp("temp",tok_srch,4) == 0)
{
tok_srch = strtok(NULL, " ");
tok_srch = strtok_next (" ");
}*/
/* if line starts with a comment, skip */
@ -67,7 +69,7 @@ char *process_line(char *line)
char *dobuf;
// We have an if statement
tok_srch = strtok(NULL, ";");
tok_srch = strtok_next (";");
if (tok_srch == NULL)
{
@ -88,7 +90,8 @@ char *process_line(char *line)
*compbuf = '\0';
strcat(compbuf, parse_vars(tok_srch));
tok_srch = strtok(NULL, ";");
tok_srch = strtok_next (";");
if (tok_srch == NULL)
{
x_warn("ss:warn:if syntax error, missing last argument?");
@ -109,13 +112,14 @@ char *process_line(char *line)
return NULL;
}
//@@@
else if (strncmp("ifn:", tok_srch, 4) == 0)
{
char *proc_return;
char *dobuf;
// We have an if statement
tok_srch = strtok(NULL, ";");
tok_srch = strtok_next (";");
if (tok_srch == NULL)
{
@ -124,6 +128,7 @@ char *process_line(char *line)
}
// Check if there's anything after the first quote
if (strcmp(tok_srch, "\n") == 0 ||
strcmp(tok_srch, " \n") == 0 ||
strcmp(tok_srch, " ") == 0)
@ -134,28 +139,79 @@ char *process_line(char *line)
compbuf = qmalloc(QM_SS, (strlen(tok_srch) + 1));
*compbuf = '\0';
strcat (compbuf, tok_srch);
printf ("toksrch: %s\n", tok_srch);
tok_srch = strtok(NULL, ";");
tok_srch = strtok_next (";");
printf ("toksrch: %s\n", tok_srch);
if( (strncmp("false", parse_vars(parse_bq(compbuf)), 5) == 0)
|| (strncmp("0", parse_vars(parse_bq(compbuf)), 1) == 0))
//--------------------------------------------------------------------
// Possible examples of "compbuf[]" at this point:
//
// false // or 0
// true // or 1
// `comp: "1" "1"`
// `comp: "1" "2"`
// %foo% // which *contains* one of the preceding
// The "parse_bq" calls below return copies of "compbuf[]" that re-
// placed quoted `things` with the return values of the corresponding
// functions.
// In the context of this calling routine (process_line) that needs to
// be a single false, 0, true, or 1 [if backquotes are used].
// "parse_vars" replaces %foo% with the value of the specified variab-
// le. Which, if a variable is used, needs to work out to a single
// false, 0, true, or 1.
// The bottom line is that we expect to end up with "false", "0",
// "true", or "1" being passed to "strncmp" as the 2nd argument. As
// this is code that implements "ifn", only the values "false" and "0"
// will then lead to further processing.
if ((strncmp ("false" ,
parse_vars (parse_bq (compbuf)), 5) == 0) ||
(strncmp ("0" ,
parse_vars (parse_bq (compbuf)), 1) == 0))
//--------------------------------------------------------------------
{
// Example of "tok_srch[]" at this point:
//
// ifn: false; print "Hello"; print "World"
// ^ Here ^ This has been replaced with EOS
while (tok_srch != NULL)
{
dobuf = qmalloc (QM_SS, (strlen (tok_srch) + 1));
*dobuf = '\0';
strcat (dobuf, tok_srch);
//proc_return = process_line(parse_vars(dobuf));
//if(proc_return != NULL) {
// printf("%s\n", proc_return);
// fflush(stdout);
//}
printf("toksrch: %s\n", tok_srch);
tok_srch = strtok(NULL, ";");
// In the cited example, on the first pass here, "dobuf[]" now con-
// tains:
// print "Hello"<EOS>
proc_return = process_line (parse_vars (dobuf));
if (proc_return != NULL)
{
printf ("%s\n", proc_return);
fflush (stdout);
}
printf ("toksrch: %s dobuf: %s\n", tok_srch, dobuf);
tok_srch = strtok_next (";");
// In the cited example, on the first pass here, "tok_srch[]" now
// points to:
//
// ifn: false; print "Hello"; print "World"
// ^ Here ^
// This has been replaced with EOS
}
}
@ -170,7 +226,7 @@ char *process_line(char *line)
char *countbuf;
// We have an if statement
tok_srch = strtok(NULL, ";");
tok_srch = strtok_next (";");
if (tok_srch == NULL)
{
@ -192,7 +248,7 @@ char *process_line(char *line)
strcat(countbuf, parse_vars(tok_srch));
loop_count = atoi(countbuf);
tok_srch = strtok(NULL, ";");
tok_srch = strtok_next (";");
if (tok_srch == NULL)
{
x_warn("ss:warn:loop syntax error, missing last argument?");
@ -220,7 +276,7 @@ char *process_line(char *line)
else if (strncmp("comp:", tok_srch, 5) == 0)
{
// We have an if statement
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:if statement requires arguments");
@ -235,7 +291,7 @@ char *process_line(char *line)
}
// Make sure the end quote exists
if(strtok(NULL, "\"") == NULL)
if (strtok_next ("\"") == NULL)
{
x_warn("ss:warn:if syntax error, missing quote?");
return NULL;
@ -244,7 +300,7 @@ char *process_line(char *line)
compbuf = qmalloc(QM_SS, (strlen(parse_vars(tok_srch)) + 1));
strcpy(compbuf, parse_vars(tok_srch));
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:if statement requires two compared arguments");
@ -259,7 +315,7 @@ char *process_line(char *line)
}
// Make sure the end quote exists
if(strtok(NULL, "\"") == NULL)
if (strtok_next ("\"") == NULL)
{
x_warn("ss:warn:if syntax error, missing end quote?");
return NULL;
@ -281,14 +337,14 @@ char *process_line(char *line)
{
char *varname;
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:unset syntax error, missing quote?");
return NULL;
}
if(strtok(NULL, "\"") == NULL)
if (strtok_next ("\"") == NULL)
{
x_warn("ss:warn:unset syntax error, missing end quote?");
return NULL;
@ -313,7 +369,7 @@ char *process_line(char *line)
else if (strncmp("move",tok_srch,4) == 0 || strncmp("mv", tok_srch, 2) == 0)
{
char orig_fn[MAX_STRING_BUFSIZE]; // Should never be more than 6 characters
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:move syntax error, missing quote?");
@ -337,22 +393,21 @@ char *process_line(char *line)
}
/* strtok to the content that will be written to file */
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:move syntax error, missing quote?");
return NULL;
}
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (strcmp(tok_srch, "\n") == 0 || strcmp(tok_srch, " \n") == 0)
{
x_warn("ss:warn:move syntax error, missing second filename?");
return NULL;
}
if(strtok(NULL, "\"") == NULL)
if (strtok_next ("\"") == NULL)
{
x_warn("ss:warn:move syntax error, missing quote?");
return NULL;
@ -385,14 +440,14 @@ char *process_line(char *line)
char *dirname;
int chdir_return;
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:chdir syntax error, missing quote?");
return NULL;
}
if(strtok(NULL, "\"") == NULL)
if (strtok_next ("\"") == NULL)
{
x_warn("ss:warn:chdir syntax error, missing end quote?");
return NULL;
@ -414,13 +469,13 @@ char *process_line(char *line)
{
char *dirname;
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
dirname = ".";
}
if(strtok(NULL, "\"")==NULL && dirname == NULL)
if (strtok_next ("\"")==NULL && dirname == NULL)
{
x_warn("ss:warn:showdir syntax error, missing end quote?");
return NULL;
@ -473,14 +528,14 @@ char *process_line(char *line)
int fd;
tar_free_pool();
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:decompress syntax error, missing quote?");
return NULL;
}
if(strtok(NULL, "\"")==NULL)
if (strtok_next ("\"")==NULL)
{
x_warn("ss:warn:decompress syntax error, missing end quote?");
return NULL;
@ -550,7 +605,7 @@ char *process_line(char *line)
int fd;
tar_free_pool();
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:compress syntax error, missing quote?");
@ -579,14 +634,14 @@ char *process_line(char *line)
return NULL;
}
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:compress syntax error, missing quote?");
return NULL;
}
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:compress syntax error, missing quote?");
@ -599,7 +654,7 @@ char *process_line(char *line)
return NULL;
}
if(strtok(NULL, "\"")==NULL)
if (strtok_next ("\"")==NULL)
{
x_warn("ss:warn:compress syntax error, missing end quote?");
return NULL;
@ -607,16 +662,16 @@ char *process_line(char *line)
int argc = 0;
char *argv [MAX_FILES];
char *alt_save;
char *p2 = strtok_r (tok_srch, " ", &alt_save);
char *p2 = strtok(tok_srch, " ");
while (p2 && argc < MAX_FILES-1)
{
argv[argc++] = p2;
p2 = strtok(NULL, " ");
p2 = strtok_r (NULL, " ", &alt_save);
}
argv[argc] = 0;
const char **tarin = (const char **) &argv[0];
if (tar_write(fd, &archive, argc, tarin, '1') < 0) {
@ -676,14 +731,14 @@ char *process_line(char *line)
else if (strncmp("mkdir",tok_srch,5) == 0)
{
int parsed;
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:mkdir syntax error, missing quote?");
return NULL;
}
if(strtok(NULL, "\"")==NULL)
if (strtok_next ("\"")==NULL)
{
x_warn("ss:warn:mkdir syntax error, missing end quote?");
return NULL;
@ -708,14 +763,14 @@ char *process_line(char *line)
else if (strncmp("mkfile",tok_srch,5) == 0)
{
int parsed;
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:mkfile syntax error, missing quote?");
return NULL;
}
if(strtok(NULL, "\"")==NULL)
if (strtok_next ("\"")==NULL)
{
x_warn("ss:warn:mkfile syntax error, missing end quote?");
return NULL;
@ -759,14 +814,14 @@ char *process_line(char *line)
else if (strncmp("isfile",tok_srch,5) == 0)
{
int parsed;
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:isfile syntax error, missing quote?");
return NULL;
}
if(strtok(NULL, "\"")==NULL)
if (strtok_next ("\"")==NULL)
{
x_warn("ss:warn:isfile syntax error, missing end quote?");
return NULL;
@ -787,14 +842,14 @@ char *process_line(char *line)
else if (strncmp("isdir",tok_srch,5) == 0)
{
int parsed;
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:isdir syntax error, missing quote?");
return NULL;
}
if(strtok(NULL, "\"")==NULL)
if (strtok_next ("\"")==NULL)
{
x_warn("ss:warn:isdir syntax error, missing end quote?");
return NULL;
@ -815,7 +870,7 @@ char *process_line(char *line)
else if (strncmp("print",tok_srch,5) == 0)
{
char *parsed;
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:print syntax error, missing quote?");
@ -837,7 +892,7 @@ char *process_line(char *line)
/* sleep function */
else if (strncmp("sleep",tok_srch,5) == 0)
{
tok_srch = strtok(NULL, " ");
tok_srch = strtok_next (" ");
if (tok_srch == NULL)
{
x_warn("ss:warn:sleep syntax error, need trailing integer for operation");
@ -863,7 +918,7 @@ char *process_line(char *line)
else if (strncmp("calc",tok_srch,5) == 0)
{
char *expr_return;
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:calc syntax error, missing quotes around equation");
@ -876,7 +931,7 @@ char *process_line(char *line)
return NULL;
}
if(strtok(NULL, "\"") == NULL)
if (strtok_next ("\"") == NULL)
{
x_warn("ss:warn:calc syntax error, missing ending quote?");
return NULL;
@ -892,7 +947,7 @@ char *process_line(char *line)
{
char srch[MAX_NETSRCH_BUF];
char port[7]; // Should never be more than 6 characters
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:netlisten syntax error, missing beginning quote");
@ -916,14 +971,14 @@ char *process_line(char *line)
}
/* strtok to the content that will be written to file */
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:netlisten syntax error, missing quote?");
return NULL;
}
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:netlisten syntax error, missing quote?");
@ -939,14 +994,14 @@ char *process_line(char *line)
strcpy(srch, parse_vars(tok_srch));
/* strtok to the socket response */
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:netlisten syntax error, missing quote?");
return NULL;
}
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:netlisten syntax error, missing quote?");
@ -959,7 +1014,7 @@ char *process_line(char *line)
return NULL;
}
if(strtok(NULL, "\"") == NULL)
if (strtok_next ("\"") == NULL)
{
x_warn("ss:warn:netlisten syntax error, missing end quote?");
return NULL;
@ -973,7 +1028,7 @@ char *process_line(char *line)
else if (strncmp("nethttp",tok_srch,7) == 0)
{
char port[7]; // Should never be more than 6 characters
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:nethttp syntax error, missing quote?");
@ -997,7 +1052,7 @@ char *process_line(char *line)
}
/* strtok to the content that will be written to file */
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:nethttp syntax error, missing quote?");
@ -1005,14 +1060,14 @@ char *process_line(char *line)
}
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (strcmp(tok_srch, "\n") == 0 || strcmp(tok_srch, " \n") == 0)
{
x_warn("ss:warn:nethttp syntax error, missing quote?");
return NULL;
}
if(strtok(NULL, "\"") == NULL)
if (strtok_next ("\"") == NULL)
{
x_warn("ss:warn:nethttp syntax error, missing quote?");
return NULL;
@ -1039,7 +1094,7 @@ char *process_line(char *line)
char data[MAX_STRING_BUFSIZE];
char port[7];
/* strtok to filename of function */
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:nettoss syntax error, missing quote?");
@ -1058,14 +1113,14 @@ char *process_line(char *line)
strcpy(address, parse_vars(tok_srch));
/* strtok to the content that will be written to file */
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:nettoss syntax error, missing quote?");
return NULL;
}
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (strcmp(tok_srch, "\n") == 0 || strcmp(tok_srch, " \n") == 0)
{
x_warn("ss:warn:nettoss syntax error, missing quote?");
@ -1080,14 +1135,14 @@ char *process_line(char *line)
strcpy(port, parse_vars(tok_srch));
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:nettoss syntax error, missing quote?");
return NULL;
}
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:nettoss syntax error, missing quote?");
@ -1100,7 +1155,7 @@ char *process_line(char *line)
return NULL;
}
if(strtok(NULL, "\"") == NULL)
if (strtok_next ("\"") == NULL)
{
x_warn("ss:warn:nettoss syntax error, missing end quote?");
return NULL;
@ -1116,7 +1171,7 @@ char *process_line(char *line)
else if (strncmp("encode", tok_srch,6) == 0)
{
char *var_conv;
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:encode syntax error, missing quote?");
@ -1149,7 +1204,7 @@ char *process_line(char *line)
else if (strncmp("decode", tok_srch,6) == 0)
{
char *var_conv;
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:decode syntax error, missing quote?");
@ -1182,7 +1237,7 @@ char *process_line(char *line)
{
char *file_line, *catfile, *file_md5_val;
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:md5 syntax error, missing quote?");
@ -1210,7 +1265,7 @@ char *process_line(char *line)
{
char *cmd_line;
int return_val;
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:exec syntax error, missing quote?");
@ -1223,7 +1278,7 @@ char *process_line(char *line)
return NULL;
}
if(strtok(NULL, "\"") == NULL)
if (strtok_next ("\"") == NULL)
{
x_warn("ss:warn:exec syntax error, missing quote?");
return NULL;
@ -1246,7 +1301,7 @@ char *process_line(char *line)
bzero(filename, MAX_FILENAME_LEN);
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:search syntax error, missing quote?");
@ -1277,7 +1332,7 @@ char *process_line(char *line)
}
/* strtok to the content that will be written to file */
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
fclose(search_file);
@ -1285,7 +1340,7 @@ char *process_line(char *line)
return NULL;
}
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
fclose(search_file);
@ -1300,7 +1355,7 @@ char *process_line(char *line)
return NULL;
}
if(strtok(NULL, "\"") == NULL)
if (strtok_next ("\"") == NULL)
{
fclose(search_file);
x_warn("ss:warn:search syntax error, missing end quote?");
@ -1322,7 +1377,7 @@ char *process_line(char *line)
FILE* write_file = NULL;
/* strtok to filename of function */
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:write syntax error, missing quote?");
@ -1347,7 +1402,7 @@ char *process_line(char *line)
}
/* strtok to the content that will be written to file */
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
fclose(write_file);
@ -1355,7 +1410,7 @@ char *process_line(char *line)
return NULL;
}
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
fclose(write_file);
@ -1370,7 +1425,7 @@ char *process_line(char *line)
return NULL;
}
if(strtok(NULL, "\"") == NULL)
if (strtok_next ("\"") == NULL)
{
fclose(write_file);
x_warn("ss:warn:write syntax error, missing end quote?");
@ -1392,7 +1447,7 @@ char *process_line(char *line)
FILE *read_file = NULL;
/* strtok to filename of function */
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:read syntax error, missing quote?");
@ -1405,7 +1460,7 @@ char *process_line(char *line)
return NULL;
}
if(strtok(NULL, "\"") == NULL)
if (strtok_next ("\"") == NULL)
{
x_warn("ss:warn:read syntax error, missing quote?");
return NULL;
@ -1454,7 +1509,7 @@ char *process_line(char *line)
FILE *read_file = NULL;
/* strtok to filename of function */
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:cat syntax error, missing quote?");
@ -1488,7 +1543,7 @@ char *process_line(char *line)
return NULL;
}
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
fclose(read_file);
@ -1496,7 +1551,7 @@ char *process_line(char *line)
return NULL;
}
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
fclose(read_file);
@ -1511,7 +1566,7 @@ char *process_line(char *line)
return NULL;
}
if(strtok(NULL, "\"") == NULL)
if (strtok_next ("\"") == NULL)
{
fclose(read_file);
x_warn("ss:warn:cat syntax error, missing end quote?");
@ -1543,7 +1598,7 @@ char *process_line(char *line)
else if (strncmp("delete", tok_srch, 6) == 0) {
char *del_filename;
tok_srch = strtok(NULL, "\"");
tok_srch = strtok_next ("\"");
if (tok_srch == NULL)
{
x_warn("ss:warn:delete syntax error, missing quote?");
@ -1556,7 +1611,7 @@ char *process_line(char *line)
return NULL;
}
if(strtok(NULL, "\"") == NULL)
if (strtok_next ("\"") == NULL)
{
x_warn("ss:warn:delete syntax error, missing quote?");
return NULL;
@ -1585,7 +1640,8 @@ char *process_line(char *line)
}
}
else if(strcmp(tok_srch, "\n") != 0 && strcmp(tok_srch, "") != 0) {
else if (strcmp(tok_srch, "\n") != 0 && strcmp(tok_srch, "") != 0)
{
if (tok_srch[strlen(tok_srch)-1] == '\n')
{
return NULL;
@ -1595,7 +1651,7 @@ char *process_line(char *line)
int varc = get_var_count();
char *varname_tmp = tok_srch;
char *bq_check;
tok_srch = strtok(NULL, "=");
tok_srch = strtok_next ("=");
// Check for back quotes, return string with backquotes processed
bq_check = strip_nl(parse_vars(parse_bq(tok_srch)));