Mail Archives: cygwin/2001/03/27/09:45:04
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 -