diff options
author | Mattias Andrée <maandree@kth.se> | 2024-01-09 22:04:24 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2024-01-09 22:04:24 +0100 |
commit | ae850b1ac755f471beac4dbfef4654fe3fbaaae9 (patch) | |
tree | 319e7f7f1b99cd1ee75e100f0a29b0f7c827ccea /libpatch_format_patch.c | |
download | libpatch-ae850b1ac755f471beac4dbfef4654fe3fbaaae9.tar.gz libpatch-ae850b1ac755f471beac4dbfef4654fe3fbaaae9.tar.bz2 libpatch-ae850b1ac755f471beac4dbfef4654fe3fbaaae9.tar.xz |
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libpatch_format_patch.c')
-rw-r--r-- | libpatch_format_patch.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libpatch_format_patch.c b/libpatch_format_patch.c new file mode 100644 index 0000000..22df906 --- /dev/null +++ b/libpatch_format_patch.c @@ -0,0 +1,27 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + + +int +libpatch_format_patch(struct libpatch_diff2_printer *printer, struct libpatch_diff2 *diff, size_t difflen, + const struct libpatch_file *file1, const struct libpatch_file *file2, enum libpatch_style style) +{ + switch (style) { + case LIBPATCH_STYLE_NORMAL: + return libpatch_format_normal_patch(printer, diff, difflen, file1, file2); + case LIBPATCH_STYLE_COPIED: + return libpatch_format_copied_patch(printer, diff, difflen, file1, file2); + case LIBPATCH_STYLE_UNIFIED: + return libpatch_format_unified_patch(printer, diff, difflen, file1, file2); + case LIBPATCH_STYLE_ED: + return libpatch_format_ed_patch(printer, diff, difflen, file1, file2); + case LIBPATCH_STYLE_ED_ALTERNATIVE: + return libpatch_format_ed_alternative_patch(printer, diff, difflen, file1, file2); + case LIBPATCH_STYLE_RCS: + return libpatch_format_rcs_patch(printer, diff, difflen, file1, file2); + default: + case LIBPATCH_STYLE_GARBAGE: + errno = EINVAL; + return -1; + } +} |