allow dmapi test tools get/set_dmattr to take handle or pathname
authorDean Roehrich <roehrich@sgi.com>
Fri, 7 Mar 2003 15:19:18 +0000 (15:19 +0000)
committerDean Roehrich <roehrich@sgi.com>
Fri, 7 Mar 2003 15:19:18 +0000 (15:19 +0000)
allow pathname or handle

dmapi/src/suite1/cmd/get_dmattr.c
dmapi/src/suite1/cmd/set_dmattr.c

index 039e6c3870f0fd589f1914caa5167ade2d176391..a03180da21c7cdaaa503e80375c6e686e9e5970f 100644 (file)
@@ -40,7 +40,7 @@
 Test program used to test the DMAPI function dm_get_dmattr().  The
 command line is:
 
-       get_dmattr [-b buflen] [-s sid] [-t token] pathname attr
+       get_dmattr [-b buflen] [-s sid] [-t token] {pathname|handle} attr
 
 where pathname is the name of a file, buflen is the size of the buffer to use
 in the call, attr is the name of the DMAPI attribute, and sid is the session ID
@@ -61,7 +61,7 @@ static void
 usage(void)
 {
        fprintf(stderr, "usage:\t%s [-b buflen] [-s sid] [-t token] "
-               "pathname attr\n", Progname);
+               "{pathname|handle} attr\n", Progname);
        exit(1);
 }
 
@@ -73,7 +73,7 @@ main(
 {
        dm_sessid_t     sid = DM_NO_SESSION;
        dm_token_t      token = DM_NO_TOKEN;
-       char            *pathname;
+       char            *object;
        dm_attrname_t   *attrnamep;
        void            *bufp;
        size_t          buflen = 10000;
@@ -108,7 +108,7 @@ main(
        }
        if (optind + 2 != argc)
                usage();
-       pathname = argv[optind++];
+       object = argv[optind++];
        attrnamep = (dm_attrname_t *)argv[optind];
 
        if (dm_init_service(&name) == -1)  {
@@ -120,9 +120,8 @@ main(
 
        /* Get the file's handle. */
 
-       if (dm_path_to_handle(pathname, &hanp, &hlen)) {
-               fprintf(stderr, "can't get handle for file %s, %s\n",
-                       pathname, strerror(errno));
+       if (opaque_to_handle(object, &hanp, &hlen)) {
+               fprintf(stderr, "can't get handle for %s\n", object);
                exit(1);
        }
 
index ec39db633d7d158e34b217897a03a774cce247a9..ff271db94cece72d4b3e95dd42e33b3e9319b0e5 100644 (file)
@@ -41,7 +41,7 @@
 Test program used to test the DMAPI function dm_set_dmattr().  The
 command line is:
 
-       set_dmattr [-b buflen] [-s sid] [-u] pathname attr value
+       set_dmattr [-b buflen] [-s sid] [-u] {pathname|handle} attr value
 
 where pathname is the name of a file, buflen is the size of the buffer to use
 in the call, attr is the name of the DMAPI attribute, -u is selected if 
@@ -62,8 +62,8 @@ char  *Progname;
 static void
 usage(void)
 {
-       fprintf(stderr, "usage:\t%s [-b buflen] [-s sid] [-u] pathname "
-               "attr value\n", Progname);
+       fprintf(stderr, "usage:\t%s [-b buflen] [-s sid] [-u] "
+               "{pathname|handle} attr value\n", Progname);
        exit(1);
 }
 
@@ -74,7 +74,7 @@ main(
        char    **argv)
 {
        dm_sessid_t     sid = DM_NO_SESSION;
-       char            *pathname;
+       char            *object;
        dm_attrname_t   *attrnamep;
        char            *bufp;
        size_t          buflen;
@@ -111,7 +111,7 @@ main(
        }
        if (optind + 3 != argc)
                usage();
-       pathname = argv[optind++];
+       object = argv[optind++];
        attrnamep = (dm_attrname_t *)argv[optind++];
        bufp = argv[optind];
        if (!bflag)
@@ -126,9 +126,8 @@ main(
 
        /* Get the file's handle. */
 
-       if (dm_path_to_handle(pathname, &hanp, &hlen)) {
-               fprintf(stderr, "can't get handle for file %s, %s\n",
-                       pathname, strerror(errno));
+       if (opaque_to_handle(object, &hanp, &hlen)) {
+               fprintf(stderr, "can't get handle for %s\n", object);
                exit(1);
        }