summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2010-07-23 21:46:06 +0000
committerRay Lai <ray@cvs.openbsd.org>2010-07-23 21:46:06 +0000
commite8df46ebc95c21d2fa189e326823cccada62e7cc (patch)
tree48c7fb4aadada0cc104af21571a8b98cda5a6187
parent4f1a72500c438538bed55293f2e724efc28584f0 (diff)
Reduce variable/function name and whitespace differences between
cvs/rcs. OK xsa zinovik
-rw-r--r--usr.bin/cvs/add.c20
-rw-r--r--usr.bin/cvs/annotate.c8
-rw-r--r--usr.bin/cvs/buf.c61
-rw-r--r--usr.bin/cvs/buf.h32
-rw-r--r--usr.bin/cvs/checkout.c4
-rw-r--r--usr.bin/cvs/client.c12
-rw-r--r--usr.bin/cvs/commit.c60
-rw-r--r--usr.bin/cvs/cvs.h4
-rw-r--r--usr.bin/cvs/date.y10
-rw-r--r--usr.bin/cvs/diff.c12
-rw-r--r--usr.bin/cvs/diff.h26
-rw-r--r--usr.bin/cvs/diff3.c47
-rw-r--r--usr.bin/cvs/diff_internals.c6
-rw-r--r--usr.bin/cvs/file.c10
-rw-r--r--usr.bin/cvs/getlog.c20
-rw-r--r--usr.bin/cvs/history.c14
-rw-r--r--usr.bin/cvs/import.c54
-rw-r--r--usr.bin/cvs/init.c4
-rw-r--r--usr.bin/cvs/logmsg.c12
-rw-r--r--usr.bin/cvs/rcs.c84
-rw-r--r--usr.bin/cvs/rcs.h16
-rw-r--r--usr.bin/cvs/remote.c6
-rw-r--r--usr.bin/cvs/server.c12
-rw-r--r--usr.bin/cvs/trigger.c70
-rw-r--r--usr.bin/cvs/update.c20
-rw-r--r--usr.bin/cvs/util.c12
-rw-r--r--usr.bin/cvs/util.h14
-rw-r--r--usr.bin/rcs/buf.c93
-rw-r--r--usr.bin/rcs/buf.h36
-rw-r--r--usr.bin/rcs/ci.c46
-rw-r--r--usr.bin/rcs/co.c22
-rw-r--r--usr.bin/rcs/date.y10
-rw-r--r--usr.bin/rcs/diff.c4
-rw-r--r--usr.bin/rcs/diff.h9
-rw-r--r--usr.bin/rcs/diff3.c104
-rw-r--r--usr.bin/rcs/ident.c22
-rw-r--r--usr.bin/rcs/merge.c10
-rw-r--r--usr.bin/rcs/rcs.c57
-rw-r--r--usr.bin/rcs/rcs.h7
-rw-r--r--usr.bin/rcs/rcsclean.c14
-rw-r--r--usr.bin/rcs/rcsdiff.c28
-rw-r--r--usr.bin/rcs/rcsmerge.c10
-rw-r--r--usr.bin/rcs/rcsnum.c12
-rw-r--r--usr.bin/rcs/rcsprog.h4
-rw-r--r--usr.bin/rcs/rcsutil.c20
-rw-r--r--usr.bin/rcs/rlog.c20
46 files changed, 586 insertions, 592 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c
index 06f2630f114..d72df948ce0 100644
--- a/usr.bin/cvs/add.c
+++ b/usr.bin/cvs/add.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -210,19 +210,19 @@ cvs_add_loginfo(char *repo)
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
@@ -283,7 +283,7 @@ cvs_add_tobranch(struct cvs_file *cf, char *tag)
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)
diff --git a/usr.bin/cvs/annotate.c b/usr.bin/cvs/annotate.c
index eaaa9bd45af..ac63148c99c 100644
--- a/usr.bin/cvs/annotate.c
+++ b/usr.bin/cvs/annotate.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -69,7 +69,7 @@ cvs_annotate(int argc, char **argv)
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;
@@ -156,8 +156,8 @@ cvs_annotate_local(struct cvs_file *cf)
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);
diff --git a/usr.bin/cvs/buf.c b/usr.bin/cvs/buf.c
index baf9baa2c6d..85a3ebe0b20 100644
--- a/usr.bin/cvs/buf.c
+++ b/usr.bin/cvs/buf.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -44,18 +44,19 @@
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
@@ -68,44 +69,44 @@ cvs_buf_alloc(size_t len)
}
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);
@@ -113,7 +114,7 @@ cvs_buf_free(BUF *b)
}
u_char *
-cvs_buf_release(BUF *b)
+buf_release(BUF *b)
{
u_char *tmp;
@@ -123,7 +124,7 @@ cvs_buf_release(BUF *b)
}
void
-cvs_buf_putc(BUF *b, int c)
+buf_putc(BUF *b, int c)
{
u_char *bp;
@@ -137,13 +138,13 @@ cvs_buf_putc(BUF *b, int c)
}
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;
@@ -162,13 +163,13 @@ cvs_buf_append(BUF *b, const void *data, size_t len)
}
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);
@@ -176,7 +177,7 @@ cvs_buf_write_fd(BUF *b, int fd)
}
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:
@@ -187,9 +188,9 @@ 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)
@@ -201,39 +202,39 @@ open:
}
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);
diff --git a/usr.bin/cvs/buf.h b/usr.bin/cvs/buf.h
index 66fc66e9e76..82c8398e6c4 100644
--- a/usr.bin/cvs/buf.h
+++ b/usr.bin/cvs/buf.h
@@ -1,4 +1,4 @@
-/* $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.
@@ -29,21 +29,21 @@
#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 */
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index 63d2da997a2..1f6d3622270 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $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>
*
@@ -95,7 +95,7 @@ cvs_checkout(int argc, char **argv)
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':
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c
index a9f656f0268..b41f101f6cc 100644
--- a/usr.bin/cvs/client.c
+++ b/usr.bin/cvs/client.c
@@ -1,4 +1,4 @@
-/* $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>
*
@@ -135,20 +135,20 @@ client_get_supported_responses(void)
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);
}
diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c
index 31dc8870b81..f51ea1c3ad1 100644
--- a/usr.bin/cvs/commit.c
+++ b/usr.bin/cvs/commit.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -237,54 +237,54 @@ cvs_commit_loginfo(char *repo)
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
@@ -610,7 +610,7 @@ cvs_commit_local(struct cvs_file *cf)
} 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) {
@@ -736,9 +736,9 @@ commit_diff(struct cvs_file *cf, RCSNUM *rev, int reverse)
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);
}
@@ -746,7 +746,7 @@ commit_diff(struct cvs_file *cf, RCSNUM *rev, int reverse)
(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;
@@ -785,9 +785,9 @@ commit_desc_set(struct cvs_file *cf)
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);
diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h
index f0edcf20380..bbb9aa0bf47 100644
--- a/usr.bin/cvs/cvs.h
+++ b/usr.bin/cvs/cvs.h
@@ -1,4 +1,4 @@
-/* $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.
@@ -356,7 +356,7 @@ const char *cvs_var_get(const char *);
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 *);
diff --git a/usr.bin/cvs/date.y b/usr.bin/cvs/date.y
index 93da8115e54..494af2b3933 100644
--- a/usr.bin/cvs/date.y
+++ b/usr.bin/cvs/date.y
@@ -1,5 +1,5 @@
%{
-/* $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
@@ -800,12 +800,12 @@ difftm(struct tm *a, struct tm *b)
}
/*
- * 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;
@@ -814,7 +814,7 @@ cvs_date_parse(const char *p)
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;
@@ -879,7 +879,7 @@ main(int argc, char **argv)
(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
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c
index 0fd878d7ad6..4900eda2b32 100644
--- a/usr.bin/cvs/diff.c
+++ b/usr.bin/cvs/diff.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -97,10 +97,10 @@ cvs_diff(int argc, char **argv)
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"
@@ -495,14 +495,14 @@ cvs_diff_local(struct cvs_file *cf)
} 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);
}
}
diff --git a/usr.bin/cvs/diff.h b/usr.bin/cvs/diff.h
index 757b272b391..16934ca551d 100644
--- a/usr.bin/cvs/diff.h
+++ b/usr.bin/cvs/diff.h
@@ -1,4 +1,4 @@
-/* $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.
@@ -63,8 +63,8 @@
*
* @(#)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 */
/*
@@ -80,13 +80,13 @@
/*
* 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
@@ -105,7 +105,7 @@
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;
@@ -116,11 +116,11 @@ extern int diff_iflag;
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 */
diff --git a/usr.bin/cvs/diff3.c b/usr.bin/cvs/diff3.c
index 7bbc01da0b2..ec74dcca1f4 100644
--- a/usr.bin/cvs/diff3.c
+++ b/usr.bin/cvs/diff3.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -104,8 +104,8 @@ struct diff {
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
@@ -114,8 +114,8 @@ static struct diff *d23 = NULL;
* 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) */
@@ -162,8 +162,8 @@ cvs_merge_file(struct cvs_file *cf, int verbose)
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;
@@ -171,16 +171,16 @@ cvs_merge_file(struct cvs_file *cf, int verbose)
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);
@@ -192,12 +192,12 @@ cvs_merge_file(struct cvs_file *cf, int verbose)
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;
@@ -218,10 +218,10 @@ cvs_merge_file(struct cvs_file *cf, int verbose)
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",
@@ -320,10 +320,10 @@ diff3_internal(int argc, char **argv, const char *fmark, const char *rmark)
}
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;
@@ -799,8 +799,7 @@ edscript(int n)
(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);
diff --git a/usr.bin/cvs/diff_internals.c b/usr.bin/cvs/diff_internals.c
index 40e4d744213..7c83f745865 100644
--- a/usr.bin/cvs/diff_internals.c
+++ b/usr.bin/cvs/diff_internals.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -204,7 +204,7 @@ const char *diff_file1 = NULL;
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;
@@ -1446,7 +1446,7 @@ diff_output(const char *fmt, ...)
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);
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index 1150d4aec1c..b4109847796 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -808,14 +808,14 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
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 &&
diff --git a/usr.bin/cvs/getlog.c b/usr.bin/cvs/getlog.c
index 2b2028e5413..73917bc02a0 100644
--- a/usr.bin/cvs/getlog.c
+++ b/usr.bin/cvs/getlog.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -452,7 +452,7 @@ date_select(RCSFILE *file, char *date)
if (last == NULL) {
flags |= LDATE_SINGLE;
- firstdate = cvs_date_parse(first);
+ firstdate = date_parse(first);
delim = '\0';
last = "\0";
} else {
@@ -462,33 +462,33 @@ date_select(RCSFILE *file, char *date)
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);
}
}
diff --git a/usr.bin/cvs/history.c b/usr.bin/cvs/history.c
index 05d9e7ecc9b..82b944cecb3 100644
--- a/usr.bin/cvs/history.c
+++ b/usr.bin/cvs/history.c
@@ -1,4 +1,4 @@
-/* $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>
*
@@ -130,23 +130,23 @@ cvs_history_add(int type, struct cvs_file *cf, const char *argument)
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:
diff --git a/usr.bin/cvs/import.c b/usr.bin/cvs/import.c
index f07d5d08517..3edd9ce5b65 100644
--- a/usr.bin/cvs/import.c
+++ b/usr.bin/cvs/import.c
@@ -1,4 +1,4 @@
-/* $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>
*
@@ -183,7 +183,7 @@ cvs_import(int argc, char **argv)
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);
@@ -209,7 +209,7 @@ import_printf(const char *fmt, ...)
va_end(vap);
cvs_printf("%s", str);
- cvs_buf_puts(logbuf, str);
+ buf_puts(logbuf, str);
xfree(str);
}
@@ -265,29 +265,29 @@ import_loginfo(char *repo)
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
@@ -322,7 +322,7 @@ import_new(struct cvs_file *cf)
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");
@@ -397,11 +397,11 @@ import_update(struct cvs_file *cf)
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);
@@ -463,13 +463,13 @@ import_get_rcsdiff(struct cvs_file *cf, RCSNUM *rev)
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);
diff --git a/usr.bin/cvs/init.c b/usr.bin/cvs/init.c
index 338dcf0100a..14694061035 100644
--- a/usr.bin/cvs/init.c
+++ b/usr.bin/cvs/init.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -177,7 +177,7 @@ init_mkfile(char *path, const char **content)
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");
diff --git a/usr.bin/cvs/logmsg.c b/usr.bin/cvs/logmsg.c
index f817f729342..12e667de44f 100644
--- a/usr.bin/cvs/logmsg.c
+++ b/usr.bin/cvs/logmsg.c
@@ -1,4 +1,4 @@
-/* $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>
*
@@ -62,7 +62,7 @@ cvs_logmsg_read(const char *path)
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';
@@ -78,8 +78,8 @@ cvs_logmsg_read(const char *path)
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)
@@ -87,8 +87,8 @@ cvs_logmsg_read(const char *path)
(void)fclose(fp);
- cvs_buf_putc(bp, '\0');
- return (cvs_buf_release(bp));
+ buf_putc(bp, '\0');
+ return (buf_release(bp));
}
char *
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index d14cceed78c..3eac5b26018 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -211,8 +211,8 @@ static struct rcs_key {
#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 *);
@@ -232,8 +232,8 @@ static int rcs_pushtok(RCSFILE *, const char *, int);
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;
@@ -1025,12 +1025,12 @@ rcs_comment_set(RCSFILE *file, const char *comment)
}
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;
@@ -1136,8 +1136,8 @@ rcs_patch_lines(struct cvs_lines *dlines, struct cvs_lines *plines,
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;
@@ -1339,7 +1339,7 @@ rcs_rev_remove(RCSFILE *rf, RCSNUM *rev)
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);
@@ -2504,8 +2504,8 @@ rcs_deltatext_set(RCSFILE *rfp, RCSNUM *rev, BUF *bp)
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) {
@@ -2709,10 +2709,10 @@ rcs_get_revision(const char *revstr, RCSFILE *rfp)
* 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;
@@ -2720,8 +2720,8 @@ rcs_rev_getlines(RCSFILE *rfp, RCSNUM *frev, struct cvs_line ***alines)
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)
@@ -2759,7 +2759,7 @@ rcs_rev_getlines(RCSFILE *rfp, RCSNUM *frev, struct cvs_line ***alines)
i++;
}
- *alines = xcalloc(i + 1, sizeof(struct cvs_line *));
+ *alines = xcalloc(i + 1, sizeof(struct rcs_line *));
(*alines)[i] = NULL;
annotate = ANNOTATE_NOW;
@@ -2815,7 +2815,7 @@ again:
i++;
}
- *alines = xcalloc(i + 1, sizeof(struct cvs_line *));
+ *alines = xcalloc(i + 1, sizeof(struct rcs_line *));
(*alines)[i] = NULL;
annotate = ANNOTATE_NOW;
@@ -2891,7 +2891,7 @@ done:
}
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;
@@ -2899,8 +2899,8 @@ rcs_annotate_getlines(RCSFILE *rfp, RCSNUM *frev, struct cvs_line ***alines)
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");
@@ -2992,7 +2992,7 @@ rcs_annotate_getlines(RCSFILE *rfp, RCSNUM *frev, struct cvs_line ***alines)
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;
@@ -3015,13 +3015,13 @@ rcs_rev_getbuf(RCSFILE *rfp, RCSNUM *rev, int mode)
{
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)
@@ -3048,7 +3048,7 @@ rcs_rev_getbuf(RCSFILE *rfp, RCSNUM *rev, int mode)
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);
}
@@ -3071,8 +3071,8 @@ rcs_rev_write_fd(RCSFILE *rfp, RCSNUM *rev, int _fd, int mode)
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;
@@ -3157,8 +3157,8 @@ rcs_rev_write_stmp(RCSFILE *rfp, RCSNUM *rev, char *template, int mode)
}
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;
@@ -3350,7 +3350,7 @@ rcs_kwexp_line(char *rcsfile, struct rcs_delta *rdp, struct cvs_lines *lines,
/* 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;
@@ -3490,28 +3490,28 @@ rcs_kwexp_line(char *rcsfile, struct rcs_delta *rdp, struct cvs_lines *lines,
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;
}
}
diff --git a/usr.bin/cvs/rcs.h b/usr.bin/cvs/rcs.h
index 3935d68e0c3..a5a736d2b06 100644
--- a/usr.bin/cvs/rcs.h
+++ b/usr.bin/cvs/rcs.h
@@ -1,4 +1,4 @@
-/* $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.
@@ -142,12 +142,12 @@ struct rcs_lock {
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);
@@ -191,8 +191,8 @@ typedef struct rcs_file {
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 *);
@@ -236,10 +236,10 @@ RCSNUM *rcs_tag_resolve(RCSFILE *, const char *);
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 *);
diff --git a/usr.bin/cvs/remote.c b/usr.bin/cvs/remote.c
index 09a828cac57..162fe539282 100644
--- a/usr.bin/cvs/remote.c
+++ b/usr.bin/cvs/remote.c
@@ -1,4 +1,4 @@
-/* $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>
*
@@ -219,8 +219,8 @@ cvs_remote_send_file_buf(char *file, BUF *bp, mode_t mode)
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);
diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c
index 5e846b39b6c..2ae21a980be 100644
--- a/usr.bin/cvs/server.c
+++ b/usr.bin/cvs/server.c
@@ -1,4 +1,4 @@
-/* $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>
*
@@ -219,21 +219,21 @@ cvs_server_validreq(char *data)
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");
diff --git a/usr.bin/cvs/trigger.c b/usr.bin/cvs/trigger.c
index 54f64334fb4..f2d3f010b73 100644
--- a/usr.bin/cvs/trigger.c
+++ b/usr.bin/cvs/trigger.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -71,10 +71,10 @@ expand_args(BUF *buf, struct file_info_list *file_info, const char *repo,
}
}
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')
@@ -84,16 +84,16 @@ expand_args(BUF *buf, struct file_info_list *file_info, const char *repo,
* 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);
}
@@ -155,10 +155,10 @@ expand_args(BUF *buf, struct file_info_list *file_info, const char *repo,
}
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)
@@ -170,11 +170,11 @@ expand_args(BUF *buf, struct file_info_list *file_info, const char *repo,
*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;
}
@@ -190,14 +190,14 @@ expand_var(BUF *buf, const char *var)
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) {
@@ -205,7 +205,7 @@ expand_var(BUF *buf, const char *var)
"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");
@@ -261,13 +261,13 @@ parse_cmd(int type, char *cmd, const char *repo,
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;
}
@@ -332,14 +332,14 @@ again:
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);
}
@@ -552,19 +552,19 @@ cvs_trigger_loginfo_header(BUF *buf, char *repo)
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');
}
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c
index 7d51f981a74..5a0b2c78c8d 100644
--- a/usr.bin/cvs/update.c
+++ b/usr.bin/cvs/update.c
@@ -1,4 +1,4 @@
-/* $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>
*
@@ -78,7 +78,7 @@ cvs_update(int argc, char **argv)
break;
case 'D':
dateflag = optarg;
- cvs_specified_date = cvs_date_parse(dateflag);
+ cvs_specified_date = date_parse(dateflag);
reset_tag = 0;
break;
case 'd':
@@ -529,8 +529,8 @@ update_has_conflict_markers(struct cvs_file *cf)
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);
@@ -538,11 +538,11 @@ update_has_conflict_markers(struct cvs_file *cf)
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");
@@ -592,7 +592,7 @@ update_join_file(struct cvs_file *cf)
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);
@@ -601,7 +601,7 @@ update_join_file(struct cvs_file *cf)
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);
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c
index 458249124fd..f94e920c717 100644
--- a/usr.bin/cvs/util.c
+++ b/usr.bin/cvs/util.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -685,13 +685,13 @@ cvs_mkpath(const char *path, char *tag)
/*
* 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));
@@ -717,9 +717,9 @@ cvs_splitlines(u_char *data, size_t len)
}
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);
diff --git a/usr.bin/cvs/util.h b/usr.bin/cvs/util.h
index 2ead529e144..d595c6b4848 100644
--- a/usr.bin/cvs/util.h
+++ b/usr.bin/cvs/util.h
@@ -1,4 +1,4 @@
-/* $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.
@@ -44,19 +44,19 @@ void cvs_freeargv(char **, int);
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;
};
@@ -66,8 +66,8 @@ struct cvs_argvector {
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);
diff --git a/usr.bin/rcs/buf.c b/usr.bin/rcs/buf.c
index 7849f66c1ee..43c67439827 100644
--- a/usr.bin/rcs/buf.c
+++ b/usr.bin/rcs/buf.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -41,7 +41,7 @@
#define BUF_INCR 128
-struct rcs_buf {
+struct buf {
u_int cb_flags;
/* buffer handle, buffer size, and data length */
@@ -52,17 +52,17 @@ struct rcs_buf {
#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;
@@ -81,7 +81,7 @@ rcs_buf_alloc(size_t len, u_int flags)
}
/*
- * rcs_buf_load()
+ * buf_load()
*
* Open the file specified by <path> and load all of its contents into a
* buffer.
@@ -89,7 +89,7 @@ rcs_buf_alloc(size_t len, u_int flags)
* 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;
@@ -110,7 +110,7 @@ rcs_buf_load(const char *path, u_int flags)
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);
@@ -118,7 +118,7 @@ rcs_buf_load(const char *path, u_int flags)
int saved_errno;
saved_errno = errno;
- rcs_buf_free(buf);
+ buf_free(buf);
buf = NULL;
errno = saved_errno;
goto out;
@@ -141,13 +141,8 @@ 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);
@@ -155,14 +150,14 @@ rcs_buf_free(BUF *b)
}
/*
- * 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;
@@ -172,33 +167,33 @@ rcs_buf_release(BUF *b)
}
/*
- * 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;
@@ -206,9 +201,9 @@ rcs_buf_putc(BUF *b, int c)
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;
@@ -218,19 +213,19 @@ rcs_buf_putc(BUF *b, int c)
}
/*
- * 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
@@ -239,7 +234,7 @@ rcs_buf_getc(BUF *b, size_t pos)
* 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;
@@ -251,7 +246,7 @@ rcs_buf_append(BUF *b, const void *data, size_t len)
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;
@@ -264,11 +259,11 @@ rcs_buf_append(BUF *b, const void *data, size_t len)
}
/*
- * 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;
@@ -280,31 +275,31 @@ rcs_buf_fappend(BUF *b, const char *fmt, ...)
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;
@@ -329,13 +324,13 @@ rcs_buf_write_fd(BUF *b, int fd)
}
/*
- * 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:
@@ -346,9 +341,9 @@ rcs_buf_write(BUF *b, const char *path, mode_t mode)
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)
@@ -360,14 +355,14 @@ rcs_buf_write(BUF *b, const char *path, mode_t mode)
}
/*
- * 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;
@@ -376,22 +371,22 @@ rcs_buf_write_stmp(BUF *b, char *template)
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;
diff --git a/usr.bin/rcs/buf.h b/usr.bin/rcs/buf.h
index 16ded552b25..990a4b8195f 100644
--- a/usr.bin/rcs/buf.h
+++ b/usr.bin/rcs/buf.h
@@ -1,4 +1,4 @@
-/* $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.
@@ -27,11 +27,11 @@
* -----------------
*
* 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.
*/
@@ -43,21 +43,21 @@
/* 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 */
diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c
index 72aa4f3e116..f53697e95cd 100644
--- a/usr.bin/rcs/ci.c
+++ b/usr.bin/rcs/ci.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -136,7 +136,7 @@ checkin_main(int argc, char **argv)
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':
@@ -348,7 +348,7 @@ checkin_diff_file(struct checkin_params *pb)
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;
}
@@ -359,21 +359,21 @@ checkin_diff_file(struct checkin_params *pb)
}
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;
@@ -383,11 +383,11 @@ checkin_diff_file(struct checkin_params *pb)
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)
@@ -451,7 +451,7 @@ checkin_update(struct checkin_params *pb)
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) */
@@ -511,7 +511,7 @@ checkin_update(struct checkin_params *pb)
* 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
@@ -627,7 +627,7 @@ checkin_init(struct checkin_params *pb)
}
/* 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 */
@@ -867,11 +867,11 @@ checkin_keywordscan(BUF *data, RCSNUM **rev, time_t *date, char **author,
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;
@@ -918,12 +918,12 @@ checkin_keywordscan(BUF *data, RCSNUM **rev, time_t *date, char **author,
}
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)
@@ -997,7 +997,7 @@ checkin_parsekeyword(char *keystring, RCSNUM **rev, time_t *date,
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);
@@ -1024,7 +1024,7 @@ checkin_parsekeyword(char *keystring, RCSNUM **rev, time_t *date,
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;
diff --git a/usr.bin/rcs/co.c b/usr.bin/rcs/co.c
index 3619d149de7..5268c15abd9 100644
--- a/usr.bin/rcs/co.c
+++ b/usr.bin/rcs/co.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -262,7 +262,7 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
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,
@@ -303,7 +303,7 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
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;
}
@@ -354,7 +354,7 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
return (-1);
}
} else {
- bp = rcs_buf_alloc(1, 0);
+ bp = buf_alloc(1, 0);
}
/*
@@ -463,16 +463,16 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
}
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);
}
@@ -492,7 +492,7 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
(void)close(fd);
}
- rcs_buf_free(bp);
+ buf_free(bp);
return (0);
}
@@ -546,13 +546,13 @@ checkout_file_has_diffs(RCSFILE *rfp, RCSNUM *frev, const char *dst)
}
(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);
diff --git a/usr.bin/rcs/date.y b/usr.bin/rcs/date.y
index 3e0aa290717..424a0835f7f 100644
--- a/usr.bin/rcs/date.y
+++ b/usr.bin/rcs/date.y
@@ -1,5 +1,5 @@
%{
-/* $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
@@ -805,12 +805,12 @@ difftm(struct tm *a, struct tm *b)
}
/*
- * 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;
@@ -819,7 +819,7 @@ rcs_date_parse(const char *p)
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;
@@ -884,7 +884,7 @@ main(int argc, char **argv)
(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
diff --git a/usr.bin/rcs/diff.c b/usr.bin/rcs/diff.c
index c3f9f27cb91..087210aaf45 100644
--- a/usr.bin/rcs/diff.c
+++ b/usr.bin/rcs/diff.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -1377,7 +1377,7 @@ diff_output(const char *fmt, ...)
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);
diff --git a/usr.bin/rcs/diff.h b/usr.bin/rcs/diff.h
index 32fd0ed2eda..1dbfc659f0b 100644
--- a/usr.bin/rcs/diff.h
+++ b/usr.bin/rcs/diff.h
@@ -1,4 +1,4 @@
-/* $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.
@@ -63,9 +63,8 @@
*
* @(#)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>
@@ -125,4 +124,4 @@ extern RCSNUM *diff_rev1;
extern RCSNUM *diff_rev2;
extern regex_t *diff_ignore_re;
-#endif /* RCS_DIFF_H */
+#endif /* DIFF_H */
diff --git a/usr.bin/rcs/diff3.c b/usr.bin/rcs/diff3.c
index 0cd51a12583..faa995bdfa3 100644
--- a/usr.bin/rcs/diff3.c
+++ b/usr.bin/rcs/diff3.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -126,7 +126,7 @@ static int last[4];
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);
@@ -166,45 +166,45 @@ merge_diff3(char **av, int flags)
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;
@@ -217,15 +217,15 @@ merge_diff3(char **av, int flags)
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;
@@ -235,13 +235,13 @@ merge_diff3(char **av, int flags)
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);
@@ -287,7 +287,7 @@ rcs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2, int flags)
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))
@@ -300,38 +300,38 @@ rcs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2, int flags)
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;
@@ -344,15 +344,15 @@ rcs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2, int flags)
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;
@@ -362,13 +362,13 @@ rcs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2, int flags)
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);
@@ -449,14 +449,18 @@ ed_patch_lines(struct rcs_lines *dlines, struct rcs_lines *plines)
/* 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')
@@ -585,6 +589,7 @@ readin(char *name, struct diff **dd)
(*dd)[i].old.from = (*dd)[i-1].old.to;
(*dd)[i].new.from = (*dd)[i-1].new.to;
}
+
(void)fclose(fp[0]);
return (i);
@@ -903,8 +908,7 @@ edscript(int n)
(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);
diff --git a/usr.bin/rcs/ident.c b/usr.bin/rcs/ident.c
index 6f9db86ec1f..be68267fbc4 100644
--- a/usr.bin/rcs/ident.c
+++ b/usr.bin/rcs/ident.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -119,19 +119,19 @@ ident_line(FILE *fp)
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)
@@ -140,26 +140,26 @@ ident_line(FILE *fp)
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
diff --git a/usr.bin/rcs/merge.c b/usr.bin/rcs/merge.c
index 2aad5a25d9d..aa74f4a034e 100644
--- a/usr.bin/rcs/merge.c
+++ b/usr.bin/rcs/merge.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -102,13 +102,13 @@ merge_main(int argc, char **argv)
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);
}
diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c
index e8d034972ac..94870dffc19 100644
--- a/usr.bin/rcs/rcs.c
+++ b/usr.bin/rcs/rcs.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -1145,7 +1145,7 @@ rcs_patch_lines(struct rcs_lines *dlines, struct rcs_lines *plines)
*
* 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)
@@ -1190,13 +1190,13 @@ 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;
@@ -1261,14 +1261,14 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev)
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);
@@ -1455,16 +1455,16 @@ rcs_rev_remove(RCSFILE *rf, RCSNUM *rev)
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)
@@ -2662,9 +2662,9 @@ rcs_expand_keywords(char *rcsfile, struct rcs_delta *rdp, BUF *bp, int mode)
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;
@@ -2832,25 +2832,25 @@ rcs_expand_keywords(char *rcsfile, struct rcs_delta *rdp, BUF *bp, int mode)
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;
}
}
@@ -2880,9 +2880,10 @@ rcs_deltatext_set(RCSFILE *rfp, RCSNUM *rev, BUF *bp)
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;
diff --git a/usr.bin/rcs/rcs.h b/usr.bin/rcs/rcs.h
index 6e82ae5ed66..2401f5fb004 100644
--- a/usr.bin/rcs/rcs.h
+++ b/usr.bin/rcs/rcs.h
@@ -1,4 +1,4 @@
-/* $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.
@@ -45,7 +45,6 @@
#define RCS_SYM_INVALCHAR "$,.:;@"
-
#define RCS_MAGIC_BRANCH ".0."
#define RCS_STATE_EXP "Exp"
#define RCS_STATE_DEAD "dead"
@@ -55,7 +54,6 @@
#define RCS_LOCK_LOOSE 0
#define RCS_LOCK_STRICT 1
-
/*
* Keyword expansion table
*/
@@ -90,7 +88,6 @@
((k & RCS_KWEXP_ERR) || \
((k & RCS_KWEXP_OLD) && (k & ~RCS_KWEXP_OLD)))
-
struct rcs_kw {
char kw_str[16];
int kw_type;
@@ -146,7 +143,6 @@ typedef struct rcs_num {
u_int16_t *rn_id;
} RCSNUM;
-
struct rcs_access {
char *ra_name;
uid_t ra_uid;
@@ -166,7 +162,6 @@ struct rcs_lock {
TAILQ_ENTRY(rcs_lock) rl_list;
};
-
struct rcs_branch {
RCSNUM *rb_num;
TAILQ_ENTRY(rcs_branch) rb_list;
diff --git a/usr.bin/rcs/rcsclean.c b/usr.bin/rcs/rcsclean.c
index b0168ab1e51..f4cd973b739 100644
--- a/usr.bin/rcs/rcsclean.c
+++ b/usr.bin/rcs/rcsclean.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -165,22 +165,22 @@ rcsclean_file(char *fname, const char *rev_str)
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;
}
@@ -211,9 +211,9 @@ rcsclean_file(char *fname, const char *rev_str)
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);
}
diff --git a/usr.bin/rcs/rcsdiff.c b/usr.bin/rcs/rcsdiff.c
index 78239f8f336..1ba7a00678b 100644
--- a/usr.bin/rcs/rcsdiff.c
+++ b/usr.bin/rcs/rcsdiff.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -316,7 +316,7 @@ rcsdiff_file(RCSFILE *file, RCSNUM *rev, const char *filename, int dflags)
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;
}
@@ -332,18 +332,18 @@ rcsdiff_file(RCSFILE *file, RCSNUM *rev, const char *filename, int dflags)
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)
@@ -355,9 +355,9 @@ out:
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)
@@ -413,18 +413,18 @@ rcsdiff_rev(RCSFILE *file, RCSNUM *rev1, RCSNUM *rev2, int dflags)
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)
@@ -434,9 +434,9 @@ rcsdiff_rev(RCSFILE *file, RCSNUM *rev1, RCSNUM *rev2, int dflags)
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)
diff --git a/usr.bin/rcs/rcsmerge.c b/usr.bin/rcs/rcsmerge.c
index 9b57b23be80..280e351557a 100644
--- a/usr.bin/rcs/rcsmerge.c
+++ b/usr.bin/rcs/rcsmerge.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -166,15 +166,15 @@ rcsmerge_main(int argc, char **argv)
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);
diff --git a/usr.bin/rcs/rcsnum.c b/usr.bin/rcs/rcsnum.c
index 176de241de8..dc44ca2a769 100644
--- a/usr.bin/rcs/rcsnum.c
+++ b/usr.bin/rcs/rcsnum.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -282,8 +282,8 @@ rcsnum_aton(const char *str, char **ep, RCSNUM *nump)
* 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.
@@ -305,9 +305,9 @@ rcsnum_aton(const char *str, char **ep, RCSNUM *nump)
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] =
diff --git a/usr.bin/rcs/rcsprog.h b/usr.bin/rcs/rcsprog.h
index dc9b720d40c..66db98cda81 100644
--- a/usr.bin/rcs/rcsprog.h
+++ b/usr.bin/rcs/rcsprog.h
@@ -1,4 +1,4 @@
-/* $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.
@@ -83,7 +83,7 @@ extern char *rcs_tmpdir;
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 **);
diff --git a/usr.bin/rcs/rcsutil.c b/usr.bin/rcs/rcsutil.c
index 83a9638379c..a4fa4928387 100644
--- a/usr.bin/rcs/rcsutil.c
+++ b/usr.bin/rcs/rcsutil.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -337,7 +337,7 @@ rcs_prompt(const char *prompt)
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))
@@ -348,14 +348,14 @@ rcs_prompt(const char *prompt)
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
@@ -451,10 +451,10 @@ rcs_set_description(RCSFILE *file, const char *in)
/* 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 `-'. */
@@ -535,11 +535,11 @@ rcs_patchfile(u_char *data, size_t dlen, u_char *patch, size_t plen,
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);
diff --git a/usr.bin/rcs/rlog.c b/usr.bin/rcs/rlog.c
index 696c23b9cd8..43d451450e0 100644
--- a/usr.bin/rcs/rlog.c
+++ b/usr.bin/rcs/rlog.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -227,7 +227,7 @@ rlog_select_daterev(RCSFILE *rcsfile, char *date)
if (last == NULL) {
flags |= RLOG_DATE_SINGLE;
- firstdate = rcs_date_parse(first);
+ firstdate = date_parse(first);
delim = '\0';
last = "\0";
} else {
@@ -237,33 +237,33 @@ rlog_select_daterev(RCSFILE *rcsfile, char *date)
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);
}
}