2 * This file is part of the UCB release of Plan 9. It is subject to the license
3 * terms in the LICENSE file found in the top-level directory of this
4 * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
5 * part of the UCB release of Plan 9, including this file, may be copied,
6 * modified, propagated, or distributed except according to the terms contained
27 fprintf(stderr, "CSQUERY:usage: ndb/csquery [/net/cs [addr...]]\n");
28 fprintf(stderr, "CSQUERY:usage");
32 void query(char *addr)
38 fd = open(server, O_RDWR);
40 error(1, 0, "cannot open %s: %r", server);
41 amt = write(fd, addr, strlen(addr));
42 if (amt != strlen(addr)) {
43 printf("CSQUERY:Tried to write %d to fd %d, only wrote %d\n", strlen(addr),fd,amt);
45 fprintf(stderr, "CSQUERY:Writing request: translating %s: %r\n", addr);
52 while ((n = read(fd, buf, sizeof(buf) - 1)) > 0) {
60 void main(int argc, char **argv)
67 if (argv[0][0] != '-')
85 for (i = 1; i < argc; i++)
93 while (read(0, &p[i], 1) > 0){
94 /* Attempt to echo our input back to stdout */