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.
----------------------------------------------------------------------------*/
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);
}
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;
/* 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");
/* 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);
}
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),
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);
}
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';
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);
}
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");
/* 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);
}