const char *Blanks(int cnt)
{
-#if 1
- abort();
-#else
static const char *BlkStr = " ";
static int BlkStrLen = 0;
cnt = BlkStrLen;
return BlkStr + (BlkStrLen - cnt);
-#endif
}
/*!------------------------------------------------------------------------
char *SysStringCore(char *pDest, char *pDestCurr, LargeWord Num, int System, int Stellen, char StartCharacter)
{
-#if 1
- abort();
-#else
LargeWord Digit;
do
}
while ((Stellen > 0) || Num);
return pDestCurr;
-#endif
}
int SysString(char *pDest, size_t DestSize, LargeWord Num, int System, int Stellen, Boolean ForceLeadZero, char StartCharacter, char SplitCharacter)
{
-#if 1
- abort();
-#else
int Len = 0;
char *pDestCurr, *pDestNext;
if (pDestCurr != pDest)
strmov(pDest, pDestCurr);
return Len;
-#endif
}
/*---------------------------------------------------------------------------*/
char *as_strdup(const char *s)
{
-#if 1
- abort();
-#else
char *ptr;
if (!s)
if (ptr != 0)
strcpy(ptr, s);
return ptr;
-#endif
}
/*---------------------------------------------------------------------------*/
/* ...so is snprintf... */
static void ResetFormatContext(tFormatContext *pContext)
{
-#if 1
- abort();
-#else
int z;
for (z = 0; z < 3; z++)
pContext->LeftAlign =
pContext->AddPlus =
pContext->ForceUpper = False;
-#endif
}
/*!------------------------------------------------------------------------
static size_t limit_minus_one(dest_format_context_t *p_dest_ctx, size_t cnt)
{
-#if 1
- abort();
-#else
/* anyway still enough space? */
if (p_dest_ctx->dest_remlen > cnt)
else
return (cnt >= p_dest_ctx->dest_remlen) ? p_dest_ctx->dest_remlen - 1 : cnt;
-#endif
}
/*!------------------------------------------------------------------------
static size_t append_pad(dest_format_context_t *p_dest_ctx, char src, size_t cnt)
{
-#if 1
- abort();
-#else
cnt = limit_minus_one(p_dest_ctx, cnt);
if (cnt > 0)
p_dest_ctx->dest_remlen -= cnt;
}
return cnt;
-#endif
}
#if 0
static int FloatConvert(char *pDest, size_t DestSize, double Src, int Digits, Boolean TruncateTrailingZeros, char FormatType)
{
-#if 1
- abort();
-#else
int DecPt;
int Sign, Result = 0;
char *pBuf, *pEnd, *pRun;
Result = pRun - pDest;
Result += as_snprintf(pRun, DestSize - Result, "e%+02d", DecPt - 1);
return Result;
-#endif
}
#else
static int FloatConvert(char *pDest, size_t DestSize, double Src, int Digits, Boolean TruncateTrailingZeros, char FormatType)
{
-#if 1
- abort();
-#else
char Format[10];
(void)DestSize;
Format[4] = (HexStartCharacter == 'a') ? FormatType : toupper(FormatType);
sprintf(pDest, Format, Digits, Src);
return strlen(pDest);
-#endif
}
#endif
static size_t append(dest_format_context_t *p_dest_ctx, const char *p_src, size_t cnt, tFormatContext *pFormatContext)
{
-#if 1
- abort();
-#else
size_t pad_len, result = 0;
pad_len = (pFormatContext->Arg[0] > (int)cnt) ? pFormatContext->Arg[0] - cnt : 0;
ResetFormatContext(pFormatContext);
return result + cnt;
-#endif
}
/*!------------------------------------------------------------------------
static int vsprcatf_core(dest_format_context_t *p_dest_ctx, const char *pFormat, va_list ap)
{
-#if 1
- abort();
-#else
const char *pFormatStart = pFormat;
int Result = 0;
size_t OrigLen = strlen(p_dest_ctx->p_dest);
if (p_dest_ctx->dest_remlen > 0)
*(p_dest_ctx->p_dest++) = '\0';
return Result;
-#endif
}
/*!------------------------------------------------------------------------
int as_vsdprcatf(as_dynstr_t *p_dest, const char *pFormat, va_list ap)
{
-#if 1
- abort();
-#else
dest_format_context_t ctx;
ctx.p_dest = p_dest->p_str;
ctx.dest_remlen = p_dest->capacity;
ctx.p_dynstr = p_dest;
return vsprcatf_core(&ctx, pFormat, ap);
-#endif
}
/*!------------------------------------------------------------------------
int as_vsdprintf(as_dynstr_t *p_dest, const char *pFormat, va_list ap)
{
-#if 1
- abort();
-#else
if (p_dest->capacity > 0)
p_dest->p_str[0] = '\0';
return as_vsdprcatf(p_dest, pFormat, ap);
-#endif
}
/*!------------------------------------------------------------------------
int as_sdprcatf(as_dynstr_t *p_dest, const char *pFormat, ...)
{
-#if 1
- abort();
-#else
va_list ap;
int ret;
ret = as_vsdprcatf(p_dest, pFormat, ap);
va_end(ap);
return ret;
-#endif
}
/*!------------------------------------------------------------------------
int as_sdprintf(as_dynstr_t *p_dest, const char *pFormat, ...)
{
-#if 1
- abort();
-#else
va_list ap;
int ret;
ret = as_vsdprintf(p_dest, pFormat, ap);
va_end(ap);
return ret;
-#endif
}
/*!------------------------------------------------------------------------
int as_vsnprcatf(char *pDest, size_t DestSize, const char *pFormat, va_list ap)
{
-#if 1
- abort();
-#else
dest_format_context_t ctx;
if (DestSize == sizeof(char*))
ctx.dest_remlen = DestSize;
ctx.p_dynstr = NULL;
return vsprcatf_core(&ctx, pFormat, ap);
-#endif
}
/*!------------------------------------------------------------------------
int as_vsnprintf(char *pDest, size_t DestSize, const char *pFormat, va_list ap)
{
-#if 1
- abort();
-#else
if (DestSize > 0)
*pDest = '\0';
return as_vsnprcatf(pDest, DestSize, pFormat, ap);
-#endif
}
/*!------------------------------------------------------------------------
int as_snprintf(char *pDest, size_t DestSize, const char *pFormat, ...)
{
-#if 1
- abort();
-#else
va_list ap;
int Result;
Result = as_vsnprcatf(pDest, DestSize, pFormat, ap);
va_end(ap);
return Result;
-#endif
}
/*!------------------------------------------------------------------------
int as_snprcatf(char *pDest, size_t DestSize, const char *pFormat, ...)
{
-#if 1
- abort();
-#else
va_list ap;
int Result;
Result = as_vsnprcatf(pDest, DestSize, pFormat, ap);
va_end(ap);
return Result;
-#endif
}
int as_strcasecmp(const char *src1, const char *src2)
{
-#if 1
- abort();
-#else
if (!src1)
src1 = "";
if (!src2)
src2++;
}
return ((int) tolower(*src1)) - ((int) tolower(*src2));
-#endif
-}
+}
int as_strncasecmp(const char *src1, const char *src2, size_t len)
{
-#if 1
- abort();
-#else
if (!src1)
src1 = "";
if (!src2)
src2++;
}
return ((int) tolower(*src1)) - ((int) tolower(*src2));
-#endif
-}
+}
#ifdef NEEDS_STRSTR
char *strstr(const char *haystack, const char *needle)
{
-#if 1
- abort();
-#else
int lh = strlen(haystack), ln = strlen(needle);
int z;
char *p;
if (strncmp(p = haystack + z, needle, ln) == 0)
return p;
return NULL;
-#endif
}
#endif
char *strrmultchr(const char *haystack, const char *needles)
{
-#if 1
- abort();
-#else
const char *pPos;
for (pPos = haystack + strlen(haystack) - 1; pPos >= haystack; pPos--)
if (strchr(needles, *pPos))
return (char*)pPos;
return NULL;
-#endif
}
/*---------------------------------------------------------------------------*/
size_t strmaxcpy(char *dest, const char *src, size_t Max)
{
-#if 1
- abort();
-#else
size_t cnt = strlen(src);
/* leave room for terminating NUL */
memcpy(dest, src, cnt);
dest[cnt] = '\0';
return cnt;
-#endif
}
/*---------------------------------------------------------------------------*/
size_t strmaxcat(char *Dest, const char *Src, size_t MaxLen)
{
-#if 1
- abort();
-#else
int TLen = strlen(Src);
size_t DLen = strlen(Dest);
}
else
return DLen;
-#endif
}
void strprep(char *Dest, const char *Src)
{
-#if 1
- abort();
-#else
memmove(Dest + strlen(Src), Dest, strlen(Dest) + 1);
memmove(Dest, Src, strlen(Src));
-#endif
}
/*!------------------------------------------------------------------------
void strmaxprep(char *p_dest, const char *p_src, size_t max_len)
{
-#if 1
- abort();
-#else
size_t src_len = strlen(p_src),
dest_len = strlen(p_dest);
src_len = max_len - dest_len - 1;
memmove(p_dest + src_len, p_dest, dest_len + 1);
memmove(p_dest, p_src, src_len);
-#endif
}
/*!------------------------------------------------------------------------
void strmaxprep2(char *p_dest, const char *p_src, size_t max_len)
{
-#if 1
- abort();
-#else
size_t src_len = strlen(p_src),
dest_len = strlen(p_dest);
dest_len = max_len - 1;
memmove(p_dest + src_len, p_dest, dest_len + 1);
memmove(p_dest, p_src, src_len);
-#endif
}
void strins(char *Dest, const char *Src, int Pos)
{
-#if 1
- abort();
-#else
memmove(Dest + Pos + strlen(Src), Dest + Pos, strlen(Dest) + 1 - Pos);
memmove(Dest + Pos, Src, strlen(Src));
-#endif
}
void strmaxins(char *Dest, const char *Src, int Pos, size_t MaxLen)
{
-#if 1
- abort();
-#else
size_t RLen;
RLen = strlen(Src);
RLen = MaxLen - strlen(Dest);
memmove(Dest + Pos + RLen, Dest + Pos, strlen(Dest) + 1 - Pos);
memmove(Dest + Pos, Src, RLen);
-#endif
}
int strlencmp(const char *pStr1, unsigned Str1Len,
const char *pStr2, unsigned Str2Len)
{
-#if 1
- abort();
-#else
const char *p1, *p2, *p1End, *p2End;
int Diff;
return Diff;
}
return ((int)Str1Len) - ((int)Str2Len);
-#endif
}
unsigned fstrlenprint(FILE *pFile, const char *pStr, unsigned StrLen)
{
-#if 1
- abort();
-#else
unsigned Result = 0;
const char *pRun, *pEnd;
}
return Result;
-#endif
}
size_t as_strnlen(const char *pStr, size_t MaxLen)
{
-#if 1
- abort();
-#else
size_t Res = 0;
for (; (MaxLen > 0); MaxLen--, pStr++, Res++)
if (!*pStr)
break;
return Res;
-#endif
}
/*!------------------------------------------------------------------------
int strreplace(char *pHaystack, const char *pFrom, const char *pTo, size_t ToMaxLen, size_t HaystackSize)
{
-#if 1
- abort();
-#else
int HaystackLen = -1, FromLen = -1, ToLen = -1, Count = 0;
int HeadLen, TailLen;
char *pSearch, *pPos;
Count++;
}
-#endif
}
/*---------------------------------------------------------------------------*/
void ReadLn(FILE *Datei, char *Zeile)
{
-#if 1
- abort();
-#else
char *ptr;
int l;
Zeile[--l] = '\0';
if ((l > 0) && (Zeile[l - 1] == 26))
Zeile[--l] = '\0';
-#endif
}
#if 0
static void dump(const char *pLine, unsigned Cnt)
{
-#if 1
- abort();
-#else
unsigned z;
fputc('\n', stderr);
fputc('\n', stderr);
}
fputc('\n', stderr);
-#endif
}
#endif
size_t ReadLnCont(FILE *Datei, as_dynstr_t *p_line)
{
-#if 1
- abort();
-#else
char *ptr, *pDest;
size_t l, Count, LineCount;
Boolean Terminated;
}
return LineCount;
-#endif
}
/*!------------------------------------------------------------------------
int DigitVal(char ch, int Base)
{
-#if 1
- abort();
-#else
int Result;
/* Ziffern 0..9 ergeben selbiges */
Result = -1;
return (Result >= Base) ? -1 : Result;
-#endif
}
/*--------------------------------------------------------------------*/
LargeInt ConstLongInt(const char *inp, Boolean *pErr, LongInt Base)
{
-#if 1
- abort();
-#else
static const char Prefixes[4] = { '$', '@', '%', '\0' }; /* die moeglichen Zahlensysteme */
static const char Postfixes[4] = { 'H', 'O', '\0', '\0' };
static const LongInt Bases[3] = { 16, 8, 2 }; /* die dazugehoerigen Basen */
}
return erg;
-#endif
}
/*--------------------------------------------------------------------------*/
void KillBlanks(char *s)
{
-#if 1
- abort();
-#else
char *z, *dest;
Boolean InSgl = False, InDbl = False, ThisEscaped = False, NextEscaped = False;
*dest++ = *z;
}
*dest = '\0';
-#endif
}
int CopyNoBlanks(char *pDest, const char *pSrc, size_t MaxLen)
{
-#if 1
- abort();
-#else
const char *pSrcRun;
char *pDestRun = pDest;
size_t Cnt = 0;
*pDestRun = '\0';
return Cnt;
-#endif
}
/*--------------------------------------------------------------------------*/
int KillPrefBlanks(char *s)
{
-#if 1
- abort();
-#else
char *z = s;
while ((*z != '\0') && as_isspace(*z))
if (z != s)
strmov(s, z);
return z - s;
-#endif
}
/*--------------------------------------------------------------------------*/
int KillPostBlanks(char *s)
{
-#if 1
- abort();
-#else
char *z = s + strlen(s) - 1;
int count = 0;
count++;
}
return count;
-#endif
}
/*--------------------------------------------------------------------------*/
int strqcmp(const char *s1, const char *s2)
{
-#if 1
- abort();
-#else
int erg = (*s1) - (*s2);
return (erg != 0) ? erg : strcmp(s1, s2);
-#endif
}
/*--------------------------------------------------------------------------*/
char *strmov(char *pDest, const char *pSrc)
{
-#if 1
- abort();
-#else
memmove(pDest, pSrc, strlen(pSrc) + 1);
return pDest;
-#endif
}
#ifdef __GNUC__
#endif
char *strcpy(char *pDest, const char *pSrc)
{
-#if 1
- abort();
-#else
int l = strlen(pSrc) + 1;
int Overlap = 0;
}
return strmov(pDest, pSrc);
-#endif
}
#endif
int strmemcpy(char *pDest, size_t DestSize, const char *pSrc, size_t SrcLen)
{
-#if 1
- abort();
-#else
if (DestSize < SrcLen + 1)
SrcLen = DestSize - 1;
memmove(pDest, pSrc, SrcLen);
pDest[SrcLen] = '\0';
return SrcLen;
-#endif
}
/*--------------------------------------------------------------------------*/
char *ParenthPos(char *pHaystack, char Needle)
{
-#if 1
- abort();
-#else
char *pRun;
int Level = 0;
}
}
return NULL;
-#endif
}
/*!------------------------------------------------------------------------
char TabCompressed(char in)
{
-#if 1
- abort();
-#else
return (in == '\t') ? ' ' : (as_isprint(in) ? in : '*');
-#endif
}
/*--------------------------------------------------------------------------*/
void strutil_init(void)
{
-#if 1
- abort();
-#else
HexStartCharacter = 'A';
-#endif
}