X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=codemuxlib.h;fp=codemuxlib.h;h=b954e317b2af28f6ce5e0eea14f4a2abb455b048;hb=0004e089d32f355a47338f6394b8d2780494b047;hp=0000000000000000000000000000000000000000;hpb=8d5fa6e42e6a276fd43204eb011ae43e6caa0411;p=codemux.git diff --git a/codemuxlib.h b/codemuxlib.h new file mode 100644 index 0000000..b954e31 --- /dev/null +++ b/codemuxlib.h @@ -0,0 +1,47 @@ +#ifndef _APPLIB_H_ +#define _APPLIB_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef OS_LINUX +#include +#endif + +#include "appdef.h" + +/* stripped version of applib.c for codemux */ + +char *GetNextLine(FILE *file); +int WordCount(char *buf); +char *GetField(const char *start, int whichField); +char *GetWord(const char *start, int whichWord); +int DoesDotlessSuffixMatch(char *start, int len, char *suffix); +int CreatePrivateAcceptSocket(int portNum, int nonBlocking); +char *StrdupLower(const char *orig); +void StrcpyLower(char *dest, const char *src); + +/* nice exit support */ +void NiceExitBack(int val, char *reason, char *file, int line); +#define NiceExit(val, reason) NiceExitBack(val, reason, __FILE__, __LINE__) + + +/* allocate stack memory to copy "src" to "dest" in lower cases */ +#define LOCAL_STR_DUP_LOWER(dest, src) \ + { dest = alloca(strlen(src) + 1); \ + StrcpyLower(dest, src); \ + } + +/* allocate stack memory to copy "src" to "dest" */ +#define LOCAL_STR_DUP(dest, src) \ + { dest = alloca(strlen(src) + 1); \ + strcpy(dest, src); \ + } +#endif +