File diff-context-function-width.patch of Package diffutils
---
src/context.c | 3 ++-
src/diff.c | 9 +++++++++
src/diff.h | 2 ++
3 files changed, 13 insertions(+), 1 deletion(-)
--- a/src/context.c
+++ b/src/context.c
@@ -150,10 +150,11 @@ static void
print_context_function (FILE *out, char const *function)
{
int i, j;
+ int limit = context_function_width > 0 ? context_function_width : 40;
putc (' ', out);
for (i = 0; c_isspace ((unsigned char) function[i]) && function[i] != '\n'; i++)
continue;
- for (j = i; j < i + 40 && function[j] != '\n'; j++)
+ for (j = i; j < i + limit && function[j] != '\n'; j++)
continue;
while (i < j && c_isspace ((unsigned char) function[j - 1]))
j--;
--- a/src/diff.c
+++ b/src/diff.c
@@ -304,6 +304,15 @@ main (int argc, char **argv)
presume_output_tty = false;
xstdopen ();
+ {
+ char const *t = getenv("DIFF_CFW");
+ if (t) {
+ context_function_width = strtoumax (t, NULL, 10);
+ if (context_function_width < 0)
+ try_help ("invalid context function width '%s'", t);
+ }
+ }
+
/* Decode the options. */
while ((c = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)
--- a/src/diff.h
+++ b/src/diff.h
@@ -230,6 +230,8 @@ XTERN bool minimal;
/* The strftime format to use for time strings. */
XTERN char const *time_format;
+
+XTERN int context_function_width;
/* The result of comparison is an "edit script": a chain of 'struct change'.
Each 'struct change' represents one place where some lines are deleted