Rev 625 | Rev 640 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 625 | Rev 635 | ||
|---|---|---|---|
| Line 115... | Line 115... | ||
| 115 | spinlock_lock(&cmd->lock); |
115 | spinlock_lock(&cmd->lock); |
| 116 | } else { |
116 | } else { |
| 117 | spinlock_lock(&cmd->lock); |
117 | spinlock_lock(&cmd->lock); |
| 118 | spinlock_lock(&hlp->lock); |
118 | spinlock_lock(&hlp->lock); |
| 119 | } |
119 | } |
| 120 | 120 | if ((strncmp(hlp->name, |
|
| 121 | if ((strncmp(hlp->name, cmd->name, strlen(cmd->name)) == 0)) { |
121 | cmd->name, max(strlen(cmd->name), |
| - | 122 | strlen(hlp->name))) == 0)) { |
|
| 122 | /* The command is already there. */ |
123 | /* The command is already there. */ |
| 123 | spinlock_unlock(&hlp->lock); |
124 | spinlock_unlock(&hlp->lock); |
| 124 | spinlock_unlock(&cmd->lock); |
125 | spinlock_unlock(&cmd->lock); |
| 125 | spinlock_unlock(&cmd_lock); |
126 | spinlock_unlock(&cmd_lock); |
| 126 | return 0; |
127 | return 0; |
| Line 137... | Line 138... | ||
| 137 | 138 | ||
| 138 | spinlock_unlock(&cmd_lock); |
139 | spinlock_unlock(&cmd_lock); |
| 139 | return 1; |
140 | return 1; |
| 140 | } |
141 | } |
| 141 | 142 | ||
| - | 143 | /** Print count times a character */ |
|
| 142 | static void rdln_print_c(char ch, int count) |
144 | static void rdln_print_c(char ch, int count) |
| 143 | { |
145 | { |
| 144 | int i; |
146 | int i; |
| 145 | for (i=0;i<count;i++) |
147 | for (i=0;i<count;i++) |
| 146 | putchar(ch); |
148 | putchar(ch); |
| 147 | } |
149 | } |
| 148 | 150 | ||
| - | 151 | /** Insert character to string */ |
|
| 149 | static void insert_char(char *str, char ch, int pos) |
152 | static void insert_char(char *str, char ch, int pos) |
| 150 | { |
153 | { |
| 151 | int i; |
154 | int i; |
| 152 | 155 | ||
| 153 | for (i=strlen(str);i > pos; i--) |
156 | for (i=strlen(str);i > pos; i--) |
| 154 | str[i] = str[i-1]; |
157 | str[i] = str[i-1]; |
| 155 | str[pos] = ch; |
158 | str[pos] = ch; |
| 156 | } |
159 | } |
| 157 | 160 | ||
| - | 161 | /** Try to find a command begenning with prefix */ |
|
| 158 | static const char * cmdtab_search_one(const char *name,link_t **startpos) |
162 | static const char * cmdtab_search_one(const char *name,link_t **startpos) |
| 159 | { |
163 | { |
| 160 | int namelen = strlen(name); |
164 | int namelen = strlen(name); |
| 161 | const char *curname; |
165 | const char *curname; |
| 162 | 166 | ||
| Line 479... | Line 483... | ||
| 479 | cmd_info_t *hlp; |
483 | cmd_info_t *hlp; |
| 480 | 484 | ||
| 481 | hlp = list_get_instance(cur, cmd_info_t, link); |
485 | hlp = list_get_instance(cur, cmd_info_t, link); |
| 482 | spinlock_lock(&hlp->lock); |
486 | spinlock_lock(&hlp->lock); |
| 483 | 487 | ||
| 484 | if (strncmp(hlp->name, &cmdline[start], strlen(hlp->name)) == 0) { |
488 | if (strncmp(hlp->name, &cmdline[start], max(strlen(hlp->name), |
| - | 489 | end-start+1)) == 0) { |
|
| 485 | cmd = hlp; |
490 | cmd = hlp; |
| 486 | break; |
491 | break; |
| 487 | } |
492 | } |
| 488 | 493 | ||
| 489 | spinlock_unlock(&hlp->lock); |
494 | spinlock_unlock(&hlp->lock); |