~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to strings/string.doc

Removed my_vsnprintf and my_snprintf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 
10
10
  bmove(dst, src, len) moves exactly "len" bytes from the source "src"
11
11
  to the destination "dst".  It does not check for NUL characters as
12
 
  strncpy() and stpncpy() do.
 
12
  strncpy() and strnmov() do.
13
13
 
14
14
  bmove_upp(dst, src, len) moves exactly "len" bytes from the source
15
15
 "src-len" to the destination "dst-len" counting downwards.
51
51
  enough  room  in  the  space s points to; strcat has no way to tell.
52
52
  Note that strcat has to search for the end of s, so if you are doing
53
53
  a lot of concatenating it may be better to use strmov, e.g.
54
 
        stpcpy(stpcpy(stpcpy(stpcpy(s,a),b),c),d)
 
54
        strmov(strmov(strmov(strmov(s,a),b),c),d)
55
55
    rather than
56
56
        strcat(strcat(strcat(strcpy(s,a),b),c),d).
57
57
    strcat returns the old value of s.
60
60
  strcend(s, c) returns a pointer to the  first  place  in  s   where  c
61
61
  occurs,  or a pointer to the end-null of s if c does not occur in s.
62
62
 
 
63
  strcont(str, set) if str contanies any character in the string set.
 
64
  The result is the position of the first found character in str, or NullS
 
65
  if there isn't anything found.
 
66
 
63
67
  strend(s) returns a character pointer to the NUL which ends s.  That
64
68
  is,  strend(s)-s  ==  strlen(s). This is useful for adding things at
65
69
  the end of strings.  It is redundant, because  strchr(s,'\0')  could
73
77
  The result is a pointer to the first character of the located instance,
74
78
  or NullS if pat does not occur in src.
75
79
 
 
80
  strinstr(src, pat) looks for an instance of pat in src.  pat is not a
 
81
  regex(3) pattern, it is a literal string which must be matched exactly.
 
82
  The result 0 if the pattern was not found else it is the start char of
 
83
  the pattern counted from the begining of the string.
 
84
 
76
85
  strmake(dst,src,length) moves length characters, or until end, of src to
77
86
  dst and appends a closing NUL to dst.
78
87
  strmake() returns pointer to closing null;
79
88
 
80
 
  stpcpy(dst, src) moves all the  characters  of  src  (including  the
 
89
  strmov(dst, src) moves all the  characters  of  src  (including  the
81
90
  closing NUL) to dst, and returns a pointer to the new closing NUL in
82
91
  dst.   The similar UNIX routine strcpy returns the old value of dst,
83
 
  which I have never found useful.  stpcpy(stpcpy(dst,a),b) moves a//b
 
92
  which I have never found useful.  strmov(strmov(dst,a),b) moves a//b
84
93
  into dst, which seems useful.
85
94
 
86
 
  stpncpy(dst,src,length) moves length characters, or until end, of src to
 
95
  strnmov(dst,src,length) moves length characters, or until end, of src to
87
96
  dst and appends a closing NUL to dst if src is shorter than length.
88
97
  The result is a pointer to the first NUL in dst, or is dst+n if dst was
89
98
  truncated.
107
116
 to dst.  If there aren't that many characters, a NUL character will
108
117
 be added to the end of dst to terminate it properly.  This gives the
109
118
 same effect as calling strxcpy(buff, src1, ..., srcn, NullS) with a
110
 
 large enough buffer, and then calling stpncpy(dst, buff, len).
111
 
 It is just like stpncpy except that it concatenates multiple sources.
 
119
 large enough buffer, and then calling strnmov(dst, buff, len).
 
120
 It is just like strnmov except that it concatenates multiple sources.
112
121
 Beware: the last argument should be the null character pointer.
113
122
 Take VERY great care not to omit it!  Also be careful to use NullS
114
123
 and NOT to use 0, as on some machines 0 is not the same size as a
115
124
 character pointer, or not the same bit pattern as NullS.
116
125
 
117
 
 Note: strxnmov is like stpncpy in that it always moves EXACTLY len
 
126
 Note: strxnmov is like strnmov in that it always moves EXACTLY len
118
127
 characters; dst will be padded on the right with NUL characters as
119
128
 needed.  strxncpy does the same.  strxncat, like strncat, does NOT.
120
129
 
127
136
 strlength(const string str)
128
137
 Return length of string with end-space:s not counted.
129
138
 
130
 
 void caseup _A((string str,uint32_t length));
131
 
 void casedn _A((string str,uint32_t length));
 
139
 void caseup _A((string str,uint length));
 
140
 void casedn _A((string str,uint length));
132
141
 void caseup_str _A((string str));
133
142
 void casedn_str _A((string str));
134
143
 Converts strings or part of string to upper or lower-case.
135
144
 
136
 
 void case_sort _A((string str,uint32_t length));
 
145
 void case_sort _A((string str,uint length));
137
146
 Converts string to a string with can be compared with strcmp() to
138
147
 get strings in rigth order.
139
148