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 { SMS_FS_STUDENT, "Student" },
36 { SMS_FS_FACULTY, "Faculty/Project" },
37 { SMS_FS_FACULTY, "Faculty" },
38 { SMS_FS_FACULTY, "Project" },
39 { SMS_FS_STAFF, "Staff" },
40 { SMS_FS_MISC, "Other" },
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.
50 format_filesys_type(fs_status)
54 register struct pair *pp;
57 int stat = atoi(fs_status);
61 for (pp = fs_names; pp->type; pp++) {
62 if (stat & pp->type) {
63 if (n_names) (void) strcat(buf, ", ");
64 (void) strcat(buf, pp->name);
72 if (n_names) (void) strcat (buf, ", ");
73 (void) sprintf(buf1, "Unknown bits 0x%x", stat);
74 (void) strcat (buf, buf1);
76 if (!n_names) (void) strcpy(buf, "none");
81 * Given a string describing a filesystem allocation type, return the
85 parse_filesys_type(fs_type_name)
88 register struct pair *pp;
89 register char *cp = fs_type_name;
94 /* Copy next component of type to temp */
95 char *t = index (cp, ',');
97 bcopy(cp, temp, t-cp);
99 cp = t + 1; /* one after the comma */
101 (void) strcpy(temp, cp);
105 t = strtrim(temp); /* nuke leading and trailing whitespace */
107 for (pp = fs_names; pp->type; pp++) {
108 if (cistrcmp(pp->name, t) == 0) {
114 (void) sprintf(temp, "%d", flags);
115 return strsave(temp);