home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / uniflex.zip / ufshow.c < prev    next >
C/C++ Source or Header  |  1993-08-23  |  7KB  |  364 lines

  1. #include "ufk.h"
  2.  
  3. TABLE  show_table[] =
  4. {
  5.    "all", 1,
  6.    "debug", 2,
  7.    "escape", 3,
  8.    "line", 4,
  9.    "baud", 5,
  10.    "configuration", 6,
  11.    "timeout", 7,
  12.    "filetype", 8,
  13.    "log", 9,
  14.    "duplex", 10,
  15.    "handshake", 11,
  16.    "block_check_type", 12,
  17.    "repeat_quote", 13,
  18.    "retry", 14,
  19.    "packet_length", 15,
  20.    "padding", 16,
  21.    "padchar", 17,
  22.    "start_of_packet", 18,
  23.    "end_of_line", 19,
  24.    "quote", 20,
  25.    "eight_bit_quote", 21,
  26.    "incomplete", 22,
  27.    "delay", 23,
  28.    "warning", 24,
  29.    "mapping", 25,
  30.    "auto_recover", 26,
  31.    "attributes", 27,
  32.    "", 0
  33. };
  34.  
  35. show()
  36. {
  37.    int   fpoint;
  38.  
  39.    fpoint = parse(params[1], show_table); /* Parse 'show' command */
  40.    if (fpoint == NULL)                    /* Ambiguous */
  41.       prterr(ER_AMBIGSHW);
  42.    else if (fpoint == ERROR)              /* Unknown */
  43.       prterr(ER_UNKNWSHW);
  44.    else                                   /* Dispatch to command if no error */
  45.       switch(fpoint)
  46.       {
  47.          case 1:
  48.                   show_all();
  49.                   break;
  50.          case 2:
  51.                   show_debug();
  52.                   break;
  53.          case 3:
  54.                   show_escape();
  55.                   break;
  56.          case 4:
  57.                   show_line();
  58.                   break;
  59.          case 5:
  60.                   show_baud();
  61.                   break;
  62.          case 6:
  63.                   show_config();
  64.                   break;
  65.          case 7:
  66.                   show_timeout();
  67.                   break;
  68.          case 8:
  69.                   show_filetype();
  70.                   break;
  71.          case 9:
  72.                   show_log();
  73.                   break;
  74.          case 10:
  75.                   show_dup();
  76.                   break;
  77.          case 11:
  78.                   show_hsh();
  79.                   break;
  80.          case 12:
  81.                   show_block_check_type();
  82.                   break;
  83.          case 13:
  84.                   show_repeat_quote();
  85.                   break;
  86.          case 14:
  87.                   show_retry();
  88.                   break;
  89.          case 15:
  90.                   show_packet_length();
  91.                   break;
  92.          case 16:
  93.                   show_pding();
  94.                   break;
  95.          case 17:
  96.                   show_pdchar();
  97.                   break;
  98.          case 18:
  99.                   show_start_of_packet();
  100.                   break;
  101.          case 19:
  102.                   show_end_of_line();
  103.                   break;
  104.          case 20:
  105.                   show_quote();
  106.                   break;
  107.          case 21:
  108.                   show_eight_bit_quote();
  109.                   break;
  110.          case 22:
  111.                   show_incomplete();
  112.                   break;
  113.          case 23:
  114.                   show_delay();
  115.                   break;
  116.          case 24:
  117.                   show_warning();
  118.                   break;
  119.          case 25:
  120.                   show_mapping();
  121.                   break;
  122.          case 26:
  123.                   show_auto_recover();
  124.                   break;
  125.          case 27:
  126.                   show_attributes();
  127.       }
  128. }
  129.  
  130. /*
  131.  * Show various parameters
  132.  */
  133.  
  134. show_all()
  135. {
  136.    show_line();
  137.    show_baud();
  138.    show_config();
  139.    show_escape();
  140.    show_filetype();
  141.    show_warning();
  142.    show_mapping();
  143.    show_auto_recover();
  144.    show_attributes();
  145.    show_log();
  146.    show_dup();
  147.    show_debug();
  148.    show_incomplete();
  149.    show_hsh();
  150.    show_retry();
  151.    show_timeout();
  152.    show_delay();
  153.    show_start_of_packet();
  154.    show_end_of_line();
  155.    show_quote();
  156.    show_eight_bit_quote();
  157.    show_repeat_quote();
  158.    show_packet_length();
  159.    show_pding();
  160.    show_pdchar();
  161.    show_block_check_type();
  162. }
  163.  
  164. show_debug()
  165. {
  166.    printf("Debug:\t\t\t\t");
  167.    if (debug != 2)
  168.       show_onoff(debug);
  169.    else
  170.       printf("File: %s\n",dbgfname);
  171. }
  172.  
  173. show_dup()
  174. {
  175.    printf("Duplex:\t\t\t\t");
  176.    if (fulldup)
  177.       printf("Full\n");
  178.    else
  179.       printf("Half\n");
  180. }
  181.  
  182. show_escape()
  183. {
  184.    printf("Escape character:\t\t%c\n", escchr);
  185. }
  186.  
  187. show_line()
  188. {
  189.    printf("Line:\t\t\t\t%s\n",tty_descr);
  190. }
  191.  
  192. show_baud()
  193. {
  194.    printf("Baudrate:\t\t\t%d baud\n", speed);
  195. }
  196.  
  197. show_config()
  198. {
  199.    static char *conftab[] =
  200.    {
  201.       "7 bits, even parity, 2 stop bits",
  202.       "7 bits, odd parity, 2 stop bits",
  203.       "7 bits, even parity, 1 stop bit",
  204.       "7 bits, odd parity, 1 stop bit",
  205.       "8 bits, no parity, 2 stop bits",
  206.       "8 bits, no parity, 1 stop bit",
  207.       "8 bits, even parity, 1 stop bit",
  208.       "8 bits, odd parity, 1 stop bit"
  209.    };
  210.  
  211.    printf("Configuration:\t\t\t%s\n", conftab[config]);
  212. }
  213.  
  214. show_timeout()
  215. {
  216.    printf("Timeout:\t\t\t%d seconds\n", mytime);
  217. }
  218.  
  219. show_filetype()
  220. {
  221.    printf("Filetype:\t\t\t", image);
  222.    if (image)
  223.       printf("Binary\n");
  224.    else
  225.       printf("Ascii\n");
  226. }
  227.  
  228. show_log()
  229. {
  230.    printf("Log file:\t\t\t");
  231.    if (logfile[0])
  232.       printf("%s\n", logfile);
  233.    else
  234.       printf("None\n");
  235. }
  236.  
  237. show_hsh()
  238. {
  239.    if (dstart == 0 || dstop == 0)
  240.       printf("Handshake:\t\toff\n");
  241.    else
  242.    {
  243.       printf("Handshake start:\t\t%d (dec)\n", dstart);
  244.       printf("Handshake stop: \t\t%d (dec)\n", dstop);
  245.    }
  246. }
  247.  
  248. show_quote()
  249. {
  250.    printf("Quote character:\t\t%c\n", myquote);
  251. }
  252.  
  253. show_repeat_quote()
  254. {
  255.    printf("Repeat quote character:\t\t");
  256.    if (myrptquote == 0)
  257.       printf("None\n");
  258.    else
  259.       printf("%c\n",myrptquote);
  260. }
  261.  
  262. show_eight_bit_quote()
  263. {
  264.    printf("Eight-bit quote character:\t");
  265.    if (myeightquote == 0)
  266.       printf("None\n");
  267.    else
  268.       printf("%c\n",myeightquote);
  269. }
  270.  
  271. show_start_of_packet()
  272. {
  273.    printf("Start of packet:\t\t%02.2x (hex)\n", mypackstart);
  274. }
  275.  
  276. show_retry()
  277. {
  278.    printf("Maximum retry's:\t\t%d (dec)\n", maxtry);
  279. }
  280.  
  281. show_packet_length()
  282. {
  283.    printf("Packet length:\t\t\t%d (dec)\n", maxpacksiz);
  284. }
  285.  
  286. show_end_of_line()
  287. {
  288.    printf("End of line character:\t\t%02.2x (hex)\n", myeol);
  289. }
  290.  
  291. show_pding()
  292. {
  293.    printf("Padding count:\t\t\t%d (dec)\n", mypad);
  294. }
  295.  
  296. show_pdchar()
  297. {
  298.    printf("Padding character:\t\t%02.2x (hex)\n", mypchar);
  299. }
  300.  
  301. show_block_check_type()
  302. {
  303.    printf("Blockcheck type:\t\t");
  304.    switch (myblock_check_type)
  305.    {
  306.       case 1:
  307.                printf("One character checksum\n");
  308.                break;
  309.       case 2:
  310.                printf("Two character checksum\n");
  311.                break;
  312.       case 3:
  313.                printf("Three character CRC-CCITT\n");
  314.                break;
  315.    }
  316. }
  317.  
  318. show_incomplete()
  319. {
  320.    printf("Incomplete file disposition:\t");
  321.    if (save_file)
  322.       printf("Keep\n");
  323.    else
  324.       printf("Discard\n");
  325. }
  326.  
  327. show_delay()
  328. {
  329.    printf("Delay before sending:\t\t%d seconds\n",send_delay);
  330. }
  331.  
  332. show_warning()
  333. {
  334.    printf("File conflict warning:\t\t");
  335.    show_onoff(warning);
  336. }
  337.  
  338. show_mapping()
  339. {
  340.    printf("Filename case mapping:\t\t");
  341.    show_onoff(mapping);
  342. }
  343.  
  344. show_auto_recover()
  345. {
  346.    printf("Auto packet length recovery:\t");
  347.    show_onoff(auto_recover);
  348. }
  349.  
  350. show_attributes()
  351. {
  352.    printf("Automatic file attributes:\t");
  353.    show_onoff(allowattr);
  354. }
  355.  
  356. show_onoff(flag)
  357. int flag;
  358. {
  359.    if (flag)
  360.       printf("On\n");
  361.    else
  362.       printf("Off\n");
  363. }
  364.