Subversion Repositories HelenOS

Rev

Rev 3346 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3346 Rev 3809
Line 51... Line 51...
51
#include "cmds.h"
51
#include "cmds.h"
52
#include "module_aliases.h"
52
#include "module_aliases.h"
53
 
53
 
54
extern volatile unsigned int cli_interactive;
54
extern volatile unsigned int cli_interactive;
55
 
55
 
56
int module_is_restricted(int pos)
-
 
57
{
-
 
58
    /* Restriction Levels:
-
 
59
     * -1 -> Available only in interactive mode
-
 
60
     *  0 -> Available in any mode
-
 
61
     *  1 -> Available only in non-interactive mode */
-
 
62
 
-
 
63
    module_t *mod = modules;
-
 
64
    mod += pos;
-
 
65
    /* We're interactive, and the module is OK to run */
-
 
66
    if (cli_interactive && mod->restricted <= 0)
-
 
67
        return 0;
-
 
68
    /* We're not interactive, and the module is OK to run */
-
 
69
    if (!cli_interactive && mod->restricted >= 0)
-
 
70
        return 0;
-
 
71
 
-
 
72
    /* Anything else is just a big fat no :) */
-
 
73
    return 1;
-
 
74
}
-
 
75
 
-
 
76
/* Checks if an entry function matching command exists in modules[], if so
56
/* Checks if an entry function matching command exists in modules[], if so
77
 * its position in the array is returned */
57
 * its position in the array is returned */
78
int is_module(const char *command)
58
int is_module(const char *command)
79
{
59
{
80
    module_t *mod;
60
    module_t *mod;