1 /* vi: set sw=4 ts=4: */
3 * getostype.c - Get the Filesystem OS type
5 * Copyright (C) 2004,2005 Theodore Ts'o <tytso@mit.edu>
7 * This file can be redistributed under the terms of the GNU Library General
15 static const char * const os_tab[] =
24 * Convert an os_type to a string
26 char *e2p_os2string(int os_type)
31 if (os_type <= EXT2_OS_LITES)
41 * Convert an os_type to a string
43 int e2p_string2os(char *str)
45 const char * const *cpp;
48 for (cpp = os_tab; *cpp; cpp++, i++) {
49 if (!strcasecmp(str, *cpp))
56 int main(int argc, char **argv)
61 for (i=0; i <= EXT2_OS_LITES; i++) {
63 os = e2p_string2os(s);
64 printf("%d: %s (%d)\n", i, s, os);
66 fprintf(stderr, "Failure!\n");