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>
22 extern char *strsave();
23 extern char *strtrim();
31 * Table of fs type names.
34 static struct pair fs_names[] = {
35 { MR_FS_STUDENT, "Student" },
36 { MR_FS_FACULTY, "Faculty" },
37 { MR_FS_STAFF, "Staff" },
38 { MR_FS_MISC, "Other" },
39 { MR_FS_GROUPQUOTA, "GroupQuota" },
40 /* Insert new entries before the 0,0 pair */
45 * Given a numeric string containing a filesystem status value, return
46 * a string indicating what allocation type it is.
49 format_filesys_type(fs_status)
53 register struct pair *pp;
56 int stat = atoi(fs_status);
60 for (pp = fs_names; pp->type; pp++) {
61 if (stat & pp->type) {
62 if (n_names) (void) strcat(buf, ", ");
63 (void) strcat(buf, pp->name);
71 if (n_names) (void) strcat (buf, ", ");
72 (void) sprintf(buf1, "Unknown bits 0x%x", stat);
73 (void) strcat (buf, buf1);
75 if (!n_names) (void) strcpy(buf, "none");
80 * Given a string describing a filesystem allocation type, return the
84 parse_filesys_type(fs_type_name)
87 register struct pair *pp;
88 register char *cp = fs_type_name;
93 /* Copy next component of type to temp */
94 char *t = index (cp, ',');
96 bcopy(cp, temp, t-cp);
98 cp = t + 1; /* one after the comma */
100 (void) strcpy(temp, cp);
104 t = strtrim(temp); /* nuke leading and trailing whitespace */
106 for (pp = fs_names; pp->type; pp++) {
107 if (strcasecmp(pp->name, t) == 0) {
113 (void) sprintf(temp, "%d", flags);
114 return strsave(temp);