Fast question abount EDITOR
Polytropon
freebsd at edvax.de
Thu Apr 5 16:02:29 UTC 2012
On Thu, 05 Apr 2012 08:57:55 +0200, Andrea Venturoli wrote:
> Hello.
>
> This might be a stupid question... however...
>
> %setenv EDITOR emacs -nw
> setenv: Too many arguments.
>
> %setenv EDITOR "emacs -nw"
> %crontab -e
> crontab: emacs -nw: No such file or directory
> crontab: "emacs -nw" exited with status 1
>
>
> Is there a way I can easily achieve the above?
> Do I really need a script which in turns call emacs -nw?
According to crontab's source, the editor is invoked
by an execlp() call, usr/src/usr.sbin/cron/crontab/crontab.c
in line 404:
execlp(editor, editor, Filename, (char *)NULL);
The synopsis of this function can be found in "man 3 exec":
int execlp(const char *file, const char *arg, ... /*, (char *)0 */);
The manpage contains this information:
The initial argument for these functions is the pathname
of a file which is to be executed.
and:
The first argument, by convention, should point to
the file name associated with the file being executed.
as well as:
The functions execlp(), execvp(), and execvP() will
duplicate the actions of the shell in searching for
an executable file if the specified file name does
not contain a slash ``/'' character. For execlp()
and execvp(), search path is the path specified in
the environment by ``PATH'' variable. If this
variable is not specified, the default path is set
according to the _PATH_DEFPATH definition in <paths.h>,
which is set to ``/usr/bin:/bin''.
That means that $EDITOR has to contain the file name of the
editor (as its location will be determined automatically).
When options are added, this requirement isn't met anymore.
This seems to imply that you cannot use an alias - you'd
have to provide a script as you initially did assume. :-(
--
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions
mailing list