Lines Matching +full:constant +full:- +full:current

2  * Copyright (C) 1984-2025  Mark Nudelman
60 * words, returning each one as a standard null-terminated string.
69 constant char *esc = get_meta_escape(); in init_textlist()
73 tlist->string = skipsp(str); in init_textlist()
74 tlist->endstring = tlist->string + strlen(tlist->string); in init_textlist()
75 for (s = str; s < tlist->endstring; s++) in init_textlist()
81 } else if (esclen > 0 && s + esclen < tlist->endstring && in init_textlist()
85 s += esclen - 1; in init_textlist()
104 public constant char * forw_textlist(struct textlist *tlist, constant char *prev) in forw_textlist()
106 constant char *s; in forw_textlist()
113 s = tlist->string; in forw_textlist()
116 while (s < tlist->endstring && *s == '\0') in forw_textlist()
118 if (s >= tlist->endstring) in forw_textlist()
123 public constant char * back_textlist(struct textlist *tlist, constant char *prev) in back_textlist()
125 constant char *s; in back_textlist()
132 s = tlist->endstring; in back_textlist()
133 else if (prev <= tlist->string) in back_textlist()
136 s = prev - 1; in back_textlist()
138 s--; in back_textlist()
139 if (s <= tlist->string) in back_textlist()
141 while (s[-1] != '\0' && s > tlist->string) in back_textlist()
142 s--; in back_textlist()
149 static void modeline_option(constant char *str, size_t opt_len) in modeline_option()
151 struct mloption { constant char *opt_name; void (*opt_func)(constant char*,size_t); }; in modeline_option()
158 for (opt = options; opt->opt_name != NULL; opt++) in modeline_option()
160 size_t name_len = strlen(opt->opt_name); in modeline_option()
161 if (opt_len > name_len && strncmp(str, opt->opt_name, name_len) == 0) in modeline_option()
163 (*opt->opt_func)(str + name_len, opt_len - name_len); in modeline_option()
173 static size_t modeline_option_len(constant char *str) in modeline_option_len()
176 constant char *s; in modeline_option_len()
190 * Parse colon- or space-separated option settings in a modeline.
192 static void modeline_options(constant char *str, char end_char) in modeline_options()
211 static void check_modeline(constant char *line) in check_modeline()
214 static constant char *pgms[] = { "less:", "vim:", "vi:", "ex:", NULL }; in check_modeline()
215 constant char **pgm; in check_modeline()
218 constant char *pline = line; in check_modeline()
221 constant char *str; in check_modeline()
226 if (pline == line || pline[-1] == ' ') in check_modeline()
250 constant char *line; in check_modelines()
277 kill(pipefd->_pid, SIGINT); in close_pipe()
280 if (status == -1) in close_pipe()
340 * Check for error status from the current altpipe.
352 * Close the current input file.
357 constant char *altfilename; in close_file()
363 * Save the current position so that we can return to in close_file()
395 * Filename == "-" means standard input.
396 * Filename == NULL means just close the current file.
398 public int edit(constant char *filename) in edit()
408 static int edit_error(constant char *filename, constant char *alt_filename, void *altpipe, IFILE if… in edit_error()
418 * Re-open the current file. in edit_error()
423 * Whoops. The "current" ifile is the one we just deleted. in edit_error()
433 * ifile == NULL means just close the current file.
440 constant char *filename; in edit_ifile()
441 constant char *open_filename; in edit_ifile()
474 f = -1; in edit_ifile()
498 if (strcmp(filename, "-") == 0) in edit_ifile()
500 } else if (strcmp(filename, "-") == 0) in edit_ifile()
515 * Ctrl-C to not raise SIGINT. We must undo in edit_ifile()
516 * that side-effect. in edit_ifile()
522 f = -1; in edit_ifile()
526 f = -1; in edit_ifile()
570 error("%s is a terminal (use -f to open it)", &parg); in edit_ifile()
628 /* Remember the i-number and device of the opened file. */ in edit_ifile()
629 if (strcmp(open_filename, "-") != 0) in edit_ifile()
679 * Edit a space-separated list of files.
686 constant char *good_filename; in edit_list()
687 constant char *filename; in edit_list()
689 constant char *gfilename; in edit_list()
730 * Trying to edit the current file; don't reopen it. in edit_list()
761 * Edit the n-th next or previous file in the command line (ifile) list.
773 if (--n < 0) in edit_istep()
813 return (edit_istep(h, n, -1)); in edit_iprev()
818 return edit_istep(curr_ifile, n, -1); in edit_prev()
853 hold_ifile(save_ifile, -1); in unsave_ifile()
905 error("Missing filename (\"less --help\" for help)", NULL_PARG); in edit_stdin()
908 return (edit("-")); in edit_stdin()
933 public void use_logfile(constant char *filename) in use_logfile()
989 logfile = -1; in use_logfile()