delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/27/09:45:04

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <69E2FE062AA0D411BE9B00306E00E15222F666@NL-GRH-MAIL01>
From: Arjen Bax <arjen DOT bax AT cmg DOT nl>
To: cygwin AT cygwin DOT com
Subject: RE: tcp_wrappers
Date: Tue, 27 Mar 2001 16:42:28 +0200
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)

Aloha,

Jacek Trzcinski [mailto:jacek AT certum DOT pl] wrote on Tuesday, March 27,
2001 3:53 PM:

> I had to change to:
> 
> if (errno < _sys_nerr && errno > 0) 
> {
> strcpy(bp, _sys_errlist[errno]);
> } else 
> { 
> sprintf(bp, "Unknown error %d", errno);
> }
> Does anybody know it can be made simpler ( with minimal changes). It
> seems to be typical names problem. This changes I made looking at
> libcygwin.a and watching what are correct names of needed variables.

This looks exactly like the implementation of the standard function
strerror() to me, so it could be replaced by:

    #include <string.h>

    strcpy(bp, strerror(errno));

Of course, look out for overflow of your buffer bp[], but you already
knew that ;-).

HTH,

Arjen Bax
-- 
CMG Noord-Nederland B.V.
Sector Telecommunications & Utilities
Postbus 70237, 9704 AE  Groningen
Tel. (050)52 19 500, Fax (050)52 19 504
<http://www.cmg.nl> <http://www.cmg.com>

Adding manpower to a late software project makes it later.


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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