@@ -27,6 +27,7 @@
*/
#define CMD_FLAG_ONESHOT (1<<31)
#define CMD_FLAG_FOREIGN_OK (1<<30) /* command not restricted to XFS */
+#define CMD_FLAG_LIBRARY (1<<29) /* command provided by libxcmd */
typedef int (*cfunc_t)(int argc, char **argv);
typedef void (*helpfunc_t)(void);
@@ -109,9 +109,6 @@ static int
init_check_command(
const cmdinfo_t *ct)
{
- if (ct->flags & CMD_FLAG_ONESHOT)
- return 1;
-
if (!file && !(ct->flags & CMD_NOFILE_OK)) {
fprintf(stderr, _("no files are open, try 'help open'\n"));
return 0;
@@ -48,6 +48,10 @@ static int
check_command(
const cmdinfo_t *ci)
{
+ /* always run internal library supplied commands */
+ if (ci->flags & CMD_FLAG_LIBRARY)
+ return 1;
+
if (check_func)
return check_func(ci);
return 1;
@@ -89,7 +89,7 @@ help_init(void)
help_cmd.cfunc = help_f;
help_cmd.argmin = 0;
help_cmd.argmax = 1;
- help_cmd.flags = CMD_FLAG_ONESHOT | CMD_ALL_FSTYPES;
+ help_cmd.flags = CMD_FLAG_ONESHOT | CMD_FLAG_LIBRARY;
help_cmd.args = _("[command]");
help_cmd.oneline = _("help for one or all commands");
@@ -39,7 +39,7 @@ quit_init(void)
quit_cmd.cfunc = quit_f;
quit_cmd.argmin = -1;
quit_cmd.argmax = -1;
- quit_cmd.flags = CMD_FLAG_ONESHOT | CMD_ALL_FSTYPES;
+ quit_cmd.flags = CMD_FLAG_ONESHOT | CMD_FLAG_LIBRARY;
quit_cmd.oneline = _("exit the program");
add_command(&quit_cmd);
@@ -117,10 +117,6 @@ init_check_command(
if (!fs_path)
return 1;
- /* Always run commands that are valid for all fs types. */
- if (ct->flags & CMD_ALL_FSTYPES)
- return 1;
-
/* If it's an XFS filesystem, always run the command. */
if (!(fs_path->fs_flags & FS_FOREIGN))
return 1;