EDITOR

Section: C Library Functions (3)
Updated: 11/12/80
Index Return to Main Contents
 

NAME

editor - execute the user's favorite editor  

SYNOPSIS

int editor (file,message);
char *file,*message;  

DESCRIPTION

Editor will execute the editor preferred by the user, to edit the file whose name is file. The string message will be printed to tell the user what he is editing.

This routine contains all the special knowledge needed to execute the editors known to the system; if the user wants to use some other editor, it will be done but with no special assistance from this routine.

There is assumed to be an environment parameter called EDITOR, whose value is the name of the user's favorite editor (e.g. ex, emacs). If the EDITOR parameter is missing from the environment, some default editor will be used.

The runp(3) routine is used to execute the editor; it uses the PATH environment parameter to find the editor. In general, if the editor can be found by the shell, it should be found by editor.

Editor returns the return code of the editor upon normal completion, or -1 if the editor if interrupted or cannot be executed.

This routine is useful for any program which allows the user to edit a text file.  

ENVIRONMENT

EDITOR

is assumed to be the name of the user's favorite editor. The editors currently in use at CMU are: "ex", "vi", "emacs", and "ed". Any other editor is also acceptable; it will be executed with a single parameter which the name of the file to be edited. The value of EDITOR may be an absolute name, if desired.
PATH

is assumed to be the searchlist for executable programs.

 

SEE ALSO

ed(1), emacs(1), ex(1), runp(3)  

DIAGNOSTICS

Returns -1 if the editor cannot be successfully executed, 0 normally, >0 if the editor itself discovers some error condition.  

BUGS

Currently configured for the editors in use at Carnegie-Mellon University. The default editor is emacs.

If message contains a newline, it may not be completely meaningful when using some screen-oriented editors.


 

Index

NAME
SYNOPSIS
DESCRIPTION
ENVIRONMENT
SEE ALSO
DIAGNOSTICS
BUGS

This document was created by man2html, using the manual pages.
Time: 16:57:50 GMT, September 23, 2024