/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
+ * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
#include <lib/hsm.h>
-#ifdef linux
+#include <getopt.h>
#include <string.h>
-#endif
+
/*---------------------------------------------------------------------------
Test program used to test the DMAPI function dm_punch_hole(). The
command line is:
- punch_hole [-o offset] [-l length] [-s sid] pathname
+ punch_hole [-o offset] [-l length] [-s sid] {pathname|handle}
where pathname is the name of a file, offset is the offset of the start of
the punch, and length is the length of the punch. sid is the
static void
usage(void)
{
- int i;
-
fprintf(stderr, "usage:\t%s [-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 = 0;
void *hanp;
size_t hlen;
char *name;
int opt;
- int i;
if (Progname = strrchr(argv[0], '/')) {
Progname++;
}
if (optind + 1 != argc)
usage();
- pathname = argv[optind];
+ object = argv[optind];
if (dm_init_service(&name) == -1) {
- fprintf(stderr, "Can't inititalize the DMAPI\n");
+ fprintf(stderr, "Can't initialize the DMAPI\n");
exit(1);
}
if (sid == DM_NO_SESSION)
/* 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);
}