From owner-p4-projects@FreeBSD.ORG Thu Oct 23 05:28:17 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 52FE916A4C0; Thu, 23 Oct 2003 05:28:17 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2B07C16A4B3 for ; Thu, 23 Oct 2003 05:28:17 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8440543F93 for ; Thu, 23 Oct 2003 05:28:16 -0700 (PDT) (envelope-from areisse@nailabs.com) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h9NCSGXJ045399 for ; Thu, 23 Oct 2003 05:28:16 -0700 (PDT) (envelope-from areisse@nailabs.com) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h9NCSGUJ045396 for perforce@freebsd.org; Thu, 23 Oct 2003 05:28:16 -0700 (PDT) (envelope-from areisse@nailabs.com) Date: Thu, 23 Oct 2003 05:28:16 -0700 (PDT) Message-Id: <200310231228.h9NCSGUJ045396@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to areisse@nailabs.com using -f From: Andrew Reisse To: Perforce Change Reviews Subject: PERFORCE change 40290 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2003 12:28:17 -0000 http://perforce.freebsd.org/chv.cgi?CH=40290 Change 40290 by areisse@areisse_ibook on 2003/10/23 05:28:08 add -t option to list labels instead of changing them Affected files ... .. //depot/projects/trustedbsd/sedarwin/mac_cmds/setfsmac/setfsmac.c#3 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin/mac_cmds/setfsmac/setfsmac.c#3 (text+ko) ==== @@ -74,7 +74,7 @@ void add_specs(struct label_specs *, const char *, int); void add_setfmac_specs(struct label_specs *, char *); void add_spec_line(const char *, int, struct label_spec_entry *, char *); -int apply_specs(struct label_specs *, FTSENT *, int, int); +int apply_specs(struct label_specs *, FTSENT *, int, int, int); int specs_empty(struct label_specs *); int @@ -86,6 +86,7 @@ int eflag = 0, xflag = 0, vflag = 0, Rflag = 0, hflag; int ch, is_setfmac; char *bn; + int test = 0; bn = basename(argv[0]); if (bn == NULL) @@ -93,7 +94,7 @@ is_setfmac = strcmp(bn, "setfmac") == 0; hflag = is_setfmac ? FTS_LOGICAL : FTS_PHYSICAL; specs = new_specs(); - while ((ch = getopt(argc, argv, is_setfmac ? "Rh" : "ef:s:vx")) != -1) { + while ((ch = getopt(argc, argv, is_setfmac ? "Rh" : "ef:s:vxt")) != -1) { switch (ch) { case 'R': Rflag = 1; @@ -116,6 +117,9 @@ case 'x': xflag = FTS_XDEV; break; + case 't': + test = 1; + break; default: usage(is_setfmac); } @@ -149,7 +153,7 @@ case FTS_F: /* do regular */ case FTS_SL: /* do symlink */ case FTS_W: /* do whiteout */ - if (apply_specs(specs, ftsent, hflag, vflag)) { + if (apply_specs(specs, ftsent, hflag, vflag, test)) { if (eflag) { errx(1, "labeling not supported in " "%.*s", ftsent->fts_pathlen, @@ -383,7 +387,8 @@ } int -apply_specs(struct label_specs *specs, FTSENT *ftsent, int hflag, int vflag) +apply_specs(struct label_specs *specs, FTSENT *ftsent, int hflag, int vflag, + int listonly) { regmatch_t pmatch; struct label_spec *ls; @@ -465,6 +470,15 @@ strcat(macstr, ls->match->mactext); } } + if (listonly) { + if (!strncmp ("sebsd/", macstr, 6)) + printf ("%-43s %s\n", ftsent->fts_path, macstr+6); + else + printf ("%-43s %s\n", ftsent->fts_path, macstr); + free (macstr); + return; + } + if (mac_from_text(&mac, macstr)) err(1, "mac_from_text(%s)", macstr); if ((hflag == FTS_PHYSICAL ? mac_set_link(ftsent->fts_accpath, mac) :