Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connectionsPath: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Richard Harnden
Newsgroups: comp.lang.c
Subject: Re: Running an editor from ANSI C
Date: Fri, 7 Jun 2024 20:08:03 +0100
Organization: A noiseless patient Spider
Lines: 54
Message-ID:
References:
<87o78dzw1a.fsf@nosuchdomain.example.com>
<87frtpznoa.fsf@nosuchdomain.example.com>
<871q59yty1.fsf@nosuchdomain.example.com>
Reply-To: nospam.harnden@invalid.com
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 07 Jun 2024 21:08:05 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="459b11261669d4f8bcbaef599a03cd81";
logging-data="2304710"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Ia1e5jgj+sfIjlKEI9jeY5SVxCaYF7ho="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:JQC2uh5zWXkzNcGNMh4/0XsfR+c=
In-Reply-To:
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: AVG (VPS 240607-6, 6/7/2024), Outbound message
Bytes: 3229
On 07/06/2024 19:52, Malcolm McLean wrote:
> On 07/06/2024 18:56, Janis Papanagnou wrote:
>> On 07.06.2024 14:57, Malcolm McLean wrote:
>>> On 07/06/2024 10:37, Keith Thompson wrote:
>>>> Malcolm McLean writes:
>>>>>
>>>>> Ah thank you. But then main has to take an extra parameter. Now will
>>>>> the shell still be absolutely robust, and completely portable, and run
>>>>> just anywhere?
>>>>
>>>> What? Why would main need an extra parameter?
>>>>
>>> Hre's the main function for the shell.
>>>
>>> int main(int argc, char **argv)
>>> {
>> [...]
>>> }
>>>
>>> Now to get the $EDITOR variable I will have to modify this function.
>>>
>>> int main(int argc, char **argv, char **envp)
>>>
>>> Now what are the implications of doing that? [...]
>>
>> I'm certainly not the most qualified person to answer that, so
>> just two comments...
>> Declaring the extra parameter doesn't spoil the code, does it?
>> (If you don't use it you don't need to specify it. If you have
>> declared it you can use it or not.)
>> Personally my first reflex would be to use a dedicated function
>> to obtain a specific environment variable, specifically getenv();
>> I thought it wouldn't require the 'envp' to work?
>>
>> For me it works
>>
>> #include
>> #include
>> void main (int argc, char * argv[])
>> {
>> printf ("%s\t%s\n", argv[1], getenv(argv[1]));
>> }
>>
>>
>> Janis
>>
> Is getenv() standard now? When did it come in?
C11, I think.
--
This email has been checked for viruses by AVG antivirus software.
www.avg.com