3 // Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; version 2 of the License.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #include <lib/vserver.h>
28 #include <lib/vserver-internal.h>
31 #include <sys/types.h>
38 { "help", no_argument, 0, CMD_HELP },
39 { "version", no_argument, 0, CMD_VERSION },
40 { "immu", no_argument, 0, CMD_IMMU },
41 { "iunlink", no_argument, 0, CMD_IMMU },
42 { "admin", no_argument, 0, CMD_ADMIN },
43 { "watch", no_argument, 0, CMD_WATCH },
44 { "hide", no_argument, 0, CMD_HIDE },
45 { "barrier", no_argument, 0, CMD_BARRIER },
46 { "~iunlink", no_argument, 0, CMD_UNSET_IMMU },
47 { "!iunlink", no_argument, 0, CMD_UNSET_IMMU },
48 { "~immu", no_argument, 0, CMD_UNSET_IMMU },
49 { "!immu", no_argument, 0, CMD_UNSET_IMMU },
50 { "~admin", no_argument, 0, CMD_UNSET_ADMIN },
51 { "!admin", no_argument, 0, CMD_UNSET_ADMIN },
52 { "~watch", no_argument, 0, CMD_UNSET_WATCH },
53 { "!watch", no_argument, 0, CMD_UNSET_WATCH },
54 { "~hide", no_argument, 0, CMD_UNSET_HIDE },
55 { "!hide", no_argument, 0, CMD_UNSET_HIDE },
56 { "~barrier", no_argument, 0, CMD_UNSET_BARRIER },
57 { "!barrier", no_argument, 0, CMD_UNSET_BARRIER },
58 { "iunlink-but-not-immutable", no_argument, 0, CMD_IMMUX },
59 { "~iunlink-but-not-immutable", no_argument, 0, CMD_UNSET_IMMUX },
60 { "!iunlink-but-not-immutable", no_argument, 0, CMD_UNSET_IMMUX },
64 char const CMDLINE_OPTIONS_SHORT[] = "Rx";
67 showHelp(int fd, char const *cmd, int res)
69 WRITE_MSG(fd, "Usage: ");
72 " [-Rx] [--[~](iunlink|admin|watch|hide|barrier|iunlink-but-not-immutable)]* [--] <file>+\n\n"
74 " -R ... recurse through directories\n"
75 " -x ... do not cross filesystems\n\n"
76 "Please report bugs to " PACKAGE_BUGREPORT "\n");
84 "setattr " VERSION " -- sets vserver specific file attributes\n"
85 "This program is part of " PACKAGE_STRING "\n\n"
86 "Copyright (C) 2004 Enrico Scholz\n"
87 VERSION_COPYRIGHT_DISCLAIMER);
92 fixupParams(struct Arguments * args, int argc)
95 WRITE_MSG(2, "No filename given; use '--help' for more information\n");
99 args->do_display_dir = !args->do_recurse;
100 args->do_display_dot = true;
104 handleFile(char const *name, char const * display_name)
106 int rc = vc_set_iattr(name,
108 global_args->set_mask & ~global_args->del_mask,
109 global_args->set_mask | global_args->del_mask);
112 perror(display_name);