Skip to content
Commits on Source (2)
......@@ -174,7 +174,7 @@ void scr_time( struct code *pc, int fargc, char **fargv )
}
/* set default idle time to zero */
snprintf(value, MAXTEXTLENGTH - 1, "0");
string_add(&value, "0");
size_t wi;
json_t *entry;
......@@ -184,7 +184,7 @@ void scr_time( struct code *pc, int fargc, char **fargv )
if (!strcasecmp(name, uname))
{
snprintf(value, MAXTEXTLENGTH - 1, "%ld", now - idletime);
string_add(&value, "%ld", now - idletime);
if (script_debug) printf("- %s: Idletime is %ld\n", pc->inst->name, now - idletime);
}
}
......@@ -193,9 +193,10 @@ void scr_time( struct code *pc, int fargc, char **fargv )
else if (!strcasecmp(pc->inst->name, "whenami"))
{
struct tm *tt;
tt=localtime(&now);
strftime(value, MAXTEXTLENGTH-1, "%H:%M", tt);
value=malloc(10);
strftime(value, 9, "%H:%M", tt);
}
else if (!strcasecmp(pc->inst->name, "date"))
{
......@@ -963,16 +964,16 @@ void scr_split( struct code *pc, int fargc, char **fargv )
char *bbp;
if ((bbp = strchr(ccp, ' ')) == NULL)
{
VAR_STR_UPDATE(&var1, cc);
VAR_STR_UPDATE(&var1, ccp);
VAR_STR_UPDATE(&var2, "");
}
else
{
bbp = bb;
bbp++;
VAR_STR_UPDATE(&var2, bbp);
*bb=0;
VAR_STR_UPDATE(&var1, cc);
char *dd = bbp;
dd++;
VAR_STR_UPDATE(&var2, dd);
*bbp=0;
VAR_STR_UPDATE(&var1, ccp);
}
}
......