1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
/*
* XMail by Davide Libenzi ( Intranet and Internet mail server )
* Copyright (C) 1999,..,2004 Davide Libenzi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Davide Libenzi <davidel@xmailserver.org>
*
*/
#ifndef _STRUTILS_H
#define _STRUTILS_H
struct DynString {
char *pszBuffer;
int iStringSize;
int iBufferSize;
};
void *StrMemDup(void const *pData, long lSize, long lExtra);
int StrCmdLineToken(char const *&pszCmdLine, char *pszToken);
char **StrGetArgs(char const *pszCmdLine, int &iArgsCount);
char *StrLower(char *pszString);
char *StrUpper(char *pszString);
char *StrCrypt(char const *pszString, char *pszCrypt);
char *StrDeCrypt(char const *pszString, char *pszDeCrypt);
char **StrBuildList(char const *pszString, ...);
char **StrTokenize(const char *pszString, const char *pszTokenizer);
void StrFreeStrings(char **ppszStrings);
int StrStringsCount(char const *const *ppszStrings);
bool StrStringsMatch(char const *const *ppszStrings, char const *pszMatch);
bool StrStringsIMatch(char const *const *ppszStrings, char const *pszMatch);
bool StrStringsRIWMatch(char const *const *pszMatches, char const *pszString);
char *StrConcat(char const *const *ppszStrings, char const *pszCStr);
char *StrDeQuote(char *pszString, int iChar);
char *StrQuote(const char *pszString, int iChar);
char **StrGetTabLineStrings(const char *pszUsrLine);
int StrWriteCRLFString(FILE *pFile, const char *pszString);
int StrWildMatch(char const *pszString, char const *pszMatch);
int StrIWildMatch(char const *pszString, char const *pszMatch);
char *StrLoadFile(FILE *pFile);
char *StrSprint(char const *pszFormat, ...);
int StrSplitString(char const *pszString, char const *pszSplitters,
char *pszStrLeft, int iSizeLeft, char *pszStrRight, int iSizeRight);
char *StrLTrim(char *pszString, char const *pszTrimChars);
char *StrRTrim(char *pszString, char const *pszTrimChars);
char *StrTrim(char *pszString, char const *pszTrimChars);
char *StrIStr(char const *pszBuffer, char const *pszMatch);
char *StrLimStr(char const *pszBuffer, char const *pszMatch, char const *pszLimits);
char *StrLimIStr(char const *pszBuffer, char const *pszMatch, char const *pszLimits);
int StrDynInit(DynString *pDS, char const *pszInit = NULL);
int StrDynFree(DynString *pDS);
int StrDynTruncate(DynString *pDS);
char const *StrDynGet(DynString *pDS);
char *StrDynDrop(DynString *pDS, int *piSize);
int StrDynSize(DynString *pDS);
int StrDynAdd(DynString *pDS, char const *pszBuffer, int iStringSize = -1);
int StrDynPrint(DynString *pDS, char const *pszFormat, ...);
char *StrNDup(char const *pszStr, int iSize);
int StrParamGet(char const *pszBuffer, char const *pszName, char *pszVal, int iMaxVal);
char *StrMacSubst(char const *pszIn, int *piSize,
char *(*pLkupProc)(void *, char const *, int), void *pPriv);
#endif
|