Deutsch   English   Français   Italiano  
<v40rnj$2g7r9$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: James Kuyper <jameskuyper@alumni.caltech.edu>
Newsgroups: comp.lang.c
Subject: Re: Running an editor from ANSI C
Date: Sat, 8 Jun 2024 01:54:56 -0400
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <v40rnj$2g7r9$1@dont-email.me>
References: <v3pge7$uf2i$1@dont-email.me> <v3r2pl$16mtl$1@dont-email.me>
 <v3r7v8$1b57j$1@dont-email.me> <v3rek5$1c4i5$1@dont-email.me>
 <v3rrtm$1e6g8$1@dont-email.me> <v3ru84$1eafb$1@dont-email.me>
 <87o78dzw1a.fsf@nosuchdomain.example.com> <v3tkmb$1o860$3@dont-email.me>
 <v3uk0l$20s0s$2@dont-email.me> <v3uoeo$21g4g$5@dont-email.me>
 <v3v6jt$23q0b$2@dont-email.me> <v3vk3m$265uv$1@dont-email.me>
 <iJJ8O.22$raU6.11@fx16.iad> <v403ei$2913i$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 08 Jun 2024 07:54:59 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="447ef11239a3655ed74a8f7f5605db70";
	logging-data="2629481"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+m3wpCiblfTW1/9HbbcU12PmzY3LkeM94="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:l10H+rm0sTtx+Zkrn1WnbN1tP7o=
In-Reply-To: <v403ei$2913i$2@dont-email.me>
Content-Language: en-US
Bytes: 2695

On 2024-06-07, Malcolm McLean <malcolm.arthur.mclean@gmail.com> wrote:
> On 07/06/2024 21:04, Scott Lurndal wrote:
>> How does your pure "C" shell
>> spawn a new process without using posix or other OS-specific
>> APIs?
>
> It can call "system".

I gather that you insist on using C90, so I'll quote from the C90
standard, but everything I'm about to say is equally a problem with the
current C standard:

7.10.4.5:

"Description
The system function passes the string pointed to by string to the host
environment to be executed by a command processor in an
implementation-defined manner. A null pointer may be used for string to
inquire whether a command processor exists.

Returns
If the argument is a null pointer, the system function returns nonzero
only if a command processor is available. If the argument is not a null
pointer, the system function returns an implementation-defined value."

Note in particular: whether the system even has a a command processor
depends upon the operating system. The manner in which the command
string is processed and the meaning of system()'s nonzero return values
depend upon the operating system as well, though the C implementation is
required to document it. There's no way to write portable C code that
calls system().