diff --git a/contrib/chg/Makefile b/contrib/chg/Makefile --- a/contrib/chg/Makefile +++ b/contrib/chg/Makefile @@ -25,7 +25,7 @@ all: $(TARGET) $(CC) $(LDFLAGS) -o $@ $(OBJS) chg.o: hgclient.h procutil.h util.h -hgclient.o: hgclient.h util.h +hgclient.o: hgclient.h procutil.h util.h procutil.o: procutil.h util.h util.o: util.h diff --git a/contrib/chg/hgclient.c b/contrib/chg/hgclient.c --- a/contrib/chg/hgclient.c +++ b/contrib/chg/hgclient.c @@ -23,6 +23,7 @@ #include #include "hgclient.h" +#include "procutil.h" #include "util.h" enum { @@ -71,6 +72,8 @@ struct hgclient_tag_ { 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 @@ static void handlesystemrequest(hgclient 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]); }