2 * Copyright (c) 2000-2001 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would 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 the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 /*---------------------------------------------------------------------------
27 Test program used to test the DMAPI function dm_remove_dmattr(). The
30 remove_dmattr [-s sid] [-u] pathname attr
32 where pathname is the name of a file, attr is the name of the DMAPI attribute,
33 and sid is the session ID whose attributes you are interested in.
35 ----------------------------------------------------------------------------*/
38 extern char *sys_errlist[];
49 fprintf(stderr, "usage:\t%s [-s sid] [-u] pathname attr\n", Progname);
59 dm_sessid_t sid = DM_NO_SESSION;
61 dm_attrname_t *attrnamep;
68 Progname = strrchr(argv[0], '/');
75 /* Crack and validate the command line options. */
77 while ((opt = getopt(argc, argv, "s:u")) != EOF) {
89 if (optind + 2 != argc)
91 pathname = argv[optind++];
92 attrnamep = (dm_attrname_t *)argv[optind++];
94 if (dm_init_service(&name) == -1) {
95 fprintf(stderr, "Can't initialize the DMAPI\n");
98 if (sid == DM_NO_SESSION)
99 find_test_session(&sid);
101 /* Get the file's handle. */
103 if (dm_path_to_handle(pathname, &hanp, &hlen)) {
104 fprintf(stderr, "can't get handle for file %s\n", pathname);
108 if (dm_remove_dmattr(sid, hanp, hlen, DM_NO_TOKEN, setdtime,
110 fprintf(stderr, "dm_remove_dmattr failed, %s\n",
115 dm_handle_free(hanp, hlen);