Lines Matching +full:re +full:-
3 /*-
4 * SPDX-License-Identifier: BSD-2-Clause
31 * functions needed to support gnu-m4 extensions, including a fake freezing
60 * First, -I options, in the order found on the command line.
81 n->name = xstrdup(dirname); in new_path_entry()
82 n->next = 0; in new_path_entry()
94 last->next = n; in addtoincludepath()
115 /* for portability: getenv result is read-only */ in ensure_m4path()
131 for (pe = first; pe; pe = pe->next) { in dopath()
132 snprintf(path, sizeof(path), "%s/%s", pe->name, filename); in dopath()
168 argv[1] = p->defn; in doindir()
170 eval(argv+1, argc-1, p->type, is_traced(n)); in doindir()
181 eval(argv+1, argc-1, macro_builtin_type(p), is_traced(p)); in dobuiltin()
205 #define addconstantstring(s) addchars((s), sizeof(s)-1)
249 exit_regerror(int er, regex_t *re, const char *source) in exit_regerror() argument
254 errlen = regerror(er, re, NULL, 0); in exit_regerror()
257 regerror(er, re, errbuf, errlen); in exit_regerror()
262 * -E flag functionality.
280 add_sub(int n, const char *string, regex_t *re, regmatch_t *pm) in add_sub() argument
282 if (n > (int)re->re_nsub) in add_sub()
286 else if (pm[n].rm_so != -1 && in add_sub()
287 pm[n].rm_eo != -1) { in add_sub()
289 pm[n].rm_eo - pm[n].rm_so); in add_sub()
297 add_replace(const char *string, regex_t *re, const char *replace, regmatch_t *pm) in add_replace() argument
303 add_sub(0, string, re, pm); in add_replace()
314 add_sub(0, string, re, pm); in add_replace()
321 add_sub(*(++p) - '0', string, re, pm); in add_replace()
330 do_subst(const char *string, regex_t *re, const char *source, in do_subst() argument
337 while ((error = regexec(re, string, re->re_nsub+1, pm, flags)) == 0) { in do_subst()
339 if (string[pm[0].rm_eo-1] == '\n') in do_subst()
345 /* NULL length matches are special... We use the `vi-mode' in do_subst()
346 * rule: don't allow a NULL-match at the last match in do_subst()
362 add_replace(string, re, replace, pm); in do_subst()
366 exit_regerror(error, re, source); in do_subst()
371 do_regexp(const char *string, regex_t *re, const char *source, in do_regexp() argument
376 switch(error = regexec(re, string, re->re_nsub+1, pm, 0)) { in do_regexp()
378 add_replace(string, re, replace, pm); in do_regexp()
384 exit_regerror(error, re, source); in do_regexp()
389 do_regexpindex(const char *string, regex_t *re, const char *source, in do_regexpindex() argument
394 switch(error = regexec(re, string, re->re_nsub+1, pm, 0)) { in do_regexpindex()
399 pbnum(-1); in do_regexpindex()
402 exit_regerror(error, re, source); in do_regexpindex()
430 addconstantstring("[_a-zA-Z0-9]"); in twiddle()
433 addconstantstring("[^_a-zA-Z0-9]"); in twiddle()
483 regex_t re; in dopatsubst() local
491 (l > 0 && argv[3][l-1] == '$')) in dopatsubst()
495 error = regcomp(&re, source, mode); in dopatsubst()
497 exit_regerror(error, &re, source); in dopatsubst()
499 pmatch = xreallocarray(NULL, re.re_nsub+1, sizeof(regmatch_t), in dopatsubst()
501 do_subst(argv[2], &re, source, in dopatsubst()
504 regfree(&re); in dopatsubst()
513 regex_t re; in doregexp() local
529 error = regcomp(&re, source, REG_EXTENDED|REG_NEWLINE); in doregexp()
531 exit_regerror(error, &re, source); in doregexp()
533 pmatch = xreallocarray(NULL, re.re_nsub+1, sizeof(regmatch_t), NULL); in doregexp()
535 do_regexpindex(argv[2], &re, source, pmatch); in doregexp()
537 do_regexp(argv[2], &re, source, argv[4], pmatch); in doregexp()
539 regfree(&re); in doregexp()
581 width = -width; in doformat()
619 while ((long)l < width--) in doformat()
624 while ((long)l < width--) in doformat()
644 argv[1] = __DECONST(char *, "-c"); in doesyscmd()
649 if (pipe(p) == -1) in doesyscmd()
652 case -1: in doesyscmd()
663 * pushback-only. */ in doesyscmd()
670 } while (cc > 0 || (cc == -1 && errno == EINTR)); in doesyscmd()
673 while (waitpid(cpid, &status, 0) == -1) { in doesyscmd()