Common Desktop Environment: Help System Author's and Programmer's Guide

To Display a Man Page

  1. Create a quick help dialog.

    You can use a general help dialog to display a man page, but this isn't recommended because most of its features are useful only with standard help topics.

  2. Set the following resources for the help dialog:

    DtNhelpType

    Set to DtHELP_TYPE_MAN_PAGE.

    DtNmanPage

    Set to the name of the man page. The value of this resource is passed directly to the system man command. So, to specify a particular section of a man page, precede the man page name by a section number, just as you would if you were typing the man command conventionally.

    You can also set other values for the dialog, such as its size and title.

  3. Manage the dialog using XtManageChild().

Example

The following program segment displays the man page for the grep command. It also sets the size of the dialog to better suit a man page.

ac = 0;
 XtSetArg (al[ac], DtNhelpType, DtHELP_TYPE_MAN_PAGE);  ac++;
 XtSetArg (al[ac], DtNmanPage,   "grep");                ac++;
 XtSetArg (al[ac], DtNcolumns,  80);                     ac++;
 XtSetArg (al[ac], DtNrows,     20);                     ac++;
 XtSetValues (quickHelpDialog, al, ac);
 XtManageChild (quickHelpDialog);