29 |
#include "strbuf.h" |
#include "strbuf.h" |
30 |
#include "strmake.h" |
#include "strmake.h" |
31 |
|
|
|
static STRBUF *sb; |
|
|
|
|
32 |
/* |
/* |
33 |
* strmake: make string from original string p. |
* strmake: make string from original string with limit character. |
34 |
* |
* |
35 |
* i) p original string. |
* i) p original string. |
36 |
* i) lim limitter |
* i) lim limitter |
39 |
* Usage: |
* Usage: |
40 |
* strmake("aaa:bbb", ":/=") => "aaaa" |
* strmake("aaa:bbb", ":/=") => "aaaa" |
41 |
* |
* |
42 |
* Note: The result string area is module local. So, following call |
* Note: The result string area is function local. So, following call |
43 |
* to the function in this module may destroy the area. |
* to this function may destroy the area. |
44 |
*/ |
*/ |
45 |
char * |
char * |
46 |
strmake(p, lim) |
strmake(p, lim) |
47 |
const char *p; |
const char *p; |
48 |
const char *lim; |
const char *lim; |
49 |
{ |
{ |
50 |
|
static STRBUF *sb; |
51 |
const char *c; |
const char *c; |
52 |
|
|
53 |
if (sb == NULL) |
if (sb == NULL) |
64 |
} |
} |
65 |
|
|
66 |
/* |
/* |
67 |
* strtrim: delete blanks from original string. |
* strtrim: make string from original string with deleting blanks. |
68 |
* |
* |
69 |
* i) p original string. |
* i) p original string. |
70 |
* i) flag TRIM_HEAD from only head |
* i) flag TRIM_HEAD from only head |
81 |
* strtrim(" # define ", TRIM_BOTH, NULL) => "# define" |
* strtrim(" # define ", TRIM_BOTH, NULL) => "# define" |
82 |
* strtrim(" # define ", TRIM_ALL, NULL) => "#define" |
* strtrim(" # define ", TRIM_ALL, NULL) => "#define" |
83 |
* |
* |
84 |
* Note: The result string area is module local. So, following call |
* Note: The result string area is function local. So, following call |
85 |
* to the function in this module may destroy the area. |
* to this function may destroy the area. |
86 |
*/ |
*/ |
87 |
char * |
char * |
88 |
strtrim(p, flag, len) |
strtrim(p, flag, len) |
90 |
int flag; |
int flag; |
91 |
int *len; |
int *len; |
92 |
{ |
{ |
93 |
|
static STRBUF *sb; |
94 |
int cut_off = -1; |
int cut_off = -1; |
95 |
|
|
96 |
if (sb == NULL) |
if (sb == NULL) |