--- a/contrib/chg/hgclient.c Tue Jan 10 06:58:51 2017 +0800
+++ b/contrib/chg/hgclient.c Tue Jan 10 06:59:03 2017 +0800
@@ -23,6 +23,7 @@
#include <unistd.h>
#include "hgclient.h"
+#include "procutil.h"
#include "util.h"
enum {
@@ -71,6 +72,8 @@
static const size_t defaultdatasize = 4096;
+static void attachio(hgclient_t *hgc);
+
static void initcontext(context_t *ctx)
{
ctx->ch = '\0';
@@ -248,6 +251,13 @@
memcpy(ctx->data, &r_n, sizeof(r_n));
ctx->datasize = sizeof(r_n);
writeblock(hgc);
+ } else if (strcmp(args[0], "pager") == 0) {
+ setuppager(args[1]);
+ if (hgc->capflags & CAP_ATTACHIO)
+ attachio(hgc);
+ /* unblock the server */
+ static const char emptycmd[] = "\n";
+ sendall(hgc->sockfd, emptycmd, sizeof(emptycmd) - 1);
} else {
abortmsg("unknown type in system request: %s", args[0]);
}