/* * Prompt for which line number we want to go to, then execute gotoline() * with that number as its argument. * * Make sure the bounds are within the file. * * Bound to M-G */ int setline(int f, int n) { char setl[6]; int l; (void)mlreplyt("Go to line: ", setl, 6, 10); l = atoi(setl); /* XXX: This sucks! */ if (l < 1) l = 1; else if (l > curwp->w_bufp->b_lines) l = curwp->w_bufp->b_lines; gotoline(f, l); return (TRUE); }
/* * Read a pattern. Stash it in the external variable "pat". The "pat" is not * updated if the user types in an empty line. If the user typed an empty * line, and there is no old pattern, it is an error. Display the old pattern, * in the style of Jeff Lomicka. There is some do-it-yourself control * expansion. change to using <ESC> to delemit the end-of-pattern to allow * <NL>s in the search string */ int readpattern (char *prompt) { char tpat[NPAT + 20]; int s; strncpy (tpat, prompt, NPAT-12); /* copy prompt to output string */ strncat (tpat, " [", 3); /* build new prompt string */ expandp (&pat[0], &tpat[strlen (tpat)], NPAT / 2); /* add old pattern */ strncat (tpat, "]<ESC>: ", 9); s = mlreplyt (tpat, tpat, NPAT, 27); /* Read pattern */ if (s == TRUE) /* Specified */ strncpy (pat, tpat, NPAT); else if (s == FALSE && pat[0] != 0) /* CR, but old one */ s = TRUE; return (s); }