File: string.h

package info (click to toggle)
yiff 2.14.2-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,044 kB
  • ctags: 2,899
  • sloc: ansic: 36,398; cpp: 7,233; makefile: 428; sh: 156
file content (98 lines) | stat: -rw-r--r-- 2,883 bytes parent folder | download
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
	    String Examination and Manipulation Functions
 */

#ifndef STRING_H
#define STRING_H	/* NOT to be confused with standard _STRING_H */

#include <sys/types.h>
#include "../include/os.h"

#ifndef ISBLANK
# define ISBLANK(c)	(((c) == ' ') || ((c) == '\t'))
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* Basic string handling. */
extern int strlinelen(const char *s);
extern int strlongestline(const char *s);
extern int strlines(const char *s);
#ifdef __MSW__
extern int strcasecmp(const char *s1, const char *s2);
#endif
extern const char *strseekblank(const char *s);
#ifndef __GLIBC__
extern char *strcasestr(const char *haystack, const char *needle);
#endif
extern int strpfx(const char *str, const char *pfx);
extern int strcasepfx(const char *str, const char *pfx);
extern void strtoupper(char *s);
extern void strtolower(char *s);
extern char *strcatalloc(char *orig, const char *new_str);
extern void substr(char *s, const char *token, const char *val);
#ifndef __MSW__
extern void strset(char *s, char c, int n);
#endif
extern void strpad(char *s, int n);
extern void straddflag(char *s, const char *flag, char operation, int len);

#if defined(__cplusplus) || defined(c_plusplus)
extern "C" char *StringCopyAlloc(const char *str);
#else
extern char *StringCopyAlloc(const char *str);
#endif

extern void *MemoryCopyAlloc(const void *ptr, int nbytes);
extern char **StringCopyArray(const char **strv, int strc);
extern void StringStripSpaces(char *s);
extern char **StringQSort(char **strings, int nitems);
extern char *StringTailSpaces(char *string, int len);
extern void StringShortenFL(char *string, int limit);
extern void StringFreeArray(char **strv, int strc);

/* UNIX configruation file format string handling. */
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" int StringIsYes(const char *string);
extern "C" int StringIsComment(const char *s, char c);
extern "C" char *StringCfgParseParm(const char *string);
extern "C" char *StringCfgParseValue(const char *string);
#else
extern int StringIsYes(const char *string);
extern int StringIsComment(const char *s, char c);
extern char *StringCfgParseParm(const char *string);
extern char *StringCfgParseValue(const char *string);
#endif

/* Misc string parsing. */
extern int StringParseStdColor(
	const char *s,
	u_int8_t *r_rtn,
	u_int8_t *g_rtn,
	u_int8_t *b_rtn
);
extern int StringParseIP(
	const char *s,
	u_int8_t *c1,
	u_int8_t *c2,
	u_int8_t *c3,
	u_int8_t *c4
);

/* ShipWars CyberSpace network protocol string functions. */
extern int StringGetNetCommand(const char *str);
extern char *StringGetNetArgument(const char *str);

/* Time string formatting. */
extern char *StringCurrentTimeFormat(const char *format);
extern char *StringTimeFormat(const char *format, time_t seconds);
extern char *StringFormatTimePeriod(time_t seconds);


#ifdef __cplusplus
}
#endif

#endif /* STRING_H */