No Message Supplied

This commit is contained in:
Dean Roehrich
2002-06-11 17:59:14 +00:00
parent e08aa2c4bc
commit f2e2850a78
2 changed files with 26 additions and 17 deletions
+18 -9
View File
@@ -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);
}
+8 -8
View File
@@ -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);
}