1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2001 Silicon Graphics, Inc.
13 /*---------------------------------------------------------------------------
15 Test program used to test the DMAPI function dm_remove_dmattr(). The
18 remove_dmattr [-s sid] [-u] pathname attr
20 where pathname is the name of a file, attr is the name of the DMAPI attribute,
21 and sid is the session ID whose attributes you are interested in.
23 ----------------------------------------------------------------------------*/
26 extern char *sys_errlist[];
37 fprintf(stderr, "usage:\t%s [-s sid] [-u] pathname attr\n", Progname);
47 dm_sessid_t sid = DM_NO_SESSION;
49 dm_attrname_t *attrnamep;
56 Progname = strrchr(argv[0], '/');
63 /* Crack and validate the command line options. */
65 while ((opt = getopt(argc, argv, "s:u")) != EOF) {
77 if (optind + 2 != argc)
79 pathname = argv[optind++];
80 attrnamep = (dm_attrname_t *)argv[optind++];
82 if (dm_init_service(&name) == -1) {
83 fprintf(stderr, "Can't initialize the DMAPI\n");
86 if (sid == DM_NO_SESSION)
87 find_test_session(&sid);
89 /* Get the file's handle. */
91 if (dm_path_to_handle(pathname, &hanp, &hlen)) {
92 fprintf(stderr, "can't get handle for file %s\n", pathname);
96 if (dm_remove_dmattr(sid, hanp, hlen, DM_NO_TOKEN, setdtime,
98 fprintf(stderr, "dm_remove_dmattr failed, %s\n",
103 dm_handle_free(hanp, hlen);