code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
Terms of Agreement:
By using this code, you agree to the following terms...
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for langauges that allow it) freely and with no charge.
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
/* +++Date last modified: 05-Jul-1997 */
/*
** Header file for SNIPPETS string manipulation functions
*/
#ifndef SNIP_STR__H
#define SNIP_STR__H
#include
#include
#include "sniptype.h" /* for LAST_CHAR() & NUL */
#include "extkword.h" /* for FAR*/
/*
** Macros to print proper plurals by Bob Stout
*/
#define plural_text(n) &"s"[(1 == (n))]
#define plural_text2(n) &"es"[(1 == (n)) << 1]
#define plural_text3(n) &"y\0ies"[(1 != (n)) << 1]
/*
** Safe string macros by Keiichi Nakasato
*/
/* strncpy() variants that are guaranteed to append NUL */
#define strn1cpy(d,s,n) (strncpy(d,s,n),(d)[n]=0,d)
#define strn0cpy(d,s,n) strn1cpy(d,s,(n)-1)
/* like strcpy, except guaranteed to work with overlapping strings */
#define strMove(d,s) memmove(d,s,strlen(s)+1)
/*
** Prototypes
**
** Note: if compiling strictly conforming ANSI/ISO standard C code, the
**function names are modified to be compliant.
*/
#if defined(__STDC__) && __STDC__
#define memmemmemMem
#define strchcat strChcat
#define strdelstrDel
#define strdelch strDelch
#define strdupstrDup
#define strecpy strEcpy
#define stristr strIstr
#define strrepl strRepl
#define strrevstrRev
#define strrpbrk strRpbrk
#define struprstrUpr
#define strlwrstrLwr
#endif
#if defined(__cplusplus) && __cplusplus
extern "C" {
#endif
void *memmem(const void *buf, const void *pattern,/* Memmem.C*/
size_t buflen, size_t len);
char *sstrcpy(char *to, char *from); /* Sstrcpy.C */
char *sstrcat(char *to, char *from); /* Sstrcpy.C */
char *sstrdel(char *s, ...); /* Sstrdel.C */
char *stptok(const char *s, char *tok, size_t toklen,
char *brk); /* Stptok.C*/
char *strchcat(char *string, int ch, size_t buflen); /* Strchcat.C */
char *strdel(char *string, size_t first, size_t len); /* Strdel.C*/
char *strdelch(char *string, const char *lose);/* Strdelch.C */
char *strdup(const char *string); /* Strdup.C*/
char *strecpy(char *target, const char *src); /* Strecpy.C/Asm */
char *stristr(const char *String, /* Stristr.C */
const char *Pattern);
char *strrepl(char *Str, size_t BufSiz,
char *OldStr, char *NewStr);/* Strrepl.C */
char *strrev(char *str); /* Strrev.C*/
char *strrpbrk(const char *szString,
const char *szChars);/* Strrpbrk.C */
char *strupr(char *string);/* Strupr.C*/
char *strlwr(char *string);/* Strupr.C*/
char *translate(char *string);/* Translat.C */
char *xstrcat(char *des, char *src, ...); /* Xstrcat.C */
char *rule_line(char * s, unsigned short len,
short units, char * digits, char filler);/* Ruleline.C */
char *rmallws(char *str); /* Rmallws.C */
char *rmlead(char *str); /* Rmlead.C*/
char *rmtrail(char *str); /* Rmtrail.C */
char *trim (char *str);/* Trim.C */
void lv1ws(char *str);/* Lv1Ws.C*/
#if defined(MSDOS) || defined(__MSDOS__)
void FAR *fmemmem(const void FAR *buf,/* Fmemmem.C */
const void FAR *pattern, long buflen, long len);
#endif
#if defined(__cplusplus) && __cplusplus
}
#endif
#endif /* SNIP_STR__H */