diff --git a/include/shell.h b/include/shell.h index 8e99bea..38effcc 100644 --- a/include/shell.h +++ b/include/shell.h @@ -15,9 +15,9 @@ typedef struct { int occupied; // 开放寻址必须有的“已占用”标记 } ShellCmdEntry; -static char currentUser[USERNAME_MAX]; -static int cmdCount; -static ShellCmdEntry cmdBucket[CMDSIZE_MAX]; +extern char currentUser[USERNAME_MAX]; +extern int cmdCount; +extern ShellCmdEntry cmdBucket[CMDSIZE_MAX]; int shellInit(char *username); int shellLoop(); diff --git a/src/shell.c b/src/shell.c index 824a973..4dabcdb 100644 --- a/src/shell.c +++ b/src/shell.c @@ -4,7 +4,9 @@ #include #include #include - +char currentUser[USERNAME_MAX]; +int cmdCount; +ShellCmdEntry cmdBucket[CMDSIZE_MAX]; /* 初始化shell,注册命令,传入登录的用户名 */ int shellInit(char *username) { cmdCount = 0;