• Home
  • Raw
  • Download

Lines Matching refs:command

262   struct sedcmd *command;  in sed_line()  local
285 command = TT.restart ? ((struct sedcmd *)TT.restart)-1 : (void *)TT.pattern; in sed_line()
288 while (command) { in sed_line()
289 char *str, c = command->c; in sed_line()
292 if (*command->lmatch || *command->rmatch) { in sed_line()
297 if (command->hit) { in sed_line()
298 if (!(lm = command->lmatch[1])) { in sed_line()
299 if (!command->rmatch[1]) command->hit = 0; in sed_line()
301 void *rm = get_regex(command, command->rmatch[1]); in sed_line()
306 } else if (lm > 0 && lm < TT.count) command->hit = 0; in sed_line()
310 if (!(lm = *command->lmatch)) { in sed_line()
311 void *rm = get_regex(command, *command->rmatch); in sed_line()
313 if (line && !regexec0(rm, line, len, 0, 0, 0)) command->hit++; in sed_line()
314 } else if (lm == TT.count || (lm == -1 && !pline)) command->hit++; in sed_line()
316 if (!command->lmatch[1] && !command->rmatch[1]) miss = 1; in sed_line()
320 lm = !(command->hit ^ command->not); in sed_line()
323 if (miss || command->lmatch[1] == TT.count) command->hit = 0; in sed_line()
331 command = command->next; in sed_line()
332 if (command->c == '{') curly++; in sed_line()
333 if (command->c == '}') curly--; in sed_line()
336 command = command->next; in sed_line()
343 command = command->next; in sed_line()
351 if (command->arg1) a->str = command->arg1+(char *)command; in sed_line()
359 if (!command->arg1) break; in sed_line()
360 str = command->arg1+(char *)command; in sed_line()
361 for (command = (void *)TT.pattern; command; command = command->next) in sed_line()
362 if (command->c == ':' && !strcmp(command->arg1+(char *)command, str)) in sed_line()
364 if (!command) error_exit("no :%s", str); in sed_line()
367 str = command->arg1+(char *)command; in sed_line()
368 if (!command->hit) emit(str, strlen(str), 1); in sed_line()
390 command = (void *)TT.pattern; in sed_line()
412 str = command->arg1+(char *)command; in sed_line()
440 TT.restart = command->next+1; in sed_line()
447 TT.restart = command->next+1; in sed_line()
469 char *rline = line, *new = command->arg2 + (char *)command, *swap, *rswap; in sed_line()
471 regex_t *reg = get_regex(command, command->arg1); in sed_line()
488 off = command->sflags>>3; in sed_line()
551 if (!(command->sflags & 2)) break; in sed_line()
556 if (command->sflags & 4) emit(line, len, eol); in sed_line()
559 if (command->w) goto writenow; in sed_line()
571 name = command->w + (char *)command; in sed_line()
578 perror_exit("w '%s'", command->arg1+(char *)command); in sed_line()
591 char *from, *to = (char *)command; in sed_line()
594 from = to+command->arg1; in sed_line()
595 to += command->arg2; in sed_line()
606 command = command->next; in sed_line()
639 struct sedcmd *command; in do_sed_file() local
644 for (command = (void *)TT.pattern; command; command = command->next) in do_sed_file()
645 command->hit = 0; in do_sed_file()
731 struct sedcmd *command = (void *)TT.pattern; in parse_pattern() local
742 if (command && command->prev->hit) { in parse_pattern()
745 command = dlist_pop(&TT.pattern); in parse_pattern()
746 c = command->c; in parse_pattern()
747 reg = (char *)command; in parse_pattern()
748 reg += command->arg1 + strlen(reg + command->arg1); in parse_pattern()
753 if (command->hit < 256) goto resume_s; in parse_pattern()
759 command = 0; in parse_pattern()
761 if (command) dlist_add_nomalloc(&TT.pattern, (void *)command); in parse_pattern()
776 command = (void *)toybuf; in parse_pattern()
784 if (isdigit(*line)) command->lmatch[i] = strtol(line, &line, 0); in parse_pattern()
786 command->lmatch[i] = -1; in parse_pattern()
792 if (!*s) command->rmatch[i] = 0; in parse_pattern()
795 command->rmatch[i] = reg-toybuf; in parse_pattern()
806 command->not = 1; in parse_pattern()
811 c = command->c = *(line++); in parse_pattern()
816 command = xmemdup(toybuf, reg-toybuf); in parse_pattern()
817 reg = (reg-toybuf) + (char *)command; in parse_pattern()
833 command->arg2 = reg - (char *)command; in parse_pattern()
838 command->arg1 = reg-(char *)command; in parse_pattern()
839 command->hit = delim; in parse_pattern()
844 while (*end != command->hit) { in parse_pattern()
855 reg = extend_string((void *)&command, line, reg-(char *)command,end-line); in parse_pattern()
858 if (*line == command->hit) command->hit = 0; in parse_pattern()
867 i = command->arg1; in parse_pattern()
868 command->arg1 = command->arg2; in parse_pattern()
869 command->arg2 = i; in parse_pattern()
877 if (0 <= (l = stridx("igp", *line))) command->sflags |= 1<<l; in parse_pattern()
878 else if (!(command->sflags>>3) && 0<(l = strtol(line, &line, 10))) { in parse_pattern()
879 command->sflags |= l << 3; in parse_pattern()
886 if (!*TT.remember) command->arg1 = 0; in parse_pattern()
887 else xregcomp((void *)(command->arg1 + (char *)command), TT.remember, in parse_pattern()
888 (REG_EXTENDED*!!FLAG(r))|((command->sflags&1)*REG_ICASE)); in parse_pattern()
913 command->w = reg - (char *)command; in parse_pattern()
914 command = xrealloc(command, command->w+(cc-line)+6); in parse_pattern()
915 reg = command->w + (char *)command; in parse_pattern()
931 command->arg1 = reg-(char *)command; in parse_pattern()
933 reg = extend_string((void *)&command, s, reg-(char *)command, len); in parse_pattern()
935 command->arg2 = reg-(char *)command; in parse_pattern()
938 reg = extend_string((void *)&command, s, reg-(char*)command, len); in parse_pattern()
949 command->hit = 0; in parse_pattern()
955 else if (!command->arg1) break; in parse_pattern()
961 if (!command->arg1) command->arg1 = reg - (char*)command; in parse_pattern()
962 else if (*(command->arg1+(char *)command)) *(reg++) = '\n'; in parse_pattern()
964 command->arg1 = 0; in parse_pattern()
967 reg = extend_string((void *)&command, line, reg - (char *)command, end); in parse_pattern()
983 command->hit = 256; in parse_pattern()