/* * ---------------------------------------------------------------- * Night Light String Functions Header * ---------------------------------------------------------------- * Copyright (C) 1997-2003 Jonas Kvinge * All rights reserved. * * 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., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Last modified by: * Jonas Kvinge (27.04.2002) * */ #ifdef STRCALLS_H #warning "strcalls.h already included." #else #define STRCALLS_H #define STRHOSTINVALIDCHAR "Invalid character \"%c\" in hostname." #define STRHOSTMAXCHARS "Maximum %d characters in hostname." #define STRFILEINVALIDCHAR "Invalid character \"%c\" in filename." #define STRFILEMAXCHARS "Maximum %d characters in filename." /* VARIABLES - JONAS (05.05.2000) */ #ifdef STRCALLS_C unsigned short int WMChars = 0; char *UNAMEINFO = NULL; char *PLATFORM = NULL; char *HOSTNAME = NULL; char *HOSTIPS = NULL; unsigned long int HOSTIPH = 0; unsigned long int HOSTIPN = 0; char *OSNAME = NULL; char *OSRELEASE = NULL; char *STRDURATION = NULL; char StrResult[LINELEN+1] = ""; #else extern unsigned short int WMChars; extern char *UNAMEINFO; extern char *PLATFORM; extern char *HOSTNAME; extern char *HOSTIPS; extern unsigned long int HOSTIPH; extern unsigned long int HOSTIPN; extern char *OSNAME; extern char *OSRELEASE; extern char *STRDURATION; extern char StrResult[]; #endif /* MACROS - JONAS (05.05.2000) */ #undef strdup #define strdup(s) mystrdup(__FILE__, __LINE__, __FUNCTION__, (s)) #undef strrealloc #define strrealloc(p, s) mystrrealloc(__FILE__, __LINE__, __FUNCTION__, (p), (s)) #undef strwm #define strwm(p, s) mystrwm(__FILE__, __LINE__, __FUNCTION__, (p), (s), FALSE) /* FUNCTION PROTOTYPES - JONAS (27.04.2002) */ const char *straerror(unsigned short int aerrnocode); unsigned short int strisvalidhost(const char *const StringPT); unsigned short int strisvalidfile(const char *const StringPT); const char *strresult(void); char *mystrdup(const char *const FilePT, const unsigned short int Line, const char *const FunctionPT, const char *StringPT); char *mystrrealloc(const char *FilePT, const unsigned long int Line, const char *const FunctionPT, char *OldPointer, const char *StringPT); size_t mystrspn(const char *StringPT, const char *AcceptPT); unsigned short int mystrwm(const char *FilePT, const unsigned long int Line, const char *const FunctionPT, const char *PatternPT, const char *StringPT, unsigned short int Internal); void strlower(char *StringPT); void strupper(char *StringPT); unsigned short int strdigit(const char *StringPT); unsigned short int strip(const char *StringPT); void strrnd(char *StringPT, const unsigned short int Len); const char *datestamp(void); const char *timestamp(void); const char *dtstamp(void); const char *strduration(const time_t Time); void strgetunameinfo(void); void strgetplatform(void); void strgetosname(void); void strgetosrelease(void); void strgethostname(void); char *straddbuffer(char *StringPT, const char *const BufferPT, const unsigned long int MaxStringLen, const unsigned short int AddLen); void strcleanup(void); #endif