#ifndef _HOSTINFOINT_H_
#define _HOSTINFOINT_H_
-
#define MAX_OS_NAME_LEN 128
#define MAX_OS_FULLNAME_LEN 512
#define MAX_STRUCTURED_FIELD_LEN 1024
typedef struct {
char *name;
- char value[MAX_STRUCTURED_FIELD_LEN];
+ char value[MAX_STRUCTURED_FIELD_LEN];
} StructuredField;
/* Must be sorted. Keep in same ordering as structuredFields */
PRETTY_NAME
} StructuredFieldType;
-/* Must be sorted. Keep in same ordering as StructuredFieldType. Defined in
- * hostinfoPosix.c */
+/*
+ * Must be sorted. Keep in same ordering as StructuredFieldType. Defined in
+ * hostinfoPosix.c
+ */
extern StructuredField structuredFields[];
#define MAX_STRUCTURED_STRING_LEN MAX_STRUCTURED_FIELD_LEN * 10
-
extern volatile Bool HostinfoOSNameCacheValid;
extern char HostinfoCachedOSName[MAX_OS_NAME_LEN];
extern char HostinfoCachedOSFullName[MAX_OS_FULLNAME_LEN];
extern char HostinfoCachedStructuredString[MAX_STRUCTURED_STRING_LEN];
-
/*
* Global functions
*/
extern Bool HostinfoOSData(void);
-
#endif // ifndef _HOSTINFOINT_H_
sizeof SYSTEM_BITNESS_64_LINUX))
struct hostinfoOSVersion {
- int hostinfoOSVersion[4];
+ int hostinfoOSVersion[4];
char *hostinfoOSVersionString;
};
/* Must be sorted. Keep in same ordering as StructuredFieldType*/
StructuredField structuredFields[] = {
- {"BITNESS", ""}, // "32" or "64"
- {"BUILD_NUMBER", ""}, // Always present for MacOS. Present for some Linux distros.
- {"DISTRO_NAME", ""}, // Defaults to uname -s
- {"DISTRO_VERSION", ""}, // Always present for MacOS. Read from distro files for Linux.
- {"FAMILY_NAME", ""}, // Defaults to uname -s
- {"KERNEL_VERSION", ""}, // Defaults to uname -r
- {"PRETTY_NAME", ""}, // Always present for MacOS. Read from distro files for Linux.
- {NULL},
+ { "bitness", "" }, // "32" or "64"
+ { "buildNumber", "" }, // Always present for MacOS. Present for some Linux distros.
+ { "distroName", "" }, // Defaults to uname -s
+ { "distroVersion", "" }, // Always present for MacOS. Read from distro files for Linux.
+ { "familyName", "" }, // Defaults to uname -s
+ { "kernelVersion", "" }, // Defaults to uname -r
+ { "prettyName", "" }, // Always present for MacOS. Read from distro files for Linux.
+ { NULL, "" }, // MUST BE LAST
};
#if defined __ANDROID__
sizeof HostinfoCachedStructuredString);
for (field = structuredFields; field->name != NULL; field++) {
- if (field->value != NULL && *field->value != '\0') {
+ if (field->value[0] != '\0') {
/* Account for escape char and null char */
char escapedString[MAX_STRUCTURED_FIELD_LEN * 2 + 1];
char fieldString[MAX_STRUCTURED_FIELD_LEN];
}
}
}
- Log("structuredstring = \"%s\"\n", HostinfoCachedStructuredString);
+
+ Log("structured string = \"%s\"\n", HostinfoCachedStructuredString);
}