xfstests: eliminate warnings under dmapi/src/suite1/cmd (2)
[xfstests-dev.git] / dmapi / src / suite1 / cmd / pending.c
1 /*
2  * Copyright (c) 2000-2001 Silicon Graphics, Inc.
3  * All Rights Reserved.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it would be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write the Free Software Foundation,
16  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18
19 #include <lib/hsm.h>
20
21 #include <string.h>
22
23 /*---------------------------------------------------------------------------
24
25 Test program used to test the DMAPI function dm_pending().  The
26 command line is:
27
28         pending sid token
29
30 where sid is the session ID whose event you are responding to.
31
32 ----------------------------------------------------------------------------*/
33
34 #ifndef linux
35 extern  char    *sys_errlist[];
36 #endif
37 extern  int     optind;
38 extern  char    *optarg;
39
40
41 char    *Progname;
42
43 static void
44 usage(void)
45 {
46         fprintf(stderr, "usage:\t%s sid token\n",
47                 Progname);
48         exit(1);
49 }
50
51
52 int
53 main(
54         int             argc, 
55         char            **argv)
56 {
57         dm_sessid_t     sid;
58         char            *name;
59         dm_token_t      token;
60
61         Progname = strrchr(argv[0], '/');
62         if (Progname) {
63                 Progname++;
64         } else {
65                 Progname = argv[0];
66         }
67
68         if (argc != 3)
69                 usage();
70
71         sid = atol(argv[1]);
72         token = atol(argv[2]);
73
74         if (dm_init_service(&name) == -1)  {
75                 fprintf(stderr, "Can't initialize the DMAPI\n");
76                 exit(1);
77         }
78
79         if (dm_pending(sid, token, NULL)) {
80                 fprintf(stderr, "dm_pending failed, %s\n", strerror(errno));
81                 exit(1);
82         }
83         exit(0);
84 }