plcID.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. /*====================================================================*
  2. *
  3. * Copyright (c) 2013 Qualcomm Atheros, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or
  8. * without modification, are permitted (subject to the limitations
  9. * in the disclaimer below) provided that the following conditions
  10. * are met:
  11. *
  12. * * Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. *
  15. * * Redistributions in binary form must reproduce the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer in the documentation and/or other materials
  18. * provided with the distribution.
  19. *
  20. * * Neither the name of Qualcomm Atheros nor the names of
  21. * its contributors may be used to endorse or promote products
  22. * derived from this software without specific prior written
  23. * permission.
  24. *
  25. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
  26. * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE
  27. * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  28. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  29. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  30. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
  31. * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  32. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  33. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  34. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  36. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  37. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  38. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. *
  40. *--------------------------------------------------------------------*/
  41. /*====================================================================*
  42. *
  43. * plcID.c - Qualcomm Atheros Powerline Device Identity
  44. *
  45. *
  46. * Contributor(s):
  47. * Charles Maier
  48. *
  49. *--------------------------------------------------------------------*/
  50. /*====================================================================*"
  51. * system header files;
  52. *--------------------------------------------------------------------*/
  53. #include <unistd.h>
  54. #include <stdlib.h>
  55. #include <limits.h>
  56. #include <string.h>
  57. #include <ctype.h>
  58. /*====================================================================*
  59. * custom header files;
  60. *--------------------------------------------------------------------*/
  61. #include "../tools/getoptv.h"
  62. #include "../tools/putoptv.h"
  63. #include "../tools/memory.h"
  64. #include "../tools/number.h"
  65. #include "../tools/symbol.h"
  66. #include "../tools/types.h"
  67. #include "../tools/flags.h"
  68. #include "../tools/files.h"
  69. #include "../tools/error.h"
  70. #include "../plc/plc.h"
  71. #include "../ram/nvram.h"
  72. #include "../ram/sdram.h"
  73. #include "../nvm/nvm.h"
  74. #include "../pib/pib.h"
  75. #include "../mme/mme.h"
  76. /*====================================================================*
  77. * custom source files;
  78. *--------------------------------------------------------------------*/
  79. #ifndef MAKEFILE
  80. #include "../tools/getoptv.c"
  81. #include "../tools/putoptv.c"
  82. #include "../tools/version.c"
  83. #include "../tools/uintspec.c"
  84. #include "../tools/hexencode.c"
  85. #include "../tools/hexdecode.c"
  86. #include "../tools/todigit.c"
  87. #include "../tools/hexdump.c"
  88. #include "../tools/hexout.c"
  89. #include "../tools/error.c"
  90. #include "../tools/synonym.c"
  91. #include "../tools/checksum32.c"
  92. #include "../tools/typename.c"
  93. #endif
  94. #ifndef MAKEFILE
  95. #include "../plc/Display.c"
  96. #include "../plc/Devices.c"
  97. #include "../plc/Failure.c"
  98. #include "../plc/ReadMME.c"
  99. #include "../plc/SendMME.c"
  100. #include "../plc/WaitForStart.c"
  101. #include "../plc/chipset.c"
  102. #endif
  103. #ifndef MAKEFILE
  104. #include "../mme/EthernetHeader.c"
  105. #include "../mme/QualcommHeader.c"
  106. #include "../mme/UnwantedMessage.c"
  107. #endif
  108. #ifndef MAKEFILE
  109. #include "../ether/openchannel.c"
  110. #include "../ether/closechannel.c"
  111. #include "../ether/readpacket.c"
  112. #include "../ether/sendpacket.c"
  113. #include "../ether/channel.c"
  114. #endif
  115. #ifndef MAKEFILE
  116. #include "../mme/MMECode.c"
  117. #endif
  118. /*====================================================================*
  119. * program constants;
  120. *--------------------------------------------------------------------*/
  121. #define PLCID_DAK 0
  122. #define PLCID_NMK 1
  123. #define PLCID_MAC 2
  124. #define PLCID_MFG 3
  125. #define PLCID_USR 4
  126. #define PLCID_NET 5
  127. /*====================================================================*
  128. *
  129. * signed PLCSelect (struct plc * plc, signed old (struct plc *), signed new (struct plc *));
  130. *
  131. * plc.h
  132. *
  133. * wait for device to start in order to determine chipset then call
  134. * the approproate function based on chipset; unfortunately, chipset
  135. * detection and selection may not be this simple in the future;
  136. *
  137. * Contributor(s):
  138. * Charles Maier
  139. *
  140. *--------------------------------------------------------------------*/
  141. signed PLCSelect (struct plc * plc, signed old (struct plc *), signed new (struct plc *))
  142. {
  143. char firmware [PLC_VERSION_STRING];
  144. if (WaitForStart (plc, firmware, sizeof (firmware)))
  145. {
  146. Failure (plc, PLC_NODETECT);
  147. exit (1);
  148. }
  149. return ((plc->hardwareID < CHIPSET_QCA7420)? old (plc): new (plc));
  150. }
  151. /*====================================================================*
  152. *
  153. * signed ReadKey1 (struct plc * plc);
  154. *
  155. * read the first block of the PIB from a device then echo one of
  156. * several parameters on stdout as a string; program output can be
  157. * used in scripts to define variables or compare strings;
  158. *
  159. * this function is an abridged version of ReadParameters(); it reads only
  160. * the first 1024 bytes of the PIB then stops; most parameters of
  161. * general interest occur in that block;
  162. *
  163. *--------------------------------------------------------------------*/
  164. static signed ReadKey1 (struct plc * plc)
  165. {
  166. extern const byte broadcast [ETHER_ADDR_LEN];
  167. extern const byte localcast [ETHER_ADDR_LEN];
  168. static signed count = 0;
  169. struct channel * channel = (struct channel *) (plc->channel);
  170. struct message * message = (struct message *) (plc->message);
  171. #ifndef __GNUC__
  172. #pragma pack (push,1)
  173. #endif
  174. struct __packed vs_rd_mod_request
  175. {
  176. struct ethernet_hdr ethernet;
  177. struct qualcomm_hdr qualcomm;
  178. uint8_t MODULEID;
  179. uint8_t RESERVED;
  180. uint16_t MLENGTH;
  181. uint32_t MOFFSET;
  182. uint8_t DAK [16];
  183. }
  184. * request = (struct vs_rd_mod_request *) (message);
  185. struct __packed vs_rd_mod_confirm
  186. {
  187. struct ethernet_hdr ethernet;
  188. struct qualcomm_hdr qualcomm;
  189. uint8_t MSTATUS;
  190. uint8_t RESERVED1 [3];
  191. uint8_t MODULEID;
  192. uint8_t RESERVED2;
  193. uint16_t MLENGTH;
  194. uint32_t MOFFSET;
  195. uint32_t MCHKSUM;
  196. struct simple_pib pib;
  197. }
  198. * confirm = (struct vs_rd_mod_confirm *) (message);
  199. #ifndef __GNUC__
  200. #pragma pack (pop)
  201. #endif
  202. memset (message, 0, sizeof (* message));
  203. EthernetHeader (& request->ethernet, channel->peer, channel->host, channel->type);
  204. QualcommHeader (& request->qualcomm, 0, (VS_RD_MOD | MMTYPE_REQ));
  205. request->MODULEID = VS_MODULE_PIB;
  206. request->MLENGTH = HTOLE16 (PLC_RECORD_SIZE);
  207. request->MOFFSET = HTOLE32 (0);
  208. plc->packetsize = ETHER_MIN_LEN - ETHER_CRC_LEN;
  209. if (SendMME (plc) <= 0)
  210. {
  211. error (1, errno, CHANNEL_CANTSEND);
  212. }
  213. while (ReadMME (plc, 0, (VS_RD_MOD | MMTYPE_CNF)) > 0)
  214. {
  215. if (confirm->MSTATUS)
  216. {
  217. Failure (plc, PLC_WONTDOIT);
  218. return (-1);
  219. }
  220. if (count++ > 0)
  221. {
  222. putc (plc->coupling, stdout);
  223. }
  224. if (plc->action == PLCID_MAC)
  225. {
  226. hexout (confirm->pib.MAC, sizeof (confirm->pib.MAC), HEX_EXTENDER, 0, stdout);
  227. }
  228. else if (plc->action == PLCID_DAK)
  229. {
  230. hexout (confirm->pib.DAK, sizeof (confirm->pib.DAK), HEX_EXTENDER, 0, stdout);
  231. }
  232. else if (plc->action == PLCID_NMK)
  233. {
  234. hexout (confirm->pib.NMK, sizeof (confirm->pib.NMK), HEX_EXTENDER, 0, stdout);
  235. }
  236. else if (plc->action == PLCID_MFG)
  237. {
  238. confirm->pib.MFG [PIB_HFID_LEN -1] = (char) (0);
  239. printf ("%s", confirm->pib.MFG);
  240. }
  241. else if (plc->action == PLCID_USR)
  242. {
  243. confirm->pib.USR [PIB_HFID_LEN -1] = (char) (0);
  244. printf ("%s", confirm->pib.USR);
  245. }
  246. else if (plc->action == PLCID_NET)
  247. {
  248. confirm->pib.NET [PIB_HFID_LEN -1] = (char) (0);
  249. printf ("%s", confirm->pib.NET);
  250. }
  251. /* If request was not sent to broadcast and not sent to localcast
  252. * it must have been a unicast request and there will be
  253. * no more confirmations worth waiting for.
  254. */
  255. if (memcmp (channel->peer, broadcast, sizeof (channel->peer)) &&
  256. memcmp (channel->peer, localcast, sizeof (channel->peer)))
  257. {
  258. break;
  259. }
  260. }
  261. if (plc->packetsize < 0)
  262. {
  263. error (1, errno, CHANNEL_CANTREAD);
  264. }
  265. return (0);
  266. }
  267. /*====================================================================*
  268. *
  269. * signed ReadKey2 (struct plc * plc);
  270. *
  271. * plc.h
  272. *
  273. * read start of parameter chain from the device using a single
  274. * VS_MODULE_OPERATION message; search parameter chain for PIB and
  275. * print requested plc->action on stdout;
  276. *
  277. * Contributor(s):
  278. * Charles Maier
  279. *
  280. *--------------------------------------------------------------------*/
  281. static signed ReadKey2 (struct plc * plc)
  282. {
  283. extern const byte broadcast [ETHER_ADDR_LEN];
  284. extern const byte localcast [ETHER_ADDR_LEN];
  285. static signed count = 0;
  286. struct channel * channel = (struct channel *) (plc->channel);
  287. struct message * message = (struct message *) (plc->message);
  288. struct nvm_header2 * nvm_header;
  289. uint32_t origin = ~ 0;
  290. uint32_t offset = 0;
  291. signed module = 0;
  292. char * filename = "device";
  293. #ifndef __GNUC__
  294. #pragma pack (push,1)
  295. #endif
  296. struct __packed vs_module_operation_read_request
  297. {
  298. struct ethernet_hdr ethernet;
  299. struct qualcomm_hdr qualcomm;
  300. uint32_t RESERVED;
  301. uint8_t NUM_OP_DATA;
  302. struct __packed
  303. {
  304. uint16_t MOD_OP;
  305. uint16_t MOD_OP_DATA_LEN;
  306. uint32_t MOD_OP_RSVD;
  307. uint16_t MODULE_ID;
  308. uint16_t MODULE_SUB_ID;
  309. uint16_t MODULE_LENGTH;
  310. uint32_t MODULE_OFFSET;
  311. }
  312. MODULE_SPEC;
  313. }
  314. * request = (struct vs_module_operation_read_request *) (message);
  315. struct __packed vs_module_operation_read_confirm
  316. {
  317. struct ethernet_hdr ethernet;
  318. struct qualcomm_hdr qualcomm;
  319. uint16_t MSTATUS;
  320. uint16_t ERR_REC_CODE;
  321. uint32_t RESERVED;
  322. uint8_t NUM_OP_DATA;
  323. struct __packed
  324. {
  325. uint16_t MOD_OP;
  326. uint16_t MOD_OP_DATA_LEN;
  327. uint32_t MOD_OP_RSVD;
  328. uint16_t MODULE_ID;
  329. uint16_t MODULE_SUB_ID;
  330. uint16_t MODULE_LENGTH;
  331. uint32_t MODULE_OFFSET;
  332. }
  333. MODULE_SPEC;
  334. uint8_t MODULE_DATA [PLC_MODULE_SIZE];
  335. }
  336. * confirm = (struct vs_module_operation_read_confirm *) (message);
  337. #ifndef __GNUC__
  338. #pragma pack (pop)
  339. #endif
  340. memset (message, 0, sizeof (* message));
  341. EthernetHeader (& request->ethernet, channel->peer, channel->host, channel->type);
  342. QualcommHeader (& request->qualcomm, 0, (VS_MODULE_OPERATION | MMTYPE_REQ));
  343. plc->packetsize = (ETHER_MIN_LEN - ETHER_CRC_LEN);
  344. request->NUM_OP_DATA = 1;
  345. request->MODULE_SPEC.MOD_OP = HTOLE16 (0);
  346. request->MODULE_SPEC.MOD_OP_DATA_LEN = HTOLE16 (sizeof (request->MODULE_SPEC));
  347. request->MODULE_SPEC.MOD_OP_RSVD = HTOLE32 (0);
  348. request->MODULE_SPEC.MODULE_ID = HTOLE16 (PLC_MODULEID_PARAMETERS);
  349. request->MODULE_SPEC.MODULE_SUB_ID = HTOLE16 (0);
  350. request->MODULE_SPEC.MODULE_LENGTH = HTOLE16 (PLC_MODULE_SIZE);
  351. request->MODULE_SPEC.MODULE_OFFSET = HTOLE32 (0);
  352. if (SendMME (plc) <= 0)
  353. {
  354. error (1, errno, CHANNEL_CANTSEND);
  355. }
  356. while (ReadMME (plc, 0, (VS_MODULE_OPERATION | MMTYPE_CNF)) > 0)
  357. {
  358. if (confirm->MSTATUS)
  359. {
  360. Failure (plc, PLC_WONTDOIT);
  361. return (-1);
  362. }
  363. if (count++ > 0)
  364. {
  365. putc (plc->coupling, stdout);
  366. }
  367. do
  368. {
  369. nvm_header = (struct nvm_header2 *) (& confirm->MODULE_DATA [offset]);
  370. if (LE16TOH (nvm_header->MajorVersion) != 1)
  371. {
  372. if (_allclr (plc->flags, PLC_SILENCE))
  373. {
  374. error (0, errno, NVM_HDR_VERSION, filename, module);
  375. }
  376. return (-1);
  377. }
  378. if (LE16TOH (nvm_header->MinorVersion) != 1)
  379. {
  380. if (_allclr (plc->flags, PLC_SILENCE))
  381. {
  382. error (0, errno, NVM_HDR_VERSION, filename, module);
  383. }
  384. return (-1);
  385. }
  386. if (LE32TOH (nvm_header->PrevHeader) != origin)
  387. {
  388. if (_allclr (plc->flags, PLC_SILENCE))
  389. {
  390. error (0, errno, NVM_HDR_LINK, filename, module);
  391. }
  392. return (-1);
  393. }
  394. if (checksum32 (nvm_header, sizeof (* nvm_header), 0))
  395. {
  396. error (0, 0, NVM_HDR_CHECKSUM, filename, module);
  397. return (-1);
  398. }
  399. origin = offset;
  400. offset += sizeof (* nvm_header);
  401. if (LE32TOH (nvm_header->ImageType) == NVM_IMAGE_PIB)
  402. {
  403. struct simple_pib * pib = (struct simple_pib *) (& confirm->MODULE_DATA [offset]);
  404. if (plc->action == PLCID_MAC)
  405. {
  406. hexout (pib->MAC, sizeof (pib->MAC), HEX_EXTENDER, 0, stdout);
  407. }
  408. else if (plc->action == PLCID_DAK)
  409. {
  410. hexout (pib->DAK, sizeof (pib->DAK), HEX_EXTENDER, 0, stdout);
  411. }
  412. else if (plc->action == PLCID_NMK)
  413. {
  414. hexout (pib->NMK, sizeof (pib->NMK), HEX_EXTENDER, 0, stdout);
  415. }
  416. else if (plc->action == PLCID_MFG)
  417. {
  418. pib->MFG [PIB_HFID_LEN -1] = (char) (0);
  419. printf ("%s", pib->MFG);
  420. }
  421. else if (plc->action == PLCID_USR)
  422. {
  423. pib->USR [PIB_HFID_LEN -1] = (char) (0);
  424. printf ("%s", pib->USR);
  425. }
  426. else if (plc->action == PLCID_NET)
  427. {
  428. pib->NET [PIB_HFID_LEN -1] = (char) (0);
  429. printf ("%s", pib->NET);
  430. }
  431. if (memcmp (channel->peer, broadcast, sizeof (channel->peer)) &&
  432. memcmp (channel->peer, localcast, sizeof (channel->peer)))
  433. {
  434. return 0;
  435. }
  436. }
  437. if (checksum32 (& confirm->MODULE_DATA [offset], LE32TOH (nvm_header->ImageLength), nvm_header->ImageChecksum))
  438. {
  439. if (_allclr (plc->flags, PLC_SILENCE))
  440. {
  441. error (0, errno, NVM_IMG_CHECKSUM, filename, module);
  442. }
  443. return (-1);
  444. }
  445. offset += LE32TOH (nvm_header->ImageLength);
  446. module++;
  447. }
  448. while (~ nvm_header->NextHeader);
  449. }
  450. if (plc->packetsize < 0)
  451. {
  452. error (1, errno, CHANNEL_CANTREAD);
  453. }
  454. return (0);
  455. }
  456. /*====================================================================*
  457. *
  458. * int main (int argc, char const * argv []);
  459. *
  460. *--------------------------------------------------------------------*/
  461. int main (int argc, char const * argv [])
  462. {
  463. extern struct channel channel;
  464. static char const * optv [] =
  465. {
  466. "Ac:Dei:MnNqSt:Uv",
  467. "device",
  468. "Qualcomm Atheros Powerline Device Identity",
  469. "A\tEthernet address (MAC)",
  470. "c c\tcharacter delimiter is (c)",
  471. "D\tDevice Access Key (DAK)",
  472. "e\tredirect stderr to stdout",
  473. #if defined (WINPCAP) || defined (LIBPCAP)
  474. "i n\thost interface is (n) [" LITERAL (CHANNEL_ETHNUMBER) "]",
  475. #else
  476. "i s\thost interface is (s) [" LITERAL (CHANNEL_ETHDEVICE) "]",
  477. #endif
  478. "M\tNetwork Membership Key (NMK)",
  479. "n\tappend newline on output",
  480. "N\tnetwork HFID",
  481. "q\tquiet mode",
  482. "S\tmanufacturer HFID",
  483. "t n\tread timeout is (n) milliseconds [" LITERAL (CHANNEL_TIMEOUT) "]",
  484. "U\tuser HFID",
  485. "v\tverbose mode",
  486. (char const *) (0)
  487. };
  488. #include "../plc/plc.c"
  489. signed c;
  490. plc.action = PLCID_DAK;
  491. plc.coupling = '\n';
  492. if (getenv (PLCDEVICE))
  493. {
  494. #if defined (WINPCAP) || defined (LIBPCAP)
  495. channel.ifindex = atoi (getenv (PLCDEVICE));
  496. #else
  497. channel.ifname = strdup (getenv (PLCDEVICE));
  498. #endif
  499. }
  500. optind = 1;
  501. while (~ (c = getoptv (argc, argv, optv)))
  502. {
  503. switch (c)
  504. {
  505. case 'A':
  506. plc.action = PLCID_MAC;
  507. break;
  508. case 'c':
  509. plc.coupling = * optarg;
  510. break;
  511. case 'D':
  512. plc.action = PLCID_DAK;
  513. break;
  514. case 'e':
  515. dup2 (STDOUT_FILENO, STDERR_FILENO);
  516. break;
  517. case 'i':
  518. #if defined (WINPCAP) || defined (LIBPCAP)
  519. channel.ifindex = atoi (optarg);
  520. #else
  521. channel.ifname = optarg;
  522. #endif
  523. break;
  524. case 'M':
  525. plc.action = PLCID_NMK;
  526. break;
  527. case 'n':
  528. _setbits (plc.flags, PLC_NEWLINE);
  529. break;
  530. case 'N':
  531. plc.action = PLCID_NET;
  532. break;
  533. case 'q':
  534. _setbits (channel.flags, CHANNEL_SILENCE);
  535. _setbits (plc.flags, PLC_SILENCE);
  536. break;
  537. case 'S':
  538. plc.action = PLCID_MFG;
  539. break;
  540. case 't':
  541. channel.timeout = (signed)(uintspec (optarg, 0, UINT_MAX));
  542. break;
  543. case 'U':
  544. plc.action = PLCID_USR;
  545. break;
  546. case 'v':
  547. _setbits (channel.flags, CHANNEL_VERBOSE);
  548. _setbits (plc.flags, PLC_VERBOSE);
  549. break;
  550. default:
  551. break;
  552. }
  553. }
  554. argc -= optind;
  555. argv += optind;
  556. openchannel (& channel);
  557. if (! (plc.message = malloc (sizeof (* plc.message))))
  558. {
  559. error (1, errno, PLC_NOMEMORY);
  560. }
  561. if (! argc)
  562. {
  563. PLCSelect (& plc, ReadKey1, ReadKey2);
  564. }
  565. while ((argc) && (* argv))
  566. {
  567. if (! hexencode (channel.peer, sizeof (channel.peer), synonym (* argv, devices, SIZEOF (devices))))
  568. {
  569. error (1, errno, PLC_BAD_MAC, * argv);
  570. }
  571. PLCSelect (& plc, ReadKey1, ReadKey2);
  572. argv++;
  573. argc--;
  574. }
  575. if (_anyset (plc.flags, PLC_NEWLINE))
  576. {
  577. printf ("\n");
  578. }
  579. free (plc.message);
  580. closechannel (& channel);
  581. return (0);
  582. }