ecuusage.c 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /*+-----------------------------------------------------------------------
  2. ecuusage.c - user admonishment
  3. wht@wht.net
  4. Defined functions:
  5. fkmap_cmd_usage()
  6. general_usage(uptr)
  7. log_cmd_usage()
  8. usage()
  9. ------------------------------------------------------------------------*/
  10. /*+:EDITS:*/
  11. /*:04-26-2000-11:15-wht@bob-RELEASE 4.42 */
  12. /*:01-24-1997-02:37-wht@yuriatin-SOURCE RELEASE 4.00 */
  13. /*:12-19-1996-17:22-wht@yuriatin-fix bug in <hostname> display */
  14. /*:10-24-1996-03:14-wht@yuriatin-document -T switch */
  15. /*:09-16-1996-04:18-wht@yuriatin-update telnet usage */
  16. /*:09-11-1996-20:00-wht@yuriatin-3.48-major telnet,curses,structural overhaul */
  17. /*:12-06-1995-13:30-wht@n4hgf-termecu w/errno -1 consideration */
  18. /*:11-23-1995-11:20-wht@kepler-source control 3.37 for tsx-11 */
  19. /*:11-14-1995-10:23-wht@kepler-3.37.80-source control point: SOCKETS */
  20. /*:11-12-1995-01:13-wht@gyro-add -n, doc add -z */
  21. /*:10-14-1995-16:17-wht@kepler-use valid_baud_string */
  22. /*:01-12-1995-15:19-wht@n4hgf-apply Andrew Chernov 8-bit clean+FreeBSD patch */
  23. /*:05-04-1994-04:39-wht@n4hgf-ECU release 3.30 */
  24. /*:12-04-1992-21:11-wht@n4hgf-add -l=type info */
  25. /*:09-16-1992-13:54-wht@n4hgf-add fkmap usage */
  26. /*:09-10-1992-13:59-wht@n4hgf-ECU release 3.20 */
  27. /*:08-22-1992-15:38-wht@n4hgf-ECU release 3.20 BETA */
  28. /*:04-24-1992-21:07-wht@n4hgf-put defaults back into cmd line usage */
  29. /*:04-24-1992-06:30-wht@n4hgf-rll usage fixes */
  30. /*:07-25-1991-12:57-wht@n4hgf-ECU release 3.10 */
  31. /*:04-27-1991-01:52-wht@n4hgf-overhaul revision numbers */
  32. /*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
  33. #include "ecu.h"
  34. #if 0
  35. #include <stdio.h>
  36. #include "termecu.h"
  37. #include "ecutermio.h" /* for baudrate */
  38. #define pf printf
  39. #endif
  40. extern char *makedate; /* temporary make date */
  41. extern char *revstr; /* ecunumrev.c */
  42. extern char *valid_baud_string;
  43. char *usage_text[] =
  44. {
  45. "usage: ecu [-l <ttyname | =type>] [-b <baud>] [-eon]\n",
  46. " [-h] [-t] [-P <phonedir>] [-F name] [-T <tracelevel>]\n",
  47. " [-N] [-n] [-z] [-T]\n",
  48. " [-p <initial_proc> [-d] [-D] <args...> |\n",
  49. " <phone_number> | <logical> ",
  50. #ifdef CFG_TelnetOption
  51. "| <hostname>",
  52. #endif
  53. "]\n",
  54. "-F sets an alternate funckeymap name for the *keyboard*\n",
  55. "-N disable curses displays - use `scrolling tty' display\n",
  56. "-P choose alternate phone directory (<phonedir> must be a full path)\n",
  57. "-T set procedure tracing to level: 0=none, 1=standard, 2=ECU-debugging\n",
  58. "-b bit rate (",
  59. "VBS",
  60. ")\n",
  61. "-e even parity -o odd parity -n no parity\n",
  62. "-h half duplex ... default is full duplex\n",
  63. "-l <ttyname> chooses /dev/<ttyname>\n",
  64. "-l =<type> chooses line from Devices with matching type (1st field)\n",
  65. "-n disables the built-in receiver ANSI filter\n",
  66. "-t append NL to incoming and outgoing CR characters\n",
  67. #ifdef CFG_TelnetOption
  68. "-z if telnet connection, show options traffic\n",
  69. #endif
  70. "\n",
  71. "<phone_number> is an actual number beginning with a numeric digit.\n",
  72. "<logical> is a dialing directory name.\n",
  73. #ifdef CFG_TelnetOption
  74. "<hostname> is an internet hostname or IP address. A hostname\n",
  75. "is distinguished from a <phone_number> or <logical> by virtue of\n",
  76. "containing a period; a trailing period will be removed.\n",
  77. #endif
  78. "\n",
  79. "-p execute an initial procedure\n",
  80. "-D unconditionally stop execution when -p initial procedure is done\n",
  81. "-d stop execution if -p initial procedure fails\n",
  82. "-T enable procedure tracing prior to first procedure execution\n",
  83. "\n",
  84. "For interactive option selection, try executing ecu with no arguments\n",
  85. "\n",
  86. "For a list of built in commands, type HOME?<ENTER> once program started\n",
  87. (char *)0 /* terminated with null pointer */
  88. };
  89. char *log_cmd_usage_text[] =
  90. {
  91. "Usage: log [-s] [-r] <filename>\n",
  92. " log off turn logging off\n",
  93. " -s scratch any previous contents of <filename>, else append\n",
  94. " -r raw log, else drop non-printable characters\n",
  95. (char *)0 /* terminated with null pointer */
  96. };
  97. char *fkmap_cmd_usage_text[] =
  98. {
  99. "usage: fkmap \n",
  100. " fkmap <keyname>\n",
  101. " fkmap <keyname> <keylist>\n",
  102. " fkmap -l <name>\n",
  103. " fkmap -r\n",
  104. " fkmap -s <file>\n",
  105. (char *)0 /* terminated with null pointer */
  106. };
  107. /*+-----------------------------------------------------------------------
  108. general_usage(uptr)
  109. ------------------------------------------------------------------------*/
  110. void
  111. general_usage(uptr)
  112. char **uptr;
  113. {
  114. while (*uptr != (char *)0)
  115. pputs(*(uptr++));
  116. } /* end of usage */
  117. /*+-----------------------------------------------------------------------
  118. usage()
  119. special case: "VBS" replaced with dynamic-built bit rate string
  120. ------------------------------------------------------------------------*/
  121. void
  122. usage()
  123. {
  124. char **cpp;
  125. fprintf(stderr, "ecu %s made: %s\n", revstr, makedate);
  126. cpp = usage_text;
  127. while (*cpp)
  128. {
  129. if (!strcmp(*cpp, "VBS"))
  130. {
  131. *cpp = valid_baud_string;
  132. break;
  133. }
  134. cpp++;
  135. }
  136. general_usage(usage_text);
  137. pprintf("\nDefaults: tty=%s baud=%d parity=%c\n",
  138. CFG_DefaultTty, CFG_DefaultBitRate, CFG_DefaultParity);
  139. errno = -1;
  140. termecu(TERMECU_USAGE);
  141. /* NOTREACHED */
  142. }
  143. /*+-------------------------------------------------------------------------
  144. log_cmd_usage()
  145. --------------------------------------------------------------------------*/
  146. void
  147. log_cmd_usage()
  148. {
  149. general_usage(log_cmd_usage_text);
  150. } /* end of log_cmd_usage */
  151. /*+-------------------------------------------------------------------------
  152. fkmap_cmd_usage()
  153. --------------------------------------------------------------------------*/
  154. void
  155. fkmap_cmd_usage()
  156. {
  157. general_usage(fkmap_cmd_usage_text);
  158. } /* end of fkmap_cmd_usage */
  159. /* vi: set tabstop=4 shiftwidth=4: */