Lines Matching +full:conv +full:- +full:period
3 /*-
4 * SPDX-License-Identifier: BSD-4-Clause
36 /*-
71 * 0 - character disallowed in long file name.
72 * 1 - character should be replaced by '_' in DOS file name,
74 * 2 - character ('.' and ' ') should be skipped in DOS file name,
79 /* iso8859-1 -> cp850 */
80 0, 0, 0, 0, 0, 0, 0, 0, /* 00-07 */
81 0, 0, 0, 0, 0, 0, 0, 0, /* 08-0f */
82 0, 0, 0, 0, 0, 0, 0, 0, /* 10-17 */
83 0, 0, 0, 0, 0, 0, 0, 0, /* 18-1f */
84 2, 0x21, 0, 0x23, 0x24, 0x25, 0x26, 0x27, /* 20-27 */
85 0x28, 0x29, 0, 1, 1, 0x2d, 2, 0, /* 28-2f */
86 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 30-37 */
87 0x38, 0x39, 0, 1, 0, 1, 0, 0, /* 38-3f */
88 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 40-47 */
89 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 48-4f */
90 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 50-57 */
91 0x58, 0x59, 0x5a, 1, 0, 1, 0x5e, 0x5f, /* 58-5f */
92 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 60-67 */
93 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 68-6f */
94 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 70-77 */
95 0x58, 0x59, 0x5a, 0x7b, 0, 0x7d, 0x7e, 0, /* 78-7f */
96 0, 0, 0, 0, 0, 0, 0, 0, /* 80-87 */
97 0, 0, 0, 0, 0, 0, 0, 0, /* 88-8f */
98 0, 0, 0, 0, 0, 0, 0, 0, /* 90-97 */
99 0, 0, 0, 0, 0, 0, 0, 0, /* 98-9f */
100 0, 0xad, 0xbd, 0x9c, 0xcf, 0xbe, 0xdd, 0xf5, /* a0-a7 */
101 0xf9, 0xb8, 0xa6, 0xae, 0xaa, 0xf0, 0xa9, 0xee, /* a8-af */
102 0xf8, 0xf1, 0xfd, 0xfc, 0xef, 0xe6, 0xf4, 0xfa, /* b0-b7 */
103 0xf7, 0xfb, 0xa7, 0xaf, 0xac, 0xab, 0xf3, 0xa8, /* b8-bf */
104 0xb7, 0xb5, 0xb6, 0xc7, 0x8e, 0x8f, 0x92, 0x80, /* c0-c7 */
105 0xd4, 0x90, 0xd2, 0xd3, 0xde, 0xd6, 0xd7, 0xd8, /* c8-cf */
106 0xd1, 0xa5, 0xe3, 0xe0, 0xe2, 0xe5, 0x99, 0x9e, /* d0-d7 */
107 0x9d, 0xeb, 0xe9, 0xea, 0x9a, 0xed, 0xe8, 0xe1, /* d8-df */
108 0xb7, 0xb5, 0xb6, 0xc7, 0x8e, 0x8f, 0x92, 0x80, /* e0-e7 */
109 0xd4, 0x90, 0xd2, 0xd3, 0xde, 0xd6, 0xd7, 0xd8, /* e8-ef */
110 0xd1, 0xa5, 0xe3, 0xe0, 0xe2, 0xe5, 0x99, 0xf6, /* f0-f7 */
111 0x9d, 0xeb, 0xe9, 0xea, 0x9a, 0xed, 0xe8, 0x98, /* f8-ff */
116 /* cp850 -> iso8859-1 */
117 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, /* 00-07 */
118 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, /* 08-0f */
119 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, /* 10-17 */
120 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, /* 18-1f */
121 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 20-27 */
122 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 28-2f */
123 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 30-37 */
124 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 38-3f */
125 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 40-47 */
126 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 48-4f */
127 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 50-57 */
128 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 58-5f */
129 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 60-67 */
130 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 68-6f */
131 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 70-77 */
132 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 78-7f */
133 0xc7, 0xfc, 0xe9, 0xe2, 0xe4, 0xe0, 0xe5, 0xe7, /* 80-87 */
134 0xea, 0xeb, 0xe8, 0xef, 0xee, 0xec, 0xc4, 0xc5, /* 88-8f */
135 0xc9, 0xe6, 0xc6, 0xf4, 0xf6, 0xf2, 0xfb, 0xf9, /* 90-97 */
136 0xff, 0xd6, 0xdc, 0xf8, 0xa3, 0xd8, 0xd7, 0x3f, /* 98-9f */
137 0xe1, 0xed, 0xf3, 0xfa, 0xf1, 0xd1, 0xaa, 0xba, /* a0-a7 */
138 0xbf, 0xae, 0xac, 0xbd, 0xbc, 0xa1, 0xab, 0xbb, /* a8-af */
139 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xc1, 0xc2, 0xc0, /* b0-b7 */
140 0xa9, 0x3f, 0x3f, 0x3f, 0x3f, 0xa2, 0xa5, 0x3f, /* b8-bf */
141 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xe3, 0xc3, /* c0-c7 */
142 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xa4, /* c8-cf */
143 0xf0, 0xd0, 0xca, 0xcb, 0xc8, 0x3f, 0xcd, 0xce, /* d0-d7 */
144 0xcf, 0x3f, 0x3f, 0x3f, 0x3f, 0xa6, 0xcc, 0x3f, /* d8-df */
145 0xd3, 0xdf, 0xd4, 0xd2, 0xf5, 0xd5, 0xb5, 0xfe, /* e0-e7 */
146 0xde, 0xda, 0xdb, 0xd9, 0xfd, 0xdd, 0xaf, 0x3f, /* e8-ef */
147 0xad, 0xb1, 0x3f, 0xbe, 0xb6, 0xa7, 0xf7, 0xb8, /* f0-f7 */
148 0xb0, 0xa8, 0xb7, 0xb9, 0xb3, 0xb2, 0x3f, 0x3f, /* f8-ff */
154 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 00-07 */
155 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 08-0f */
156 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 10-17 */
157 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 18-1f */
158 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 20-27 */
159 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 28-2f */
160 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 30-37 */
161 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 38-3f */
162 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 40-47 */
163 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 48-4f */
164 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 50-57 */
165 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 58-5f */
166 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 60-67 */
167 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 68-6f */
168 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 70-77 */
169 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 78-7f */
170 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 80-87 */
171 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 88-8f */
172 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 90-97 */
173 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 98-9f */
174 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* a0-a7 */
175 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* a8-af */
176 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* b0-b7 */
177 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* b8-bf */
178 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* c0-c7 */
179 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* c8-cf */
180 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* d0-d7 */
181 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* d8-df */
182 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* e0-e7 */
183 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* e8-ef */
184 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* f0-f7 */
185 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* f8-ff */
191 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 00-07 */
192 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 08-0f */
193 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 10-17 */
194 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 18-1f */
195 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 20-27 */
196 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 28-2f */
197 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 30-37 */
198 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 38-3f */
199 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 40-47 */
200 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 48-4f */
201 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 50-57 */
202 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 58-5f */
203 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 60-67 */
204 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 68-6f */
205 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 70-77 */
206 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 78-7f */
207 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 80-87 */
208 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 88-8f */
209 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 90-97 */
210 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 98-9f */
211 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* a0-a7 */
212 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* a8-af */
213 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* b0-b7 */
214 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* b8-bf */
215 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* c0-c7 */
216 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* c8-cf */
217 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* d0-d7 */
218 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* d8-df */
219 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* e0-e7 */
220 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* e8-ef */
221 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* f0-f7 */
222 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* f8-ff */
267 * Now, if there is an extension then put in a period and copy in in dos2unixfn()
304 int conv = 1; in unix2dosfn() local
334 for (cp = un, i = unlen; --i >= 0; cp++) in unix2dosfn()
357 for (cp = un + 1, i = unlen - 1; --i >= 0;) { in unix2dosfn()
380 l = dp1 - dp; in unix2dosfn()
382 l = unlen - (dp - un); in unix2dosfn()
389 if (conv != 3) in unix2dosfn()
390 conv = 2; in unix2dosfn()
393 conv = 3; in unix2dosfn()
394 dn[j-1] = ' '; in unix2dosfn()
400 if (((dn[j] & 0x80) || *(cp - 1) != dn[j]) && conv != 3) in unix2dosfn()
401 conv = 2; in unix2dosfn()
403 conv = 3; in unix2dosfn()
407 conv = 3; in unix2dosfn()
408 dn[j--] = ' '; in unix2dosfn()
412 conv = 3; in unix2dosfn()
413 dp--; in unix2dosfn()
415 for (dp = cp; *--dp == ' ' || *dp == '.';); in unix2dosfn()
422 for (i = dp - un, j = 0; un < dp && j < 8; j++) { in unix2dosfn()
428 if (conv != 3) in unix2dosfn()
429 conv = 2; in unix2dosfn()
432 conv = 3; in unix2dosfn()
433 dn[j-1] = ' '; in unix2dosfn()
439 if (((dn[j] & 0x80) || *(un - 1) != dn[j]) && conv != 3) in unix2dosfn()
440 conv = 2; in unix2dosfn()
442 conv = 3; in unix2dosfn()
446 conv = 3; in unix2dosfn()
447 dn[j--] = ' '; in unix2dosfn()
451 conv = 3; in unix2dosfn()
463 if (conv != 3) { in unix2dosfn()
465 conv = 0; in unix2dosfn()
475 *--wcp = gen % 10 + '0'; in unix2dosfn()
477 conv = 0; in unix2dosfn()
480 for (i = 8; dn[--i] == ' ';); in unix2dosfn()
482 if (gentext + sizeof(gentext) - wcp + 1 > 8 - i) in unix2dosfn()
483 i = 8 - (gentext + sizeof(gentext) - wcp + 1); in unix2dosfn()
488 i -= mbsadjpos((const char**)&cp, i, unlen, 1, pmp->pm_flags, pmp->pm_d2u); in unix2dosfn()
499 conv = 3; in unix2dosfn()
509 return conv; in unix2dosfn()
533 unlen = mbsadjpos((const char **)&un, unlen, (cnt - 1) * WIN_CHARS, 2, in unix2winfn()
534 pmp->pm_flags, pmp->pm_u2w); in unix2winfn()
540 wep->weCnt = cnt; in unix2winfn()
541 wep->weAttributes = ATTR_WIN95; in unix2winfn()
542 wep->weReserved1 = 0; in unix2winfn()
543 wep->weChksum = chksum; in unix2winfn()
544 wep->weReserved2 = 0; in unix2winfn()
550 for (wcp = wep->wePart1, i = sizeof(wep->wePart1)/2; --i >= 0 && !end;) { in unix2winfn()
557 for (wcp = wep->wePart2, i = sizeof(wep->wePart2)/2; --i >= 0 && !end;) { in unix2winfn()
564 for (wcp = wep->wePart3, i = sizeof(wep->wePart3)/2; --i >= 0 && !end;) { in unix2winfn()
573 wep->weCnt |= end; in unix2winfn()
579 * Returns the checksum or -1 if no match
594 return -1; in winChkName()
607 return -2; in winChkName()
619 return -2; in winChkName()
626 * Returns the checksum or -1 if impossible
638 if ((wep->weCnt&WIN_CNT) > howmany(WIN_MAXLEN, WIN_CHARS) in win2unixfn()
639 || !(wep->weCnt&WIN_CNT)) in win2unixfn()
640 return -1; in win2unixfn()
645 if (wep->weCnt&WIN_LAST) { in win2unixfn()
646 chksum = wep->weChksum; in win2unixfn()
647 } else if (chksum != wep->weChksum) in win2unixfn()
648 chksum = -1; in win2unixfn()
649 if (chksum == -1) in win2unixfn()
650 return -1; in win2unixfn()
656 for (cp = wep->wePart1, i = sizeof(wep->wePart1)/2; --i >= 0;) { in win2unixfn()
662 (wep->weCnt & WIN_CNT) - 1) != 0) in win2unixfn()
663 return -1; in win2unixfn()
667 return -1; in win2unixfn()
676 for (cp = wep->wePart2, i = sizeof(wep->wePart2)/2; --i >= 0;) { in win2unixfn()
682 (wep->weCnt & WIN_CNT) - 1) != 0) in win2unixfn()
683 return -1; in win2unixfn()
687 return -1; in win2unixfn()
696 for (cp = wep->wePart3, i = sizeof(wep->wePart3)/2; --i >= 0;) { in win2unixfn()
702 (wep->weCnt & WIN_CNT) - 1) != 0) in win2unixfn()
703 return -1; in win2unixfn()
707 return -1; in win2unixfn()
717 if (mbnambuf_write(nbp, name, (wep->weCnt & WIN_CNT) - 1) != 0) in win2unixfn()
718 return -1; in win2unixfn()
731 for (s = 0, i = 11; --i >= 0; s += *name++) in winChksum()
747 if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) { in winSlotCnt()
750 msdosfs_iconv->conv(pmp->pm_u2w, (const char **)&un, &unlen, &wnp, &wlen); in winSlotCnt()
753 return howmany(WIN_MAXLEN - wlen/2, WIN_CHARS); in winSlotCnt()
767 for (un += unlen; unlen > 0; unlen--) in winLenFixup()
768 if (*--un != ' ' && *un != '.') in winLenFixup()
786 msdosfs_iconv->conv(handle, instr, &inlen, &outp, &outlen); in mbsadjpos()
791 return (inlen - min(inlen, outlen)); in mbsadjpos()
804 if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) { in dos2unixchr()
808 msdosfs_iconv->convchr_case(pmp->pm_d2u, (const char **)instr, in dos2unixchr()
811 msdosfs_iconv->convchr(pmp->pm_d2u, (const char **)instr, in dos2unixchr()
813 len -= olen; in dos2unixchr()
819 (*ilen)--; in dos2unixchr()
824 (*ilen)--; in dos2unixchr()
849 if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) { in unix2doschr()
856 msdosfs_iconv->convchr(pmp->pm_u2w, (const char **)instr, in unix2doschr()
858 unixlen = len - *ilen; in unix2doschr()
864 (*ilen)--; in unix2doschr()
873 c = *(*instr -1); in unix2doschr()
884 *instr -= unixlen; in unix2doschr()
889 msdosfs_iconv->convchr_case(pmp->pm_u2d, (const char **)instr, in unix2doschr()
891 len -= olen; in unix2doschr()
897 (*ilen) -= unixlen; in unix2doschr()
903 while(len--) in unix2doschr()
904 wc |= (*(outp - len - 1) & 0xff) << (len << 3); in unix2doschr()
908 (*ilen)--; in unix2doschr()
925 if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) { in win2unixchr()
933 msdosfs_iconv->convchr(pmp->pm_w2u, __DECONST(const char **, in win2unixchr()
935 len -= olen; in win2unixchr()
964 if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) { in unix2winchr()
968 msdosfs_iconv->convchr_case(pmp->pm_u2w, (const char **)instr, in unix2winchr()
972 msdosfs_iconv->convchr(pmp->pm_u2w, (const char **)instr, in unix2winchr()
986 (*ilen)--; in unix2winchr()
1001 nbp->nb_len = 0; in mbnambuf_init()
1002 nbp->nb_last_id = -1; in mbnambuf_init()
1003 nbp->nb_buf[sizeof(nbp->nb_buf) - 1] = '\0'; in mbnambuf_init()
1010 * exactly WIN_CHARS in length. For non-ASCII substrings, we shift all
1021 if (nbp->nb_len != 0 && id != nbp->nb_last_id - 1) { in mbnambuf_write()
1023 printf("msdosfs: non-decreasing id: id %d, last id %d\n", in mbnambuf_write()
1024 id, nbp->nb_last_id); in mbnambuf_write()
1029 /* Will store this substring in a WIN_CHARS-aligned slot. */ in mbnambuf_write()
1030 slot = &nbp->nb_buf[id * WIN_CHARS]; in mbnambuf_write()
1032 newlen = nbp->nb_len + count; in mbnambuf_write()
1041 if (count > WIN_CHARS && nbp->nb_len != 0) { in mbnambuf_write()
1042 if ((id * WIN_CHARS + count + nbp->nb_len) > in mbnambuf_write()
1043 sizeof(nbp->nb_buf)) in mbnambuf_write()
1046 memmove(slot + count, slot + WIN_CHARS, nbp->nb_len); in mbnambuf_write()
1051 nbp->nb_len = newlen; in mbnambuf_write()
1052 nbp->nb_last_id = id; in mbnambuf_write()
1059 * Be sure to always nul-terminate the d_name and then copy the string
1068 if (nbp->nb_len > sizeof(dp->d_name) - 1) { in mbnambuf_flush()
1072 memcpy(dp->d_name, &nbp->nb_buf[0], nbp->nb_len); in mbnambuf_flush()
1073 dp->d_name[nbp->nb_len] = '\0'; in mbnambuf_flush()
1074 dp->d_namlen = nbp->nb_len; in mbnambuf_flush()
1077 return (dp->d_name); in mbnambuf_flush()