Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -41,8 +41,6 @@ ...@@ -41,8 +41,6 @@
#include <stdlib.h> /* malloc */ #include <stdlib.h> /* malloc */
#include <string.h> /* strdup */ #include <string.h> /* strdup */
#include "truncsp.c" /* truncsp() and truncnl() */
/***********************************/ /***********************************/
/* CSV (Comma Separated Value) API */ /* CSV (Comma Separated Value) API */
/***********************************/ /***********************************/
......
...@@ -416,3 +416,31 @@ clock_t DLLCALL msclock(void) ...@@ -416,3 +416,31 @@ clock_t DLLCALL msclock(void)
return((clock_t)(usecs/(1000000/MSCLOCKS_PER_SEC))); return((clock_t)(usecs/(1000000/MSCLOCKS_PER_SEC)));
} }
#endif #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" { ...@@ -171,6 +171,11 @@ extern "C" {
#endif #endif
#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__) #if defined(__unix__)
#define STRERROR(x) strerror(x) #define STRERROR(x) strerror(x)
#else #else
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
static ini_style_t default_style; static ini_style_t default_style;
#include "truncsp.c" /* truncsp() and truncnl() */
static char* section_name(char* p) static char* section_name(char* p)
{ {
char* tp; char* tp;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment