OSDN Git Service

libss: fix memory handling errors
[android-x86/external-e2fsprogs.git] / lib / ss / requests.c
1 /*
2  * Various minor routines...
3  *
4  * Copyright 1987, 1988, 1989 by MIT
5  *
6  * Permission to use, copy, modify, and distribute this software and
7  * its documentation for any purpose is hereby granted, provided that
8  * the names of M.I.T. and the M.I.T. S.I.P.B. not be used in
9  * advertising or publicity pertaining to distribution of the software
10  * without specific, written prior permission.  M.I.T. and the
11  * M.I.T. S.I.P.B. make no representations about the suitability of
12  * this software for any purpose.  It is provided "as is" without
13  * express or implied warranty.
14  */
15
16 #include "config.h"
17 #include <stdio.h>
18 #include "ss_internal.h"
19
20 #define DECLARE(name) void name(int argc,const char * const *argv, \
21                                 int sci_idx, void *infop)
22
23 /*
24  * ss_self_identify -- assigned by default to the "." request
25  */
26 void ss_self_identify(int argc __SS_ATTR((unused)),
27                       const char * const *argv __SS_ATTR((unused)),
28                       int sci_idx, void *infop __SS_ATTR((unused)))
29 {
30      register ss_data *info = ss_info(sci_idx);
31      printf("%s version %s\n", info->subsystem_name,
32             info->subsystem_version);
33 }
34
35 /*
36  * ss_subsystem_name -- print name of subsystem
37  */
38 void ss_subsystem_name(int argc __SS_ATTR((unused)),
39                        const char * const *argv __SS_ATTR((unused)),
40                        int sci_idx,
41                        void *infop __SS_ATTR((unused)))
42 {
43      printf("%s\n", ss_info(sci_idx)->subsystem_name);
44 }
45
46 /*
47  * ss_subsystem_version -- print version of subsystem
48  */
49 void ss_subsystem_version(int argc __SS_ATTR((unused)),
50                           const char * const *argv __SS_ATTR((unused)),
51                           int sci_idx,
52                           void *infop __SS_ATTR((unused)))
53 {
54      printf("%s\n", ss_info(sci_idx)->subsystem_version);
55 }
56
57 /*
58  * ss_unimplemented -- routine not implemented (should be
59  * set up as (dont_list,dont_summarize))
60  */
61 void ss_unimplemented(int argc __SS_ATTR((unused)),
62                       const char * const *argv __SS_ATTR((unused)),
63                       int sci_idx, void *infop __SS_ATTR((unused)))
64 {
65      ss_perror(sci_idx, SS_ET_UNIMPLEMENTED, "");
66 }