Start command validation
This commit is contained in:
21
util.c
21
util.c
@@ -1,4 +1,6 @@
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
void get_time(char *thetime)
|
||||
{
|
||||
@@ -11,3 +13,22 @@ void get_time(char *thetime)
|
||||
strftime(thetime, 80, "%H:%M", timeinfo);
|
||||
}
|
||||
|
||||
char *trim(char *str)
|
||||
{
|
||||
char *end;
|
||||
|
||||
while (isspace(*str))
|
||||
str++;
|
||||
|
||||
if (*str == 0)
|
||||
return str;
|
||||
|
||||
end = str + strlen(str) - 1;
|
||||
while (end > str && isspace(*end))
|
||||
end--;
|
||||
|
||||
*(end+1) = 0;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user