allow dmapi test tools get/set_dmattr to take handle or pathname

allow pathname or handle
This commit is contained in:
Dean Roehrich
2003-03-07 15:19:18 +00:00
parent 332a286c6e
commit bcbe9ee230
2 changed files with 13 additions and 15 deletions
+6 -7
View 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);
}
+7 -8
View 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);
}