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
14 static const char *os_tab[] =
23 * Convert an os_type to a string
25 char *e2p_os2string(int os_type)
30 if (os_type <= EXT2_OS_LITES)
35 ret = malloc(strlen(os)+1);
42 * Convert an os_type to a string
44 int e2p_string2os(char *str)
49 for (cpp = os_tab; *cpp; cpp++, i++) {
50 if (!strcasecmp(str, *cpp))
57 int main(int argc, char **argv)
62 for (i=0; i <= EXT2_OS_LITES; i++) {
64 os = e2p_string2os(s);
65 printf("%d: %s (%d)\n", i, s, os);
67 fprintf(stderr, "Failure!\n");