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 const char *os_tab[] =
22 * Convert an os_type to a string
24 char *e2p_os2string(int os_type)
29 if (os_type <= EXT2_OS_LITES)
34 ret = malloc(strlen(os)+1);
40 * Convert an os_type to a string
42 int e2p_string2os(char *str)
47 for (cpp = os_tab; *cpp; cpp++, i++) {
48 if (!strcasecmp(str, *cpp))
55 int main(int argc, char **argv)
60 for (i=0; i <= EXT2_OS_LITES; i++) {
62 os = e2p_string2os(s);
63 printf("%d: %s (%d)\n", i, s, os);
65 fprintf(stderr, "Failure!\n");