Client/Server Mode

XNEdit can be operated on its own, or as a two-part client/server application. Client/server mode is useful for integrating XNEdit with software development environments, mailers, and other programs; or just as a quick way to open files from the shell command line without starting a new XNEdit session.

To run XNEdit in server mode, type:

      xnedit -server

XNEdit can also be started in server mode via the XNEdit Client program (xnc) when no servers are available.

The xnc program, which is distributed along with XNEdit, sends commands to an XNEdit server to open files or execute editor actions. It can also be used on files that are already opened.

Listing a file on the xnc command line means: Open it if it is not already open and bring the window to the front.

xnc supports the following command line options:

    xnc [-read] [-create]
       [-line n | +n] [-do command] [-lm languagemode]
       [-svrname name] [-svrcmd command]
       [-ask] [-noask] [-timeout seconds]
       [-geometry geometry | -g geometry] [-icon | -iconic]
       [-tabbed] [-untabbed] [-group] [-wait]
       [-V | -version]
       [-xrm resourcestring] [-display [host]:server[.screen]]
       [--] [file...]

-read
Open the file read-only regardless of its actual permissions. There is no effect if the file is already open.

-create
Don't warn about file creation when a file doesn't exist.

-line n, +n
Go to line number n. This will also affect files which are already open.

-do command
Execute an XNEdit macro or action on the file following the -do argument on the command line.

If you use this command without a filename, xnc would randomly choose one window to focus and execute the macro in.

-lm languagemode
Initial language mode used.

-svrname name
Explicitly instructs xnc which server to connect to, an instance of xnedit(1) with a corresponding -svrname argument. By naming servers, you can run several simultaneously, and direct files and commands specifically to any one.

-svrcmd command
The command which xnc uses to start an XNEdit server. It is also settable via the X resource `nc.serverCommand' (see X Resources). Defaults to "xnedit -server".

-ask, -noask
Instructs xnc to automatically start a server if one is not available. This overrides the X resource `nc.autoStart' (see X Resources).

-timeout seconds
Basic time-out period used in communication with an XNEdit server. The default is 10 seconds. Also settable via the X resource `nc.timeOut'.

Under rare conditions (such as a slow connection), it may be necessary to increase the time-out period. In most cases, the default is fine.

-geometry geometry, -g geometry
The initial size and/or location of editor windows. See XNEdit Command Line for details.

-icon, -iconic
Initial window state.

-tabbed
Open all subsequent files in new tabs. Resets -group option.

-untabbed
Open all subsequent files in new windows. Resets -group option.

-group
Open all subsequent files as tabs in a new window.

-wait
Instructs xnc not to return to the shell until all files given are closed.

Normally, xnc returns once the files given in its command line are opened by the server. When this option is given, xnc returns only after the last file given in this call is closed.

Note that this option affects all files in the command line, not only the ones following this option.

Note that xnc will wait for all files given in the command line, even if the files were already opened.

-version, -V
Prints xnc's version and build information.

-xrm resourcestring
Contains the resourcestring passed to a newly started server. This option has no effect if the server is already started.

-display [<host>]:<server>[.<screen>]
The name of the X server to use. See XNEdit Command Line for details.

Command Line Arguments

In typical Unix style, arguments affect the files which follow them on the command line, for example:

      incorrect:   xnc file.c -line 25
      correct:     xnc -line 25 file.c

-read, -create, and -line affect all of the files which follow them on the command line.

The -do macro is executed only once, on the next file on the line. -do without a file following it on the command line, executes the macro on the first available window (presumably when you give a -do command without a corresponding file or window, you intend it to do something independent of the window in which it happens to execute).

The -wait option affects all files named in the command line.

Multiple Servers

Sometimes it is useful to have more than one XNEdit server running, for example to keep mail and programming work separate. The option, -svrname, to both xnedit and xnc, allows you to start, and communicate with, separate named servers. A named server responds only to requests with the corresponding -svrname argument. If you use ClearCase and are within a ClearCase view, the server name will default to the name of the view (based on the value of the CLEARCASE_ROOT environment variable).

Communication

Communication between xnc and xnedit is done through the X display. So as long as the X Window System is set up and working properly, xnc will work properly as well. xnc uses the DISPLAY environment variable, the machine name and your user name to find the appropriate server, meaning, if you have several machines sharing a common file system, xnc will not be able to find a server that is running on a machine with a different host name, even though it may be perfectly appropriate for editing a given file.

The command which xnc uses to start an xnedit server is settable via the X resource nc.serverCommand, by default, "xnedit -server".