Annotation of src/usr.bin/rcs/co.c, Revision 1.114
1.114 ! tobias 1: /* $OpenBSD: co.c,v 1.113 2010/07/30 21:47:18 ray Exp $ */
1.1 joris 2: /*
3: * Copyright (c) 2005 Joris Vink <joris@openbsd.org>
4: * All rights reserved.
5: *
6: * Redistribution and use in source and binary forms, with or without
7: * modification, are permitted provided that the following conditions
8: * are met:
9: *
10: * 1. Redistributions of source code must retain the above copyright
11: * notice, this list of conditions and the following disclaimer.
12: * 2. The name of the author may not be used to endorse or promote products
13: * derived from this software without specific prior written permission.
14: *
15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
16: * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
17: * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
18: * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21: * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22: * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23: * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25: */
26:
1.105 xsa 27: #include <sys/stat.h>
28:
29: #include <err.h>
30: #include <fcntl.h>
31: #include <stdio.h>
32: #include <stdlib.h>
33: #include <string.h>
34: #include <unistd.h>
1.1 joris 35:
36: #include "rcsprog.h"
1.100 millert 37: #include "diff.h"
1.1 joris 38:
1.70 xsa 39: #define CO_OPTSTRING "d:f::I::k:l::M::p::q::r::s:Tu::Vw::x::z::"
1.38 xsa 40:
1.43 xsa 41: static void checkout_err_nobranch(RCSFILE *, const char *, const char *,
42: const char *, int);
1.100 millert 43: static int checkout_file_has_diffs(RCSFILE *, RCSNUM *, const char *);
1.4 joris 44:
1.1 joris 45: int
46: checkout_main(int argc, char **argv)
47: {
1.106 xsa 48: int fd, i, ch, flags, kflag, ret;
1.78 pat 49: RCSNUM *rev;
1.1 joris 50: RCSFILE *file;
1.94 ray 51: const char *author, *date, *state;
1.45 joris 52: char fpath[MAXPATHLEN];
1.94 ray 53: char *rev_str, *username;
1.37 xsa 54: time_t rcs_mtime = -1;
1.1 joris 55:
1.106 xsa 56: flags = ret = 0;
1.33 xsa 57: kflag = RCS_KWEXP_ERR;
1.1 joris 58: rev = RCS_HEAD_REV;
1.73 ray 59: rev_str = NULL;
1.94 ray 60: author = date = state = NULL;
1.4 joris 61:
1.38 xsa 62: while ((ch = rcs_getopt(argc, argv, CO_OPTSTRING)) != -1) {
1.1 joris 63: switch (ch) {
1.49 joris 64: case 'd':
1.94 ray 65: date = rcs_optarg;
1.49 joris 66: break;
1.18 joris 67: case 'f':
1.73 ray 68: rcs_setrevstr(&rev_str, rcs_optarg);
1.24 niallo 69: flags |= FORCE;
1.18 joris 70: break;
1.65 niallo 71: case 'I':
1.73 ray 72: rcs_setrevstr(&rev_str, rcs_optarg);
1.65 niallo 73: flags |= INTERACTIVE;
74: break;
75:
1.33 xsa 76: case 'k':
77: kflag = rcs_kflag_get(rcs_optarg);
78: if (RCS_KWEXP_INVAL(kflag)) {
1.83 xsa 79: warnx("invalid RCS keyword substitution mode");
1.33 xsa 80: (usage)();
81: exit(1);
82: }
83: break;
1.4 joris 84: case 'l':
1.53 xsa 85: if (flags & CO_UNLOCK) {
1.81 xsa 86: warnx("warning: -u overridden by -l");
1.53 xsa 87: flags &= ~CO_UNLOCK;
88: }
1.73 ray 89: rcs_setrevstr(&rev_str, rcs_optarg);
1.24 niallo 90: flags |= CO_LOCK;
1.26 niallo 91: break;
92: case 'M':
1.73 ray 93: rcs_setrevstr(&rev_str, rcs_optarg);
1.26 niallo 94: flags |= CO_REVDATE;
1.4 joris 95: break;
1.20 joris 96: case 'p':
1.73 ray 97: rcs_setrevstr(&rev_str, rcs_optarg);
1.80 xsa 98: flags |= PIPEOUT;
1.20 joris 99: break;
1.3 joris 100: case 'q':
1.73 ray 101: rcs_setrevstr(&rev_str, rcs_optarg);
1.79 xsa 102: flags |= QUIET;
1.3 joris 103: break;
1.1 joris 104: case 'r':
1.73 ray 105: rcs_setrevstr(&rev_str, rcs_optarg);
1.4 joris 106: break;
1.24 niallo 107: case 's':
1.94 ray 108: state = rcs_optarg;
1.24 niallo 109: flags |= CO_STATE;
1.34 xsa 110: break;
111: case 'T':
112: flags |= PRESERVETIME;
1.24 niallo 113: break;
1.4 joris 114: case 'u':
1.73 ray 115: rcs_setrevstr(&rev_str, rcs_optarg);
1.53 xsa 116: if (flags & CO_LOCK) {
1.81 xsa 117: warnx("warning: -l overridden by -u");
1.53 xsa 118: flags &= ~CO_LOCK;
119: }
1.24 niallo 120: flags |= CO_UNLOCK;
1.1 joris 121: break;
1.7 joris 122: case 'V':
123: printf("%s\n", rcs_version);
124: exit(0);
1.38 xsa 125: case 'w':
1.44 joris 126: /* if no argument, assume current user */
127: if (rcs_optarg == NULL) {
1.48 xsa 128: if ((author = getlogin()) == NULL)
1.84 xsa 129: err(1, "getlogin");
1.94 ray 130: } else
131: author = rcs_optarg;
1.43 xsa 132: flags |= CO_AUTHOR;
1.38 xsa 133: break;
1.30 xsa 134: case 'x':
1.66 ray 135: /* Use blank extension if none given. */
136: rcs_suffixes = rcs_optarg ? rcs_optarg : "";
1.59 joris 137: break;
138: case 'z':
139: timezone_flag = rcs_optarg;
1.30 xsa 140: break;
1.1 joris 141: default:
142: (usage)();
143: exit(1);
144: }
145: }
146:
1.13 joris 147: argc -= rcs_optind;
148: argv += rcs_optind;
1.1 joris 149:
150: if (argc == 0) {
1.81 xsa 151: warnx("no input file");
1.1 joris 152: (usage)();
153: exit (1);
154: }
1.11 deraadt 155:
1.81 xsa 156: if ((username = getlogin()) == NULL)
1.84 xsa 157: err(1, "getlogin");
1.104 otto 158:
1.1 joris 159: for (i = 0; i < argc; i++) {
1.92 ray 160: fd = rcs_choosefile(argv[i], fpath, sizeof(fpath));
161: if (fd < 0) {
1.98 niallo 162: warn("%s", fpath);
1.106 xsa 163: ret = 1;
1.1 joris 164: continue;
1.92 ray 165: }
1.104 otto 166: rcs_strip_suffix(argv[i]);
1.1 joris 167:
1.79 xsa 168: if (!(flags & QUIET))
1.90 xsa 169: (void)fprintf(stderr, "%s --> %s\n", fpath,
1.80 xsa 170: (flags & PIPEOUT) ? "standard output" : argv[i]);
1.35 xsa 171:
172: if ((flags & CO_LOCK) && (kflag & RCS_KWEXP_VAL)) {
1.81 xsa 173: warnx("%s: cannot combine -kv and -l", fpath);
1.86 joris 174: (void)close(fd);
1.35 xsa 175: continue;
176: }
1.21 niallo 177:
1.86 joris 178: if ((file = rcs_open(fpath, fd,
179: RCS_RDWR|RCS_PARSE_FULLY)) == NULL)
1.1 joris 180: continue;
181:
1.37 xsa 182: if (flags & PRESERVETIME)
1.86 joris 183: rcs_mtime = rcs_get_mtime(file);
1.37 xsa 184:
1.72 xsa 185: rcs_kwexp_set(file, kflag);
1.37 xsa 186:
1.75 ray 187: if (rev_str != NULL) {
188: if ((rev = rcs_getrevnum(rev_str, file)) == NULL)
1.84 xsa 189: errx(1, "invalid revision: %s", rev_str);
1.75 ray 190: } else {
1.76 joris 191: /* no revisions in RCS file, generate empty 0.0 */
192: if (file->rf_ndelta == 0) {
193: rev = rcsnum_parse("0.0");
194: if (rev == NULL)
1.84 xsa 195: errx(1, "failed to generate rev 0.0");
1.76 joris 196: } else {
197: rev = rcsnum_alloc();
198: rcsnum_cpy(file->rf_head, rev, 0);
199: }
1.73 ray 200: }
1.17 joris 201:
1.106 xsa 202: if (checkout_rev(file, rev, argv[i], flags,
203: username, author, state, date) < 0) {
1.73 ray 204: rcs_close(file);
205: rcsnum_free(rev);
1.106 xsa 206: ret = 1;
1.73 ray 207: continue;
1.8 niallo 208: }
1.58 xsa 209:
1.79 xsa 210: if (!(flags & QUIET))
1.90 xsa 211: (void)fprintf(stderr, "done\n");
1.17 joris 212:
1.73 ray 213: rcsnum_free(rev);
1.37 xsa 214:
1.86 joris 215: rcs_write(file);
1.37 xsa 216: if (flags & PRESERVETIME)
1.86 joris 217: rcs_set_mtime(file, rcs_mtime);
218: rcs_close(file);
1.1 joris 219: }
220:
1.106 xsa 221: return (ret);
1.1 joris 222: }
223:
224: void
225: checkout_usage(void)
226: {
1.11 deraadt 227: fprintf(stderr,
1.42 xsa 228: "usage: co [-TV] [-ddate] [-f[rev]] [-I[rev]] [-kmode] [-l[rev]]\n"
229: " [-M[rev]] [-p[rev]] [-q[rev]] [-r[rev]] [-sstate]\n"
230: " [-u[rev]] [-w[user]] [-xsuffixes] [-ztz] file ...\n");
1.1 joris 231: }
1.14 niallo 232:
233: /*
234: * Checkout revision <rev> from RCSFILE <file>, writing it to the path <dst>
1.88 ray 235: * Currently recognised <flags> are CO_LOCK, CO_UNLOCK and CO_REVDATE.
1.14 niallo 236: *
1.49 joris 237: * Looks up revision based upon <lockname>, <author>, <state> and <date>
1.44 joris 238: *
1.14 niallo 239: * Returns 0 on success, -1 on failure.
240: */
241: int
1.24 niallo 242: checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
1.49 joris 243: const char *lockname, const char *author, const char *state,
244: const char *date)
1.14 niallo 245: {
1.44 joris 246: BUF *bp;
1.69 joris 247: u_int i;
1.86 joris 248: int fd, lcount;
1.108 xsa 249: char buf[RCS_REV_BUFSZ];
1.99 millert 250: mode_t mode = DEFFILEMODE;
1.18 joris 251: struct stat st;
1.44 joris 252: struct rcs_delta *rdp;
253: struct rcs_lock *lkp;
1.97 ray 254: char *fdate;
1.100 millert 255: const char *fstatus;
1.49 joris 256: time_t rcsdate, givendate;
1.69 joris 257: RCSNUM *rev;
1.49 joris 258:
259: rcsdate = givendate = -1;
1.113 ray 260: if (date != NULL && (givendate = date_parse(date)) == -1) {
261: warnx("invalid date: %s", date);
262: return -1;
263: }
1.14 niallo 264:
1.90 xsa 265: if (file->rf_ndelta == 0 && !(flags & QUIET))
266: (void)fprintf(stderr,
267: "no revisions present; generating empty revision 0.0\n");
1.76 joris 268:
1.69 joris 269: /* XXX rcsnum_cmp()
270: * Check out the latest revision if <frev> is greater than HEAD
271: */
1.76 joris 272: if (file->rf_ndelta != 0) {
273: for (i = 0; i < file->rf_head->rn_len; i++) {
274: if (file->rf_head->rn_id[i] < frev->rn_id[i]) {
275: frev = file->rf_head;
276: break;
277: }
1.69 joris 278: }
279: }
1.15 niallo 280:
1.44 joris 281: lcount = 0;
282: TAILQ_FOREACH(lkp, &(file->rf_locks), rl_list) {
283: if (!strcmp(lkp->rl_name, lockname))
284: lcount++;
285: }
286:
287: /*
288: * If the user didn't specify any revision, we cycle through
289: * revisions to lookup the first one that matches what he specified.
290: *
291: * If we cannot find one, we return an error.
292: */
293: rdp = NULL;
1.77 deraadt 294: if (file->rf_ndelta != 0 && frev == file->rf_head) {
1.44 joris 295: if (lcount > 1) {
1.81 xsa 296: warnx("multiple revisions locked by %s; "
1.44 joris 297: "please specify one", lockname);
298: return (-1);
299: }
300:
301: TAILQ_FOREACH(rdp, &file->rf_delta, rd_list) {
1.49 joris 302: if (date != NULL) {
303: fdate = asctime(&rdp->rd_date);
1.113 ray 304: if ((rcsdate = date_parse(fdate)) == -1) {
305: warnx("invalid date: %s", fdate);
306: return -1;
307: }
1.49 joris 308: if (givendate <= rcsdate)
309: continue;
310: }
311:
1.77 deraadt 312: if (author != NULL &&
313: strcmp(rdp->rd_author, author))
1.44 joris 314: continue;
1.49 joris 315:
1.77 deraadt 316: if (state != NULL &&
317: strcmp(rdp->rd_state, state))
1.44 joris 318: continue;
319:
320: frev = rdp->rd_num;
321: break;
322: }
1.76 joris 323: } else if (file->rf_ndelta != 0) {
1.44 joris 324: rdp = rcs_findrev(file, frev);
325: }
326:
1.77 deraadt 327: if (file->rf_ndelta != 0 && rdp == NULL) {
1.49 joris 328: checkout_err_nobranch(file, author, date, state, flags);
1.44 joris 329: return (-1);
330: }
331:
1.76 joris 332: if (file->rf_ndelta == 0)
333: rev = frev;
334: else
335: rev = rdp->rd_num;
336:
1.69 joris 337: rcsnum_tostr(rev, buf, sizeof(buf));
1.15 niallo 338:
1.77 deraadt 339: if (file->rf_ndelta != 0 && rdp->rd_locker != NULL) {
1.44 joris 340: if (strcmp(lockname, rdp->rd_locker)) {
1.97 ray 341: warnx("Revision %s is already locked by %s; %s",
342: buf, rdp->rd_locker,
343: (flags & CO_UNLOCK) ? "use co -r or rcs -u" : "");
1.44 joris 344: return (-1);
345: }
346: }
347:
1.79 xsa 348: if (!(flags & QUIET) && !(flags & NEWFILE) &&
1.77 deraadt 349: !(flags & CO_REVERT) && file->rf_ndelta != 0)
1.91 xsa 350: (void)fprintf(stderr, "revision %s", buf);
1.74 deraadt 351:
1.76 joris 352: if (file->rf_ndelta != 0) {
353: if ((bp = rcs_getrev(file, rev)) == NULL) {
1.81 xsa 354: warnx("cannot find revision `%s'", buf);
1.76 joris 355: return (-1);
356: }
357: } else {
1.112 ray 358: bp = buf_alloc(1);
1.14 niallo 359: }
1.69 joris 360:
1.55 niallo 361: /*
362: * Do keyword expansion if required.
363: */
1.76 joris 364: if (file->rf_ndelta != 0)
365: bp = rcs_kwexp_buf(bp, file, rev);
1.67 niallo 366: /*
367: * File inherits permissions from its ,v file
368: */
1.93 ray 369: if (file->rf_fd != -1) {
370: if (fstat(file->rf_fd, &st) == -1)
1.86 joris 371: err(1, "%s", file->rf_path);
1.102 xsa 372: file->rf_mode = mode = st.st_mode;
1.103 niallo 373: } else {
374: mode = file->rf_mode;
1.86 joris 375: }
1.67 niallo 376:
1.24 niallo 377: if (flags & CO_LOCK) {
1.76 joris 378: if (file->rf_ndelta != 0) {
1.77 deraadt 379: if (lockname != NULL &&
380: rcs_lock_add(file, lockname, rev) < 0) {
1.76 joris 381: if (rcs_errno != RCS_ERR_DUPENT)
382: return (-1);
383: }
1.14 niallo 384: }
1.18 joris 385:
1.99 millert 386: /* File should only be writable by owner. */
387: mode &= ~(S_IWGRP|S_IWOTH);
1.67 niallo 388: mode |= S_IWUSR;
1.76 joris 389:
390: if (file->rf_ndelta != 0) {
1.79 xsa 391: if (!(flags & QUIET) && !(flags & NEWFILE) &&
1.77 deraadt 392: !(flags & CO_REVERT))
1.91 xsa 393: (void)fprintf(stderr, " (locked)");
1.76 joris 394: }
1.24 niallo 395: } else if (flags & CO_UNLOCK) {
1.76 joris 396: if (file->rf_ndelta != 0) {
397: if (rcs_lock_remove(file, lockname, rev) < 0) {
398: if (rcs_errno != RCS_ERR_NOENT)
399: return (-1);
400: }
1.46 joris 401: }
1.18 joris 402:
1.67 niallo 403: /* Strip all write bits from mode */
1.99 millert 404: mode &= ~(S_IWUSR|S_IWGRP|S_IWOTH);
1.76 joris 405:
406: if (file->rf_ndelta != 0) {
1.79 xsa 407: if (!(flags & QUIET) && !(flags & NEWFILE) &&
1.77 deraadt 408: !(flags & CO_REVERT))
1.91 xsa 409: (void)fprintf(stderr, " (unlocked)");
1.76 joris 410: }
1.18 joris 411: }
1.107 xsa 412:
413: /* If strict locking is disabled, make file writable by owner. */
414: if (rcs_lock_getmode(file) == RCS_LOCK_LOOSE)
415: mode |= S_IWUSR;
1.56 xsa 416:
1.90 xsa 417: if (file->rf_ndelta == 0 && !(flags & QUIET) &&
1.76 joris 418: ((flags & CO_LOCK) || (flags & CO_UNLOCK))) {
1.91 xsa 419: (void)fprintf(stderr, "no revisions, so nothing can be %s\n",
1.76 joris 420: (flags & CO_LOCK) ? "locked" : "unlocked");
421: } else if (file->rf_ndelta != 0) {
1.88 ray 422: /* XXX - Not a good way to detect if a newline is needed. */
423: if (!(flags & QUIET) && !(flags & NEWFILE) &&
424: !(flags & CO_REVERT))
1.90 xsa 425: (void)fprintf(stderr, "\n");
1.76 joris 426: }
1.18 joris 427:
1.44 joris 428: if (flags & CO_LOCK) {
1.71 niallo 429: if (rcs_errno != RCS_ERR_DUPENT)
430: lcount++;
1.79 xsa 431: if (!(flags & QUIET) && lcount > 1 && !(flags & CO_REVERT))
1.81 xsa 432: warnx("%s: warning: You now have %d locks.",
1.63 xsa 433: file->rf_path, lcount);
1.44 joris 434: }
435:
1.100 millert 436: if ((flags & (PIPEOUT|FORCE)) == 0 && stat(dst, &st) != -1) {
1.68 ray 437: /*
1.100 millert 438: * Prompt the user if the file is writable or the file is
439: * not writable but is different from the RCS head version.
440: * This is different from GNU which will silently overwrite
441: * the file regardless of its contents so long as it is
442: * read-only.
1.68 ray 443: */
444: if (st.st_mode & (S_IWUSR|S_IWGRP|S_IWOTH))
1.100 millert 445: fstatus = "writable";
446: else if (checkout_file_has_diffs(file, frev, dst) != D_SAME)
447: fstatus = "modified";
448: else
449: fstatus = NULL;
450: if (fstatus) {
451: (void)fprintf(stderr, "%s %s exists%s; ", fstatus, dst,
452: (getuid() == st.st_uid) ? "" :
453: ", and you do not own it");
454: (void)fprintf(stderr, "remove it? [ny](n): ");
455: if (rcs_yesno('n') == 'n') {
456: if (!(flags & QUIET) && isatty(STDIN_FILENO))
457: warnx("%s %s exists; checkout aborted",
458: fstatus, dst);
459: else
460: warnx("checkout aborted");
461: return (-1);
462: }
1.18 joris 463: }
1.14 niallo 464: }
1.17 joris 465:
1.96 ray 466: if (flags & PIPEOUT)
1.111 ray 467: buf_write_fd(bp, STDOUT_FILENO);
1.96 ray 468: else {
1.86 joris 469: (void)unlink(dst);
470:
471: if ((fd = open(dst, O_WRONLY|O_CREAT|O_TRUNC, mode)) < 0)
472: err(1, "%s", dst);
473:
1.111 ray 474: if (buf_write_fd(bp, fd) < 0) {
1.81 xsa 475: warnx("failed to write revision to file");
1.111 ray 476: buf_free(bp);
1.86 joris 477: (void)close(fd);
1.20 joris 478: return (-1);
479: }
1.86 joris 480:
481: if (fchmod(fd, mode) == -1)
482: warn("%s", dst);
483:
1.24 niallo 484: if (flags & CO_REVDATE) {
485: struct timeval tv[2];
1.36 xsa 486: memset(&tv, 0, sizeof(tv));
1.69 joris 487: tv[0].tv_sec = (long)rcs_rev_getdate(file, rev);
1.24 niallo 488: tv[1].tv_sec = tv[0].tv_sec;
1.86 joris 489: if (futimes(fd, (const struct timeval *)&tv) < 0)
1.81 xsa 490: warn("utimes");
1.24 niallo 491: }
1.86 joris 492:
493: (void)close(fd);
1.14 niallo 494: }
1.96 ray 495:
1.111 ray 496: buf_free(bp);
1.17 joris 497:
1.14 niallo 498: return (0);
1.43 xsa 499: }
500:
501: /*
502: * checkout_err_nobranch()
503: *
504: * XXX - should handle the dates too.
505: */
506: static void
507: checkout_err_nobranch(RCSFILE *file, const char *author, const char *date,
508: const char *state, int flags)
509: {
510: if (!(flags & CO_AUTHOR))
511: author = NULL;
512: if (!(flags & CO_STATE))
513: state = NULL;
514:
1.81 xsa 515: warnx("%s: No revision on branch has%s%s%s%s%s%s.",
1.43 xsa 516: file->rf_path,
517: date ? " a date before " : "",
518: date ? date : "",
519: author ? " and author " + (date ? 0:4 ) : "",
520: author ? author : "",
521: state ? " and state " + (date || author ? 0:4) : "",
522: state ? state : "");
1.100 millert 523: }
524:
525: /*
526: * checkout_file_has_diffs()
527: *
528: * Check for diffs between the working file and its current revision.
1.109 ray 529: * Same return values as diffreg()
1.100 millert 530: */
531: static int
532: checkout_file_has_diffs(RCSFILE *rfp, RCSNUM *frev, const char *dst)
533: {
534: char *tempfile;
535: BUF *bp;
536: int ret;
537:
538: tempfile = NULL;
539:
540: if ((bp = rcs_getrev(rfp, frev)) == NULL) {
541: warnx("failed to load revision");
1.101 millert 542: return (D_ERROR);
543: }
544: if ((bp = rcs_kwexp_buf(bp, rfp, frev)) == NULL) {
545: warnx("failed to expand tags");
1.100 millert 546: return (D_ERROR);
547: }
548:
549: (void)xasprintf(&tempfile, "%s/diff.XXXXXXXXXX", rcs_tmpdir);
1.111 ray 550: buf_write_stmp(bp, tempfile);
551: buf_empty(bp);
1.100 millert 552:
553: diff_format = D_RCSDIFF;
1.110 ray 554: ret = diffreg(dst, tempfile, bp, D_FORCEASCII);
1.100 millert 555:
1.111 ray 556: buf_free(bp);
1.100 millert 557: unlink(tempfile);
558: xfree(tempfile);
559:
560: return (ret);
1.24 niallo 561: }