version 1.40, 2013/07/11 12:39:31 |
version 1.41, 2013/11/26 13:19:07 |
|
|
else |
else |
indent++; |
indent++; |
} |
} |
for (t = s; isdigit(*t) || *t == ','; t++) |
for (t = s; isdigit((unsigned char)*t) || *t == ','; t++) |
; |
; |
this_is_a_command = (isdigit(*s) && |
this_is_a_command = (isdigit((unsigned char)*s) && |
(*t == 'd' || *t == 'c' || *t == 'a')); |
(*t == 'd' || *t == 'c' || *t == 'a')); |
if (first_command_line < 0L && this_is_a_command) { |
if (first_command_line < 0L && this_is_a_command) { |
first_command_line = this_line; |
first_command_line = this_line; |
|
|
names[INDEX_FILE].path = fetchname(s + 6, |
names[INDEX_FILE].path = fetchname(s + 6, |
&names[INDEX_FILE].exists, strippath); |
&names[INDEX_FILE].exists, strippath); |
else if (strnEQ(s, "Prereq:", 7)) { |
else if (strnEQ(s, "Prereq:", 7)) { |
for (t = s + 7; isspace(*t); t++) |
for (t = s + 7; isspace((unsigned char)*t); t++) |
; |
; |
revision = savestr(t); |
revision = savestr(t); |
for (t = revision; *t && !isspace(*t); t++) |
for (t = revision; |
|
*t && !isspace((unsigned char)*t); t++) |
; |
; |
*t = '\0'; |
*t = '\0'; |
if (*revision == '\0') { |
if (*revision == '\0') { |
|
|
p_end--; |
p_end--; |
return false; |
return false; |
} |
} |
for (s = buf; *s && !isdigit(*s); s++) |
for (s = buf; |
|
*s && !isdigit((unsigned char)*s); s++) |
; |
; |
if (!*s) |
if (!*s) |
malformed(); |
malformed(); |
if (strnEQ(s, "0,0", 3)) |
if (strnEQ(s, "0,0", 3)) |
memmove(s, s + 2, strlen(s + 2) + 1); |
memmove(s, s + 2, strlen(s + 2) + 1); |
p_first = (LINENUM) atol(s); |
p_first = (LINENUM) atol(s); |
while (isdigit(*s)) |
while (isdigit((unsigned char)*s)) |
s++; |
s++; |
if (*s == ',') { |
if (*s == ',') { |
for (; *s && !isdigit(*s); s++) |
for (; *s && !isdigit((unsigned char)*s); s++) |
; |
; |
if (!*s) |
if (!*s) |
malformed(); |
malformed(); |
|
|
return false; |
return false; |
} |
} |
p_char[p_end] = '='; |
p_char[p_end] = '='; |
for (s = buf; *s && !isdigit(*s); s++) |
for (s = buf; |
|
*s && !isdigit((unsigned char)*s); s++) |
; |
; |
if (!*s) |
if (!*s) |
malformed(); |
malformed(); |
p_newfirst = (LINENUM) atol(s); |
p_newfirst = (LINENUM) atol(s); |
while (isdigit(*s)) |
while (isdigit((unsigned char)*s)) |
s++; |
s++; |
if (*s == ',') { |
if (*s == ',') { |
for (; *s && !isdigit(*s); s++) |
for (; *s && !isdigit((unsigned char)*s); s++) |
; |
; |
if (!*s) |
if (!*s) |
malformed(); |
malformed(); |
|
|
change_line: |
change_line: |
if (buf[1] == '\n' && canonicalize) |
if (buf[1] == '\n' && canonicalize) |
strlcpy(buf + 1, " \n", sizeof buf - 1); |
strlcpy(buf + 1, " \n", sizeof buf - 1); |
if (!isspace(buf[1]) && buf[1] != '>' && |
if (!isspace((unsigned char)buf[1]) && |
buf[1] != '<' && |
buf[1] != '>' && buf[1] != '<' && |
repl_beginning && repl_could_be_missing) { |
repl_beginning && repl_could_be_missing) { |
repl_missing = true; |
repl_missing = true; |
goto hunk_done; |
goto hunk_done; |
|
|
} |
} |
break; |
break; |
case ' ': |
case ' ': |
if (!isspace(buf[1]) && |
if (!isspace((unsigned char)buf[1]) && |
repl_beginning && repl_could_be_missing) { |
repl_beginning && repl_could_be_missing) { |
repl_missing = true; |
repl_missing = true; |
goto hunk_done; |
goto hunk_done; |
|
|
if (!*s) |
if (!*s) |
malformed(); |
malformed(); |
p_first = (LINENUM) atol(s); |
p_first = (LINENUM) atol(s); |
while (isdigit(*s)) |
while (isdigit((unsigned char)*s)) |
s++; |
s++; |
if (*s == ',') { |
if (*s == ',') { |
p_ptrn_lines = (LINENUM) atol(++s); |
p_ptrn_lines = (LINENUM) atol(++s); |
while (isdigit(*s)) |
while (isdigit((unsigned char)*s)) |
s++; |
s++; |
} else |
} else |
p_ptrn_lines = 1; |
p_ptrn_lines = 1; |
|
|
if (*s != '+' || !*++s) |
if (*s != '+' || !*++s) |
malformed(); |
malformed(); |
p_newfirst = (LINENUM) atol(s); |
p_newfirst = (LINENUM) atol(s); |
while (isdigit(*s)) |
while (isdigit((unsigned char)*s)) |
s++; |
s++; |
if (*s == ',') { |
if (*s == ',') { |
p_repl_lines = (LINENUM) atol(++s); |
p_repl_lines = (LINENUM) atol(++s); |
while (isdigit(*s)) |
while (isdigit((unsigned char)*s)) |
s++; |
s++; |
} else |
} else |
p_repl_lines = 1; |
p_repl_lines = 1; |
|
|
p_context = 0; |
p_context = 0; |
ret = pgets(buf, sizeof buf, pfp); |
ret = pgets(buf, sizeof buf, pfp); |
p_input_line++; |
p_input_line++; |
if (ret == NULL || !isdigit(*buf)) { |
if (ret == NULL || !isdigit((unsigned char)*buf)) { |
next_intuit_at(line_beginning, p_input_line); |
next_intuit_at(line_beginning, p_input_line); |
return false; |
return false; |
} |
} |
p_first = (LINENUM) atol(buf); |
p_first = (LINENUM) atol(buf); |
for (s = buf; isdigit(*s); s++) |
for (s = buf; isdigit((unsigned char)*s); s++) |
; |
; |
if (*s == ',') { |
if (*s == ',') { |
p_ptrn_lines = (LINENUM) atol(++s) - p_first + 1; |
p_ptrn_lines = (LINENUM) atol(++s) - p_first + 1; |
while (isdigit(*s)) |
while (isdigit((unsigned char)*s)) |
s++; |
s++; |
} else |
} else |
p_ptrn_lines = (*s != 'a'); |
p_ptrn_lines = (*s != 'a'); |
|
|
if (hunk_type == 'a') |
if (hunk_type == 'a') |
p_first++; /* do append rather than insert */ |
p_first++; /* do append rather than insert */ |
min = (LINENUM) atol(++s); |
min = (LINENUM) atol(++s); |
for (; isdigit(*s); s++) |
for (; isdigit((unsigned char)*s); s++) |
; |
; |
if (*s == ',') |
if (*s == ',') |
max = (LINENUM) atol(++s); |
max = (LINENUM) atol(++s); |
|
|
break; |
break; |
} |
} |
p_input_line++; |
p_input_line++; |
for (t = buf; isdigit(*t) || *t == ','; t++) |
for (t = buf; isdigit((unsigned char)*t) || *t == ','; t++) |
; |
; |
/* POSIX defines allowed commands as {a,c,d,i,s} */ |
/* POSIX defines allowed commands as {a,c,d,i,s} */ |
if (isdigit(*buf) && (*t == 'a' || *t == 'c' || *t == 'd' || |
if (isdigit((unsigned char)*buf) && |
*t == 'i' || *t == 's')) { |
(*t == 'a' || *t == 'c' || *t == 'd' || *t == 'i' || *t == 's')) { |
if (pipefp != NULL) |
if (pipefp != NULL) |
fputs(buf, pipefp); |
fputs(buf, pipefp); |
if (*t != 'd') { |
if (*t != 'd') { |