summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-08-04 13:26:04 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-08-04 13:26:04 +0000
commitaad9e2b96f13e9678d11f1f3827f26f963eb9c54 (patch)
tree98a22461056b88f0423288a5be9528e35f734584 /usr.bin
parent1fb294f6ab744d57fdc9bc9634c5c449e1e661b2 (diff)
* set the maximum number of arguments to 256 for the moment
* cvs_sendresp() is now required, so uncomment it
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/proto.c21
-rw-r--r--usr.bin/cvs/proto.h8
2 files changed, 17 insertions, 12 deletions
diff --git a/usr.bin/cvs/proto.c b/usr.bin/cvs/proto.c
index 1c2eaf7cccf..5e3bd4570f5 100644
--- a/usr.bin/cvs/proto.c
+++ b/usr.bin/cvs/proto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proto.c,v 1.18 2004/08/03 04:58:45 jfb Exp $ */
+/* $OpenBSD: proto.c,v 1.19 2004/08/04 13:26:02 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -758,11 +758,11 @@ cvs_getln(struct cvsroot *root, char *lbuf, size_t len)
return (0);
}
-#ifdef notyet
+
/*
* cvs_sendresp()
*
- * Send a response to the client of type <rid>, with optional arguments
+ * Send a response of type <rid> to the client, with optional arguments
* contained in <arg>, which should not be terminated by a newline.
* Returns 0 on success, or -1 on failure.
*/
@@ -771,8 +771,7 @@ int
cvs_sendresp(u_int rid, const char *arg)
{
int ret;
- size_t len;
- const char *resp;
+ struct cvs_resp *resp;
resp = cvs_resp_getbyid(rid);
if (resp == NULL) {
@@ -780,22 +779,22 @@ cvs_sendresp(u_int rid, const char *arg)
return (-1);
}
- snprintf(cvs_proto_buf, sizeof(cvs_proto_buf), "%s %s\n", resp,
- (arg == NULL) ? "" : arg);
-
- ret = fputs(resp, stdout);
+ ret = fputs(resp->resp_str, stdout);
if (ret == EOF) {
cvs_log(LP_ERRNO, "failed to send response to client");
}
else {
- if (arg != NULL)
- ret = fprintf(stdout, " %s", arg);
+ if (arg != NULL) {
+ putc(' ', stdout);
+ fputs(arg, stdout);
+ }
putc('\n', stdout);
}
return (0);
}
+#ifdef notyet
/*
* cvs_getreq()
*
diff --git a/usr.bin/cvs/proto.h b/usr.bin/cvs/proto.h
index 90a9f16ca24..b4e54a48b50 100644
--- a/usr.bin/cvs/proto.h
+++ b/usr.bin/cvs/proto.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proto.h,v 1.3 2004/08/03 04:58:45 jfb Exp $ */
+/* $OpenBSD: proto.h,v 1.4 2004/08/04 13:26:03 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -32,6 +32,11 @@
#include "buf.h"
#include "file.h"
+
+#define CVS_PROTO_MAXARG 256
+
+
+
#define CVS_REQ_TIMEOUT 300
@@ -181,6 +186,7 @@ char* cvs_resp_getvalid (void);
int cvs_sendreq (struct cvsroot *, u_int, const char *);
int cvs_getresp (struct cvsroot *);
+int cvs_sendresp (u_int, const char *);
int cvs_getln (struct cvsroot *, char *, size_t);
int cvs_senddir (struct cvsroot *, CVSFILE *);
int cvs_sendarg (struct cvsroot *, const char *, int);