]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - libxcmd/help.c
2 * Copyright (c) 2003-2005 Silicon Graphics, Inc.
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.
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.
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
19 #include "platform_defs.h"
21 #include "../quota/init.h"
23 static cmdinfo_t help_cmd
;
24 static void help_onecmd(const char *cmd
, const cmdinfo_t
*ct
);
25 static void help_oneline(const char *cmd
, const cmdinfo_t
*ct
);
32 for (ct
= cmdtab
; ct
< &cmdtab
[ncmds
]; ct
++)
33 help_oneline(ct
->name
, ct
);
34 printf(_("\nUse 'help commandname' for extended help.\n"));
48 ct
= find_command(argv
[1]);
50 printf(_("command %s not found\n"), argv
[1]);
53 help_onecmd(argv
[1], ct
);
62 help_oneline(cmd
, ct
);
75 printf("%s ", ct
->name
);
77 printf("(or %s) ", ct
->altname
);
80 printf("%s ", ct
->args
);
81 printf("-- %s\n", ct
->oneline
);
87 help_cmd
.name
= "help";
88 help_cmd
.altname
= "?";
89 help_cmd
.cfunc
= help_f
;
92 help_cmd
.flags
= CMD_FLAG_ONESHOT
| CMD_FLAG_LIBRARY
;
93 help_cmd
.args
= _("[command]");
94 help_cmd
.oneline
= _("help for one or all commands");
96 add_command(&help_cmd
);