Start command validation

This commit is contained in:
James Booth
2012-02-18 22:51:08 +00:00
parent 809daa9395
commit 18c97a431a
7 changed files with 83 additions and 17 deletions

21
util.c
View File

@@ -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;
}