Diffstat (limited to 'gammu/emb/common/misc/misc.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | gammu/emb/common/misc/misc.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/gammu/emb/common/misc/misc.c b/gammu/emb/common/misc/misc.c index c2f09e4..7227e7b 100644 --- a/gammu/emb/common/misc/misc.c +++ b/gammu/emb/common/misc/misc.c | |||
@@ -13,2 +13,5 @@ | |||
13 | #endif | 13 | #endif |
14 | #if defined(linux) || defined(__linux) || defined(__linux__) | ||
15 | # include <sys/utsname.h> | ||
16 | #endif | ||
14 | 17 | ||
@@ -232,7 +235,9 @@ char *OSDate (GSM_DateTime dt) | |||
232 | bool CheckDate(GSM_DateTime *date) | 235 | bool CheckDate(GSM_DateTime *date) |
233 | { | 236 | { |
234 | /* FIXME: This could also check if day is correct for selected month */ | 237 | const unsigned int days[]={31,29,31,30,31,30,31,31,30,31,30,31}; |
238 | |||
239 | /* FIXME: This could also check for leap years */ | ||
235 | return date->Year != 0 && | 240 | return date->Year != 0 && |
236 | date->Month >= 1 && date->Month <= 12 && | 241 | date->Month >= 1 && date->Month <= 12 && |
237 | date->Day >= 1 && date->Day <= 31; | 242 | date->Day >= 1 && date->Day <= days[date->Month]; |
238 | } | 243 | } |
@@ -453,2 +458,5 @@ char *GetOS(void) | |||
453 | #endif | 458 | #endif |
459 | #if defined(linux) || defined(__linux) || defined(__linux__) | ||
460 | struct utsnameVer; | ||
461 | #endif | ||
454 | static char Buffer[100] = {0x00}; | 462 | static char Buffer[100] = {0x00}; |
@@ -522,3 +530,4 @@ char *GetOS(void) | |||
522 | #elif defined(linux) || defined(__linux) || defined(__linux__) | 530 | #elif defined(linux) || defined(__linux) || defined(__linux__) |
523 | sprintf(Buffer, "Linux"); | 531 | uname(&Ver); |
532 | sprintf(Buffer, "Linux, kernel %s",Ver.release); | ||
524 | #elif defined(__FreeBSD__) | 533 | #elif defined(__FreeBSD__) |