Date: Thu, 23 Oct 2003 05:28:16 -0700 (PDT) From: Andrew Reisse <areisse@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 40290 for review Message-ID: <200310231228.h9NCSGUJ045396@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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) :
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200310231228.h9NCSGUJ045396>