Lines Matching +full:ascii +full:. +full:d
3 * msg.c
5 * Copyright (c) 1999 Whistle Communications, Inc.
6 * All rights reserved.
12 * 1. Any and all reproductions of the source or object code must include the
14 * 2. No rights are granted, in any manner or form, to use Whistle
15 * Communications, Inc. trademarks, including the mark "WHISTLE
17 * such appears in the above copyright notice or in the software.
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
26 * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
35 * OF SUCH DAMAGE.
37 * $Whistle: msg.c,v 1.2 1999/11/29 23:38:35 archie Exp $
40 #include <sys/cdefs.h>
41 #include <err.h>
42 #include <netgraph.h>
43 #include <stdio.h>
44 #include <stdlib.h>
45 #include <string.h>
46 #include <sysexits.h>
47 #include <unistd.h>
49 #include "ngctl.h"
55 "msg path command [args ... ]",
58 " command name and ASCII arguments (if any) and sends that message"
59 " to the node. It does this by first asking the node to convert"
60 " the ASCII message into binary format, and resending the result.",
127 struct ng_mesg *ascii; in MsgRead() local
136 /* Ask originating node to convert message to ASCII */ in MsgRead()
138 NGM_BINARY2ASCII, m, sizeof(*m) + m->header.arglen) < 0 in MsgRead()
140 printf("Rec'd %s %d from \"%s\":\n", in MsgRead()
141 (m->header.flags & NGF_RESP) != 0 ? "response" : "command", in MsgRead()
142 m->header.cmd, path); in MsgRead()
143 if (m->header.arglen == 0) in MsgRead()
146 DumpAscii((const u_char *)m->data, m->header.arglen); in MsgRead()
151 /* Display message in ASCII form */ in MsgRead()
153 ascii = (struct ng_mesg *)m2->data; in MsgRead()
154 printf("Rec'd %s \"%s\" (%d) from \"%s\":\n", in MsgRead()
155 (ascii->header.flags & NGF_RESP) != 0 ? "response" : "command", in MsgRead()
156 ascii->header.cmdstr, ascii->header.cmd, path); in MsgRead()
157 if (*ascii->data != '\0') in MsgRead()
158 printf("Args:\t%s\n", ascii->data); in MsgRead()