Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #163595
| From | scott@slp53.sl.home (Scott Lurndal) |
|---|---|
| Subject | Re: Universal Build System for C |
| Newsgroups | comp.lang.c |
| References | <933b95c1-8c8c-48dc-ae58-d49806746b2fn@googlegroups.com> <157cb0a7-adc0-411f-8f43-4717a5d888dan@googlegroups.com> <87wnkzgc1k.fsf@bsb.me.uk> <871r37j3dl.fsf@nosuchdomain.example.com> <snh39k$vsn$1@dont-email.me> |
| Message-ID | <d87nJ.62020$np6.53630@fx46.iad> (permalink) |
| Organization | UsenetServer - www.usenetserver.com |
| Date | 2021-11-23 14:45 +0000 |
Bart <bc@freeuk.com> writes:
>On 22/11/2021 21:18, Keith Thompson wrote:
>> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>>> Thiago Adams <thiago.adams@gmail.com> writes:
>>>
>>>> On Monday, October 4, 2021 at 9:34:03 AM UTC-3, Thiago Adams wrote:
>>>>
>>>> [...]
>>>> "
>>>> if (system("cl "
>>>> SOURCE_FILES
>>>> " -o output_file.exe") != 0)
>>>> {
>>>> exit(1);
>>>> }
>>>> "
>>>>
>>>>
>>>> I little update:
>>>> When I wrote the script using "system" I didn't know that system on linux
>>>> does not return the exit code of the application it executes.
>>>
>>> This is not really a C question. What system will report is very much
>>> determined by the implementation.
>>>
>>> If all goes well (there is a non-null argument and a shell that can be
>>> executed) then it returns the exit status of the shell. That's the exit
>>> status of the last comment the shell ran.
>>>
>>> Why is this not good enough?
>>
>> On POSIX systems, system() returns an int value from which the shell's
>> exit status can be extracted. For example, /bin/false does the
>> equivalent of exit(1), but system("/bin/false") will (very probably)
>> return 256, not 1.
>
>My tests show that system() on Linux returns the last byte of the return
>code, left shifted by 8 bits.
$ man 3 system
Will describe the exact format of the return value and document
the macros used to extract the exit status.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-04 05:33 -0700
Re: Universal Build System for C Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2021-10-04 15:54 +0000
Re: Universal Build System for C fir <profesor.fir@gmail.com> - 2021-10-04 09:26 -0700
Re: Universal Build System for C fir <profesor.fir@gmail.com> - 2021-10-04 09:47 -0700
Re: Universal Build System for C fir <profesor.fir@gmail.com> - 2021-10-04 10:13 -0700
Re: Universal Build System for C fir <profesor.fir@gmail.com> - 2021-10-05 04:12 -0700
Re: Universal Build System for C Guillaume <message@bottle.org> - 2021-10-04 19:49 +0200
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-04 11:00 -0700
Re: Universal Build System for C Bart <bc@freeuk.com> - 2021-10-06 20:37 +0100
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-07 06:18 -0700
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-07 06:25 -0700
Re: Universal Build System for C Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-07 07:41 -0700
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-08 14:05 -0700
Re: Universal Build System for C Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-08 14:22 -0700
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-08 14:44 -0700
Re: Universal Build System for C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-10-08 23:25 +0100
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-08 15:37 -0700
Re: Universal Build System for C Bart <bc@freeuk.com> - 2021-10-08 22:51 +0100
Re: Universal Build System for C Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2021-10-09 01:39 -0700
Re: Universal Build System for C Bart <bc@freeuk.com> - 2021-10-09 11:00 +0100
Re: Universal Build System for C scott@slp53.sl.home (Scott Lurndal) - 2021-10-10 18:09 +0000
8-bit ASCII (was Re: Universal Build System for C) scott@slp53.sl.home (Scott Lurndal) - 2021-10-10 20:55 +0000
Re: Universal Build System for C Bart <bc@freeuk.com> - 2021-10-08 23:05 +0100
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-08 15:30 -0700
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-08 18:12 -0700
Re: Universal Build System for C Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-08 20:51 -0700
Re: Universal Build System for C David Brown <david.brown@hesbynett.no> - 2021-10-09 12:54 +0200
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-09 06:30 -0700
Re: Universal Build System for C David Brown <david.brown@hesbynett.no> - 2021-10-09 17:29 +0200
Re: Universal Build System for C Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2021-10-08 23:39 +0000
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-10-08 17:50 -0700
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-11-22 04:26 -0800
Re: Universal Build System for C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-11-22 20:39 +0000
Re: Universal Build System for C Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-11-22 13:18 -0800
Re: Universal Build System for C Bart <bc@freeuk.com> - 2021-11-22 21:49 +0000
Re: Universal Build System for C scott@slp53.sl.home (Scott Lurndal) - 2021-11-23 14:45 +0000
Re: Universal Build System for C Bart <bc@freeuk.com> - 2021-11-23 16:03 +0000
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2022-04-18 14:39 -0700
Re: Universal Build System for C Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2022-04-18 22:17 +0000
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2022-04-18 16:07 -0700
Re: Universal Build System for C scott@slp53.sl.home (Scott Lurndal) - 2021-11-23 14:44 +0000
Re: Universal Build System for C Thiago Adams <thiago.adams@gmail.com> - 2021-11-22 16:19 -0800
Re: Universal Build System for C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-11-23 01:00 +0000
csiph-web