Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #126405
| From | fred flintstone <fred@server.invalid> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: understanding C issues in geany install |
| Date | 2018-02-07 07:44 -0800 |
| Message-ID | <fe0l6qF2cqfU1@mid.individual.net> (permalink) |
| References | <fdh9l6Fhh6eU1@mid.individual.net> <465929e9-1112-725d-26fd-47edfb89b44c@verizon.net> |
On 02/01/2018 12:39 PM, James R. Kuyper wrote:
> On 02/01/2018 02:55 PM, fred flintstone wrote:
> ...
>> Q1) Does contemporary standard C have any defined relationship to the
>> shell, from the point of view of C?
>
> "#include <stdlib.h>
> int system(const char *string);
>
> If string is a null pointer, the system function determines whether the
> host environment has a command processor. If string is not a null
> pointer, the system function passes the string pointed to by string to
> that command processor to be executed in a manner which the
> implementation shall document; this might then cause the program calling
> system to behave in a non-conforming manner or to terminate.
>
> 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, and the system function does return, it returns an
> implementation-defined value." (7.22.4.8)
>
> That is the only defined relationship between them.
>
> Given the implementation-dependence of the behavior of system(), it's
> close to impossible to make any portable use of that function.
ok
>
>> Running ./configure ...
>> checking for a BSD-compatible install... /usr/bin/install -c
>> checking whether build environment is sane... yes
>> checking for a thread-safe mkdir -p... /bin/mkdir -p
>>
>> Q2) What does -c entail in the above?
>
> That's a question about the install command; on a Unix-like system, if
> the man pages have been correctly installed, you should be able to get
> the answer by typing:
>
> man install
>
> "man" in the name for the online user manual program. On the system I'm
> using right now, the man page indicates "install" ignores the -c option.
> This kind of thing happens if something that used to be optional has
> become standard, so there's no longer any need to have an option to make
> it happen. The option is still allowed, so people don't have to rewrite
> their build scripts, but it doesn't change anything.
It didn't occur to me that I could "man install," where I find this:
-c (ignored)
>
>> Q3) When I script, I write
>> mkdir -p boulder
>> , without really knowing why. Is there a place I can look at the C
>> source of mkdir on my machine to ascertain why?
>
> Possibly, but typing
>
> man mkdir
>
> is a much simpler way to the get the answer:
>
> " -p, --parents
> no error if existing, make parent directories as needed"
>
> What this means is that instead of typing:
> mkdir parent
> mkdir parent/child
>
> you can type
> mkdir -p parent/child
>
> And it will first create the parent directory, if necessary, and then
> parent/child. Without the -p option, it would look for a parent
> directory to place child in, not find it, and generate an error message.
> It is therefore never necessary to use -p unless there's at least one
> '/' in the pathname for the directory you want to create.
Gotcha. I'd never quite figured this out.
>
>> $ lsb_release -a
>> No LSB modules are available.
>> Distributor ID: Ubuntu
>> Description: Ubuntu 16.04.3 LTS
>> Release: 16.04
>> Codename: xenial
>> $
>>
>> checking for gcc... gcc
>> checking whether the C compiler works... yes
>> checking for C compiler default output file name... a.out
>> checking for suffix of executables...
>> checking whether we are cross compiling... no
>> checking for suffix of object files... o
>> checking whether we are using the GNU C compiler... yes
>> checking whether gcc accepts -g... yes
>> checking for gcc option to accept ISO C89... none needed
>> checking whether gcc understands -c and -o together... yes
>> checking dependency style of gcc... gcc3
>> checking how to run the C preprocessor... gcc -E
>>
>> Nothing crazy looking here. Do I gather correctly that g is an alias for
>> gcc?
>
> The only isolated g in the above output is on the following line:
> > checking whether gcc accepts -g... yes
>
> That g is NOT an alias for gcc. It is part of -g, which is an option
> that gcc might or might not accept. You can get information about gcc by
> typing:
> man gcc
>
> If you type "/ -g ", man will search for the string " -g ". Hit "n" as
> needed to continue on to the next match. On my system, I had to hit "n"
> 5 times to get to the correct description, which says:
>
> "-g Produce debugging information in the operating system's native
> format (stabs, COFF, XCOFF, or DWARF 2). GDB can work with
> this debugging information."
>
>> Also, curious how C 89 and 99 were made to gyve:
>> checking for gcc option to accept ISO C99... none needed
>>
>> checking if gcc static flag -static works... yes
>> checking if gcc supports -c -o file.o... yes
>> checking if gcc supports -c -o file.o... (cached) yes
>>
>> Again, cloudy about -c in this context.
>
> In this case, -c is a option on the gcc command. from "man gcc":
>
> "-c Compile or assemble the source files, but do not link. The linking
> stage simply is not done. The ultimate output is in the form
> of an object file for each source file."
So -c has a different context here.
>
>> Finally, I have one Big Question:
>>
>> Does the C Programming Language, as defined by C99, define anything
>> about the shells that surround it? It's alright if the answer is no; I
>> just want to know what it is.
>
> No.
>
>> From C's point of view, what is bash?
>
> Nothing. Such matters are outside the scope of the C standard.
>
>> ... Does bash have a standard it
>> adheres to? Is that POSIX?
>
> See <https://en.wikipedia.org/wiki/Bash_(Unix_shell)>.
>
> bash is a freeware replacement for the Bourne shell, sh. It's widely
> available on Linux and macOS platforms, and there's a Windows 10
> compatible version as well. sh is defined by a POSIX standard. Executing
> "bash -posix" makes it conform very closely to the POSIX requirements
> for sh.
Alright, these were the answers I was looking for. It's very helpful for
me to sort out which standard applies. This script:
https://github.com/TBlazer66/island/blob/master/1.repos.sh
aims to install geany on debian systems. I can get scripts to save now,
but still cannot get them to conform to an indenting scheme, so these
scripts are still super jagged.
Thanks all for comments,
--
fred flintstone
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
understanding C issues in geany install fred flintstone <fred@server.invalid> - 2018-02-01 11:55 -0800
Re: understanding C issues in geany install Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-02-01 12:04 -0800
Re: understanding C issues in geany install Keith Thompson <kst-u@mib.org> - 2018-02-01 12:19 -0800
Re: understanding C issues in geany install Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-02-04 19:24 +0000
Re: understanding C issues in geany install David Kleinecke <dkleinecke@gmail.com> - 2018-02-04 16:02 -0800
Re: understanding C issues in geany install "James R. Kuyper" <jameskuyper@verizon.net> - 2018-02-01 15:39 -0500
Re: understanding C issues in geany install fred flintstone <fred@server.invalid> - 2018-02-07 07:44 -0800
Re: understanding C issues in geany install Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2018-02-01 16:08 -0700
Re: understanding C issues in geany install gordonb.669da@burditt.org (Gordon Burditt) - 2018-02-05 20:56 -0600
Re: understanding C issues in geany install John Bode <jfbode1029@gmail.com> - 2018-02-06 09:26 -0800
Re: understanding C issues in geany install Keith Thompson <kst-u@mib.org> - 2018-02-06 12:36 -0800
Re: understanding C issues in geany install "James R. Kuyper" <jameskuyper@verizon.net> - 2018-02-06 15:49 -0500
Re: understanding C issues in geany install scott@slp53.sl.home (Scott Lurndal) - 2018-02-06 21:37 +0000
csiph-web