From f2e2850a788994ddf97080cda220828a29df50bd Mon Sep 17 00:00:00 2001 From: Dean Roehrich Date: Tue, 11 Jun 2002 17:59:14 +0000 Subject: [PATCH] No Message Supplied --- dmapi/src/common/cmd/read_invis.c | 27 ++++++++++++++++++--------- dmapi/src/common/cmd/write_invis.c | 16 ++++++++-------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/dmapi/src/common/cmd/read_invis.c b/dmapi/src/common/cmd/read_invis.c index d1f42aac..0f3ba70d 100644 --- a/dmapi/src/common/cmd/read_invis.c +++ b/dmapi/src/common/cmd/read_invis.c @@ -43,13 +43,15 @@ Test program used to test the DMAPI function dm_read_invis(). The command line is: - read_invis [-o offset] [-l length] [-s sid] pathname + read_invis [-o offset] [-l length] [-s sid] [-c char] {pathname|handle} where: 'offset' is the offset of the start of the write (0 is the default), 'length' is the length of the write in bytes (1 is the default), 'sid' is the session ID whose events you you are interested in. 'pathname' is the name of the file to be written. +'char' is ignored--it just allows read_invis and write_invis to have + interchangeable commandlines without having to fuss with the params. ----------------------------------------------------------------------------*/ @@ -67,7 +69,7 @@ static void usage(void) { fprintf(stderr, "usage:\t%s [-o offset] [-l length] " - "[-s sid] pathname\n", Progname); + "[-s sid] [-c char] {pathname|handle}\n", Progname); exit(1); } @@ -78,7 +80,7 @@ main( char **argv) { dm_sessid_t sid = DM_NO_SESSION; - char *pathname = NULL; + char *object = NULL; dm_off_t offset = 0; dm_size_t length = 1; char *bufp = NULL; @@ -97,24 +99,31 @@ main( /* Crack and validate the command line options. */ - while ((opt = getopt(argc, argv, "o:l:s:")) != EOF) { + while ((opt = getopt(argc, argv, "o:l:s:c:")) != EOF) { switch (opt) { case 'o': - offset = atol(optarg); + sscanf(optarg, "%lld", &offset); break; case 'l': - length = atol(optarg); + sscanf(optarg, "%llu", &length); break; case 's': sid = atol(optarg); break; + case 'c': + /* This is a no-op, it just allows read_invis + * and write_invis to have interchangeable + * commandlines, without having to fuss with + * the params. + */ + break; case '?': usage(); } } if (optind + 1 != argc) usage(); - pathname = argv[optind]; + object = argv[optind]; if (dm_init_service(&name) == -1) { fprintf(stderr, "Can't initialize the DMAPI\n"); @@ -125,8 +134,8 @@ main( /* Get the file's handle. */ - if (dm_path_to_handle(pathname, &hanp, &hlen)) { - fprintf(stderr, "can't get handle for file %s\n", pathname); + if (opaque_to_handle(object, &hanp, &hlen)) { + fprintf(stderr, "can't get handle for %s\n", object); exit(1); } diff --git a/dmapi/src/common/cmd/write_invis.c b/dmapi/src/common/cmd/write_invis.c index 23d12ed5..bba87016 100644 --- a/dmapi/src/common/cmd/write_invis.c +++ b/dmapi/src/common/cmd/write_invis.c @@ -41,7 +41,7 @@ Test program used to test the DMAPI function dm_write_invis(). The command line is: - write_invis [-c char] [-o offset] [-l length] [-s sid] pathname + write_invis [-c char] [-o offset] [-l length] [-s sid] {pathname|handle} where: 'char' is the character to use as a repeated pattern ('X' is the default), @@ -68,7 +68,7 @@ static void usage(void) { fprintf(stderr, "usage:\t%s [-c char] [-o offset] [-l length] " - "[-s sid] pathname\n", Progname); + "[-s sid] {pathname|handle}\n", Progname); exit(1); } @@ -79,7 +79,7 @@ main( char **argv) { dm_sessid_t sid = DM_NO_SESSION; - char *pathname = NULL; + char *object = NULL; dm_off_t offset = 0; dm_size_t length = 1; u_char ch = 'X'; @@ -104,10 +104,10 @@ main( ch = *optarg; break; case 'o': - offset = atol(optarg); + sscanf(optarg, "%lld", &offset); break; case 'l': - length = atol(optarg); + sscanf(optarg, "%llu", &length); break; case 's': sid = atol(optarg); @@ -118,7 +118,7 @@ main( } if (optind + 1 != argc) usage(); - pathname = argv[optind]; + object = argv[optind]; if (dm_init_service(&name) == -1) { fprintf(stderr, "Can't initialize the DMAPI\n"); @@ -129,8 +129,8 @@ main( /* Get the file's handle. */ - if (dm_path_to_handle(pathname, &hanp, &hlen)) { - fprintf(stderr, "can't get handle for file %s\n", pathname); + if (opaque_to_handle(object, &hanp, &hlen)) { + fprintf(stderr, "can't get handle for %s\n", object); exit(1); } -- 2.47.3