]>
git.ipfire.org Git - thirdparty/e2fsprogs.git/blob - lib/ss/list_rqs.c
2 * Copyright 1987, 1988 by MIT Student Information Processing Board
4 * Permission to use, copy, modify, and distribute this software and
5 * its documentation for any purpose is hereby granted, provided that
6 * the names of M.I.T. and the M.I.T. S.I.P.B. not be used in
7 * advertising or publicity pertaining to distribution of the software
8 * without specific, written prior permission. M.I.T. and the
9 * M.I.T. S.I.P.B. make no representations about the suitability of
10 * this software for any purpose. It is provided "as is" without
11 * express or implied warranty.
14 #include "ss_internal.h"
19 typedef void sigret_t
;
21 static char const twentyfive_spaces
[26] =
23 static char const NL
[2] = "\n";
25 void ss_list_requests(int argc
__SS_ATTR((unused
)),
26 const char * const *argv
__SS_ATTR((unused
)),
27 int sci_idx
, void *infop
__SS_ATTR((unused
)))
29 ss_request_entry
*entry
;
30 char const * const *name
;
32 ss_request_table
**table
;
37 sigset_t omask
, igmask
;
38 sigret_t (*func
)(int);
44 sigaddset(&igmask
, SIGINT
);
45 sigprocmask(SIG_BLOCK
, &igmask
, &omask
);
46 func
= signal(SIGINT
, SIG_IGN
);
47 fd
= ss_pager_create();
49 perror("ss_pager_create");
50 (void) signal(SIGINT
, func
);
53 output
= fdopen(fd
, "w");
54 sigprocmask(SIG_SETMASK
, &omask
, (sigset_t
*) 0);
56 fprintf (output
, "Available %s requests:\n\n",
57 ss_info (sci_idx
) -> subsystem_name
);
59 for (table
= ss_info(sci_idx
)->rqt_tables
; *table
; table
++) {
60 entry
= (*table
)->requests
;
61 for (; entry
->command_names
; entry
++) {
64 if (entry
->flags
& SS_OPT_DONT_LIST
)
66 for (name
= entry
->command_names
; *name
; name
++) {
67 int len
= strlen(*name
);
68 strncat(buffer
, *name
, len
);
76 fputs(buffer
, output
);
80 strncat(buffer
, twentyfive_spaces
, 25-spacing
);
81 strcat(buffer
, entry
->info_string
);
83 fputs(buffer
, output
);
90 (void) signal(SIGINT
, func
);