I need to patch libidn2 on Solaris. libidn2 was fetched from GNU's website with wget. Its not provided by Sun and its not in source control.
The library does not use glibc, and it does not have the function error (int status, int errnum, const char *format, ...). I made a copy of the original source file and I have a diff with a similar function:
solaris:libidn2-0.16$ diff -u src/idn2.c.bu src/idn2.c --- src/idn2.c.bu 2017-03-29 00:20:08.621934160 -0400 +++ src/idn2.c 2017-03-29 01:25:12.488402745 -0400 @@ -31,7 +31,9 @@ #include <unistr.h> /* Gnulib headers. */ +#ifndef __sun__ #include "error.h" +#endif #include "gettext.h" #define _(String) dgettext (PACKAGE, String) #include "progname.h" @@ -48,6 +50,18 @@ year. */ "Copyright %s %d Simon Josefsson."; +#if defined(__sun__) +static void +error (int status, int errnum, const char *format, ...) +{ + va_list args; + va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); + exit(status); +} +#endif + static void usage (int status) { I've been reading through the diff(1) and patch(1) man pages, but I'm not quite getting what needs to be done. I don't believe I've found a discussion of the task (maybe I am not seeing the forest through the trees).
My question is, how can I turn this into a free standing patch? That is, how can I turn it into something to apply after a fresh download and unpack of libidn2?