aboutsummaryrefslogtreecommitdiffstats
path: root/libpatch_style_requires_text.c
blob: 631f9fb0085950bd9563008154e6c415d76943d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* See LICENSE file for copyright and license details. */
#include "common.h"


int
libpatch_style_requires_text(enum libpatch_style style, int multifile)
{
	switch (style) {
	case LIBPATCH_STYLE_NORMAL:
	case LIBPATCH_STYLE_COPIED:
	case LIBPATCH_STYLE_UNIFIED:
		return 0;
	case LIBPATCH_STYLE_ED:
	case LIBPATCH_STYLE_ED_ALTERNATIVE:
		return LIBPATCH_STYLE_REQUIRES_LF_TERMINATION;
	case LIBPATCH_STYLE_RCS:
		return multifile ? LIBPATCH_STYLE_REQUIRES_LF_TERMINATION : 0;
	default:
		errno = EINVAL;
		return -1;
	}
}