9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Boyd Roberts <boyd@strakt.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] APE: strdup()
Date: Mon, 15 Oct 2001 09:22:46 +0200	[thread overview]
Message-ID: <3BCA8EC6.8B8B40C9@strakt.com> (raw)
In-Reply-To: <cej-1011015091415.A01300@cejchan.gli.cas.cz>

pac wrote:
> 
>      char *parameterfile, optarg;
>                 ...
>      parameterfile = strdup(optarg);
> 
> cc: incompatible types: "IND CHAR" and "INT" for op "AS"
> although manpage says:
> char* strdup(char *s)

Yes, this is why I don't like declarations like that.

You have declared a char * [parameterfile] and a char [optarg]
which has be premoted to int when passed to strdup().

Before I shoot myself in the foot, I checked out getopt(3).

You need to declare:

    extern char *optarg;

I never commit to memory all this quirky stuff;  I always use man.


  reply	other threads:[~2001-10-15  7:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-15  7:14 pac
2001-10-15  7:22 ` Boyd Roberts [this message]
2001-10-15  7:41 ` Wladimir Mutel
2001-10-15  7:47   ` Boyd Roberts
2001-10-15 10:01     ` strdup once more, was: " pac
2001-10-22  9:25       ` Douglas A. Gwyn
2001-10-15 19:15 David Gordon Hogan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3BCA8EC6.8B8B40C9@strakt.com \
    --to=boyd@strakt.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).