+ (void) wmove(ms->ms_screen, y + ms->ms_input_y, x);
+ (void) wrefresh(ms->ms_screen);
+}
+
+/* Parse buf into a list of words, which will be placed in strings specified by
+ argv. Space for these strings must have already been allocated.
+ Only the first n characters of each word will be copied */
+Parse_words(buf, argv, n)
+char *buf;
+char *argv[];
+int n;
+{
+ char *start, *end; /* For sausage machine */
+ int argc;
+
+ start = buf;
+ for(argc = 0; argc < MAX_ARGC; argc++) {
+ while(isspace(*start)) start++; /* Kill whitespace */
+ if(*start == '\0') break; /* Nothing left */
+ /* Now find the end of the word */
+ for(end = start; *end != '\0' && !isspace(*end); end++);
+ (void) strncpy(argv[argc], start, MIN(end - start, n)); /* Copy it */
+ argv[argc][MIN(end - start, n-1)] = '\0'; /* Terminate */
+ start = end;
+ }
+ return(argc);
+}
+
+/* This is the internal form of Find_command, which recursively searches
+ for a menu_line with command command in the specified menu */
+/* It will search to a maximum depth of d */
+struct menu_line *find_command_from(c, m, d)
+char *c;
+struct menu *m;
+int d;
+{
+ int line;
+ struct menu_line *maybe;
+
+ if(d < 0) return((struct menu_line *) 0); /* Too deep! */
+ for(line = 0; line < m->m_length; line++) {
+ if(!strcmp(c, m->m_lines[line].ml_command)) {
+ return(&m->m_lines[line]);
+ } else if(m->m_lines[line].ml_submenu != NULLMENU
+ && (maybe =
+ find_command_from(c, m->m_lines[line].ml_submenu, d-1))
+ != (struct menu_line *) 0) {
+ return(maybe);
+ }
+ }
+ /* If we got to here, nothing works */
+ return((struct menu_line *) 0);