2 * getostype.c - Get the Filesystem OS type
4 * Copyright (C) 2004,2005 Theodore Ts'o <tytso@mit.edu>
7 * This file may be redistributed under the terms of the GNU Library
8 * General Public License, version 2.
17 static const char *os_tab[] =
26 * Convert an os_type to a string
28 char *e2p_os2string(int os_type)
33 if (os_type <= EXT2_OS_LITES)
38 ret = malloc(strlen(os)+1);
45 * Convert an os_type to a string
47 int e2p_string2os(char *str)
52 for (cpp = os_tab; *cpp; cpp++, i++) {
53 if (!strcasecmp(str, *cpp))
60 int main(int argc, char **argv)
65 for (i=0; i <= EXT2_OS_LITES; i++) {
67 os = e2p_string2os(s);
68 printf("%d: %s (%d)\n", i, s, os);
70 fprintf(stderr, "Failure!\n");