| 901 | } |
| 902 | |
| 903 | static void msh_opt_complete(char *opts_str, struct msh_cmd_opt *cmd_opt) |
| 904 | { |
| 905 | struct msh_cmd_opt *opt = cmd_opt; |
| 906 | const char *name_ptr = RT_NULL; |
| 907 | int min_length = 0, length, opts_str_len; |
| 908 | |
| 909 | opts_str_len = strlen(opts_str); |
| 910 | |
| 911 | for (opt = cmd_opt; opt->id; opt++) |
| 912 | { |
| 913 | if (!strncmp(opt->name, opts_str, opts_str_len)) |
| 914 | { |
| 915 | if (min_length == 0) |
| 916 | { |
| 917 | /* set name_ptr */ |
| 918 | name_ptr = opt->name; |
| 919 | /* set initial length */ |
| 920 | min_length = strlen(name_ptr); |
| 921 | } |
| 922 | |
| 923 | length = str_common(name_ptr, opt->name); |
| 924 | if (length < min_length) |
| 925 | { |
| 926 | min_length = length; |
| 927 | } |
| 928 | |
| 929 | rt_kprintf("%s\n", opt->name); |
| 930 | } |
| 931 | } |
| 932 | rt_kprintf("\n"); |
| 933 | |
| 934 | if (name_ptr != NULL) |
| 935 | { |
| 936 | strncpy(opts_str, name_ptr, min_length); |
| 937 | } |
| 938 | } |
| 939 | |
| 940 | static void msh_opt_help(msh_cmd_opt_t *cmd_opt) |
| 941 | { |
no test coverage detected