Commit 5079d2ee authored by rswindell's avatar rswindell
Browse files

truncsp() and truncnl() are now part of genwrap.c (since STRERROR needs

truncsp() on Win32 anyway).
parent f0550f24
......@@ -41,8 +41,6 @@
#include <stdlib.h> /* malloc */
#include <string.h> /* strdup */
#include "truncsp.c" /* truncsp() and truncnl() */
/***********************************/
/* CSV (Comma Separated Value) API */
/***********************************/
......
......@@ -416,3 +416,31 @@ clock_t DLLCALL msclock(void)
return((clock_t)(usecs/(1000000/MSCLOCKS_PER_SEC)));
}
#endif
/****************************************************************************/
/* Truncates all white-space chars off end of 'str' (needed by STRERRROR) */
/****************************************************************************/
char* DLLCALL truncsp(char* str)
{
unsigned c;
c=strlen(str);
while(c && (str[c-1]==' ' || str[c-1]=='\t' || str[c-1]=='\r' || str[c-1]=='\n')) c--;
str[c]=0;
return(str);
}
/****************************************************************************/
/* Truncates carriage-return and line-feed chars off end of 'str' */
/****************************************************************************/
char* DLLCALL truncnl(char* str)
{
unsigned c;
c=strlen(str);
while(c && (str[c-1]=='\r' || str[c-1]=='\n')) c--;
str[c]=0;
return(str);
}
......@@ -171,6 +171,11 @@ extern "C" {
#endif
#endif
/* Truncate white-space chars off end of string */
DLLEXPORT char* DLLCALL truncsp(char* str);
/* Truncate new-line chars off end of string */
DLLEXPORT char* DLLCALL truncnl(char* str);
#if defined(__unix__)
#define STRERROR(x) strerror(x)
#else
......
......@@ -54,8 +54,6 @@
static ini_style_t default_style;
#include "truncsp.c" /* truncsp() and truncnl() */
static char* section_name(char* p)
{
char* tp;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment