aboutsummaryrefslogtreecommitdiffstats
path: root/sdk/other/string.h
blob: 5db8cd4e53b1eb1da65b2ee77ee47ced9c48c373 (plain)
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
/*
 * Portable string handling routines.
 * $Id$
 * Copyright (c) 1997 by Tycho Softworks.
 * For conditions of distribution and reuse see product license.
 */

#ifndef	__OTHER_STRINGS_H__
#define	__OTHER_STRINGS_H__

#ifndef	__STD_STRING_H__
#include <std/string.h>
#endif

#ifndef	__STD_TYPES_H__
#include <std/types.h>
#endif

#ifdef	__cplusplus
extern "C" {
#endif

#ifdef	__NAMESPACE
#define	__SPACES	__NAMESPACE(__SPACES)
#endif

extern	char	__SPACES[];

#ifdef	__NAMESPACE
#define	strblank	__NAMESPACE(strblank)
#define	strtrim		__NAMESPACE(strtrim)
#define	strrtrim	__NAMESPACE(strrtrim)
#define	strltrim	__NAMESPACE(strltrim)
#define	right		__NAMESPACE(right)
#define	left		__NAMESPACE(left)
#define	ccount		__NAMESPACE(ccount)
#define	tail		__NAMESPACE(tail)
#define	field		__NAMESPACE(field)
#define	token		__NAMESPACE(token)
#define	strcopy		__NAMESPACE(strcopy)
#define	strncopy	__NAMESPACE(strncopy)
#define	strdiff		__NAMESPACE(strdiff)
#define	getargv		__NAMESPACE(getargv)
#endif

bool	strblank(const char *str);
char 	*strtrim(char *s, const char *trim);
char 	*strrtrim(char *s, const char *trim);
char 	*strltrim(char *s, const char *trim);
char 	*right(char *str, size_t len);
char	*left(char *str, size_t len);
int  	ccount(const char *str, const char *list);
char	*tail(const char *str);
char	*field(char **ptr, const char *tok);
char	*token(char **ptr, const char *tok);
char	*strcopy(char *to, const char *from);
char	*strncopy(char *to, const char *from, int len);
int	strdiff(const char *s1, const char *s2);
int	getargv(char *base[], char *str);
void	fatal(int exitcode, const char *format, ...);
#ifdef	__cplusplus
}
#endif

#endif