xbot/lib/util.h

58 lines
1023 B
C
Raw Normal View History

2015-03-24 10:12:35 +00:00
/*
* xbot: Just another IRC bot
*
* Written by Aaron Blakely <aaron@ephasic.org>
**/
#ifndef UTIL_H
#define UTIL_H
2024-03-09 08:40:06 +00:00
#include "logger.h"
2024-03-11 10:22:05 +00:00
#define DEBUG 1
#ifdef DEBUG
#define BREAKPOINT() asm("int $3")
#else
#define BREAKPOINT()
#endif
2024-02-13 07:22:10 +00:00
#ifdef _WIN32
2024-02-16 21:28:11 +00:00
#define true TRUE
#define false FALSE
2024-02-13 07:22:10 +00:00
#endif
2024-03-06 09:45:01 +00:00
#ifdef _WIN32
#ifdef MY_DLL_EXPORTS
#define MY_API __declspec(dllexport)
#else
#define MY_API __declspec(dllimport)
#endif
#else
#define MY_API
#endif
2024-03-14 08:20:38 +00:00
MY_API void eprint(char *fmt, ...);
2024-02-13 07:22:10 +00:00
#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 38)) || defined(_WIN32)
2024-03-06 09:45:01 +00:00
MY_API void strlcpy(char *to, const char *from, int len);
2024-02-13 07:22:10 +00:00
#endif
2024-03-01 02:49:33 +00:00
#ifdef _WIN32
2024-03-06 09:45:01 +00:00
MY_API char *basename(char *path);
2024-03-01 02:49:33 +00:00
#endif
2024-03-11 10:22:05 +00:00
// skip - skip over characters in a string
// s - the string to skip over
// c - the character to skip over
//
// returns a pointer to the first non-matching character
2024-03-06 09:45:01 +00:00
MY_API char *skip(char *s, char c);
2024-03-11 10:22:05 +00:00
// trim - remove leading and trailing whitespace from a string
2024-03-06 09:45:01 +00:00
MY_API void trim(char *s);
2015-03-24 10:12:35 +00:00
2024-02-13 07:22:10 +00:00
#endif