2 * getostype.c - Get the Filesystem OS type
4 * Copyright (C) 2004,2005 Theodore Ts'o <tytso@mit.edu>
6 * This file can be redistributed under the terms of the GNU Library General
13 static const char * const os_tab[] =
22 * Convert an os_type to a string
24 char *e2p_os2string(int os_type)
29 if (os_type <= EXT2_OS_LITES)
39 * Convert an os_type to a string
41 int e2p_string2os(char *str)
43 const char * const *cpp;
46 for (cpp = os_tab; *cpp; cpp++, i++) {
47 if (!strcasecmp(str, *cpp))
54 int main(int argc, char **argv)
59 for (i=0; i <= EXT2_OS_LITES; i++) {
61 os = e2p_string2os(s);
62 printf("%d: %s (%d)\n", i, s, os);
64 fprintf(stderr, "Failure!\n");