1: /* help.c - print the usage line */
   2: 
   3: #include "../h/mh.h"
   4: #include <stdio.h>
   5: 
   6: 
   7: extern char *options[];
   8: 
   9: 
  10: void help (str, swp)
  11: register char  *str;
  12: register struct swit   *swp;
  13: {
  14:     int     nameoutput,
  15:             len,
  16:             linepos,
  17:             outputlinelen;
  18:     register char  *cp,
  19:                   **ap;
  20: 
  21:     printf ("syntax: %s\n", str);
  22:     printf ("  switches are:\n");
  23:     printsw (ALL, swp, "-");
  24: 
  25:     printf ("\nversion: %s\n", version);
  26: 
  27:     nameoutput = linepos = 0;
  28:     outputlinelen = OUTPUTLINELEN;
  29:     for (ap = options; *ap; ap++) {
  30:     if (!nameoutput) {
  31:         fprintf (stdout, "%s: ", cp = "options");
  32:         linepos += (nameoutput = strlen (cp) + 2);
  33:     }
  34:     len = strlen (cp = *ap);
  35:     if (linepos != nameoutput)
  36:         if (len + linepos + 3 > outputlinelen)
  37:         fprintf (stdout, "\n%*s", linepos = nameoutput, "");
  38:         else {
  39:         fputs (" ", stdout);
  40:         linepos++;
  41:         }
  42:     fprintf (stdout, "[%s]", cp);
  43:     linepos += len + 2;
  44:     }
  45: 
  46:     if (linepos)
  47:     (void) fputc ('\n', stdout);
  48: }

Defined functions

help defined in line 10; never used
Last modified: 1985-09-08
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 826
Valid CSS Valid XHTML 1.0 Strict