diff options
author | 2006-11-10 08:32:37 +0000 | |
---|---|---|
committer | 2006-11-10 08:32:37 +0000 | |
commit | 1d57a156ae849da85408edb5c40e5d2b7c3f23ea (patch) | |
tree | dff03c3fcebc1db6e7a9853b42da23fd9803109d /usr.bin/cvs/diff3.c | |
parent | Not quite working ld.so support for sh (diff) | |
download | wireguard-openbsd-1d57a156ae849da85408edb5c40e5d2b7c3f23ea.tar.xz wireguard-openbsd-1d57a156ae849da85408edb5c40e5d2b7c3f23ea.zip |
sync with usr.bin/rcs/diff3.c
Diffstat (limited to 'usr.bin/cvs/diff3.c')
-rw-r--r-- | usr.bin/cvs/diff3.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/usr.bin/cvs/diff3.c b/usr.bin/cvs/diff3.c index 125588b35da..e6df284e4ad 100644 --- a/usr.bin/cvs/diff3.c +++ b/usr.bin/cvs/diff3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff3.c,v 1.28 2006/11/09 11:14:56 xsa Exp $ */ +/* $OpenBSD: diff3.c,v 1.29 2006/11/10 08:32:37 xsa Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -72,7 +72,7 @@ static const char copyright[] = #ifndef lint static const char rcsid[] = - "$OpenBSD: diff3.c,v 1.28 2006/11/09 11:14:56 xsa Exp $"; + "$OpenBSD: diff3.c,v 1.29 2006/11/10 08:32:37 xsa Exp $"; #endif /* not lint */ #include "includes.h" @@ -291,11 +291,13 @@ diff3_internal(int argc, char **argv, const char *fmark, const char *rmark) if (argc < 5) return (-1); - strlcpy(f1mark, "<<<<<<< ", sizeof(f1mark)); - strlcat(f1mark, fmark, sizeof(f1mark)); + i = snprintf(f1mark, sizeof(f1mark), "<<<<<<< %s", fmark); + if (i < 0 ||i >= (int)sizeof(f1mark)) + fatal("diff3_internal: truncation"); - strlcpy(f3mark, ">>>>>>> ", sizeof(f3mark)); - strlcat(f3mark, rmark, sizeof(f3mark)); + i = snprintf(f3mark, sizeof(f3mark), ">>>>>>> %s", rmark); + if (i < 0 ||i >= (int)sizeof(f3mark)) + fatal("diff3_internal: truncation"); increase(); m = readin(argv[0], &d13); @@ -315,7 +317,7 @@ int ed_patch_lines(struct cvs_lines *dlines, struct cvs_lines *plines) { char op, *ep; - struct cvs_line *sort, *lp, *dlp, *ndlp; + struct cvs_line *sort, *lp, *dlp, *ndlp, *insert_after; int start, end, i, lineno; dlp = TAILQ_FIRST(&(dlines->l_lines)); @@ -368,12 +370,13 @@ ed_patch_lines(struct cvs_lines *dlines, struct cvs_lines *plines) if (op == 'c') { + insert_after = TAILQ_PREV(dlp, cvs_tqh, l_list); for (i = 0; i <= (end - start); i++) { ndlp = TAILQ_NEXT(dlp, l_list); TAILQ_REMOVE(&(dlines->l_lines), dlp, l_list); dlp = ndlp; } - dlp = TAILQ_PREV(dlp, cvs_tqh, l_list); + dlp = insert_after; } if (op == 'a' || op == 'c') { |