equal
deleted
inserted
replaced
21 #include <sys/stat.h> |
21 #include <sys/stat.h> |
22 #include <sys/un.h> |
22 #include <sys/un.h> |
23 #include <unistd.h> |
23 #include <unistd.h> |
24 |
24 |
25 #include "hgclient.h" |
25 #include "hgclient.h" |
|
26 #include "procutil.h" |
26 #include "util.h" |
27 #include "util.h" |
27 |
28 |
28 enum { |
29 enum { |
29 CAP_GETENCODING = 0x0001, |
30 CAP_GETENCODING = 0x0001, |
30 CAP_RUNCOMMAND = 0x0002, |
31 CAP_RUNCOMMAND = 0x0002, |
68 context_t ctx; |
69 context_t ctx; |
69 unsigned int capflags; |
70 unsigned int capflags; |
70 }; |
71 }; |
71 |
72 |
72 static const size_t defaultdatasize = 4096; |
73 static const size_t defaultdatasize = 4096; |
|
74 |
|
75 static void attachio(hgclient_t *hgc); |
73 |
76 |
74 static void initcontext(context_t *ctx) |
77 static void initcontext(context_t *ctx) |
75 { |
78 { |
76 ctx->ch = '\0'; |
79 ctx->ch = '\0'; |
77 ctx->data = malloc(defaultdatasize); |
80 ctx->data = malloc(defaultdatasize); |
246 |
249 |
247 uint32_t r_n = htonl(r); |
250 uint32_t r_n = htonl(r); |
248 memcpy(ctx->data, &r_n, sizeof(r_n)); |
251 memcpy(ctx->data, &r_n, sizeof(r_n)); |
249 ctx->datasize = sizeof(r_n); |
252 ctx->datasize = sizeof(r_n); |
250 writeblock(hgc); |
253 writeblock(hgc); |
|
254 } else if (strcmp(args[0], "pager") == 0) { |
|
255 setuppager(args[1]); |
|
256 if (hgc->capflags & CAP_ATTACHIO) |
|
257 attachio(hgc); |
|
258 /* unblock the server */ |
|
259 static const char emptycmd[] = "\n"; |
|
260 sendall(hgc->sockfd, emptycmd, sizeof(emptycmd) - 1); |
251 } else { |
261 } else { |
252 abortmsg("unknown type in system request: %s", args[0]); |
262 abortmsg("unknown type in system request: %s", args[0]); |
253 } |
263 } |
254 } |
264 } |
255 |
265 |