Home | History | Annotate | Download | only in ota

Lines Matching refs:line

30 // Return nonzero if the tag should be added to this line.
31 int should_tag(const char *line, const char *propname) {
32 const char *prop = strstr(line, propname);
37 for (ptr = line; ptr < prop && isspace(*ptr); ++ptr) ;
38 if (ptr != prop) return 0; // Must be at the beginning of the line
44 // Remove existing tags from the line, return the following number (if any)
45 int remove_tag(char *line, const char *tag) {
46 char *pos = strstr(line, tag);
55 // Write line to output with the tag added, adding a number (if >0)
56 void write_tagged(FILE *out, const char *line, const char *tag, int number) {
57 const char *end = line + strlen(line);
58 while (end > line && isspace(end[-1])) --end;
60 fprintf(out, "%.*s%s%d%s", end - line, line, tag, number, end);
62 fprintf(out, "%.*s%s%s", end - line, line, tag, end);
109 char line[4096];
110 while (fgets(line, sizeof(line), input)) {
111 if (!should_tag(line, propname)) {
112 fputs(line, output); // Pass through unmodified
115 int number = remove_tag(line, tag);
117 fputs(line, output); // Remove the tag but don't re-add it
119 write_tagged(output, line, tag, number + do_number);