parsing a command from a config file - Unix

This is a discussion on parsing a command from a config file - Unix ; Bjorn Reese writes: > Rainer Weikusat wrote: > First of all, thanks for the clarification. > >> A 'portable solution' would be one where the 0 is casted to a pointer >> type that is compatible with the pointer type ...

+ Reply to Thread
Page 3 of 3 FirstFirst 1 2 3
Results 41 to 53 of 53

Thread: parsing a command from a config file

  1. Re: parsing a command from a config file

    Bjorn Reese writes:
    > Rainer Weikusat wrote:
    > First of all, thanks for the clarification.
    >
    >> A 'portable solution' would be one where the 0 is casted to a pointer
    >> type that is compatible with the pointer type 'expected' by the
    >> execl-implementation. What 'a compatible pointer type' is exactly
    >> supposed to be isn't directly specified. char * is used at least used

    >
    > It is specified. The signature of execl() is defined in the synopsis as:
    >
    > int execl(const char *path, const char *arg0, ... /*, (char *)0 */);
    >
    > The "arg0,..." in the text "[t]he arguments represented by arg0,... are
    > pointers to null-terminated character strings" refers to the second
    > parameter (arg0) of execl() and subsequent parameters.
    >
    > Our disagreement is whether or not the terminating null pointer is
    > included in the subsequent parameters (the "..." part).


    This is your 'disagreement' with the content of this text. Since arg0,
    .... are pointers to null-terminated character strings, none of them
    can be a null pointer. Which the text explicitly states:

    The arguments represented by arg0,... are pointers to
    null-terminated character strings. These strings shall
    constitute the argument list available to the new process
    image. The list is terminated by a null pointer.

    [...]

    > In your interpretation the the null pointer is not part of "arg0,...",
    > and therefore its type is unspecified.


    I am still not interpreting anything, see quote above.

    > However, in this case the null pointer can only refer to
    > "/*, (char *)0 */"


    This is a comment and it has no meaning that would be defined by the
    used programming language. In absence of additional information (and
    there isn't any), the only way to determine what it was supposed to
    mean is to ask the person who wrote it. But that still doesn't make
    what this person intended to express by using this particular comment
    part of the execl-specification.

  2. Re: parsing a command from a config file

    Rainer Weikusat wrote:
    > Bjorn Reese writes:


    >> int execl(const char *path, const char *arg0, ... /*, (char *)0 */);


    > This is your 'disagreement' with the content of this text. Since arg0,
    > ... are pointers to null-terminated character strings, none of them
    > can be a null pointer. Which the text explicitly states:


    Why not? You have already agreed that a "pointer to a null-terminated
    character string" is a "somehow qualified char * by definition" (and I
    furthermore assume that you agree that "(char *)0" is a null pointer),
    so the following text can only be interpreted as meaning that the
    terminating null pointer is of type "somehow qualified char *". Unless,
    of course, you can explain the different semantics of the ellipses (see
    my next comment below).

    > The arguments represented by arg0,... are pointers to
    > null-terminated character strings. These strings shall
    > constitute the argument list available to the new process
    > image. The list is terminated by a null pointer.

    [...]
    >> However, in this case the null pointer can only refer to
    >> "/*, (char *)0 */"

    >
    > This is a comment and it has no meaning that would be defined by the
    > used programming language. In absence of additional information (and


    Then you need to explain how the "arg0, ..." in the signature is
    different from the "arg0,..." in the text (both parts have been quoted
    above), and why the ellipsis in the signature includes the null pointer
    but the ellipsis in the text does not.

    --
    mail1dotstofanetdotdk

  3. Re: parsing a command from a config file

    Bjorn Reese writes:
    > Rainer Weikusat wrote:
    >> Bjorn Reese writes:

    >
    >>> int execl(const char *path, const char *arg0, ... /*, (char *)0 */);

    >
    >> This is your 'disagreement' with the content of this text. Since arg0,
    >> ... are pointers to null-terminated character strings, none of them
    >> can be a null pointer. Which the text explicitly states:

    >
    > Why not?


    Because ISO says so.

  4. Re: parsing a command from a config file

    Rainer Weikusat wrote:

    > Because ISO says so.


    That is irrelevant, because the type of the null pointer can be
    determined from SUS. Your refusal to acknowledge this is based on
    the assumption that the two ellipses by some stroke of magic have
    different meanings. Let me repeat the question from my previous reply
    that you ignored:

    You need to explain how the "arg0, ..." in the signature in the SUS
    synopsis is different from the "arg0,..." in the SUS text (both parts
    have been quoted below), and why the ellipsis in the signature includes
    the null pointer but the ellipsis in the text does not.

    SUS synopsis:

    int execl(const char *path, const char *arg0, ... /*, (char *)0 */);

    SUS text:

    "The arguments represented by arg0,... are pointers to null-terminated
    character strings. These strings shall constitute the argument list
    available to the new process image. The list is terminated by a null
    pointer."

    --
    mail1dotstofanetdotdk

  5. Re: parsing a command from a config file

    Bjorn Reese writes:
    > Rainer Weikusat wrote:
    >
    >> Because ISO says so.

    >
    > That is irrelevant, because the type of the null pointer can be
    > determined from SUS.


    'What ISO says' is that a null pointer compares unequal to any valid
    pointer and since a 'pointer to a null-terminated string' is a valid
    pointer, a statement talking about pointers to null terminated strings
    does not talk about null pointers.

    [...]

    > and why the ellipsis in the signature includes the null pointer but
    > the ellipsis in the text does not.


    "The arguments represented by arg0,... are pointers to null-terminated
    character strings. These strings shall constitute the argument list
    available to the new process image. The list is terminated by a null
    pointer."

    Taking 'never attribute to malice what could equally well be explained
    by mere stupidity' as starting positions, I strongly suggest that you
    try to get enough English lessons to enable you to understand the
    sentence above correctly.


  6. Re: parsing a command from a config file

    Rainer Weikusat wrote:

    > 'What ISO says' is that a null pointer compares unequal to any valid
    > pointer and since a 'pointer to a null-terminated string' is a valid
    > pointer, a statement talking about pointers to null terminated strings
    > does not talk about null pointers.


    Then where in the execl() signature is the terminating null pointer
    shown?

    Previously you agreed that that a "pointer to a null-terminated
    character string" is "a somehow qualified char * by definition".
    The first sentence in the SUS text can therefore be reworded as:

    The arguments represented by arg0,... are somehow qualified char *.

    As "arg0,..." refers to all arguments of execl() from arg0 until and
    including the terminating null pointer, the terminating null pointer is
    "a somehow qualified char *" by implication.

    --
    mail1dotstofanetdotdk

  7. Re: parsing a command from a config file

    Rainer Weikusat wrote:

    > "The arguments represented by arg0,... are pointers to null-terminated
    > character strings. These strings shall constitute the argument list
    > available to the new process image. The list is terminated by a null
    > pointer."
    >
    > Taking 'never attribute to malice what could equally well be explained
    > by mere stupidity' as starting positions, I strongly suggest that you
    > try to get enough English lessons to enable you to understand the
    > sentence above correctly.


    Consider the following parallel:

    "All cars in the queue are green. The people in the cars are on the
    way to the beach. An Audi is at the end of the queue."

    Which of the following conclusions would you make about that Audi at
    the end of the queue?

    1. "The Audi is green"

    2. "The Audi is not necessarily green, because the Audi catalogue
    shows Audis in all colors"

    --
    mail1dotstofanetdotdk

  8. Re: parsing a command from a config file

    Bjorn Reese wrote:
    > Which of the following conclusions would you make about that Audi at
    > the end of the queue?
    >
    > 1. "The Audi is green"
    >
    > 2. "The Audi is not necessarily green, because the Audi catalogue
    > shows Audis in all colors"


    3. "Audi makes bicycles too"? :-) Seriously, I'm with you on this one.

    HT

  9. Re: parsing a command from a config file

    Bjorn Reese writes:
    > Rainer Weikusat wrote:
    >
    >> "The arguments represented by arg0,... are pointers to null-terminated
    >> character strings. These strings shall constitute the argument list
    >> available to the new process image. The list is terminated by a null
    >> pointer."
    >>
    >> Taking 'never attribute to malice what could equally well be explained
    >> by mere stupidity' as starting positions, I strongly suggest that you
    >> try to get enough English lessons to enable you to understand the
    >> sentence above correctly.

    >
    > Consider the following parallel:


    There is nothing parallel here. The text above talks about a list of
    pointers to null terminated strings, making up the argument list
    available to the new process image. And it talks about 'a null
    pointer', which terminates the list, ie which is right behind the last
    pointer to a null-terminated string. Since every pointer to a null
    terminated string must be a valid pointer and 'a null pointer' is one
    with the property to be different from any valid pointer, it is
    trivially obvious that a pointer to a null terminated strings must be
    something which is not a null pointer.

    But since this leads nowhere, I suggest that you just continue to
    believe that null pointers are valid pointers to null terminated
    strings. Some people believe in the tooth fairy. So what?


  10. Re: parsing a command from a config file

    Rainer Weikusat wrote:

    > There is nothing parallel here. The text above talks about a list of
    > pointers to null terminated strings, making up the argument list
    > available to the new process image. And it talks about 'a null
    > pointer', which terminates the list, ie which is right behind the last
    > pointer to a null-terminated string. Since every pointer to a null
    > terminated string must be a valid pointer and 'a null pointer' is one
    > with the property to be different from any valid pointer, it is
    > trivially obvious that a pointer to a null terminated strings must be
    > something which is not a null pointer.


    Until you resolve your ellipses dilemma, the above argument is void.
    As you have ignored this dilemma several times, let me repeat it for
    your convenience:

    Where in the execl() signature is the terminating null pointer shown?

    Previously you agreed that that a "pointer to a null-terminated
    character string" is "a somehow qualified char * by definition".
    The first sentence in the SUS text can therefore be reworded as:

    The arguments represented by arg0,... are somehow qualified char *.

    As "arg0,..." refers to _all_ arguments of execl() from arg0 until and
    including the terminating null pointer, the terminating null pointer is
    "a somehow qualified char *" by implication.

    > But since this leads nowhere, I suggest that you just continue to
    > believe that null pointers are valid pointers to null terminated
    > strings. Some people believe in the tooth fairy. So what?


    Do you really have to keep making these innuendos and ad hominems?

    --
    mail1dotstofanetdotdk



  11. Re: parsing a command from a config file

    Bjorn Reese writes:
    > Rainer Weikusat wrote:
    >> There is nothing parallel here. The text above talks about a list of
    >> pointers to null terminated strings, making up the argument list
    >> available to the new process image. And it talks about 'a null
    >> pointer', which terminates the list, ie which is right behind the last
    >> pointer to a null-terminated string. Since every pointer to a null
    >> terminated string must be a valid pointer and 'a null pointer' is one
    >> with the property to be different from any valid pointer, it is
    >> trivially obvious that a pointer to a null terminated strings must be
    >> something which is not a null pointer.

    >
    > Until you resolve your ellipses dilemma,


    This 'elipsis dilemma' is fictious.

    > the above argument is void.


    Then you should have no difficulties in demonstrating which part of it
    is wrong because of what.

    [ repetition ]

    I am not going to address this again.

  12. Re: parsing a command from a config file

    Rainer Weikusat wrote:

    > This 'elipsis dilemma' is fictious.


    It is real, and yours to solve.

    > Then you should have no difficulties in demonstrating which part of it
    > is wrong because of what.


    The argument would have been fine if the type of the terminating null
    pointer could not have been determined, but it can and so the entire
    argument is void. Let me go through the argument again.

    You postulate that the type of the terminating null pointer is
    unspecified, because the statement that "[t]he arguments represented
    by arg0,... are pointers to null-terminated character strings" does
    not apply to the terminating null pointer, because the null pointer
    cannot point to a null-terminated string.

    However, the quoted statement does not limit itself to the arguments
    from arg0 until and excluding the terminating null pointer argument;
    it includes _all_ arguments from arg0 onwards; hence the very explicit
    "arg0,..." notation. So, the terminating null pointer must have the
    same type has the other arguments (from arg0 onwards). This means that
    "pointers to null-terminated character strings" must be interpreted as
    a "somehow qualified char *" (which you vividly agreed with earlier on).
    So the type of the null pointer is a "somehow qualified char *".

    As the type of the terminating null pointer can be deduced from SUS,
    your postulate that the type is not specified is irrelevant and void.
    The Audi is green, no matter what other colors are in the catalogue.

    The only way you can defend your postulate is to show that the quoted
    statement does not apply to the terminating null pointer, and it order
    to do that you must explain how the "arg0,..." in the text differs from
    the "arg0, ..." in the signature, or you must explain where in the
    signature this magical type-unspecified terminating null pointer occurs.

    That is your ellipses (note the plural form) dilemma.

    > I am not going to address this again.


    You never have.

    --
    mail1dotstofanetdotdk

  13. Re: parsing a command from a config file

    Bjorn Reese writes:
    > Rainer Weikusat wrote:
    >> Then you should have no difficulties in demonstrating which part of it
    >> is wrong because of what.

    >
    > The argument would have been fine if the type of the terminating null
    > pointer could not have been determined, but it can and so the entire
    > argument is void. Let me go through the argument again.
    >
    > You postulate that the type of the terminating null pointer is
    > unspecified, because the statement that "[t]he arguments represented
    > by arg0,... are pointers to null-terminated character strings" does
    > not apply to the terminating null pointer, because the null pointer
    > cannot point to a null-terminated string.


    Exactly. Since all the things refererred to by the ellipsis are
    'pointers to null-terminated character strings', the thing which isn't
    a 'pointer to a null-terminated character string' is not included in
    this set.

    > However, the quoted statement does not limit itself to the arguments
    > from arg0 until and excluding the terminating null pointer argument;


    The text actually says so on two different places:

    - by implicitly excluding the terminating null pointer because
    the arg0, ... are pointers to null-terminated character
    strings without a mentioned exception

    - by explicitly stating that the arg0,... list is terminated
    of pointers to null-terminated character strings is
    'terminated by a null pointer' (not being part of this list).

    > it includes _all_ arguments from arg0 onwards;


    It includes all argument which are pointers to null-terminated strings
    preceding the terminating null pointer. The repeatedly quoted text say
    so.

    [...]

    > The only way you can defend your postulate is to show that the quoted
    > statement does not apply to the terminating null pointer, and it order
    > to do that you must explain how the "arg0,..." in the text differs from
    > the "arg0, ..." in the signature,


    Well, it doesn't. The arg0,... in the signature does not include a
    terminating null pointer, by virtue of not including anything expcept
    arg0, and the arg0,... in the text is defined as not including a null
    pointer by virtue of being defined as list of pointers to null-terminated
    strings.

    > or you must explain where in the signature this magical
    > type-unspecified terminating null pointer occurs.


    Nowhere. There is a comment which can be interpreted as meaning that a
    null pointer of type pointer to char can be the terminating argument.
    But since the comment isn't explained anywhere, that's a coniecture.
    A comment has no defined meaning.

    >> I am not going to address this again.

    >
    > You never have.


    The basic problem here is that you really want to believe that
    something exists in this text which isn't there and that I am really
    incapable of seeing things which don't exist (which makes me totally
    unqualified for being either a politician or a sales person of any
    kind :->).

    And I don't think this will change in either near or far future.

+ Reply to Thread
Page 3 of 3 FirstFirst 1 2 3