# man --- decide on suitability of the reference manual
#         in documenting the current SWT subsystem
#
# Usage : man -(e|n)
#
# When called with the "-n" argument, 'man' lists all the
# commands and library routines that exist in the library and
# command directories, but do not have reference manual entries.
# The "-e" argument generates a list of all commands and library
# routines that have been removed, but still have reference manual
# entries.

   declare internals = "=src=/lib/sh/src/intcmd.u"

   declare switch = 1         # selects the output stream for "common"

   case [arg 1]

      when "-e"               # (e)xtra doc in the reference manual
         set switch = 2

      when "-n"               # (n)eeds doc in the reference manual

      out
         echo "Usage: "[arg 0]" -(e|n)" >/dev/errout
         exit
   esac

# compare the reference manual entries for the standard and
# local commands with what is out there in the object code
# directories.

   lf -c =bin= =lbin= =ebin= |MERGE _
      files .r$ [internals] | change _cmd.r$ |MERGE _
      :MERGE  cat -1 -2 | sort | uniq |$ _
      files .d$ =doc=/man/s1 =doc=/man/s3 =doc=/man/s5 | _
         change .d$ | sort |$ common -[switch]

# compare the reference manual entries for the standard and
# local subprograms with what is out there in the libraries.

   cat =src=/lib/swt/shared =src=/lib/swt/unshared | sort |$ _
      files .d$ =doc=/man/s2 =doc=/man/s4 =doc=/man/s6 | _
        change .d$ | sort | common -[switch]
