cvs/rcs.
OK xsa zinovik
-/* $OpenBSD: add.c,v 1.108 2010/04/04 17:11:11 zinovik Exp $ */
+/* $OpenBSD: add.c,v 1.109 2010/07/23 21:46:04 ray Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
if (getcwd(pwd, sizeof(pwd)) == NULL)
fatal("Can't get working directory");
- buf = cvs_buf_alloc(1024);
+ buf = buf_alloc(1024);
cvs_trigger_loginfo_header(buf, repo);
- cvs_buf_puts(buf, "Log Message:\nDirectory ");
- cvs_buf_puts(buf, current_cvsroot->cr_dir);
- cvs_buf_putc(buf, '/');
- cvs_buf_puts(buf, repo);
- cvs_buf_puts(buf, " added to the repository\n");
+ buf_puts(buf, "Log Message:\nDirectory ");
+ buf_puts(buf, current_cvsroot->cr_dir);
+ buf_putc(buf, '/');
+ buf_puts(buf, repo);
+ buf_puts(buf, " added to the repository\n");
- cvs_buf_putc(buf, '\0');
+ buf_putc(buf, '\0');
- loginfo = cvs_buf_release(buf);
+ loginfo = buf_release(buf);
}
void
if ((rdp = rcs_findrev(cf->file_rcs, cf->file_rcs->rf_head)) == NULL)
fatal("cvs_add_tobranch: cannot find newly added revision");
- bp = cvs_buf_alloc(1);
+ bp = buf_alloc(1);
if (rcs_deltatext_set(cf->file_rcs,
cf->file_rcs->rf_head, bp) == -1)
-/* $OpenBSD: annotate.c,v 1.60 2008/06/14 04:34:08 tobias Exp $ */
+/* $OpenBSD: annotate.c,v 1.61 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2007 Tobias Stoeckmann <tobias@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
switch (ch) {
case 'D':
dateflag = optarg;
- cvs_specified_date = cvs_date_parse(dateflag);
+ cvs_specified_date = date_parse(dateflag);
break;
case 'f':
force_head = 1;
int i;
char date[10], rnum[13], *p;
RCSNUM *bnum, *rev;
- struct cvs_line *line;
- struct cvs_line **alines;
+ struct rcs_line *line;
+ struct rcs_line **alines;
cvs_log(LP_TRACE, "cvs_annotate_local(%s)", cf->file_path);
-/* $OpenBSD: buf.c,v 1.75 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: buf.c,v 1.76 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
b->cb_size += len; \
} while (0);
-struct cvs_buf {
+struct buf {
u_char *cb_buf;
size_t cb_size;
size_t cb_len;
};
BUF *
-cvs_buf_alloc(size_t len)
+buf_alloc(size_t len)
{
BUF *b;
b = xmalloc(sizeof(*b));
+ /* Postpone creation of zero-sized buffers */
if (len > 0)
b->cb_buf = xcalloc(1, len);
else
}
BUF *
-cvs_buf_load(const char *path)
+buf_load(const char *path)
{
int fd;
BUF *bp;
if ((fd = open(path, O_RDONLY, 0600)) == -1)
- fatal("cvs_buf_load: failed to load '%s' : %s", path,
+ fatal("buf_load: failed to load '%s' : %s", path,
strerror(errno));
- bp = cvs_buf_load_fd(fd);
+ bp = buf_load_fd(fd);
(void)close(fd);
return (bp);
}
BUF *
-cvs_buf_load_fd(int fd)
+buf_load_fd(int fd)
{
struct stat st;
BUF *buf;
if (fstat(fd, &st) == -1)
- fatal("cvs_buf_load_fd: fstat: %s", strerror(errno));
+ fatal("buf_load_fd: fstat: %s", strerror(errno));
if (lseek(fd, 0, SEEK_SET) == -1)
- fatal("cvs_buf_load_fd: lseek: %s", strerror(errno));
+ fatal("buf_load_fd: lseek: %s", strerror(errno));
if (st.st_size > SIZE_MAX)
- fatal("cvs_buf_load_fd: file size too big");
- buf = cvs_buf_alloc(st.st_size);
+ fatal("buf_load_fd: file size too big");
+ buf = buf_alloc(st.st_size);
if (atomicio(read, fd, buf->cb_buf, buf->cb_size) != buf->cb_size)
- fatal("cvs_buf_load_fd: read: %s", strerror(errno));
+ fatal("buf_load_fd: read: %s", strerror(errno));
buf->cb_len = buf->cb_size;
return (buf);
}
void
-cvs_buf_free(BUF *b)
+buf_free(BUF *b)
{
if (b->cb_buf != NULL)
xfree(b->cb_buf);
}
u_char *
-cvs_buf_release(BUF *b)
+buf_release(BUF *b)
{
u_char *tmp;
}
void
-cvs_buf_putc(BUF *b, int c)
+buf_putc(BUF *b, int c)
{
u_char *bp;
}
void
-cvs_buf_puts(BUF *b, const char *str)
+buf_puts(BUF *b, const char *str)
{
- cvs_buf_append(b, str, strlen(str));
+ buf_append(b, str, strlen(str));
}
void
-cvs_buf_append(BUF *b, const void *data, size_t len)
+buf_append(BUF *b, const void *data, size_t len)
{
size_t left;
u_char *bp, *bep;
}
size_t
-cvs_buf_len(BUF *b)
+buf_len(BUF *b)
{
return (b->cb_len);
}
int
-cvs_buf_write_fd(BUF *b, int fd)
+buf_write_fd(BUF *b, int fd)
{
if (atomicio(vwrite, fd, b->cb_buf, b->cb_len) != b->cb_len)
return (-1);
}
int
-cvs_buf_write(BUF *b, const char *path, mode_t mode)
+buf_write(BUF *b, const char *path, mode_t mode)
{
int fd;
open:
fatal("open: `%s': %s", path, strerror(errno));
}
- if (cvs_buf_write_fd(b, fd) == -1) {
+ if (buf_write_fd(b, fd) == -1) {
(void)unlink(path);
- fatal("cvs_buf_write: cvs_buf_write_fd: `%s'", path);
+ fatal("buf_write: buf_write_fd: `%s'", path);
}
if (fchmod(fd, mode) < 0)
}
int
-cvs_buf_write_stmp(BUF *b, char *template, struct timeval *tv)
+buf_write_stmp(BUF *b, char *template, struct timeval *tv)
{
int fd;
if ((fd = mkstemp(template)) == -1)
fatal("mkstemp: `%s': %s", template, strerror(errno));
- if (cvs_buf_write_fd(b, fd) == -1) {
+ if (buf_write_fd(b, fd) == -1) {
(void)unlink(template);
- fatal("cvs_buf_write_stmp: cvs_buf_write_fd: `%s'", template);
+ fatal("buf_write_stmp: buf_write_fd: `%s'", template);
}
if (tv != NULL) {
if (futimes(fd, tv) == -1)
- fatal("cvs_buf_write_stmp: futimes failed");
+ fatal("buf_write_stmp: futimes failed");
}
worklist_add(template, &temp_files);
if (lseek(fd, 0, SEEK_SET) < 0)
- fatal("cvs_buf_write_stmp: lseek: %s", strerror(errno));
+ fatal("buf_write_stmp: lseek: %s", strerror(errno));
return (fd);
}
u_char *
-cvs_buf_get(BUF *bp)
+buf_get(BUF *bp)
{
return (bp->cb_buf);
}
int
-cvs_buf_differ(const BUF *b1, const BUF *b2)
+buf_differ(const BUF *b1, const BUF *b2)
{
if (b1->cb_len != b2->cb_len)
return (1);
-/* $OpenBSD: buf.h,v 1.26 2009/03/25 21:19:20 joris Exp $ */
+/* $OpenBSD: buf.h,v 1.27 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
#include <sys/types.h>
-typedef struct cvs_buf BUF;
+typedef struct buf BUF;
-BUF *cvs_buf_alloc(size_t);
-BUF *cvs_buf_load(const char *);
-BUF *cvs_buf_load_fd(int);
-void cvs_buf_free(BUF *);
-u_char *cvs_buf_release(BUF *);
-u_char *cvs_buf_get(BUF *);
-void cvs_buf_append(BUF *, const void *, size_t);
-void cvs_buf_putc(BUF *, int);
-void cvs_buf_puts(BUF *, const char *);
-size_t cvs_buf_len(BUF *);
-int cvs_buf_write_fd(BUF *, int);
-int cvs_buf_write(BUF *, const char *, mode_t);
-int cvs_buf_differ(const BUF *, const BUF *);
-int cvs_buf_write_stmp(BUF *, char *, struct timeval *);
+BUF *buf_alloc(size_t);
+BUF *buf_load(const char *);
+BUF *buf_load_fd(int);
+void buf_free(BUF *);
+u_char *buf_release(BUF *);
+u_char *buf_get(BUF *);
+void buf_append(BUF *, const void *, size_t);
+void buf_putc(BUF *, int);
+void buf_puts(BUF *, const char *);
+size_t buf_len(BUF *);
+int buf_write_fd(BUF *, int);
+int buf_write(BUF *, const char *, mode_t);
+int buf_differ(const BUF *, const BUF *);
+int buf_write_stmp(BUF *, char *, struct timeval *);
#endif /* BUF_H */
-/* $OpenBSD: checkout.c,v 1.165 2009/06/21 20:23:01 sthen Exp $ */
+/* $OpenBSD: checkout.c,v 1.166 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
exit(0);
case 'D':
dateflag = optarg;
- cvs_specified_date = cvs_date_parse(dateflag);
+ cvs_specified_date = date_parse(dateflag);
reset_tag = 0;
break;
case 'd':
-/* $OpenBSD: client.c,v 1.121 2009/04/04 11:29:57 joris Exp $ */
+/* $OpenBSD: client.c,v 1.122 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
int i, first;
first = 0;
- bp = cvs_buf_alloc(512);
+ bp = buf_alloc(512);
for (i = 0; cvs_responses[i].supported != -1; i++) {
if (cvs_responses[i].hdlr == NULL)
continue;
if (first != 0)
- cvs_buf_putc(bp, ' ');
+ buf_putc(bp, ' ');
else
first++;
- cvs_buf_puts(bp, cvs_responses[i].name);
+ buf_puts(bp, cvs_responses[i].name);
}
- cvs_buf_putc(bp, '\0');
- d = cvs_buf_release(bp);
+ buf_putc(bp, '\0');
+ d = buf_release(bp);
return (d);
}
-/* $OpenBSD: commit.c,v 1.149 2009/06/07 08:39:13 ray Exp $ */
+/* $OpenBSD: commit.c,v 1.150 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
if (getcwd(pwd, sizeof(pwd)) == NULL)
fatal("Can't get working directory");
- buf = cvs_buf_alloc(1024);
+ buf = buf_alloc(1024);
cvs_trigger_loginfo_header(buf, repo);
if (!RB_EMPTY(&files_added)) {
- cvs_buf_puts(buf, "Added Files:");
+ buf_puts(buf, "Added Files:");
RB_FOREACH(cf, cvs_flisthead, &files_added) {
- cvs_buf_putc(buf, '\n');
- cvs_buf_putc(buf, '\t');
- cvs_buf_puts(buf, cf->file_path);
+ buf_putc(buf, '\n');
+ buf_putc(buf, '\t');
+ buf_puts(buf, cf->file_path);
}
- cvs_buf_putc(buf, '\n');
+ buf_putc(buf, '\n');
}
if (!RB_EMPTY(&files_modified)) {
- cvs_buf_puts(buf, "Modified Files:");
+ buf_puts(buf, "Modified Files:");
RB_FOREACH(cf, cvs_flisthead, &files_modified) {
- cvs_buf_putc(buf, '\n');
- cvs_buf_putc(buf, '\t');
- cvs_buf_puts(buf, cf->file_path);
+ buf_putc(buf, '\n');
+ buf_putc(buf, '\t');
+ buf_puts(buf, cf->file_path);
}
- cvs_buf_putc(buf, '\n');
+ buf_putc(buf, '\n');
}
if (!RB_EMPTY(&files_removed)) {
- cvs_buf_puts(buf, "Removed Files:");
+ buf_puts(buf, "Removed Files:");
RB_FOREACH(cf, cvs_flisthead, &files_removed) {
- cvs_buf_putc(buf, '\n');
- cvs_buf_putc(buf, '\t');
- cvs_buf_puts(buf, cf->file_path);
+ buf_putc(buf, '\n');
+ buf_putc(buf, '\t');
+ buf_puts(buf, cf->file_path);
}
- cvs_buf_putc(buf, '\n');
+ buf_putc(buf, '\n');
}
- cvs_buf_puts(buf, "Log Message:\n");
+ buf_puts(buf, "Log Message:\n");
- cvs_buf_puts(buf, logmsg);
+ buf_puts(buf, logmsg);
- cvs_buf_putc(buf, '\n');
- cvs_buf_putc(buf, '\0');
+ buf_putc(buf, '\n');
+ buf_putc(buf, '\0');
- loginfo = cvs_buf_release(buf);
+ loginfo = buf_release(buf);
}
void
} else if (onbranch == 1) {
b = commit_diff(cf, crev, 1);
} else {
- b = cvs_buf_load_fd(cf->fd);
+ b = buf_load_fd(cf->fd);
}
if (isnew == 0 && onbranch == 0) {
if (cf->file_status == FILE_MODIFIED ||
cf->file_status == FILE_ADDED) {
- b = cvs_buf_load_fd(cf->fd);
- fd1 = cvs_buf_write_stmp(b, p1, NULL);
- cvs_buf_free(b);
+ b = buf_load_fd(cf->fd);
+ fd1 = buf_write_stmp(b, p1, NULL);
+ buf_free(b);
} else {
fd1 = rcs_rev_write_stmp(cf->file_rcs, rev, p1, 0);
}
(void)xasprintf(&p2, "%s/diff2.XXXXXXXXXX", cvs_tmpdir);
fd2 = rcs_rev_write_stmp(cf->file_rcs, rev, p2, RCS_KWEXP_NONE);
- b = cvs_buf_alloc(128);
+ b = buf_alloc(128);
diff_format = D_RCSDIFF;
if ((fd = open(desc_path, O_RDONLY)) == -1)
return;
- bp = cvs_buf_load_fd(fd);
- cvs_buf_putc(bp, '\0');
- desc = cvs_buf_release(bp);
+ bp = buf_load_fd(fd);
+ buf_putc(bp, '\0');
+ desc = buf_release(bp);
rcs_desc_set(cf->file_rcs, desc);
-/* $OpenBSD: cvs.h,v 1.177 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: cvs.h,v 1.178 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
void cvs_cleanup(void);
/* date.y */
-time_t cvs_date_parse(const char *);
+time_t date_parse(const char *);
/* entries.c */
struct cvs_ent *cvs_ent_parse(const char *);
%{
-/* $OpenBSD: date.y,v 1.19 2010/07/23 09:11:10 ray Exp $ */
+/* $OpenBSD: date.y,v 1.20 2010/07/23 21:46:05 ray Exp $ */
/*
** Originally written by Steven M. Bellovin <smb@research.att.com> while
}
/*
- * cvs_date_parse()
+ * date_parse()
*
* Returns the number of seconds since the Epoch corresponding to the date.
*/
time_t
-cvs_date_parse(const char *p)
+date_parse(const char *p)
{
struct tm gmt, tm;
time_t Start, tod, nowtime, tz;
if (time(&nowtime) == -1 || !gmtime_r(&nowtime, &gmt) ||
!localtime_r(&nowtime, &tm))
- fatal("cvs_date_parse failed");
+ fatal("date_parse failed");
tz = difftm(&gmt, &tm) / 60;
(void)printf("Enter date, or blank line to exit.\n\t> ");
(void)fflush(stdout);
while (fgets(buff, sizeof(buff), stdin) && buff[0]) {
- d = cvs_date_parse(buff);
+ d = date_parse(buff);
if (d == -1)
(void)printf("Bad format - couldn't convert.\n");
else
-/* $OpenBSD: diff.c,v 1.156 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: diff.c,v 1.157 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2008 Tobias Stoeckmann <tobias@openbsd.org>
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
break;
case 'D':
if (date1 == -1 && rev1 == NULL) {
- date1 = cvs_date_parse(optarg);
+ date1 = date_parse(optarg);
dateflag1 = optarg;
} else if (date2 == -1 && rev2 == NULL) {
- date2 = cvs_date_parse(optarg);
+ date2 = date_parse(optarg);
dateflag2 = optarg;
} else {
fatal("no more than 2 revisions/dates can"
} else {
if (fstat(cf->fd, &st) == -1)
fatal("fstat failed %s", strerror(errno));
- b1 = cvs_buf_load_fd(cf->fd);
+ b1 = buf_load_fd(cf->fd);
tv2[0].tv_sec = st.st_mtime;
tv2[0].tv_usec = 0;
tv2[1] = tv2[0];
- fd2 = cvs_buf_write_stmp(b1, p2, tv2);
- cvs_buf_free(b1);
+ fd2 = buf_write_stmp(b1, p2, tv2);
+ buf_free(b1);
}
}
-/* $OpenBSD: diff.h,v 1.20 2009/06/07 08:39:13 ray Exp $ */
+/* $OpenBSD: diff.h,v 1.21 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
*
* @(#)diffreg.c 8.1 (Berkeley) 6/6/93
*/
-#ifndef CVS_DIFF_H
-#define CVS_DIFF_H
+#ifndef DIFF_H
+#define DIFF_H
#define CVS_DIFF_DEFCTX 3 /* default context length */
/*
/*
* Command line flags
*/
-#define D_FORCEASCII 0x01 /* Treat file as ascii regardless of content */
-#define D_FOLDBLANKS 0x02 /* Treat all white space as equal */
-#define D_MINIMAL 0x04 /* Make diff as small as possible */
-#define D_IGNORECASE 0x08 /* Case-insensitive matching */
-#define D_PROTOTYPE 0x10 /* Display C function prototype */
-#define D_EXPANDTABS 0x20 /* Expand tabs to spaces */
-#define D_IGNOREBLANKS 0x40 /* Ignore white space changes */
+#define D_FORCEASCII 0x01 /* Treat file as ascii regardless of content */
+#define D_FOLDBLANKS 0x02 /* Treat all white space as equal */
+#define D_MINIMAL 0x04 /* Make diff as small as possible */
+#define D_IGNORECASE 0x08 /* Case-insensitive matching */
+#define D_PROTOTYPE 0x10 /* Display C function prototype */
+#define D_EXPANDTABS 0x20 /* Expand tabs to spaces */
+#define D_IGNOREBLANKS 0x40 /* Ignore white space changes */
/*
* Status values for diffreg() return values
void cvs_merge_file(struct cvs_file *, int);
void diff_output(const char *, ...);
int diffreg(const char *, const char *, int, int, BUF *, int);
-int ed_patch_lines(struct cvs_lines *, struct cvs_lines *);
+int ed_patch_lines(struct rcs_lines *, struct rcs_lines *);
extern int diff_format;
extern int diff3_conflicts;
extern int diff_pflag;
extern int diff_wflag;
extern char *diff_file;
-extern char diffargs[128];
+extern char diffargs[512]; /* XXX */
extern BUF *diffbuf;
extern RCSNUM *diff_rev1;
extern RCSNUM *diff_rev2;
extern RCSNUM *d3rev1;
extern RCSNUM *d3rev2;
-#endif
+#endif /* DIFF_H */
-/* $OpenBSD: diff3.c,v 1.52 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: diff3.c,v 1.53 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
static size_t szchanges;
-static struct diff *d13 = NULL;
-static struct diff *d23 = NULL;
+static struct diff *d13;
+static struct diff *d23;
/*
* "de" is used to gather editing scripts. These are later spewed out in
* look (!?). Array overlap indicates which sections in "de" correspond to
* lines that are different in all three files.
*/
-static struct diff *de = NULL;
-static char *overlap = NULL;
+static struct diff *de;
+static char *overlap;
static int overlapcnt = 0;
static FILE *fp[3];
static int cline[3]; /* # of the last-read line in each file (0-2) */
char *dp13, *dp23, *path1, *path2, *path3;
BUF *b1, *b2, *b3, *d1, *d2, *diffb;
size_t dlen, plen;
- struct cvs_line *lp;
- struct cvs_lines *dlines, *plines;
+ struct rcs_line *lp;
+ struct rcs_lines *dlines, *plines;
overlapcnt = 0;
b1 = b2 = b3 = d1 = d2 = diffb = NULL;
rcsnum_tostr(d3rev1, r1, sizeof(r1));
rcsnum_tostr(d3rev2, r2, sizeof(r2));
- b1 = cvs_buf_load_fd(cf->fd);
- d1 = cvs_buf_alloc(128);
- d2 = cvs_buf_alloc(128);
- diffb = cvs_buf_alloc(128);
+ b1 = buf_load_fd(cf->fd);
+ d1 = buf_alloc(128);
+ d2 = buf_alloc(128);
+ diffb = buf_alloc(128);
(void)xasprintf(&path1, "%s/diff1.XXXXXXXXXX", cvs_tmpdir);
(void)xasprintf(&path2, "%s/diff2.XXXXXXXXXX", cvs_tmpdir);
(void)xasprintf(&path3, "%s/diff3.XXXXXXXXXX", cvs_tmpdir);
- fds[2] = cvs_buf_write_stmp(b1, path1, NULL);
+ fds[2] = buf_write_stmp(b1, path1, NULL);
if (verbose == 1)
cvs_printf("Retrieving revision %s\n", r1);
fds[3] = rcs_rev_write_stmp(cf->file_rcs, d3rev1, path2, 0);
diffreg(path2, path3, fds[3], fds[4], d2, D_FORCEASCII);
(void)xasprintf(&dp13, "%s/d13.XXXXXXXXXX", cvs_tmpdir);
- fds[0] = cvs_buf_write_stmp(d1, dp13, NULL);
- cvs_buf_free(d1);
+ fds[0] = buf_write_stmp(d1, dp13, NULL);
+ buf_free(d1);
(void)xasprintf(&dp23, "%s/d23.XXXXXXXXXX", cvs_tmpdir);
- fds[1] = cvs_buf_write_stmp(d2, dp23, NULL);
- cvs_buf_free(d2);
+ fds[1] = buf_write_stmp(d2, dp23, NULL);
+ buf_free(d2);
argc = 0;
diffbuf = diffb;
if (diff3_conflicts < 0)
fatal("cvs_merge_file: merging failed for an unknown reason");
- plen = cvs_buf_len(diffb);
- patch = cvs_buf_release(diffb);
- dlen = cvs_buf_len(b1);
- data = cvs_buf_release(b1);
+ plen = buf_len(diffb);
+ patch = buf_release(diffb);
+ dlen = buf_len(b1);
+ data = buf_release(b1);
if (verbose == 1)
cvs_printf("Merging differences between %s and %s into `%s'\n",
}
int
-ed_patch_lines(struct cvs_lines *dlines, struct cvs_lines *plines)
+ed_patch_lines(struct rcs_lines *dlines, struct rcs_lines *plines)
{
char op, *ep;
- struct cvs_line *sort, *lp, *dlp, *ndlp, *insert_after;
+ struct rcs_line *sort, *lp, *dlp, *ndlp, *insert_after;
int start, end, i, lineno;
u_char tmp;
(void)fseek(fp[2], (long)de[n].new.from, SEEK_SET);
for (k = de[n].new.to-de[n].new.from; k > 0; k-= j) {
j = k > BUFSIZ ? BUFSIZ : k;
- if (fread(block, (size_t)1, (size_t)j,
- fp[2]) != (size_t)j)
+ if (fread(block, 1, j, fp[2]) != j)
return (-1);
block[j] = '\0';
diff_output("%s", block);
-/* $OpenBSD: diff_internals.c,v 1.31 2010/07/16 17:53:20 ray Exp $ */
+/* $OpenBSD: diff_internals.c,v 1.32 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
const char *diff_file2 = NULL;
RCSNUM *diff_rev1 = NULL;
RCSNUM *diff_rev2 = NULL;
-char diffargs[128];
+char diffargs[512];
static struct stat stb1, stb2;
static char *ifdefname, *ignore_pats;
regex_t ignore_re;
if (i == -1)
fatal("diff_output: could not allocate memory");
if (diffbuf != NULL)
- cvs_buf_puts(diffbuf, str);
+ buf_puts(diffbuf, str);
else
cvs_printf("%s", str);
xfree(str);
-/* $OpenBSD: file.c,v 1.259 2010/07/13 20:47:19 nicm Exp $ */
+/* $OpenBSD: file.c,v 1.260 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
cf->file_ent != NULL && !RCSNUM_ISBRANCH(cf->file_ent->ce_rev) &&
cf->file_ent->ce_status != CVS_ENT_ADDED) {
b1 = rcs_rev_getbuf(cf->file_rcs, cf->file_ent->ce_rev, 0);
- b2 = cvs_buf_load_fd(cf->fd);
+ b2 = buf_load_fd(cf->fd);
- if (cvs_buf_differ(b1, b2))
+ if (buf_differ(b1, b2))
ismodified = 1;
else
ismodified = 0;
- cvs_buf_free(b1);
- cvs_buf_free(b2);
+ buf_free(b1);
+ buf_free(b2);
}
if (cf->file_rcs != NULL && cf->file_rcsrev != NULL &&
-/* $OpenBSD: getlog.c,v 1.93 2009/03/26 17:30:04 joris Exp $ */
+/* $OpenBSD: getlog.c,v 1.94 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
if (last == NULL) {
flags |= LDATE_SINGLE;
- firstdate = cvs_date_parse(first);
+ firstdate = date_parse(first);
delim = '\0';
last = "\0";
} else {
if (delim == '>' && *last == '\0') {
flags |= LDATE_EARLIER;
- firstdate = cvs_date_parse(first);
+ firstdate = date_parse(first);
}
if (delim == '>' && *first == '\0' && *last != '\0') {
flags |= LDATE_LATER;
- firstdate = cvs_date_parse(last);
+ firstdate = date_parse(last);
}
if (delim == '<' && *last == '\0') {
flags |= LDATE_LATER;
- firstdate = cvs_date_parse(first);
+ firstdate = date_parse(first);
}
if (delim == '<' && *first == '\0' && *last != '\0') {
flags |= LDATE_EARLIER;
- firstdate = cvs_date_parse(last);
+ firstdate = date_parse(last);
}
if (*first != '\0' && *last != '\0') {
flags |= LDATE_RANGE;
if (delim == '<') {
- firstdate = cvs_date_parse(first);
- lastdate = cvs_date_parse(last);
+ firstdate = date_parse(first);
+ lastdate = date_parse(last);
} else {
- firstdate = cvs_date_parse(last);
- lastdate = cvs_date_parse(first);
+ firstdate = date_parse(last);
+ lastdate = date_parse(first);
}
}
-/* $OpenBSD: history.c,v 1.39 2008/06/19 19:03:25 tobias Exp $ */
+/* $OpenBSD: history.c,v 1.40 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2007 Joris Vink <joris@openbsd.org>
*
case CVS_HISTORY_CHECKOUT:
case CVS_HISTORY_EXPORT:
/*
- * cvs_buf_alloc uses xcalloc(), so we are safe even
+ * buf_alloc uses xcalloc(), so we are safe even
* if neither cvs_specified_tag nor cvs_specified_date
* have been supplied.
*/
- buf = cvs_buf_alloc(128);
+ buf = buf_alloc(128);
if (cvs_specified_tag != NULL) {
- cvs_buf_puts(buf, cvs_specified_tag);
+ buf_puts(buf, cvs_specified_tag);
if (cvs_specified_date != -1)
- cvs_buf_putc(buf, ':');
+ buf_putc(buf, ':');
}
if (cvs_specified_date != -1) {
gmtime_r(&cvs_specified_date, &datetm);
strftime(timebuf, sizeof(timebuf),
"%Y.%m.%d.%H.%M.%S", &datetm);
- cvs_buf_puts(buf, timebuf);
+ buf_puts(buf, timebuf);
}
- rev = cvs_buf_release(buf);
+ rev = buf_release(buf);
break;
case CVS_HISTORY_UPDATE_MERGED:
case CVS_HISTORY_UPDATE_MERGED_ERR:
-/* $OpenBSD: import.c,v 1.101 2009/06/27 16:55:31 martynas Exp $ */
+/* $OpenBSD: import.c,v 1.102 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
import_printf("\nNo conflicts created by this import.\n\n");
}
- loginfo = cvs_buf_release(logbuf);
+ loginfo = buf_release(logbuf);
logbuf = NULL;
line_list = cvs_trigger_getlines(CVS_PATH_LOGINFO, import_repository);
va_end(vap);
cvs_printf("%s", str);
- cvs_buf_puts(logbuf, str);
+ buf_puts(logbuf, str);
xfree(str);
}
if (getcwd(pwd, sizeof(pwd)) == NULL)
fatal("Can't get working directory");
- logbuf = cvs_buf_alloc(1024);
+ logbuf = buf_alloc(1024);
cvs_trigger_loginfo_header(logbuf, repo);
- cvs_buf_puts(logbuf, "Log Message:\n");
- cvs_buf_puts(logbuf, logmsg);
+ buf_puts(logbuf, "Log Message:\n");
+ buf_puts(logbuf, logmsg);
if (logmsg[0] != '\0' && logmsg[strlen(logmsg) - 1] != '\n')
- cvs_buf_putc(logbuf, '\n');
- cvs_buf_putc(logbuf, '\n');
+ buf_putc(logbuf, '\n');
+ buf_putc(logbuf, '\n');
- cvs_buf_puts(logbuf, "Status:\n\n");
+ buf_puts(logbuf, "Status:\n\n");
- cvs_buf_puts(logbuf, "Vendor Tag:\t");
- cvs_buf_puts(logbuf, vendor_tag);
- cvs_buf_putc(logbuf, '\n');
- cvs_buf_puts(logbuf, "Release Tags:\t");
+ buf_puts(logbuf, "Vendor Tag:\t");
+ buf_puts(logbuf, vendor_tag);
+ buf_putc(logbuf, '\n');
+ buf_puts(logbuf, "Release Tags:\t");
for (i = 0; i < tagcount ; i++) {
- cvs_buf_puts(logbuf, "\t\t");
- cvs_buf_puts(logbuf, release_tags[i]);
- cvs_buf_putc(logbuf, '\n');
+ buf_puts(logbuf, "\t\t");
+ buf_puts(logbuf, release_tags[i]);
+ buf_putc(logbuf, '\n');
}
- cvs_buf_putc(logbuf, '\n');
- cvs_buf_putc(logbuf, '\n');
+ buf_putc(logbuf, '\n');
+ buf_putc(logbuf, '\n');
}
static void
if ((branch = rcsnum_parse(import_branch)) == NULL)
fatal("import_new: failed to parse branch");
- bp = cvs_buf_load_fd(cf->fd);
+ bp = buf_load_fd(cf->fd);
if ((brev = rcsnum_brtorev(branch)) == NULL)
fatal("import_new: failed to get first branch revision");
fatal("import_update: rcsnum_parse failed");
b1 = rcs_rev_getbuf(cf->file_rcs, rev, RCS_KWEXP_NONE);
- b2 = cvs_buf_load_fd(cf->fd);
+ b2 = buf_load_fd(cf->fd);
- ret = cvs_buf_differ(b1, b2);
- cvs_buf_free(b1);
- cvs_buf_free(b2);
+ ret = buf_differ(b1, b2);
+ buf_free(b1);
+ buf_free(b2);
if (ret == 0) {
import_tag(cf, brev, rev);
rcsnum_free(brev);
BUF *b1, *b2;
int fd1, fd2;
- b2 = cvs_buf_alloc(128);
+ b2 = buf_alloc(128);
- b1 = cvs_buf_load_fd(cf->fd);
+ b1 = buf_load_fd(cf->fd);
(void)xasprintf(&p1, "%s/diff1.XXXXXXXXXX", cvs_tmpdir);
- fd1 = cvs_buf_write_stmp(b1, p1, NULL);
- cvs_buf_free(b1);
+ fd1 = buf_write_stmp(b1, p1, NULL);
+ buf_free(b1);
(void)xasprintf(&p2, "%s/diff2.XXXXXXXXXX", cvs_tmpdir);
fd2 = rcs_rev_write_stmp(cf->file_rcs, rev, p2, RCS_KWEXP_NONE);
-/* $OpenBSD: init.c,v 1.36 2009/03/25 21:19:20 joris Exp $ */
+/* $OpenBSD: init.c,v 1.37 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
if ((file = rcs_open(rpath, fd, rcsflags, 0444)) == NULL)
fatal("failed to create RCS file for `%s'", path);
- b = cvs_buf_load(path);
+ b = buf_load(path);
if (rcs_rev_add(file, RCS_HEAD_REV, "initial checkin", -1, NULL) == -1)
fatal("init_mkfile: failed to add new revision");
-/* $OpenBSD: logmsg.c,v 1.53 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: logmsg.c,v 1.54 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2007 Joris Vink <joris@openbsd.org>
*
fatal("cvs_logmsg_read: %s: file size too big", path);
lbuf = NULL;
- bp = cvs_buf_alloc(st.st_size);
+ bp = buf_alloc(st.st_size);
while ((buf = fgetln(fp, &len))) {
if (buf[len - 1] == '\n') {
buf[len - 1] = '\0';
sizeof(CVS_LOGMSG_PREFIX) - 1))
continue;
- cvs_buf_append(bp, buf, len);
- cvs_buf_putc(bp, '\n');
+ buf_append(bp, buf, len);
+ buf_putc(bp, '\n');
}
if (lbuf != NULL)
(void)fclose(fp);
- cvs_buf_putc(bp, '\0');
- return (cvs_buf_release(bp));
+ buf_putc(bp, '\0');
+ return (buf_release(bp));
}
char *
-/* $OpenBSD: rcs.c,v 1.296 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: rcs.c,v 1.297 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
#define RCS_NKEYS (sizeof(rcs_keys)/sizeof(rcs_keys[0]))
static RCSNUM *rcs_get_revision(const char *, RCSFILE *);
-int rcs_patch_lines(struct cvs_lines *, struct cvs_lines *,
- struct cvs_line **, struct rcs_delta *);
+int rcs_patch_lines(struct rcs_lines *, struct rcs_lines *,
+ struct rcs_line **, struct rcs_delta *);
static void rcs_parse_init(RCSFILE *);
static int rcs_parse_admin(RCSFILE *);
static int rcs_parse_delta(RCSFILE *);
static void rcs_growbuf(RCSFILE *);
static void rcs_strprint(const u_char *, size_t, FILE *);
-static void rcs_kwexp_line(char *, struct rcs_delta *, struct cvs_lines *,
- struct cvs_line *, int mode);
+static void rcs_kwexp_line(char *, struct rcs_delta *, struct rcs_lines *,
+ struct rcs_line *, int mode);
static int rcs_ignore_keys = 0;
}
int
-rcs_patch_lines(struct cvs_lines *dlines, struct cvs_lines *plines,
- struct cvs_line **alines, struct rcs_delta *rdp)
+rcs_patch_lines(struct rcs_lines *dlines, struct rcs_lines *plines,
+ struct rcs_line **alines, struct rcs_delta *rdp)
{
u_char op;
char *ep;
- struct cvs_line *lp, *dlp, *ndlp;
+ struct rcs_line *lp, *dlp, *ndlp;
int i, lineno, nbln;
u_char tmp;
void
rcs_delta_stats(struct rcs_delta *rdp, int *ladded, int *lremoved)
{
- struct cvs_lines *plines;
- struct cvs_line *lp;
+ struct rcs_lines *plines;
+ struct rcs_line *lp;
int added, i, lineno, nbln, removed;
char op, *ep;
u_char tmp;
path_tmp1 = path_tmp2 = NULL;
if (prevrdp != NULL && nextrdp != NULL) {
- newdiff = cvs_buf_alloc(64);
+ newdiff = buf_alloc(64);
/* calculate new diff */
(void)xasprintf(&path_tmp1, "%s/diff1.XXXXXXXXXX", cvs_tmpdir);
if (rdp->rd_text != NULL)
xfree(rdp->rd_text);
- len = cvs_buf_len(bp);
- dtext = cvs_buf_release(bp);
+ len = buf_len(bp);
+ dtext = buf_release(bp);
bp = NULL;
if (len != 0) {
* rcs_rev_getlines()
*
* Get the entire contents of revision <frev> from the RCSFILE <rfp> and
- * return it as a pointer to a struct cvs_lines.
+ * return it as a pointer to a struct rcs_lines.
*/
-struct cvs_lines *
-rcs_rev_getlines(RCSFILE *rfp, RCSNUM *frev, struct cvs_line ***alines)
+struct rcs_lines *
+rcs_rev_getlines(RCSFILE *rfp, RCSNUM *frev, struct rcs_line ***alines)
{
size_t plen;
int annotate, done, i, nextroot;
struct rcs_branch *brp;
struct rcs_delta *hrdp, *prdp, *rdp, *trdp;
u_char *patch;
- struct cvs_line *line, *nline;
- struct cvs_lines *dlines, *plines;
+ struct rcs_line *line, *nline;
+ struct rcs_lines *dlines, *plines;
if (rfp->rf_head == NULL ||
(hrdp = rcs_findrev(rfp, rfp->rf_head)) == NULL)
i++;
}
- *alines = xcalloc(i + 1, sizeof(struct cvs_line *));
+ *alines = xcalloc(i + 1, sizeof(struct rcs_line *));
(*alines)[i] = NULL;
annotate = ANNOTATE_NOW;
i++;
}
- *alines = xcalloc(i + 1, sizeof(struct cvs_line *));
+ *alines = xcalloc(i + 1, sizeof(struct rcs_line *));
(*alines)[i] = NULL;
annotate = ANNOTATE_NOW;
}
void
-rcs_annotate_getlines(RCSFILE *rfp, RCSNUM *frev, struct cvs_line ***alines)
+rcs_annotate_getlines(RCSFILE *rfp, RCSNUM *frev, struct rcs_line ***alines)
{
size_t plen;
int i, nextroot;
struct rcs_branch *brp;
struct rcs_delta *rdp, *trdp;
u_char *patch;
- struct cvs_line *line;
- struct cvs_lines *dlines, *plines;
+ struct rcs_line *line;
+ struct rcs_lines *dlines, *plines;
if (!RCSNUM_ISBRANCHREV(frev))
fatal("rcs_annotate_getlines: branch revision expected");
if (line->l_line != NULL)
i++;
}
- *alines = xcalloc(i + 1, sizeof(struct cvs_line *));
+ *alines = xcalloc(i + 1, sizeof(struct rcs_line *));
(*alines)[i] = NULL;
i = 0;
{
int expmode, expand;
struct rcs_delta *rdp;
- struct cvs_lines *lines;
- struct cvs_line *lp, *nlp;
+ struct rcs_lines *lines;
+ struct rcs_line *lp, *nlp;
BUF *bp;
expand = 0;
lines = rcs_rev_getlines(rfp, rev, NULL);
- bp = cvs_buf_alloc(1024 * 16);
+ bp = buf_alloc(1024 * 16);
if (!(mode & RCS_KWEXP_NONE)) {
if (rfp->rf_expand != NULL)
rcs_kwexp_line(rfp->rf_path, rdp, lines, lp, expmode);
do {
- cvs_buf_append(bp, lp->l_line, lp->l_len);
+ buf_append(bp, lp->l_line, lp->l_len);
} while ((lp = TAILQ_NEXT(lp, l_list)) != nlp);
}
size_t ret;
int expmode, expand;
struct rcs_delta *rdp;
- struct cvs_lines *lines;
- struct cvs_line *lp, *nlp;
+ struct rcs_lines *lines;
+ struct rcs_line *lp, *nlp;
extern int print_stdout;
expand = 0;
}
static void
-rcs_kwexp_line(char *rcsfile, struct rcs_delta *rdp, struct cvs_lines *lines,
- struct cvs_line *line, int mode)
+rcs_kwexp_line(char *rcsfile, struct rcs_delta *rdp, struct rcs_lines *lines,
+ struct rcs_line *line, int mode)
{
BUF *tmpbuf;
int kwtype;
/* order does not matter anymore below */
if (kwtype & RCS_KW_LOG) {
char linebuf[256];
- struct cvs_line *cur, *lp;
+ struct rcs_line *cur, *lp;
char *logp, *l_line, *prefix, *q, *sprefix;
size_t i;
fatal("rcs_kwexp_line: truncated");
/* Concatenate everything together. */
- tmpbuf = cvs_buf_alloc(len + strlen(expbuf));
+ tmpbuf = buf_alloc(len + strlen(expbuf));
/* Append everything before keyword. */
- cvs_buf_append(tmpbuf, line->l_line,
+ buf_append(tmpbuf, line->l_line,
start - line->l_line);
/* Append keyword. */
- cvs_buf_puts(tmpbuf, expbuf);
+ buf_puts(tmpbuf, expbuf);
/* Point c to end of keyword. */
- tlen = cvs_buf_len(tmpbuf) - 1;
+ tlen = buf_len(tmpbuf) - 1;
/* Append everything after keyword. */
- cvs_buf_append(tmpbuf, end,
+ buf_append(tmpbuf, end,
line->l_line + line->l_len - end);
- c = cvs_buf_get(tmpbuf) + tlen;
+ c = buf_get(tmpbuf) + tlen;
/* Point fin to end of data. */
- fin = cvs_buf_get(tmpbuf) + cvs_buf_len(tmpbuf) - 1;
+ fin = buf_get(tmpbuf) + buf_len(tmpbuf) - 1;
/* Recalculate new length. */
- len = cvs_buf_len(tmpbuf);
+ len = buf_len(tmpbuf);
/* tmpbuf is now ready, convert to string */
if (line->l_needsfree)
xfree(line->l_line);
line->l_len = len;
- line->l_line = cvs_buf_release(tmpbuf);
+ line->l_line = buf_release(tmpbuf);
line->l_needsfree = 1;
}
}
-/* $OpenBSD: rcs.h,v 1.93 2009/03/25 21:19:20 joris Exp $ */
+/* $OpenBSD: rcs.h,v 1.94 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
char *rl_name;
RCSNUM *rl_num;
- TAILQ_ENTRY(rcs_lock) rl_list;
+ TAILQ_ENTRY(rcs_lock) rl_list;
};
struct rcs_branch {
RCSNUM *rb_num;
- TAILQ_ENTRY(rcs_branch) rb_list;
+ TAILQ_ENTRY(rcs_branch) rb_list;
};
TAILQ_HEAD(rcs_dlist, rcs_delta);
void *rf_pdata;
} RCSFILE;
-struct cvs_line;
-struct cvs_lines;
+struct rcs_line;
+struct rcs_lines;
RCSFILE *rcs_open(const char *, int, int, ...);
void rcs_close(RCSFILE *);
void rcs_write(RCSFILE *);
int rcs_rev_write_stmp(RCSFILE *, RCSNUM *, char *, int);
void rcs_rev_write_fd(RCSFILE *, RCSNUM *, int, int);
-struct cvs_lines *rcs_rev_getlines(RCSFILE *, RCSNUM *,
- struct cvs_line ***);
+struct rcs_lines *rcs_rev_getlines(RCSFILE *, RCSNUM *,
+ struct rcs_line ***);
void rcs_annotate_getlines(RCSFILE *, RCSNUM *,
- struct cvs_line ***);
+ struct rcs_line ***);
BUF *rcs_rev_getbuf(RCSFILE *, RCSNUM *, int);
void rcs_delta_stats(struct rcs_delta *, int *, int *);
-/* $OpenBSD: remote.c,v 1.28 2009/04/07 21:27:45 joris Exp $ */
+/* $OpenBSD: remote.c,v 1.29 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
if (cvs_server_active != 1)
fatal("cvs_remote_send_file_buf is server only");
- len = cvs_buf_len(bp);
- data = cvs_buf_release(bp);
+ len = buf_len(bp);
+ data = buf_release(bp);
cvs_modetostr(mode, buf, sizeof(buf));
cvs_remote_output(buf);
-/* $OpenBSD: server.c,v 1.99 2009/04/18 16:26:01 joris Exp $ */
+/* $OpenBSD: server.c,v 1.100 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
int i, first;
first = 0;
- bp = cvs_buf_alloc(512);
+ bp = buf_alloc(512);
for (i = 0; cvs_requests[i].supported != -1; i++) {
if (cvs_requests[i].hdlr == NULL)
continue;
if (first != 0)
- cvs_buf_putc(bp, ' ');
+ buf_putc(bp, ' ');
else
first++;
- cvs_buf_puts(bp, cvs_requests[i].name);
+ buf_puts(bp, cvs_requests[i].name);
}
- cvs_buf_putc(bp, '\0');
- d = cvs_buf_release(bp);
+ buf_putc(bp, '\0');
+ d = buf_release(bp);
cvs_server_send_response("Valid-requests %s", d);
cvs_server_send_response("ok");
-/* $OpenBSD: trigger.c,v 1.17 2009/03/19 09:55:19 joris Exp $ */
+/* $OpenBSD: trigger.c,v 1.18 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2008 Tobias Stoeckmann <tobias@openbsd.org>
* Copyright (c) 2008 Jonathan Armani <dbd@asystant.net>
}
}
if (quote)
- cvs_buf_putc(buf, '"');
+ buf_putc(buf, '"');
if (oldstyle) {
- cvs_buf_puts(buf, repo);
- cvs_buf_putc(buf, ' ');
+ buf_puts(buf, repo);
+ buf_putc(buf, ' ');
}
if (*format == '\0')
* check like this, add only uses loginfo for directories anyway
*/
if (cvs_cmdop == CVS_OP_ADD) {
- cvs_buf_puts(buf, "- New directory");
+ buf_puts(buf, "- New directory");
if (quote)
- cvs_buf_putc(buf, '"');
+ buf_putc(buf, '"');
return (0);
}
if (cvs_cmdop == CVS_OP_IMPORT) {
- cvs_buf_puts(buf, "- Imported sources");
+ buf_puts(buf, "- Imported sources");
if (quote)
- cvs_buf_putc(buf, '"');
+ buf_putc(buf, '"');
return (0);
}
}
if (val != NULL)
- cvs_buf_puts(buf, val);
+ buf_puts(buf, val);
if (*(++p) != '\0')
- cvs_buf_putc(buf, ',');
+ buf_putc(buf, ',');
}
if (fi != NULL)
*format == 'p' || *format == 'r' || *format == 't'))
break;
- cvs_buf_putc(buf, ' ');
+ buf_putc(buf, ' ');
}
if (quote)
- cvs_buf_putc(buf, '"');
+ buf_putc(buf, '"');
return 0;
}
cvs_log(LP_ERR, "no such user variable ${=%s}", var);
return (1);
}
- cvs_buf_puts(buf, val);
+ buf_puts(buf, val);
} else {
if (strcmp(var, "CVSEDITOR") == 0 ||
strcmp(var, "EDITOR") == 0 ||
strcmp(var, "VISUAL") == 0)
- cvs_buf_puts(buf, cvs_editor);
+ buf_puts(buf, cvs_editor);
else if (strcmp(var, "CVSROOT") == 0)
- cvs_buf_puts(buf, current_cvsroot->cr_dir);
+ buf_puts(buf, current_cvsroot->cr_dir);
else if (strcmp(var, "USER") == 0) {
pw = getpwuid(geteuid());
if (pw == NULL) {
"caller ID");
return (1);
}
- cvs_buf_puts(buf, pw->pw_name);
+ buf_puts(buf, pw->pw_name);
} else if (strcmp(var, "RCSBIN") == 0) {
cvs_log(LP_ERR, "RCSBIN internal variable is no "
"longer supported");
if (*p == '%')
return (NULL);
- buf = cvs_buf_alloc(1024);
+ buf = buf_alloc(1024);
p = cmd;
again:
for (; *p != '\0'; p++) {
if ((pos = strcspn(p, "$%")) != 0) {
- cvs_buf_append(buf, p, pos);
+ buf_append(buf, p, pos);
p += pos;
}
goto again;
}
- cvs_buf_putc(buf, '\0');
- return (cvs_buf_release(buf));
+ buf_putc(buf, '\0');
+ return (buf_release(buf));
bad:
if (q != NULL)
xfree(q);
cvs_log(LP_NOTICE, "%s contains malformed command '%s'", file, cmd);
- cvs_buf_free(buf);
+ buf_free(buf);
return (NULL);
}
strerror(errno));
}
- cvs_buf_puts(buf, "Update of ");
- cvs_buf_puts(buf, current_cvsroot->cr_dir);
- cvs_buf_putc(buf, '/');
- cvs_buf_puts(buf, repo);
- cvs_buf_putc(buf, '\n');
-
- cvs_buf_puts(buf, "In directory ");
- cvs_buf_puts(buf, hostname);
- cvs_buf_puts(buf, ":");
- cvs_buf_puts(buf, dirname(pwd));
- cvs_buf_putc(buf, '/');
- cvs_buf_puts(buf, repo);
- cvs_buf_putc(buf, '\n');
- cvs_buf_putc(buf, '\n');
+ buf_puts(buf, "Update of ");
+ buf_puts(buf, current_cvsroot->cr_dir);
+ buf_putc(buf, '/');
+ buf_puts(buf, repo);
+ buf_putc(buf, '\n');
+
+ buf_puts(buf, "In directory ");
+ buf_puts(buf, hostname);
+ buf_puts(buf, ":");
+ buf_puts(buf, dirname(pwd));
+ buf_putc(buf, '/');
+ buf_puts(buf, repo);
+ buf_putc(buf, '\n');
+ buf_putc(buf, '\n');
}
-/* $OpenBSD: update.c,v 1.161 2010/07/13 21:33:44 nicm Exp $ */
+/* $OpenBSD: update.c,v 1.162 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
break;
case 'D':
dateflag = optarg;
- cvs_specified_date = cvs_date_parse(dateflag);
+ cvs_specified_date = date_parse(dateflag);
reset_tag = 0;
break;
case 'd':
BUF *bp;
int conflict;
char *content;
- struct cvs_line *lp;
- struct cvs_lines *lines;
+ struct rcs_line *lp;
+ struct rcs_lines *lines;
size_t len;
cvs_log(LP_TRACE, "update_has_conflict_markers(%s)", cf->file_path);
if (!(cf->file_flags & FILE_ON_DISK) || cf->file_ent == NULL)
return (0);
- bp = cvs_buf_load_fd(cf->fd);
+ bp = buf_load_fd(cf->fd);
- cvs_buf_putc(bp, '\0');
- len = cvs_buf_len(bp);
- content = cvs_buf_release(bp);
+ buf_putc(bp, '\0');
+ len = buf_len(bp);
+ content = buf_release(bp);
if ((lines = cvs_splitlines(content, len)) == NULL)
fatal("update_has_conflict_markers: failed to split lines");
if ((p = strchr(jrev2, ':')) != NULL) {
(*p++) = '\0';
- cvs_specified_date = cvs_date_parse(p);
+ cvs_specified_date = date_parse(p);
}
rev2 = rcs_translate_tag(jrev2, cf->file_rcs);
if (jrev1 != NULL) {
if ((p = strchr(jrev1, ':')) != NULL) {
(*p++) = '\0';
- cvs_specified_date = cvs_date_parse(p);
+ cvs_specified_date = date_parse(p);
}
rev1 = rcs_translate_tag(jrev1, cf->file_rcs);
-/* $OpenBSD: util.c,v 1.151 2009/03/24 06:59:19 joris Exp $ */
+/* $OpenBSD: util.c,v 1.152 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
/*
* Split the contents of a file into a list of lines.
*/
-struct cvs_lines *
+struct rcs_lines *
cvs_splitlines(u_char *data, size_t len)
{
u_char *p, *c;
size_t i, tlen;
- struct cvs_lines *lines;
- struct cvs_line *lp;
+ struct rcs_lines *lines;
+ struct rcs_line *lp;
lines = xcalloc(1, sizeof(*lines));
TAILQ_INIT(&(lines->l_lines));
}
void
-cvs_freelines(struct cvs_lines *lines)
+cvs_freelines(struct rcs_lines *lines)
{
- struct cvs_line *lp;
+ struct rcs_line *lp;
while ((lp = TAILQ_FIRST(&(lines->l_lines))) != NULL) {
TAILQ_REMOVE(&(lines->l_lines), lp, l_list);
-/* $OpenBSD: util.h,v 1.27 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: util.h,v 1.28 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2006 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
int cvs_exec(char *, const char *, int);
u_int cvs_revision_select(RCSFILE *, char *);
-struct cvs_line {
+struct rcs_line {
struct rcs_delta *l_delta;
u_char *l_line;
size_t l_len;
int l_lineno;
int l_lineno_orig;
int l_needsfree;
- TAILQ_ENTRY(cvs_line) l_list;
+ TAILQ_ENTRY(rcs_line) l_list;
};
-TAILQ_HEAD(tqh, cvs_line);
+TAILQ_HEAD(tqh, rcs_line);
-struct cvs_lines {
+struct rcs_lines {
int l_nblines;
struct tqh l_lines;
};
char **argv;
};
-struct cvs_lines *cvs_splitlines(u_char *, size_t);
-void cvs_freelines(struct cvs_lines *);
+struct rcs_lines *cvs_splitlines(u_char *, size_t);
+void cvs_freelines(struct rcs_lines *);
struct cvs_argvector *cvs_strsplit(char *, const char *);
void cvs_argv_destroy(struct cvs_argvector *);
int cvs_yesno(void);
-/* $OpenBSD: buf.c,v 1.14 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: buf.c,v 1.15 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
#define BUF_INCR 128
-struct rcs_buf {
+struct buf {
u_int cb_flags;
/* buffer handle, buffer size, and data length */
#define SIZE_LEFT(b) (b->cb_size - b->cb_len)
-static void rcs_buf_grow(BUF *, size_t);
+static void buf_grow(BUF *, size_t);
/*
- * rcs_buf_alloc()
+ * buf_alloc()
*
* Create a new buffer structure and return a pointer to it. This structure
- * uses dynamically-allocated memory and must be freed with rcs_buf_free(),
+ * uses dynamically-allocated memory and must be freed with buf_free(),
* once the buffer is no longer needed.
*/
BUF *
-rcs_buf_alloc(size_t len, u_int flags)
+buf_alloc(size_t len, u_int flags)
{
BUF *b;
}
/*
- * rcs_buf_load()
+ * buf_load()
*
* Open the file specified by <path> and load all of its contents into a
* buffer.
* Sets errno on error.
*/
BUF *
-rcs_buf_load(const char *path, u_int flags)
+buf_load(const char *path, u_int flags)
{
int fd;
ssize_t ret;
errno = EFBIG;
goto out;
}
- buf = rcs_buf_alloc(st.st_size, flags);
+ buf = buf_alloc(st.st_size, flags);
for (bp = buf->cb_buf; ; bp += (size_t)ret) {
len = SIZE_LEFT(buf);
ret = read(fd, bp, len);
int saved_errno;
saved_errno = errno;
- rcs_buf_free(buf);
+ buf_free(buf);
buf = NULL;
errno = saved_errno;
goto out;
return (buf);
}
-/*
- * rcs_buf_free()
- *
- * Free the buffer <b> and all associated data.
- */
void
-rcs_buf_free(BUF *b)
+buf_free(BUF *b)
{
if (b->cb_buf != NULL)
xfree(b->cb_buf);
}
/*
- * rcs_buf_release()
+ * buf_release()
*
* Free the buffer <b>'s structural information but do not free the contents
* of the buffer. Instead, they are returned and should be freed later using
* free().
*/
void *
-rcs_buf_release(BUF *b)
+buf_release(BUF *b)
{
void *tmp;
}
/*
- * rcs_buf_get()
+ * buf_get()
*/
u_char *
-rcs_buf_get(BUF *b)
+buf_get(BUF *b)
{
return (b->cb_buf);
}
/*
- * rcs_buf_empty()
+ * buf_empty()
*
* Empty the contents of the buffer <b> and reset pointers.
*/
void
-rcs_buf_empty(BUF *b)
+buf_empty(BUF *b)
{
memset(b->cb_buf, 0, b->cb_size);
b->cb_len = 0;
}
/*
- * rcs_buf_putc()
+ * buf_putc()
*
* Append a single character <c> to the end of the buffer <b>.
*/
void
-rcs_buf_putc(BUF *b, int c)
+buf_putc(BUF *b, int c)
{
u_char *bp;
if (bp == (b->cb_buf + b->cb_size)) {
/* extend */
if (b->cb_flags & BUF_AUTOEXT)
- rcs_buf_grow(b, (size_t)BUF_INCR);
+ buf_grow(b, (size_t)BUF_INCR);
else
- errx(1, "rcs_buf_putc failed");
+ errx(1, "buf_putc failed");
/* the buffer might have been moved */
bp = b->cb_buf + b->cb_len;
}
/*
- * rcs_buf_getc()
+ * buf_getc()
*
* Return u_char at buffer position <pos>.
*
*/
u_char
-rcs_buf_getc(BUF *b, size_t pos)
+buf_getc(BUF *b, size_t pos)
{
return (b->cb_buf[pos]);
}
/*
- * rcs_buf_append()
+ * buf_append()
*
* Append <len> bytes of data pointed to by <data> to the buffer <b>. If the
* buffer is too small to accept all data, it will attempt to append as much
* Returns the number of bytes successfully appended to the buffer.
*/
size_t
-rcs_buf_append(BUF *b, const void *data, size_t len)
+buf_append(BUF *b, const void *data, size_t len)
{
size_t left, rlen;
u_char *bp, *bep;
if (left < len) {
if (b->cb_flags & BUF_AUTOEXT) {
- rcs_buf_grow(b, len - left);
+ buf_grow(b, len - left);
bp = b->cb_buf + b->cb_len;
} else
rlen = bep - bp;
}
/*
- * rcs_buf_fappend()
+ * buf_fappend()
*
*/
size_t
-rcs_buf_fappend(BUF *b, const char *fmt, ...)
+buf_fappend(BUF *b, const char *fmt, ...)
{
size_t ret;
int n;
va_end(vap);
if (n == -1)
- errx(1, "rcs_buf_fappend: failed to format data");
+ errx(1, "buf_fappend: failed to format data");
- ret = rcs_buf_append(b, str, n);
+ ret = buf_append(b, str, n);
xfree(str);
return (ret);
}
/*
- * rcs_buf_len()
+ * buf_len()
*
* Returns the size of the buffer that is being used.
*/
size_t
-rcs_buf_len(BUF *b)
+buf_len(BUF *b)
{
return (b->cb_len);
}
/*
- * rcs_buf_write_fd()
+ * buf_write_fd()
*
* Write the contents of the buffer <b> to the specified <fd>
*/
int
-rcs_buf_write_fd(BUF *b, int fd)
+buf_write_fd(BUF *b, int fd)
{
u_char *bp;
size_t len;
}
/*
- * rcs_buf_write()
+ * buf_write()
*
* Write the contents of the buffer <b> to the file whose path is given in
* <path>. If the file does not exist, it is created with mode <mode>.
*/
int
-rcs_buf_write(BUF *b, const char *path, mode_t mode)
+buf_write(BUF *b, const char *path, mode_t mode)
{
int fd;
open:
err(1, "%s", path);
}
- if (rcs_buf_write_fd(b, fd) == -1) {
+ if (buf_write_fd(b, fd) == -1) {
(void)unlink(path);
- errx(1, "rcs_buf_write: rcs_buf_write_fd: `%s'", path);
+ errx(1, "buf_write: buf_write_fd: `%s'", path);
}
if (fchmod(fd, mode) < 0)
}
/*
- * rcs_buf_write_stmp()
+ * buf_write_stmp()
*
* Write the contents of the buffer <b> to a temporary file whose path is
* specified using <template> (see mkstemp.3). NB. This function will modify
* <template>, as per mkstemp
*/
void
-rcs_buf_write_stmp(BUF *b, char *template)
+buf_write_stmp(BUF *b, char *template)
{
int fd;
worklist_add(template, &temp_files);
- if (rcs_buf_write_fd(b, fd) == -1) {
+ if (buf_write_fd(b, fd) == -1) {
(void)unlink(template);
- errx(1, "rcs_buf_write_stmp: rcs_buf_write_fd: `%s'", template);
+ errx(1, "buf_write_stmp: buf_write_fd: `%s'", template);
}
(void)close(fd);
}
/*
- * rcs_buf_grow()
+ * buf_grow()
*
* Grow the buffer <b> by <len> bytes. The contents are unchanged by this
* operation regardless of the result.
*/
static void
-rcs_buf_grow(BUF *b, size_t len)
+buf_grow(BUF *b, size_t len)
{
b->cb_buf = xrealloc(b->cb_buf, 1, b->cb_size + len);
b->cb_size += len;
-/* $OpenBSD: buf.h,v 1.9 2007/02/27 07:59:13 xsa Exp $ */
+/* $OpenBSD: buf.h,v 1.10 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
* -----------------
*
* This code provides an API to generic memory buffer management. All
- * operations are performed on a rcs_buf structure, which is kept opaque to the
+ * operations are performed on a buf structure, which is kept opaque to the
* API user in order to avoid corruption of the fields and make sure that only
* the internals can modify the fields.
*
- * The first step is to allocate a new buffer using the rcs_buf_alloc()
+ * The first step is to allocate a new buffer using the buf_alloc()
* function, which returns a pointer to a new buffer.
*/
/* flags */
#define BUF_AUTOEXT 1 /* autoextend on append */
-typedef struct rcs_buf BUF;
+typedef struct buf BUF;
-BUF *rcs_buf_alloc(size_t, u_int);
-BUF *rcs_buf_load(const char *, u_int);
-void rcs_buf_free(BUF *);
-void *rcs_buf_release(BUF *);
-u_char rcs_buf_getc(BUF *, size_t);
-void rcs_buf_empty(BUF *);
-size_t rcs_buf_append(BUF *, const void *, size_t);
-size_t rcs_buf_fappend(BUF *, const char *, ...)
+BUF *buf_alloc(size_t, u_int);
+BUF *buf_load(const char *, u_int);
+void buf_free(BUF *);
+void *buf_release(BUF *);
+u_char buf_getc(BUF *, size_t);
+void buf_empty(BUF *);
+size_t buf_append(BUF *, const void *, size_t);
+size_t buf_fappend(BUF *, const char *, ...)
__attribute__((format(printf, 2, 3)));
-void rcs_buf_putc(BUF *, int);
-size_t rcs_buf_len(BUF *);
-int rcs_buf_write_fd(BUF *, int);
-int rcs_buf_write(BUF *, const char *, mode_t);
-void rcs_buf_write_stmp(BUF *, char *);
-u_char *rcs_buf_get(BUF *b);
+void buf_putc(BUF *, int);
+size_t buf_len(BUF *);
+int buf_write_fd(BUF *, int);
+int buf_write(BUF *, const char *, mode_t);
+void buf_write_stmp(BUF *, char *);
+u_char *buf_get(BUF *b);
#endif /* BUF_H */
-/* $OpenBSD: ci.c,v 1.206 2010/07/22 17:49:18 millert Exp $ */
+/* $OpenBSD: ci.c,v 1.207 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
case 'd':
if (rcs_optarg == NULL)
pb.date = DATE_MTIME;
- else if ((pb.date = rcs_date_parse(rcs_optarg)) <= 0)
+ else if ((pb.date = date_parse(rcs_optarg)) <= 0)
errx(1, "invalid date");
break;
case 'f':
b1 = b2 = b3 = NULL;
path1 = path2 = NULL;
- if ((b1 = rcs_buf_load(pb->filename, BUF_AUTOEXT)) == NULL) {
+ if ((b1 = buf_load(pb->filename, BUF_AUTOEXT)) == NULL) {
warnx("failed to load file: `%s'", pb->filename);
goto out;
}
}
b2 = rcs_kwexp_buf(b2, pb->file, pb->frev);
- if ((b3 = rcs_buf_alloc(128, BUF_AUTOEXT)) == NULL) {
+ if ((b3 = buf_alloc(128, BUF_AUTOEXT)) == NULL) {
warnx("failed to allocated buffer for diff");
goto out;
}
(void)xasprintf(&path1, "%s/diff1.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b1, path1);
+ buf_write_stmp(b1, path1);
- rcs_buf_free(b1);
+ buf_free(b1);
b1 = NULL;
(void)xasprintf(&path2, "%s/diff2.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b2, path2);
+ buf_write_stmp(b2, path2);
- rcs_buf_free(b2);
+ buf_free(b2);
b2 = NULL;
diff_format = D_RCSDIFF;
return (b3);
out:
if (b1 != NULL)
- rcs_buf_free(b1);
+ buf_free(b1);
if (b2 != NULL)
- rcs_buf_free(b2);
+ buf_free(b2);
if (b3 != NULL)
- rcs_buf_free(b3);
+ buf_free(b3);
if (path1 != NULL)
xfree(path1);
if (path2 != NULL)
pb->frev = pb->file->rf_head;
/* Load file contents */
- if ((bp = rcs_buf_load(pb->filename, BUF_AUTOEXT)) == NULL)
+ if ((bp = buf_load(pb->filename, BUF_AUTOEXT)) == NULL)
return (-1);
/* If this is a zero-ending RCSNUM eg 4.0, increment it (eg to 4.1) */
* If -f is not specified and there are no differences, tell
* the user and revert to latest version.
*/
- if (!(pb->flags & FORCE) && (rcs_buf_len(pb->deltatext) < 1)) {
+ if (!(pb->flags & FORCE) && (buf_len(pb->deltatext) < 1)) {
if (checkin_revert(pb) == -1)
return (-1);
else
}
/* Load file contents */
- if ((bp = rcs_buf_load(pb->filename, BUF_AUTOEXT)) == NULL)
+ if ((bp = buf_load(pb->filename, BUF_AUTOEXT)) == NULL)
return (-1);
/* Get default values from working copy if -k specified */
char *kwstr;
unsigned char *c, *end, *start;
- end = rcs_buf_get(data) + rcs_buf_len(data) - 1;
+ end = buf_get(data) + buf_len(data) - 1;
kwstr = NULL;
- left = rcs_buf_len(data);
- for (c = rcs_buf_get(data);
+ left = buf_len(data);
+ for (c = buf_get(data);
c <= end && (c = memchr(c, '$', left)) != NULL;
left = end - c + 1) {
size_t len;
}
len = c - start + 1;
- buf = rcs_buf_alloc(len + 1, 0);
- rcs_buf_append(buf, start, len);
+ buf = buf_alloc(len + 1, 0);
+ buf_append(buf, start, len);
/* XXX - Not binary safe. */
- rcs_buf_putc(buf, '\0');
- checkin_parsekeyword(rcs_buf_get(buf), rev, date, author, state);
+ buf_putc(buf, '\0');
+ checkin_parsekeyword(buf_get(buf), rev, date, author, state);
loopend:;
}
if (kwstr == NULL)
if (i < 5)
break;
(void)xasprintf(&datestring, "%s %s", tokens[3], tokens[4]);
- if ((*date = rcs_date_parse(datestring)) <= 0)
+ if ((*date = date_parse(datestring)) <= 0)
errx(1, "could not parse date");
xfree(datestring);
if (i < 3)
break;
(void)xasprintf(&datestring, "%s %s", tokens[1], tokens[2]);
- if ((*date = rcs_date_parse(datestring)) <= 0)
+ if ((*date = date_parse(datestring)) <= 0)
errx(1, "could not parse date");
xfree(datestring);
break;
-/* $OpenBSD: co.c,v 1.110 2009/02/25 23:16:20 ray Exp $ */
+/* $OpenBSD: co.c,v 1.111 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
rcsdate = givendate = -1;
if (date != NULL)
- givendate = rcs_date_parse(date);
+ givendate = date_parse(date);
if (file->rf_ndelta == 0 && !(flags & QUIET))
(void)fprintf(stderr,
TAILQ_FOREACH(rdp, &file->rf_delta, rd_list) {
if (date != NULL) {
fdate = asctime(&rdp->rd_date);
- rcsdate = rcs_date_parse(fdate);
+ rcsdate = date_parse(fdate);
if (givendate <= rcsdate)
continue;
}
return (-1);
}
} else {
- bp = rcs_buf_alloc(1, 0);
+ bp = buf_alloc(1, 0);
}
/*
}
if (flags & PIPEOUT)
- rcs_buf_write_fd(bp, STDOUT_FILENO);
+ buf_write_fd(bp, STDOUT_FILENO);
else {
(void)unlink(dst);
if ((fd = open(dst, O_WRONLY|O_CREAT|O_TRUNC, mode)) < 0)
err(1, "%s", dst);
- if (rcs_buf_write_fd(bp, fd) < 0) {
+ if (buf_write_fd(bp, fd) < 0) {
warnx("failed to write revision to file");
- rcs_buf_free(bp);
+ buf_free(bp);
(void)close(fd);
return (-1);
}
(void)close(fd);
}
- rcs_buf_free(bp);
+ buf_free(bp);
return (0);
}
}
(void)xasprintf(&tempfile, "%s/diff.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(bp, tempfile);
- rcs_buf_empty(bp);
+ buf_write_stmp(bp, tempfile);
+ buf_empty(bp);
diff_format = D_RCSDIFF;
ret = diffreg(dst, tempfile, bp, D_FORCEASCII);
- rcs_buf_free(bp);
+ buf_free(bp);
unlink(tempfile);
xfree(tempfile);
%{
-/* $OpenBSD: date.y,v 1.7 2010/07/23 09:14:58 ray Exp $ */
+/* $OpenBSD: date.y,v 1.8 2010/07/23 21:46:05 ray Exp $ */
/*
** Originally written by Steven M. Bellovin <smb@research.att.com> while
}
/*
- * rcs_date_parse()
+ * date_parse()
*
* Returns the number of seconds since the Epoch corresponding to the date.
*/
time_t
-rcs_date_parse(const char *p)
+date_parse(const char *p)
{
struct tm gmt, tm;
time_t Start, tod, nowtime, tz;
if (time(&nowtime) == -1 || !gmtime_r(&nowtime, &gmt) ||
!localtime_r(&nowtime, &tm))
- errx(1, "cvs_date_parse failed");
+ errx(1, "date_parse failed");
tz = difftm(&gmt, &tm) / 60;
(void)printf("Enter date, or blank line to exit.\n\t> ");
(void)fflush(stdout);
while (fgets(buff, sizeof(buff), stdin) && buff[0]) {
- d = rcs_date_parse(buff);
+ d = date_parse(buff);
if (d == -1)
(void)printf("Bad format - couldn't convert.\n");
else
-/* $OpenBSD: diff.c,v 1.30 2010/07/16 17:53:20 ray Exp $ */
+/* $OpenBSD: diff.c,v 1.31 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
if (i == -1)
err(1, "diff_output");
if (diffbuf != NULL)
- rcs_buf_append(diffbuf, str, strlen(str));
+ buf_append(diffbuf, str, strlen(str));
else
printf("%s", str);
xfree(str);
-/* $OpenBSD: diff.h,v 1.8 2009/07/14 14:09:46 jsg Exp $ */
+/* $OpenBSD: diff.h,v 1.9 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
*
* @(#)diffreg.c 8.1 (Berkeley) 6/6/93
*/
-
-#ifndef RCS_DIFF_H
-#define RCS_DIFF_H
+#ifndef DIFF_H
+#define DIFF_H
#include <sys/queue.h>
extern RCSNUM *diff_rev2;
extern regex_t *diff_ignore_re;
-#endif /* RCS_DIFF_H */
+#endif /* DIFF_H */
-/* $OpenBSD: diff3.c,v 1.29 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: diff3.c,v 1.30 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
static int eflag = 3; /* default -E for compatibility with former RCS */
static int oflag = 1; /* default -E for compatibility with former RCS */
static int debug = 0;
-static char f1mark[256], f3mark[256]; /* markers for -E and -X */
+static char f1mark[MAXPATHLEN], f3mark[MAXPATHLEN]; /* markers for -E and -X */
static int duplicate(struct range *, struct range *);
static int edit(struct diff *, int, int);
if ((flags & MERGE_EFLAG) && !(flags & MERGE_OFLAG))
oflag = 0;
- if ((b1 = rcs_buf_load(av[0], BUF_AUTOEXT)) == NULL)
+ if ((b1 = buf_load(av[0], BUF_AUTOEXT)) == NULL)
goto out;
- if ((b2 = rcs_buf_load(av[1], BUF_AUTOEXT)) == NULL)
+ if ((b2 = buf_load(av[1], BUF_AUTOEXT)) == NULL)
goto out;
- if ((b3 = rcs_buf_load(av[2], BUF_AUTOEXT)) == NULL)
+ if ((b3 = buf_load(av[2], BUF_AUTOEXT)) == NULL)
goto out;
- d1 = rcs_buf_alloc(128, BUF_AUTOEXT);
- d2 = rcs_buf_alloc(128, BUF_AUTOEXT);
- diffb = rcs_buf_alloc(128, BUF_AUTOEXT);
+ d1 = buf_alloc(128, BUF_AUTOEXT);
+ d2 = buf_alloc(128, BUF_AUTOEXT);
+ diffb = buf_alloc(128, BUF_AUTOEXT);
(void)xasprintf(&path1, "%s/diff1.XXXXXXXXXX", rcs_tmpdir);
(void)xasprintf(&path2, "%s/diff2.XXXXXXXXXX", rcs_tmpdir);
(void)xasprintf(&path3, "%s/diff3.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b1, path1);
- rcs_buf_write_stmp(b2, path2);
- rcs_buf_write_stmp(b3, path3);
+ buf_write_stmp(b1, path1);
+ buf_write_stmp(b2, path2);
+ buf_write_stmp(b3, path3);
- rcs_buf_free(b2);
+ buf_free(b2);
b2 = NULL;
if ((diffreg(path1, path3, d1, D_FORCEASCII) == D_ERROR) ||
(diffreg(path2, path3, d2, D_FORCEASCII) == D_ERROR)) {
- rcs_buf_free(diffb);
+ buf_free(diffb);
diffb = NULL;
goto out;
}
(void)xasprintf(&dp13, "%s/d13.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(d1, dp13);
+ buf_write_stmp(d1, dp13);
- rcs_buf_free(d1);
+ buf_free(d1);
d1 = NULL;
(void)xasprintf(&dp23, "%s/d23.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(d2, dp23);
+ buf_write_stmp(d2, dp23);
- rcs_buf_free(d2);
+ buf_free(d2);
d2 = NULL;
argc = 0;
diff3_conflicts = diff3_internal(argc, argv, av[0], av[2]);
if (diff3_conflicts < 0) {
- rcs_buf_free(diffb);
+ buf_free(diffb);
diffb = NULL;
goto out;
}
- plen = rcs_buf_len(diffb);
- patch = rcs_buf_release(diffb);
- dlen = rcs_buf_len(b1);
- data = rcs_buf_release(b1);
+ plen = buf_len(diffb);
+ patch = buf_release(diffb);
+ dlen = buf_len(b1);
+ data = buf_release(b1);
if ((diffb = rcs_patchfile(data, dlen, patch, plen, ed_patch_lines)) == NULL)
goto out;
out:
if (b2 != NULL)
- rcs_buf_free(b2);
+ buf_free(b2);
if (b3 != NULL)
- rcs_buf_free(b3);
+ buf_free(b3);
if (d1 != NULL)
- rcs_buf_free(d1);
+ buf_free(d1);
if (d2 != NULL)
- rcs_buf_free(d2);
+ buf_free(d2);
(void)unlink(path1);
(void)unlink(path2);
rcsnum_tostr(rev1, r1, sizeof(r1));
rcsnum_tostr(rev2, r2, sizeof(r2));
- if ((b1 = rcs_buf_load(workfile, BUF_AUTOEXT)) == NULL)
+ if ((b1 = buf_load(workfile, BUF_AUTOEXT)) == NULL)
goto out;
if (!(flags & QUIET))
if ((b3 = rcs_getrev(rf, rev2)) == NULL)
goto out;
- d1 = rcs_buf_alloc(128, BUF_AUTOEXT);
- d2 = rcs_buf_alloc(128, BUF_AUTOEXT);
- diffb = rcs_buf_alloc(128, BUF_AUTOEXT);
+ d1 = buf_alloc(128, BUF_AUTOEXT);
+ d2 = buf_alloc(128, BUF_AUTOEXT);
+ diffb = buf_alloc(128, BUF_AUTOEXT);
(void)xasprintf(&path1, "%s/diff1.XXXXXXXXXX", rcs_tmpdir);
(void)xasprintf(&path2, "%s/diff2.XXXXXXXXXX", rcs_tmpdir);
(void)xasprintf(&path3, "%s/diff3.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b1, path1);
- rcs_buf_write_stmp(b2, path2);
- rcs_buf_write_stmp(b3, path3);
+ buf_write_stmp(b1, path1);
+ buf_write_stmp(b2, path2);
+ buf_write_stmp(b3, path3);
- rcs_buf_free(b2);
+ buf_free(b2);
b2 = NULL;
if ((diffreg(path1, path3, d1, D_FORCEASCII) == D_ERROR) ||
(diffreg(path2, path3, d2, D_FORCEASCII) == D_ERROR)) {
- rcs_buf_free(diffb);
+ buf_free(diffb);
diffb = NULL;
goto out;
}
(void)xasprintf(&dp13, "%s/d13.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(d1, dp13);
+ buf_write_stmp(d1, dp13);
- rcs_buf_free(d1);
+ buf_free(d1);
d1 = NULL;
(void)xasprintf(&dp23, "%s/d23.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(d2, dp23);
+ buf_write_stmp(d2, dp23);
- rcs_buf_free(d2);
+ buf_free(d2);
d2 = NULL;
argc = 0;
diff3_conflicts = diff3_internal(argc, argv, workfile, r2);
if (diff3_conflicts < 0) {
- rcs_buf_free(diffb);
+ buf_free(diffb);
diffb = NULL;
goto out;
}
- plen = rcs_buf_len(diffb);
- patch = rcs_buf_release(diffb);
- dlen = rcs_buf_len(b1);
- data = rcs_buf_release(b1);
+ plen = buf_len(diffb);
+ patch = buf_release(diffb);
+ dlen = buf_len(b1);
+ data = buf_release(b1);
if ((diffb = rcs_patchfile(data, dlen, patch, plen, ed_patch_lines)) == NULL)
goto out;
out:
if (b2 != NULL)
- rcs_buf_free(b2);
+ buf_free(b2);
if (b3 != NULL)
- rcs_buf_free(b3);
+ buf_free(b3);
if (d1 != NULL)
- rcs_buf_free(d1);
+ buf_free(d1);
if (d2 != NULL)
- rcs_buf_free(d2);
+ buf_free(d2);
(void)unlink(path1);
(void)unlink(path2);
/* Skip blank lines */
if (lp->l_len < 2)
continue;
+
/* NUL-terminate line buffer for strtol() safety. */
tmp = lp->l_line[lp->l_len - 1];
lp->l_line[lp->l_len - 1] = '\0';
+
/* len - 1 is NUL terminator so we use len - 2 for 'op' */
op = lp->l_line[lp->l_len - 2];
start = (int)strtol(lp->l_line, &ep, 10);
+
/* Restore the last byte of the buffer */
lp->l_line[lp->l_len - 1] = tmp;
+
if (op == 'a') {
if (start > dlines->l_nblines ||
start < 0 || *ep != 'a')
(*dd)[i].old.from = (*dd)[i-1].old.to;
(*dd)[i].new.from = (*dd)[i-1].new.to;
}
+
(void)fclose(fp[0]);
return (i);
(void)fseek(fp[2], (long)de[n].new.from, SEEK_SET);
for (k = de[n].new.to-de[n].new.from; k > 0; k-= j) {
j = k > BUFSIZ ? BUFSIZ : k;
- if (fread(block, 1, (size_t)j,
- fp[2]) != (size_t)j)
+ if (fread(block, 1, j, fp[2]) != j)
return (-1);
block[j] = '\0';
diff_output("%s", block);
-/* $OpenBSD: ident.c,v 1.26 2009/10/15 10:08:43 sobrado Exp $ */
+/* $OpenBSD: ident.c,v 1.27 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org>
* All rights reserved.
BUF *bp;
size_t len;
- bp = rcs_buf_alloc(512, BUF_AUTOEXT);
+ bp = buf_alloc(512, BUF_AUTOEXT);
while ((c = getc(fp)) != VALDELIM) {
if (c == EOF)
goto out;
if (isalpha(c))
- rcs_buf_putc(bp, c);
+ buf_putc(bp, c);
else
goto out;
}
- rcs_buf_putc(bp, VALDELIM);
+ buf_putc(bp, VALDELIM);
while ((c = getc(fp)) != KEYDELIM) {
if (c == EOF)
if (c == '\n')
goto out;
- rcs_buf_putc(bp, c);
+ buf_putc(bp, c);
}
- len = rcs_buf_len(bp);
- if (rcs_buf_getc(bp, len - 1) != ' ')
+ len = buf_len(bp);
+ if (buf_getc(bp, len - 1) != ' ')
goto out;
/* append trailing KEYDELIM */
- rcs_buf_putc(bp, c);
+ buf_putc(bp, c);
/* Append newline for printing. */
- rcs_buf_putc(bp, '\n');
+ buf_putc(bp, '\n');
printf(" %c", KEYDELIM);
fflush(stdout);
- rcs_buf_write_fd(bp, STDOUT_FILENO);
+ buf_write_fd(bp, STDOUT_FILENO);
found++;
out:
if (bp != NULL)
- rcs_buf_free(bp);
+ buf_free(bp);
}
void
-/* $OpenBSD: merge.c,v 1.6 2007/04/26 21:49:33 sobrado Exp $ */
+/* $OpenBSD: merge.c,v 1.7 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
* All rights reserved.
status = 0;
if (flags & PIPEOUT)
- rcs_buf_write_fd(bp, STDOUT_FILENO);
+ buf_write_fd(bp, STDOUT_FILENO);
else {
/* XXX */
- if (rcs_buf_write(bp, argv[0], 0644) < 0)
- warnx("rcs_buf_write failed");
+ if (buf_write(bp, argv[0], 0644) < 0)
+ warnx("buf_write failed");
}
- rcs_buf_free(bp);
+ buf_free(bp);
return (status);
}
-/* $OpenBSD: rcs.c,v 1.58 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: rcs.c,v 1.59 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
*
* Get the whole contents of revision <rev> from the RCSFILE <rfp>. The
* returned buffer is dynamically allocated and should be released using
- * rcs_buf_free() once the caller is done using it.
+ * buf_free() once the caller is done using it.
*/
BUF*
rcs_getrev(RCSFILE *rfp, RCSNUM *frev)
len = rdp->rd_tlen;
if (len == 0) {
- rbuf = rcs_buf_alloc(1, 0);
- rcs_buf_empty(rbuf);
+ rbuf = buf_alloc(1, 0);
+ buf_empty(rbuf);
return (rbuf);
}
- rbuf = rcs_buf_alloc(len, BUF_AUTOEXT);
- rcs_buf_append(rbuf, rdp->rd_text, len);
+ rbuf = buf_alloc(len, BUF_AUTOEXT);
+ buf_append(rbuf, rdp->rd_text, len);
isbranch = 0;
brev = NULL;
rdp = rcs_findrev(rfp, crev);
if (rdp == NULL) {
- rcs_buf_free(rbuf);
+ buf_free(rbuf);
return (NULL);
}
plen = rdp->rd_tlen;
- dlen = rcs_buf_len(rbuf);
+ dlen = buf_len(rbuf);
patch = rdp->rd_text;
- data = rcs_buf_release(rbuf);
+ data = buf_release(rbuf);
/* check if we have parsed this rev's deltatext */
if (rdp->rd_tlen == 0)
rcs_parse_deltatexts(rfp, rdp->rd_num);
if ((nextbuf = rcs_getrev(rf, nextrdp->rd_num)) == NULL)
errx(1, "error getting revision");
- newdiff = rcs_buf_alloc(64, BUF_AUTOEXT);
+ newdiff = buf_alloc(64, BUF_AUTOEXT);
/* calculate new diff */
(void)xasprintf(&path_tmp1, "%s/diff1.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(nextbuf, path_tmp1);
- rcs_buf_free(nextbuf);
+ buf_write_stmp(nextbuf, path_tmp1);
+ buf_free(nextbuf);
(void)xasprintf(&path_tmp2, "%s/diff2.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(prevbuf, path_tmp2);
- rcs_buf_free(prevbuf);
+ buf_write_stmp(prevbuf, path_tmp2);
+ buf_free(prevbuf);
diff_format = D_RCSDIFF;
if (diffreg(path_tmp1, path_tmp2, newdiff, D_FORCEASCII) == D_ERROR)
if (timezone_flag != NULL)
rcs_set_tz(timezone_flag, rdp, &tb);
- len = rcs_buf_len(bp);
+ len = buf_len(bp);
- c = rcs_buf_get(bp);
+ c = buf_get(bp);
found = 0;
/* Final character in buffer. */
fin = c + len - 1;
errx(1, "rcs_expand_keywords: string truncated");
/* Concatenate everything together. */
- tmpbuf = rcs_buf_alloc(len + strlen(expbuf), BUF_AUTOEXT);
+ tmpbuf = buf_alloc(len + strlen(expbuf), BUF_AUTOEXT);
/* Append everything before keyword. */
- rcs_buf_append(tmpbuf, rcs_buf_get(newbuf),
- start - (unsigned char *)rcs_buf_get(newbuf));
+ buf_append(tmpbuf, buf_get(newbuf),
+ start - (unsigned char *)buf_get(newbuf));
/* Append keyword. */
- rcs_buf_append(tmpbuf, expbuf, strlen(expbuf));
+ buf_append(tmpbuf, expbuf, strlen(expbuf));
/* Point c to end of keyword. */
- c = rcs_buf_get(tmpbuf) + rcs_buf_len(tmpbuf) - 1;
+ c = buf_get(tmpbuf) + buf_len(tmpbuf) - 1;
/* Append everything after keyword. */
- rcs_buf_append(tmpbuf, end,
- ((unsigned char *)rcs_buf_get(newbuf) + rcs_buf_len(newbuf)) - end);
+ buf_append(tmpbuf, end,
+ ((unsigned char *)buf_get(newbuf) + buf_len(newbuf)) - end);
/* Point fin to end of data. */
- fin = rcs_buf_get(tmpbuf) + rcs_buf_len(tmpbuf) - 1;
+ fin = buf_get(tmpbuf) + buf_len(tmpbuf) - 1;
/* Recalculate new length. */
- len = rcs_buf_len(tmpbuf);
+ len = buf_len(tmpbuf);
/* tmpbuf is now ready, free old newbuf if allocated here. */
if (newbuf != bp)
- rcs_buf_free(newbuf);
+ buf_free(newbuf);
newbuf = tmpbuf;
}
}
if (rdp->rd_text != NULL)
xfree(rdp->rd_text);
- len = rcs_buf_len(bp);
- dtext = rcs_buf_release(bp);
+ len = buf_len(bp);
+ dtext = buf_release(bp);
bp = NULL;
+
if (len != 0) {
rdp->rd_text = xmalloc(len);
rdp->rd_tlen = len;
-/* $OpenBSD: rcs.h,v 1.8 2008/02/02 16:21:38 xsa Exp $ */
+/* $OpenBSD: rcs.h,v 1.9 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
#define RCS_SYM_INVALCHAR "$,.:;@"
-
#define RCS_MAGIC_BRANCH ".0."
#define RCS_STATE_EXP "Exp"
#define RCS_STATE_DEAD "dead"
#define RCS_LOCK_LOOSE 0
#define RCS_LOCK_STRICT 1
-
/*
* Keyword expansion table
*/
((k & RCS_KWEXP_ERR) || \
((k & RCS_KWEXP_OLD) && (k & ~RCS_KWEXP_OLD)))
-
struct rcs_kw {
char kw_str[16];
int kw_type;
u_int16_t *rn_id;
} RCSNUM;
-
struct rcs_access {
char *ra_name;
uid_t ra_uid;
TAILQ_ENTRY(rcs_lock) rl_list;
};
-
struct rcs_branch {
RCSNUM *rb_num;
TAILQ_ENTRY(rcs_branch) rb_list;
-/* $OpenBSD: rcsclean.c,v 1.50 2007/06/30 08:23:49 xsa Exp $ */
+/* $OpenBSD: rcsclean.c,v 1.51 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
warnx("failed to get needed revision");
goto out;
}
- if ((b2 = rcs_buf_load(fname, 0)) == NULL) {
+ if ((b2 = buf_load(fname, 0)) == NULL) {
warnx("failed to load `%s'", fname);
goto out;
}
/* If buffer lengths are the same, compare contents as well. */
- if (rcs_buf_len(b1) != rcs_buf_len(b2))
+ if (buf_len(b1) != buf_len(b2))
match = 0;
else {
size_t len, n;
- len = rcs_buf_len(b1);
+ len = buf_len(b1);
match = 1;
for (n = 0; n < len; ++n)
- if (rcs_buf_getc(b1, n) != rcs_buf_getc(b2, n)) {
+ if (buf_getc(b1, n) != buf_getc(b2, n)) {
match = 0;
break;
}
out:
if (b1 != NULL)
- rcs_buf_free(b1);
+ buf_free(b1);
if (b2 != NULL)
- rcs_buf_free(b2);
+ buf_free(b2);
if (file != NULL)
rcs_close(file);
}
-/* $OpenBSD: rcsdiff.c,v 1.75 2007/07/03 00:56:23 ray Exp $ */
+/* $OpenBSD: rcsdiff.c,v 1.76 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
tv[0].tv_sec = (long)rcs_rev_getdate(file, rev);
tv[1].tv_sec = tv[0].tv_sec;
- if ((b2 = rcs_buf_load(filename, BUF_AUTOEXT)) == NULL) {
+ if ((b2 = buf_load(filename, BUF_AUTOEXT)) == NULL) {
warnx("failed to load file: `%s'", filename);
goto out;
}
tv2[1].tv_sec = t;
(void)xasprintf(&path1, "%s/diff1.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b1, path1);
+ buf_write_stmp(b1, path1);
- rcs_buf_free(b1);
+ buf_free(b1);
b1 = NULL;
if (utimes(path1, (const struct timeval *)&tv) < 0)
warn("utimes");
(void)xasprintf(&path2, "%s/diff2.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b2, path2);
+ buf_write_stmp(b2, path2);
- rcs_buf_free(b2);
+ buf_free(b2);
b2 = NULL;
if (utimes(path2, (const struct timeval *)&tv2) < 0)
if (fd != -1)
(void)close(fd);
if (b1 != NULL)
- rcs_buf_free(b1);
+ buf_free(b1);
if (b2 != NULL)
- rcs_buf_free(b2);
+ buf_free(b2);
if (path1 != NULL)
xfree(path1);
if (path2 != NULL)
fprintf(stderr, "%s -r%s -r%s\n", diffargs, rbuf1, rbuf2);
(void)xasprintf(&path1, "%s/diff1.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b1, path1);
+ buf_write_stmp(b1, path1);
- rcs_buf_free(b1);
+ buf_free(b1);
b1 = NULL;
if (utimes(path1, (const struct timeval *)&tv) < 0)
warn("utimes");
(void)xasprintf(&path2, "%s/diff2.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b2, path2);
+ buf_write_stmp(b2, path2);
- rcs_buf_free(b2);
+ buf_free(b2);
b2 = NULL;
if (utimes(path2, (const struct timeval *)&tv2) < 0)
out:
if (b1 != NULL)
- rcs_buf_free(b1);
+ buf_free(b1);
if (b2 != NULL)
- rcs_buf_free(b2);
+ buf_free(b2);
if (path1 != NULL)
xfree(path1);
if (path2 != NULL)
-/* $OpenBSD: rcsmerge.c,v 1.51 2007/06/30 08:23:49 xsa Exp $ */
+/* $OpenBSD: rcsmerge.c,v 1.52 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
* All rights reserved.
status = 0;
if (flags & PIPEOUT)
- rcs_buf_write_fd(bp, STDOUT_FILENO);
+ buf_write_fd(bp, STDOUT_FILENO);
else {
/* XXX mode */
- if (rcs_buf_write(bp, argv[0], 0644) < 0)
- warnx("rcs_buf_write failed");
+ if (buf_write(bp, argv[0], 0644) < 0)
+ warnx("buf_write failed");
}
- rcs_buf_free(bp);
+ buf_free(bp);
out:
rcs_close(file);
-/* $OpenBSD: rcsnum.c,v 1.11 2008/05/22 07:03:02 joris Exp $ */
+/* $OpenBSD: rcsnum.c,v 1.12 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
* rightside of the branch number, so instead of having an odd
* number of dot-separated decimals, it will have an even number.
*
- * Now, according to all the documentation i've found on the net
- * about this, cvs does this for "efficiency reasons", i'd like
+ * Now, according to all the documentation I've found on the net
+ * about this, cvs does this for "efficiency reasons", I'd like
* to hear one.
*
* We just make sure we remove the .0. from in the branch number.
s--;
/*
- * If we have a "magic" branch, adjust it
- * so the .0. is removed.
- */
+ * If we have a "magic" branch, adjust it
+ * so the .0. is removed.
+ */
if (!strncmp(s, RCS_MAGIC_BRANCH,
strlen(RCS_MAGIC_BRANCH))) {
nump->rn_id[nump->rn_len - 1] =
-/* $OpenBSD: rcsprog.h,v 1.62 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: rcsprog.h,v 1.63 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
extern struct wklhead temp_files;
/* date.y */
-time_t rcs_date_parse(const char *);
+time_t date_parse(const char *);
/* ci.c */
int checkin_main(int, char **);
-/* $OpenBSD: rcsutil.c,v 1.33 2008/05/10 20:23:24 joris Exp $ */
+/* $OpenBSD: rcsutil.c,v 1.34 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
size_t len;
char *buf;
- bp = rcs_buf_alloc(0, BUF_AUTOEXT);
+ bp = buf_alloc(0, BUF_AUTOEXT);
if (isatty(STDIN_FILENO))
(void)fprintf(stderr, "%s", prompt);
if (isatty(STDIN_FILENO))
if (buf[0] == '.' && (len == 1 || buf[1] == '\n'))
break;
else
- rcs_buf_append(bp, buf, len);
+ buf_append(bp, buf, len);
if (isatty(STDIN_FILENO))
(void)fprintf(stderr, ">> ");
}
- rcs_buf_putc(bp, '\0');
+ buf_putc(bp, '\0');
- return (rcs_buf_release(bp));
+ return (buf_release(bp));
}
u_int
/* Description is in file <in>. */
if (in != NULL && *in != '-') {
- if ((bp = rcs_buf_load(in, BUF_AUTOEXT)) == NULL)
+ if ((bp = buf_load(in, BUF_AUTOEXT)) == NULL)
return (-1);
- rcs_buf_putc(bp, '\0');
- content = rcs_buf_release(bp);
+ buf_putc(bp, '\0');
+ content = buf_release(bp);
/* Description is in <in>. */
} else if (in != NULL)
/* Skip leading `-'. */
return (NULL);
}
- res = rcs_buf_alloc(1024, BUF_AUTOEXT);
+ res = buf_alloc(1024, BUF_AUTOEXT);
TAILQ_FOREACH(lp, &dlines->l_lines, l_list) {
if (lp->l_line == NULL)
continue;
- rcs_buf_append(res, lp->l_line, lp->l_len);
+ buf_append(res, lp->l_line, lp->l_len);
}
rcs_freelines(dlines);
-/* $OpenBSD: rlog.c,v 1.62 2009/02/15 12:55:18 joris Exp $ */
+/* $OpenBSD: rlog.c,v 1.63 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2005, 2009 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
if (last == NULL) {
flags |= RLOG_DATE_SINGLE;
- firstdate = rcs_date_parse(first);
+ firstdate = date_parse(first);
delim = '\0';
last = "\0";
} else {
if (delim == '>' && *last == '\0') {
flags |= RLOG_DATE_EARLIER;
- firstdate = rcs_date_parse(first);
+ firstdate = date_parse(first);
}
if (delim == '>' && *first == '\0' && *last != '\0') {
flags |= RLOG_DATE_LATER;
- firstdate = rcs_date_parse(last);
+ firstdate = date_parse(last);
}
if (delim == '<' && *last == '\0') {
flags |= RLOG_DATE_LATER;
- firstdate = rcs_date_parse(first);
+ firstdate = date_parse(first);
}
if (delim == '<' && *first == '\0' && *last != '\0') {
flags |= RLOG_DATE_EARLIER;
- firstdate = rcs_date_parse(last);
+ firstdate = date_parse(last);
}
if (*first != '\0' && *last != '\0') {
flags |= RLOG_DATE_RANGE;
if (delim == '<') {
- firstdate = rcs_date_parse(first);
- lastdate = rcs_date_parse(last);
+ firstdate = date_parse(first);
+ lastdate = date_parse(last);
} else {
- firstdate = rcs_date_parse(last);
- lastdate = rcs_date_parse(first);
+ firstdate = date_parse(last);
+ lastdate = date_parse(first);
}
}