6 * Copyright (C) 1987 by the Massachusetts Institute of Technology
7 * For copying and distribution information, please see the file
13 static char *rcsid_nfsparttype_c = "$Header$";
16 #include <mit-copyright.h>
23 extern char *strsave();
24 extern char *strtrim();
32 * Table of fs type names.
35 static struct pair fs_names[] = {
36 { MR_FS_STUDENT, "Student" },
37 { MR_FS_FACULTY, "Faculty" },
38 { MR_FS_STAFF, "Staff" },
39 { MR_FS_MISC, "Other" },
40 { MR_FS_GROUPQUOTA, "GroupQuota" },
41 /* Insert new entries before the 0,0 pair */
46 * Given a numeric string containing a filesystem status value, return
47 * a string indicating what allocation type it is.
49 char *format_filesys_type(char *fs_status)
55 int stat = atoi(fs_status);
59 for (pp = fs_names; pp->type; pp++)
65 strcat(buf, pp->name);
76 sprintf(buf1, "Unknown bits 0x%x", stat);
85 * Given a string describing a filesystem allocation type, return the
88 char *parse_filesys_type(char *fs_type_name)
91 char *cp = fs_type_name;
97 /* Copy next component of type to temp */
98 char *t = strchr(cp, ',');
101 memcpy(temp, cp, t - cp);
103 cp = t + 1; /* one after the comma */
111 t = strtrim(temp); /* nuke leading and trailing whitespace */
113 for (pp = fs_names; pp->type; pp++)
115 if (!strcasecmp(pp->name, t))
123 sprintf(temp, "%d", flags);
124 return strsave(temp);