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 @@ -12,4 +12,7 @@ # include "windows.h" #endif +#if defined(linux) || defined(__linux) || defined(__linux__) +# include <sys/utsname.h> +#endif #include "../gsmstate.h" @@ -231,9 +234,11 @@ char *OSDate (GSM_DateTime dt) bool CheckDate(GSM_DateTime *date) -{ - /* FIXME: This could also check if day is correct for selected month */ +{ + const unsigned int days[]={31,29,31,30,31,30,31,31,30,31,30,31}; + + /* FIXME: This could also check for leap years */ return date->Year != 0 && - date->Month >= 1 && date->Month <= 12 && - date->Day >= 1 && date->Day <= 31; + date->Month >= 1 && date->Month <= 12 && + date->Day >= 1 && date->Day <= days[date->Month]; } @@ -452,4 +457,7 @@ char *GetOS(void) bool Extended = true; #endif +#if defined(linux) || defined(__linux) || defined(__linux__) + struct utsname Ver; +#endif static char Buffer[100] = {0x00}; @@ -521,5 +529,6 @@ char *GetOS(void) } #elif defined(linux) || defined(__linux) || defined(__linux__) - sprintf(Buffer, "Linux"); + uname(&Ver); + sprintf(Buffer, "Linux, kernel %s",Ver.release); #elif defined(__FreeBSD__) sprintf(Buffer, "FreeBSD"); |