6 * Copyright (C) 1987 by the Massachusetts Institute of Technology
9 * Revision 1.1 1987-09-03 03:13:40 wesommer
15 static char *rcsid_nfsparttype_c = "$Header$";
23 extern char *strsave();
24 extern char *strtrim();
32 * Table of fs type names.
35 static struct pair fs_names[] = {
36 { SMS_FS_STUDENT, "Student" },
37 { SMS_FS_FACULTY, "Faculty/Project" },
38 { SMS_FS_FACULTY, "Faculty" },
39 { SMS_FS_FACULTY, "Project" },
40 { SMS_FS_STAFF, "Staff" },
41 { SMS_FS_MISC, "Other" },
42 /* Insert new entries before the 0,0 pair */
47 * Given a numeric string containing a filesystem status value, return
48 * a string indicating what allocation type it is.
51 format_filesys_type(fs_status)
55 register struct pair *pp;
58 int stat = atoi(fs_status);
62 for (pp = fs_names; pp->type; pp++) {
63 if (stat & pp->type) {
64 if (n_names) (void) strcat(buf, ", ");
65 (void) strcat(buf, pp->name);
73 if (n_names) (void) strcat (buf, ", ");
74 (void) sprintf(buf1, "Unknown bits 0x%x", stat);
75 (void) strcat (buf, buf1);
77 if (!n_names) (void) strcpy(buf, "none");
82 * Given a string describing a filesystem allocation type, return the
86 parse_filesys_type(fs_type_name)
89 register struct pair *pp;
90 register char *cp = fs_type_name;
95 /* Copy next component of type to temp */
96 char *t = index (cp, ',');
98 bcopy(cp, temp, t-cp);
100 cp = t + 1; /* one after the comma */
102 (void) strcpy(temp, cp);
106 t = strtrim(temp); /* nuke leading and trailing whitespace */
108 for (pp = fs_names; pp->type; pp++) {
109 if (cistrcmp(pp->name, t) == 0) {
115 (void) sprintf(temp, "%d", flags);
116 return strsave(temp);