Deleted Added
sdiff udiff text old ( 166458 ) new ( 166485 )
full compact
1/*
2 * Copyright (c) 1980, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Robert Elz at The University of Melbourne.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 28 unchanged lines hidden (view full) ---

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41static char sccsid[] = "@(#)quotacheck.c 8.3 (Berkeley) 1/29/94";
42#endif /* not lint */
43#endif
44#include <sys/cdefs.h>
45__FBSDID("$FreeBSD: head/sbin/quotacheck/quotacheck.c 166458 2007-02-03 11:20:28Z mpp $");
46
47/*
48 * Fix up / report on disk quotas & usage
49 */
50#include <sys/param.h>
51#include <sys/disklabel.h>
52#include <sys/stat.h>
53
54#include <ufs/ufs/dinode.h>
55#include <ufs/ufs/quota.h>
56#include <ufs/ffs/fs.h>
57
58#include <err.h>
59#include <errno.h>

--- 522 unchanged lines hidden (view full) ---

582int
583hasquota(fs, type, qfnamep)
584 struct fstab *fs;
585 int type;
586 char **qfnamep;
587{
588 char *opt;
589 char *cp;
590 static char initname, usrname[100], grpname[100];
591 static char buf[BUFSIZ];
592
593 if (!initname) {
594 (void)snprintf(usrname, sizeof(usrname),
595 "%s%s", qfextension[USRQUOTA], qfname);
596 (void)snprintf(grpname, sizeof(grpname),
597 "%s%s", qfextension[GRPQUOTA], qfname);
598 initname = 1;
599 }
600 strcpy(buf, fs->fs_mntops);
601 for (opt = strtok(buf, ","); opt; opt = strtok(NULL, ",")) {
602 if ((cp = index(opt, '=')) != NULL)
603 *cp++ = '\0';
604 if (type == USRQUOTA && strcmp(opt, usrname) == 0)
605 break;
606 if (type == GRPQUOTA && strcmp(opt, grpname) == 0)
607 break;
608 }
609 if (!opt)
610 return (0);
611 if (cp)
612 *qfnamep = cp;
613 else {
614 (void)snprintf(buf, sizeof(buf),
615 "%s/%s.%s", fs->fs_file, qfname, qfextension[type]);
616 *qfnamep = buf;
617 }
618 return (1);
619}
620
621/*
622 * Routines to manage the file usage table.
623 *
624 * Lookup an id of a specific type.
625 */

--- 197 unchanged lines hidden ---