delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/11/02/22:28:21

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-Id: <199911030327.TAA23623@aleph.ssd.hal.com>
Subject: Re: Bug report -- gcc-2.95
To: cygwin AT sourceware DOT cygnus DOT com
Date: Tue, 2 Nov 1999 19:27:48 -0800 (PST)
In-Reply-To: <199911030249.VAA07143@lpb.niams.nih.gov> from "Mark Schoenberg" at Nov 2, 99 09:49:09 pm
From: "J. J. Farrell" <jjf AT bcs DOT org DOT uk>
X-Mailer: ELM [version 2.4 PL23]

> From: Mark Schoenberg <mark AT lpb DOT niams DOT nih DOT gov>
> 
>      Mumit Khan's port of gcc-2.95 for Cygwin failed to compile the following
> simple subroutine with the command "gcc -v -O2 -mno-cygwin -c mdate.c -o
> mdate.o".
> 
> #include <sys/time.h>
> char *mdate()
> {
> 
>   time_t ts;
>   char *ntime, *ctime(), buf[100];
>   int ni;
> 
>   time(&ts);
>   ntime = ctime(&ts);
>   strcpy(buf,ntime);
>   ni= strlen(buf);
>   buf[ni-1] = '\0';
>   strcpy(ntime,buf);
>   return (ntime);
> }
> 
> mdate.c: In function `mdate':
> mdate.c:5: `time_t' undeclared (first use in this function)

For POSIX and C compliance you should be including <time.h> rather
than <sys/time.h>. I don't know if this will fix your problem, but
it will give you stronger grounds for complaint if it doesn't.

Just as an aside: ctime() is declared in <time.h> so would be better
not declared here; you should also be including <string.h>; and it
seems a waste of effort to copy from and to ntime!


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019