Sujet : Re: Running an editor from ANSI C
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 08. Jun 2024, 21:51:30
Autres entêtes
Organisation : None to speak of
Message-ID : <87jzizxinh.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Michael S <
already5chosen@yahoo.com> writes:
On Fri, 7 Jun 2024 10:47:57 -0000 (UTC)
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
On Fri, 07 Jun 2024 02:37:42 -0700, Keith Thompson wrote:
As for portability, I'm not aware of the $EDITOR convention being
used on non-POSIX systems.
Can non-POSIX systems offer anything better? Any worthwhile
alternative?
No.
>
Yes. The one below is better.
ShellExecute(NULL, "edit", filename, NULL, NULL, SW_NORMAL);
For those not familiar with Windows, "edit" is not a command name, it's
an "object verb". The above call invokes the user's configured command
to edit the specified file. It might invoke a text editor for foo.txt,
an image editor for foo.png. It's similar to right-clicking a file in
the file explorer and selecting "Edit". Other verbs include "open",
"print", and "properties".
https://learn.microsoft.com/en-us/windows/win32/shell/launch#using-shellexecute-and-shellexecuteexOn Unix-like systems, xdg-open does something similar. (It's typically
configured by default to invoke a GUI editor; it doesn't pay attention
to $EDITOR.)
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */