summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/proto.c
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-05-26 22:27:12 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-05-26 22:27:12 +0000
commit5fc69eea983a583664e0b8762f0275a2c85e10c4 (patch)
tree04451b1341feb044c04105baf90bbd530984a86c /usr.bin/cvs/proto.c
parent4a3c8238a722dc1e543d412a6f7c6c36d2114061 (diff)
make cvs_getln() return the length of the line that was read, so we
don't have to call strlen() right after
Diffstat (limited to 'usr.bin/cvs/proto.c')
-rw-r--r--usr.bin/cvs/proto.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/cvs/proto.c b/usr.bin/cvs/proto.c
index 1418ec6d373..e24f24dc5eb 100644
--- a/usr.bin/cvs/proto.c
+++ b/usr.bin/cvs/proto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proto.c,v 1.54 2005/05/24 06:42:38 joris Exp $ */
+/* $OpenBSD: proto.c,v 1.55 2005/05/26 22:27:11 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -660,7 +660,6 @@ cvs_recvfile(struct cvsroot *root, mode_t *mode)
return (fbuf);
}
-
/*
* cvs_sendreq()
*
@@ -767,6 +766,8 @@ cvs_getresp(struct cvsroot *root)
*
* Get a line from the remote end and store it in <lbuf>. The terminating
* newline character is stripped from the result.
+ * Returns the length in bytes of the line (not including the NUL byte), or
+ * -1 on failure.
*/
int
cvs_getln(struct cvsroot *root, char *lbuf, size_t len)
@@ -796,7 +797,7 @@ cvs_getln(struct cvsroot *root, char *lbuf, size_t len)
if ((rlen > 0) && (lbuf[rlen - 1] == '\n'))
lbuf[--rlen] = '\0';
- return (0);
+ return (rlen);
}
@@ -898,11 +899,11 @@ cvs_sendln(struct cvsroot *root, const char *line)
if (cvs_server_inlog != NULL) {
fputs(line, cvs_server_inlog);
if (nl)
- fputc('\n', cvs_server_inlog);
+ putc('\n', cvs_server_inlog);
}
fputs(line, out);
if (nl)
- fputc('\n', out);
+ putc('\n', out);
return (0);
}