dtpad(1)

NAME
dtpad - edit text files

SYNOPSIS
dtpad [-options] [file]

DESCRIPTION
The dtpad utility is a basic editor that supports editing text files in a manner consistent with other common Graphical User Interface text manipulation and file access mechanisms. Cursor positioning and text selection as well as access to various edit operations can be done via the standard Motif text manipulation mechanisms using the mouse or user-definable key combinations. Text can be cut, copied or pasted, or dragged to and from the Text Editor and/or other compliant application windows via the standard Motif Clipboard and ICCCM Primary and Secondary selection mechanisms. Also, standard dialogs are presented for accessing files and printing text.

The Text Editor also provides the following features:

    Pull down menus for common edit and file operations. Undo of the previous edit operation. Search and replace. Spell checking. Simple formatting. Wrap-to-fit and overstrike modes. Optional status line - allowing cursor positioning by line number. Automatic file save on many abnormal termination conditions. Mechanism for automatic session save and restore.

In the CDE, the Text Editor can be a drag target for CDE files, allowing a File Manager file icon to be dropped on a Text Editor window for insertion in the current text. Also, in CDE, the Text Editor operates in a transparent client-server mode in which all text editing for a display is handled by a single Text Editor server process. In this mode, invoking the Text Editor causes the invoked Text Editor process to be relegated to the role of a requestor process that simply sends an edit request to the server process where the actual editing is handled. The server creates and maintains a separate edit window for each edit request and notifies the requestor when its edit window is closed. The requestor normally just blocks until told by the server to exit; however, if the server cannot honor the edit request (for example, it can't access the directory containing the requestor's file), the requestor handles the editing by itself. If a Text Editor server for a display is not running when an edit request is made, CDE automatically starts one, normally on the CDE session server (which need not be the same as the requestor's host). The normal client-server behavior can be disabled or altered via the Client and Server Control options described under the OPTIONS heading in this manual page.

OPTIONS
The following options are available:

  Basic Command Line Options

    Automatically and silently saves the current text when there are unsaved changes and the Text Editor is closed. The default action for this situation posts a dialog asking whether or not to save the current text. This option inhibits the posting of the Save dialog when the Text Editor is closed. The Save dialog is always posted when a new file is specified and there are unsaved changes.
    Posts a Warning dialog whenever a file name is specified and the file does not exist or cannot be accessed.
    Disables the Warning dialog posted whenever a file is specified for which the user does not have write permission. The default posts a Warning dialog whenever this situation occurs.
    Indicates that the default file name associated with the current text is not to change when the text is saved under a name different than what it was read in under. The current text can still be saved under a different file name; however, the default file name does not change. By default, the default file name is automatically changed to correspond to the last name under which the current text was saved.
    Disallows editing of text in the edit window, essentially turning the Text Editor into a text viewer. The default allows text editing in the edit window even if the text was obtained from a file for which the user does not have write permission.

    Displays a status line at the bottom of the edit window. The status line shows the line number of the line where the text cursor is currently positioned. The text cursor can be positioned to a specific line by selecting the line number window in the status line, typing the desired number and pressing the Return key. Normally, a status line is not displayed.
    Initially turns on wrap-to-fit mode. Wrap-to-fit mode can be toggled on or off via the Edit menu Wrap-to-fit button and normally is initially turned off.
    Displays the edit window for the current invocation of the Text Editor in the specified workspace or workspaces. The default displays the edit window in the workspace in which the Text Editor was invoked. The workspace_list argument specifies a blank-separated list of CDE workspaces. If more than one workspace is specified, the list must be enclosed in quotes.
    Restores the Text Editor to all text editing windows and settings that were in effect at a previous CDE shutdown. All other command-line options are ignored when this option is specified. The session_file argument specifies a Text Editor session file, previously saved at session shutdown by the Text Editor, to be used to restore the Text Editor to its state at shutdown.

  Client and Server Control Options

    Forces the current invocation of the Text Editor to do its own text processing in its own window, independent of the Text Editor server. This is useful for displaying the Text Editor with an environment different from that of other edit windows controlled by the server as, for example, to specify a different locale or different color resources. The Text Editor still supports file drag and drop in this mode.
    Terminates the Text Editor requestor process as soon as the Text Editor server determines that it can handle the requestor's edit request. If this option is not specified, the requestor blocks, terminating only when it receives notification from the server that its edit window has been closed.
    Forces a Text Editor server to be started up (if one is not already running) to process all subsequent edit requests for the display. These edit requests are normally generated by subsequent invocations of the Text Editor without the -standAlone command-line option and cause the server to create a separate edit window to handle each request. Users normally do not need to use this option since the initial edit request for the display causes the CDE to start a Text Editor server automatically.
    Specifies that the Text Editor server process is to terminate when the last edit window for the display is closed. It should only be used with the -server option since it only applies to the server process. If this option is not specified, the Text Editor server remains active indefinitely, even when all active edit windows have been closed.

OPERANDS
The following operand is supported:

    The file to be edited or viewed. If no file is specified, the Text Editor opens a new (empty) edit window and the file name must be specified when the contents are saved.

RESOURCES
The dtpad utility supports the specific Text Editor resources described here plus the standard resources related to the Text Editor widget hierarchy. The main widgets that make up the Text Editor hierarchy are shown under this heading to aid in specifying resources. The widget instance name is shown first, followed by the widget class name in parentheses. Indentation indicates hierarchical structure.

    dtpad (Dtpad)
        main (MainWindow)
            bar (MenuBar)
                fileMenu (PulldownMenu)
                editMenu (PulldownMenu)
                formatMenu (PulldownMenu)
                optionsMenu (PulldownMenu)
                helpMenu (PulldownMenu)
            editor (DtEditor)

The client-server architecture of dtpad restricts the scope of resources that can be specified for individual edit windows that the Text Editor server handles. For efficiency, only the resources specific to the Text Editor are passed on the Text Editor server. None of the standard widget resources, except for geometry, are passed on from the requestor Text Editor to the Text Editor server. These resources are loaded according to the environment on the server's host at the time the server is started up. If more control is required, the -standAlone command-line option is used to create a separate, stand alone dtpad process where any and all of the standard resources, such as fontList or colors, can be loaded according to the environment on the requestor's host.

Basic Resources
Name | Class | Type | Default
saveOnClose | SaveOnClose | Boolean | False
missingFileWarning | MissingFileWarning | Boolean | False
readOnlyWarning | ReadOnlyWarning | Boolean | True
nameChange | NameChange | Boolean | True
viewOnly | ViewOnly | Boolean | False
statusLine | StatusLine | Boolean | False
wrapToFit | WrapToFit | Boolean | False
workspaceList | WorkspaceList | String | NULL
session | Session | String | NULL

  Basic Resources

    Indicates whether the Text Editor is to save automatically the current text when there are unsaved changes and the Text Editor is closed. Setting this resource to True automatically saves unsaved changes when the Text Editor is closed. This is equivalent to specifying the -saveOnClose command-line option.
    Indicates whether a warning dialog is to be posted when a file is specified that does not exist or cannot be accessed. Setting this resource to True displays the warning. This is equivalent to specifying the -missingFileWarning command-line option.
    Indicates whether a warning dialog is to be posted when a file for which the user does not have write permission is read. Setting this resource to False suppresses the warning. This is equivalent to specifying the -noReadOnlyWarning command-line option.
    Indicates whether the current file name is to be changed when the current text is saved under a new name. Setting this resource to False does not allow the name to be reset. This is equivalent to specifying the -noNameChange command-line option.
    Indicates whether text only be viewed or whether it can be edited in the edit window. Setting this resource to True disables text editing. This is equivalent to specifying the -viewOnly command-line option.
    Indicates whether the Text Editor is to display the status line at the bottom of the edit window. Setting this resource to True displays the status line. This is equivalent to specifying the -statusLine command-line option.
    Indicates whether the Text Editor is to enable wrap-to-fit mode when the editor is started. Setting this resource to True enables wrap-to-fit mode. This is equivalent to specifying the -wrapToFit command-line option.
    Indicates which workspace or workspaces the Text Editor is to be displayed in. This is equivalent to specifying the -workspaceList command-line option.
    Specifies the saved session file to use in restoring a previously saved Text Editor session. This is equivalent to specifying the -session command-line argument.

Client-Server Control Resources
Name | Class | Type | Default
standAlone | StandAlone | Boolean | False
blocking | Blocking | Boolean | True
server | Server | Boolean | False
exitOnLastClose | ExitOnLastClose | Boolean | False

  Client And Server Control Resources

    Specifies whether the Text Editor is to run as a separate, independent Text Editor process without using the Text Editor server. Setting this resource to True invokes a separate, independent process. This is equivalent to specifying the -standAlone command-line option.
    Specifies that the client Text Editor process is not to terminate until receiving notification from the Text Editor server that the user exited or closed its edit window. Setting this resource to False causes the client process to exit immediately when the server determines that it can handle its edit request. This is equivalent to specifying the -noBlocking command-line option.
    Specifies that the Text Editor is to be started in server mode to handle all processing for all subsequent edit requests for the display. Setting this resource to True is equivalent to specifying the -server command-line option.
    Specifies that the Text Editor server is to terminate when the last edit window for the display is closed. Setting this resource to True is equivalent to specifying the -exitOnLastClose command-line option.

STDIN
Not used.

INPUT FILES
None.

ENVIRONMENT VARIABLES
The following environment variables affect the execution of dtpad:

    Specify the default X Windows display to connect to. Provide a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, override the values of all the other internationalization variables. Determine the locale that is used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output. Determine the location of message catalogues for the processing of LC_MESSAGES.

ASYNCHRONOUS EVENTS

  ToolTalk Messages
The following ToolTalk Desktop and Media requests are supported by the Text Editor server:

    Text in an arbitrary codeset Data that does not match any other data type

In addition, the Text Editor supports the messages below for any media type that does not have a specific editor registered.

The following messages are supported from the Media Exchange message set:

    Opens a new edit window for composing arbitrary file(s). Opens a new edit window for editing an existing file or buffer or for composing a specific new file or buffer. Opens a new edit window for displaying an existing file or buffer.

The following messages are supported from the Desktop message set:

    Terminates the text editing services or closes a specific Text Editor edit window as specified by the operation2Quit argument. The operation2Quit argument must be the message ID of the Media Exchange request that created the edit window. The default actions for notifying the user, saving or returning text and closing edit windows are:

        If operation2Quit is specified, the specified edit window is closed; otherwise, all edit window(s) are closed and the text editing services are terminated If there are unsaved changes, the user is notified and allowed to save the text and/or abort the Quit; otherwise, the user is not notified and the text is not saved (or returned if a buffer is being edited)

    Both the silent and force arguments are supported. However, the semantics of silent differ from the Desktop message set in that the text editing services provides user notification only when there are unsaved changes, rather than user notification when an edit window is terminated. The following table describes variances in the default action for various combination of silent and force.
    silent | force | action
    False | False | default
    True | False | If there are unsaved changes, the user is not notified, the text is not saved and the edit window is not terminated.
    False | True | If there are unsaved changes, the user is still notified and allowed to save the text, but cannot abort the
    True | True | If there are unsaved changes, the user is not notified, the text is not saved and the edit window is closed.
    Whenever the Quit request is not carried out (i.e., in the default case when the user explicitly aborts the Quit or when silent is True and force is not specified or is False), the Quit request is failed with TT_DESKTOP_ECANCELED. Saves a specific edit window opened via an Edit request. The ID argument must have the messageID vtype and have the value of the message ID of the Edit request that created the edit window. Sent when a file has been saved, as the result of a Save request or a user action.

STDOUT
Not used.

STDERR
Not used.

OUTPUT FILES
None.

EXTENDED DESCRIPTION
None.

EXIT STATUS
The following exit values are returned:

    Successful completion. An error occurred.

CONSEQUENCES OF ERRORS
Default.

APPLICATION USAGE
None.

EXAMPLES
None.

NOTES

  Modes of Operation
Each instance of the Text Editor operates in one of three modes:

    When the Text Editor is started without any overriding command-line options (that is, -standAlone or -server), it always attempts to run in this mode. In this mode it simply sends an edit request to a separate Text Editor server process and then blocks (does nothing) until it receives a notice from the server when its edit request is done, at which time it exits. If -noBlocking is specified, it exits immediately after the server accepts its edit request rather than waiting until the edit request is done. If the Text Editor server cannot process the edit request from the Text Editor instance (for example, the server process doesn't exist or can't be started, or it can't access the requestor's file), or if -standAlone is specified on the command line, the Text Editor instance operates in standAlone mode. In this mode the Text Editor creates its own edit window and handles all processing for this window on its own. In addition, it does not handle any edit requests from outside sources and it exits when its edit window is closed. When -server is specified on the command line, the Text Editor instance operates as a server for all Text Editor edit requests for the same display. That is, it creates a separate edit window and does the actual editing for all Text Editor instances running to the same display that do not have -standAlone specified on their command line. Only one Text Editor server for a display can exist, and in the CDE, this instance is normally started automatically if it's not running at the time an edit request is made.

  Automatic File Save
The Text Editor automatically saves the current text to a panic save file before exiting whenever it encounters a panic signal or an internal X error. Panic signals are signals such as SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGIOT, SIGEMT, SIGFPE, SIGBUS, SIGSEGV, SIGSYS, SIGPIPE and SIGTERM. Internal X errors are both non fatal X Error events (as trapped by XSetErrorHandler(3X)), such as a failure in X server memory allocation, and fatal X errors (as trapped by XSetIOErrorHandler), such as losing the connection to the X server. The Text Editor constructs the name of the panic save file by bracketing the file name as supplied by the user (or noName if none is supplied) with enough number symbols (#) to make the name unique.

  Wrap-to-fit Mode and Formatting
Wrap-to-fit mode and text formatting are essentially independent operations. Wrap-to-fit mode pertains to the dynamic display of lines, as delimited by <newline> characters, which exceed the width of the Text Editor window and is based on the left and right window boundaries. When wrap-to-fit mode is off (the default), each line of text is displayed on a single line on the display and text entered at the right window boundary causes the window to scroll automatically to the right to accommodate the new text until an actual <newline> character is entered (normally, by pressing the Return key). When wrap-to-fit mode is on, lines longer than the window width are automatically wrapped at the right window margin to one or more display lines, and text entered at the right window boundary is automatically broken on a word boundary to the first column of the next display line. Wrap-to-fit mode is dynamic in that wrapped lines are automatically adjusted when text is inserted or deleted or when the window is resized. Wrap-to-fit mode only affects the display of lines; it does not actually insert <newline> characters in the text.

Text formatting is a static operation that inserts actual <newline> (and/or <space>) characters directly in the text to match it to the left and right margins (and justification mode) specified in the Format Settings dialog. Format settings affect text only when explicitly applied and have no affect on wrap-to-fit mode or previously formatted text. Initially, and whenever the window is resized, the right format margin is automatically set to the window width to match the wrap-to-fit boundary.

FILES

    Text Editor Application Defaults.
    Text Editor Message Catalog.
    Text Editor Help Volume.
    Contains Text Editor action definitions used by the Text Editor.
    ToolTalk process-types file containing message definitions used by the Text Editor.
    Panic save file (see Automatic File Save).

SEE ALSO
DtEditor(3).