Update copyright annotations and license boilerplates to correspond with SGI Legals...
[xfstests-dev.git] / dmapi / src / simple / dm_destroy_session.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 #include <stdio.h>
19 #include <stdlib.h>
20 #include <sys/errno.h>
21 #include <getopt.h>
22 #ifdef linux
23 #include <dmapi.h>
24 #endif
25 #ifdef __sgi
26 #include <sys/dmi.h>
27 #endif
28
29 int
30 main( int argc, char **argv )
31 {
32         extern char *optarg;
33         int c;
34         int ret;
35         dm_sessid_t sid = 0;
36         char *versionstr;
37
38         while( (c = getopt(argc, argv, "hs:")) != -1 ) {
39                 switch(c){
40                 case 's':
41                         sid = atoi( optarg );
42                         break;
43                 case 'h':
44                         fprintf(stderr, "Usage: %s <-s sid>\n", argv[0] );
45                         exit(2);
46                 }
47         }
48
49         if( sid == 0 ){
50                 fprintf(stderr, "%s: must specify -s\n", argv[0] );
51                 exit(1);
52         }
53
54         if( dm_init_service( &versionstr ) < 0 )
55                 exit(1);
56
57         ret = dm_destroy_session( sid );
58         printf( "ret=%d\n", ret );
59         exit(0);
60 }