Lines Matching refs:one
78 char one[50]; variable
136 for (__n = 0; __n < (int) sizeof (one); ++__n) \
137 one[__n] = 'Z'; \
138 fn (one, str); \
139 for (cp = one, __n = 0; __n < n; ++__n, ++cp) \
149 check (strcpy (one, "abcd") == one, 1); /* Returned value. */ in test_strcpy()
150 equal (one, "abcd", 2); /* Basic test. */ in test_strcpy()
152 (void) strcpy (one, "x"); in test_strcpy()
153 equal (one, "x", 3); /* Writeover. */ in test_strcpy()
154 equal (one+2, "cd", 4); /* Wrote too much? */ in test_strcpy()
157 (void) strcpy (one, two); in test_strcpy()
158 equal (one, "hi there", 5); /* Basic test encore. */ in test_strcpy()
161 (void) strcpy (one, ""); in test_strcpy()
162 equal (one, "", 7); /* Boundary condition. */ in test_strcpy()
166 (void) strcpy (one + i, "hi there"); /* Unaligned destination. */ in test_strcpy()
167 equal (one + i, "hi there", 8 + (i * 2)); in test_strcpy()
168 (void) strcpy (two, one + i); /* Unaligned source. */ in test_strcpy()
192 void *dst = one; in test_strcpy()
201 check ((stpcpy (one, "a") - one) == 1, 1); in test_stpcpy()
202 equal (one, "a", 2); in test_stpcpy()
204 check ((stpcpy (one, "ab") - one) == 2, 3); in test_stpcpy()
205 equal (one, "ab", 4); in test_stpcpy()
207 check ((stpcpy (one, "abc") - one) == 3, 5); in test_stpcpy()
208 equal (one, "abc", 6); in test_stpcpy()
210 check ((stpcpy (one, "abcd") - one) == 4, 7); in test_stpcpy()
211 equal (one, "abcd", 8); in test_stpcpy()
213 check ((stpcpy (one, "abcde") - one) == 5, 9); in test_stpcpy()
214 equal (one, "abcde", 10); in test_stpcpy()
216 check ((stpcpy (one, "abcdef") - one) == 6, 11); in test_stpcpy()
217 equal (one, "abcdef", 12); in test_stpcpy()
219 check ((stpcpy (one, "abcdefg") - one) == 7, 13); in test_stpcpy()
220 equal (one, "abcdefg", 14); in test_stpcpy()
222 check ((stpcpy (one, "abcdefgh") - one) == 8, 15); in test_stpcpy()
223 equal (one, "abcdefgh", 16); in test_stpcpy()
225 check ((stpcpy (one, "abcdefghi") - one) == 9, 17); in test_stpcpy()
226 equal (one, "abcdefghi", 18); in test_stpcpy()
228 check ((stpcpy (one, "x") - one) == 1, 19); in test_stpcpy()
229 equal (one, "x", 20); /* Writeover. */ in test_stpcpy()
230 equal (one+2, "cdefghi", 21); /* Wrote too much? */ in test_stpcpy()
232 check ((stpcpy (one, "xx") - one) == 2, 22); in test_stpcpy()
233 equal (one, "xx", 23); /* Writeover. */ in test_stpcpy()
234 equal (one+3, "defghi", 24); /* Wrote too much? */ in test_stpcpy()
236 check ((stpcpy (one, "xxx") - one) == 3, 25); in test_stpcpy()
237 equal (one, "xxx", 26); /* Writeover. */ in test_stpcpy()
238 equal (one+4, "efghi", 27); /* Wrote too much? */ in test_stpcpy()
240 check ((stpcpy (one, "xxxx") - one) == 4, 28); in test_stpcpy()
241 equal (one, "xxxx", 29); /* Writeover. */ in test_stpcpy()
242 equal (one+5, "fghi", 30); /* Wrote too much? */ in test_stpcpy()
244 check ((stpcpy (one, "xxxxx") - one) == 5, 31); in test_stpcpy()
245 equal (one, "xxxxx", 32); /* Writeover. */ in test_stpcpy()
246 equal (one+6, "ghi", 33); /* Wrote too much? */ in test_stpcpy()
248 check ((stpcpy (one, "xxxxxx") - one) == 6, 34); in test_stpcpy()
249 equal (one, "xxxxxx", 35); /* Writeover. */ in test_stpcpy()
250 equal (one+7, "hi", 36); /* Wrote too much? */ in test_stpcpy()
252 check ((stpcpy (one, "xxxxxxx") - one) == 7, 37); in test_stpcpy()
253 equal (one, "xxxxxxx", 38); /* Writeover. */ in test_stpcpy()
254 equal (one+8, "i", 39); /* Wrote too much? */ in test_stpcpy()
256 check ((stpcpy (stpcpy (stpcpy (one, "a"), "b"), "c") - one) == 3, 40); in test_stpcpy()
257 equal (one, "abc", 41); in test_stpcpy()
258 equal (one + 4, "xxx", 42); in test_stpcpy()
283 memset (one, 'x', sizeof (one)); in test_stpncpy()
284 check (stpncpy (one, "abc", 2) == one + 2, 1); in test_stpncpy()
285 check (stpncpy (one, "abc", 3) == one + 3, 2); in test_stpncpy()
286 check (stpncpy (one, "abc", 4) == one + 3, 3); in test_stpncpy()
287 check (one[3] == '\0' && one[4] == 'x', 4); in test_stpncpy()
288 check (stpncpy (one, "abcd", 5) == one + 4, 5); in test_stpncpy()
289 check (one[4] == '\0' && one[5] == 'x', 6); in test_stpncpy()
290 check (stpncpy (one, "abcd", 6) == one + 4, 7); in test_stpncpy()
291 check (one[4] == '\0' && one[5] == '\0' && one[6] == 'x', 8); in test_stpncpy()
298 (void) strcpy (one, "ijk"); in test_strcat()
299 check (strcat (one, "lmn") == one, 1); /* Returned value. */ in test_strcat()
300 equal (one, "ijklmn", 2); /* Basic test. */ in test_strcat()
302 (void) strcpy (one, "x"); in test_strcat()
303 (void) strcat (one, "yz"); in test_strcat()
304 equal (one, "xyz", 3); /* Writeover. */ in test_strcat()
305 equal (one+4, "mn", 4); /* Wrote too much? */ in test_strcat()
307 (void) strcpy (one, "gh"); in test_strcat()
309 (void) strcat (one, two); in test_strcat()
310 equal (one, "ghef", 5); /* Basic test encore. */ in test_strcat()
313 (void) strcpy (one, ""); in test_strcat()
314 (void) strcat (one, ""); in test_strcat()
315 equal (one, "", 7); /* Boundary conditions. */ in test_strcat()
316 (void) strcpy (one, "ab"); in test_strcat()
317 (void) strcat (one, ""); in test_strcat()
318 equal (one, "ab", 8); in test_strcat()
319 (void) strcpy (one, ""); in test_strcat()
320 (void) strcat (one, "cd"); in test_strcat()
321 equal (one, "cd", 9); in test_strcat()
372 (void) strcpy (one, "ijk"); in test_strncat()
373 check (strncat (one, "lmn", 99) == one, 1); /* Returned value. */ in test_strncat()
374 equal (one, "ijklmn", 2); /* Basic test. */ in test_strncat()
376 (void) strcpy (one, "x"); in test_strncat()
377 (void) strncat (one, "yz", 99); in test_strncat()
378 equal (one, "xyz", 3); /* Writeover. */ in test_strncat()
379 equal (one+4, "mn", 4); /* Wrote too much? */ in test_strncat()
381 (void) strcpy (one, "gh"); in test_strncat()
383 (void) strncat (one, two, 99); in test_strncat()
384 equal (one, "ghef", 5); /* Basic test encore. */ in test_strncat()
387 (void) strcpy (one, ""); in test_strncat()
388 (void) strncat (one, "", 99); in test_strncat()
389 equal (one, "", 7); /* Boundary conditions. */ in test_strncat()
390 (void) strcpy (one, "ab"); in test_strncat()
391 (void) strncat (one, "", 99); in test_strncat()
392 equal (one, "ab", 8); in test_strncat()
393 (void) strcpy (one, ""); in test_strncat()
394 (void) strncat (one, "cd", 99); in test_strncat()
395 equal (one, "cd", 9); in test_strncat()
397 (void) strcpy (one, "ab"); in test_strncat()
398 (void) strncat (one, "cdef", 2); in test_strncat()
399 equal (one, "abcd", 10); /* Count-limited. */ in test_strncat()
401 (void) strncat (one, "gh", 0); in test_strncat()
402 equal (one, "abcd", 11); /* Zero count. */ in test_strncat()
404 (void) strncat (one, "gh", 2); in test_strncat()
405 equal (one, "abcdgh", 12); /* Count and length equal. */ in test_strncat()
407 (void) strncat (one, "ij", (size_t)-1); /* set sign bit in count */ in test_strncat()
408 equal (one, "abcdghij", 13); in test_strncat()
482 check (strncpy (one, "abc", 4) == one, 1); /* Returned value. */ in test_strncpy()
483 equal (one, "abc", 2); /* Did the copy go right? */ in test_strncpy()
485 (void) strcpy (one, "abcdefgh"); in test_strncpy()
486 (void) strncpy (one, "xyz", 2); in test_strncpy()
487 equal (one, "xycdefgh", 3); /* Copy cut by count. */ in test_strncpy()
489 (void) strcpy (one, "abcdefgh"); in test_strncpy()
490 (void) strncpy (one, "xyz", 3); /* Copy cut just before NUL. */ in test_strncpy()
491 equal (one, "xyzdefgh", 4); in test_strncpy()
493 (void) strcpy (one, "abcdefgh"); in test_strncpy()
494 (void) strncpy (one, "xyz", 4); /* Copy just includes NUL. */ in test_strncpy()
495 equal (one, "xyz", 5); in test_strncpy()
496 equal (one+4, "efgh", 6); /* Wrote too much? */ in test_strncpy()
498 (void) strcpy (one, "abcdefgh"); in test_strncpy()
499 (void) strncpy (one, "xyz", 5); /* Copy includes padding. */ in test_strncpy()
500 equal (one, "xyz", 7); in test_strncpy()
501 equal (one+4, "", 8); in test_strncpy()
502 equal (one+5, "fgh", 9); in test_strncpy()
504 (void) strcpy (one, "abc"); in test_strncpy()
505 (void) strncpy (one, "xyz", 0); /* Zero-length copy. */ in test_strncpy()
506 equal (one, "abc", 10); in test_strncpy()
508 (void) strncpy (one, "", 2); /* Zero-length source. */ in test_strncpy()
509 equal (one, "", 11); in test_strncpy()
510 equal (one+1, "", 12); in test_strncpy()
511 equal (one+2, "c", 13); in test_strncpy()
513 (void) strcpy (one, "hi there"); in test_strncpy()
514 (void) strncpy (two, one, 9); in test_strncpy()
516 equal (one, "hi there", 15); /* Stomped on source? */ in test_strncpy()
569 (void) strcpy (one, "abcd"); in test_strchr()
570 check (strchr (one, 'c') == one+2, 2); /* Basic test. */ in test_strchr()
571 check (strchr (one, 'd') == one+3, 3); /* End of string. */ in test_strchr()
572 check (strchr (one, 'a') == one, 4); /* Beginning. */ in test_strchr()
573 check (strchr (one, '\0') == one+4, 5); /* Finding NUL. */ in test_strchr()
574 (void) strcpy (one, "ababa"); in test_strchr()
575 check (strchr (one, 'b') == one+1, 6); /* Finding first. */ in test_strchr()
576 (void) strcpy (one, ""); in test_strchr()
577 check (strchr (one, 'b') == NULL, 7); /* Empty string. */ in test_strchr()
578 check (strchr (one, '\0') == one, 8); /* NUL in empty string. */ in test_strchr()
601 (void) strcpy (one, "abcd"); in test_strchrnul()
602 check (strchrnul (one, 'c') == one+2, 3); /* Basic test. */ in test_strchrnul()
603 check (strchrnul (one, 'd') == one+3, 4); /* End of string. */ in test_strchrnul()
604 check (strchrnul (one, 'a') == one, 5); /* Beginning. */ in test_strchrnul()
605 check (strchrnul (one, '\0') == one+4, 6); /* Finding NUL. */ in test_strchrnul()
606 (void) strcpy (one, "ababa"); in test_strchrnul()
607 check (strchrnul (one, 'b') == one+1, 7); /* Finding first. */ in test_strchrnul()
608 (void) strcpy (one, ""); in test_strchrnul()
609 check (strchrnul (one, 'b') == one, 8); /* Empty string. */ in test_strchrnul()
610 check (strchrnul (one, '\0') == one, 9); /* NUL in empty string. */ in test_strchrnul()
631 (void) strcpy (one, "abcd"); in test_rawmemchr()
632 check (rawmemchr (one, 'c') == one+2, 1); /* Basic test. */ in test_rawmemchr()
633 check (rawmemchr (one, 'd') == one+3, 2); /* End of string. */ in test_rawmemchr()
634 check (rawmemchr (one, 'a') == one, 3); /* Beginning. */ in test_rawmemchr()
635 check (rawmemchr (one, '\0') == one+4, 4); /* Finding NUL. */ in test_rawmemchr()
636 (void) strcpy (one, "ababa"); in test_rawmemchr()
637 check (rawmemchr (one, 'b') == one+1, 5); /* Finding first. */ in test_rawmemchr()
638 (void) strcpy (one, ""); in test_rawmemchr()
639 check (rawmemchr (one, '\0') == one, 6); /* NUL in empty string. */ in test_rawmemchr()
659 (void) strcpy (one, "abcd"); in test_index()
660 check (index (one, 'c') == one+2, 2); /* Basic test. */ in test_index()
661 check (index (one, 'd') == one+3, 3); /* End of string. */ in test_index()
662 check (index (one, 'a') == one, 4); /* Beginning. */ in test_index()
663 check (index (one, '\0') == one+4, 5); /* Finding NUL. */ in test_index()
664 (void) strcpy (one, "ababa"); in test_index()
665 check (index (one, 'b') == one+1, 6); /* Finding first. */ in test_index()
666 (void) strcpy (one, ""); in test_index()
667 check (index (one, 'b') == NULL, 7); /* Empty string. */ in test_index()
668 check (index (one, '\0') == one, 8); /* NUL in empty string. */ in test_index()
676 (void) strcpy (one, "abcd"); in test_strrchr()
677 check (strrchr (one, 'c') == one+2, 2); /* Basic test. */ in test_strrchr()
678 check (strrchr (one, 'd') == one+3, 3); /* End of string. */ in test_strrchr()
679 check (strrchr (one, 'a') == one, 4); /* Beginning. */ in test_strrchr()
680 check (strrchr (one, '\0') == one+4, 5); /* Finding NUL. */ in test_strrchr()
681 (void) strcpy (one, "ababa"); in test_strrchr()
682 check (strrchr (one, 'b') == one+3, 6); /* Finding last. */ in test_strrchr()
683 (void) strcpy (one, ""); in test_strrchr()
684 check (strrchr (one, 'b') == NULL, 7); /* Empty string. */ in test_strrchr()
685 check (strrchr (one, '\0') == one, 8); /* NUL in empty string. */ in test_strrchr()
706 (void) strcpy (one, "abcd"); in test_memrchr()
707 l = strlen (one) + 1; in test_memrchr()
708 check (memrchr (one, 'c', l) == one+2, 2); /* Basic test. */ in test_memrchr()
709 check (memrchr (one, 'd', l) == one+3, 3); /* End of string. */ in test_memrchr()
710 check (memrchr (one, 'a', l) == one, 4); /* Beginning. */ in test_memrchr()
711 check (memrchr (one, '\0', l) == one+4, 5); /* Finding NUL. */ in test_memrchr()
712 (void) strcpy (one, "ababa"); in test_memrchr()
713 l = strlen (one) + 1; in test_memrchr()
714 check (memrchr (one, 'b', l) == one+3, 6); /* Finding last. */ in test_memrchr()
715 (void) strcpy (one, ""); in test_memrchr()
716 l = strlen (one) + 1; in test_memrchr()
717 check (memrchr (one, 'b', l) == NULL, 7); /* Empty string. */ in test_memrchr()
718 check (memrchr (one, '\0', l) == one, 8); /* NUL in empty string. */ in test_memrchr()
751 (void) strcpy (one, "abcd"); in test_rindex()
752 check (rindex (one, 'c') == one+2, 2); /* Basic test. */ in test_rindex()
753 check (rindex (one, 'd') == one+3, 3); /* End of string. */ in test_rindex()
754 check (rindex (one, 'a') == one, 4); /* Beginning. */ in test_rindex()
755 check (rindex (one, '\0') == one+4, 5); /* Finding NUL. */ in test_rindex()
756 (void) strcpy (one, "ababa"); in test_rindex()
757 check (rindex (one, 'b') == one+3, 6); /* Finding last. */ in test_rindex()
758 (void) strcpy (one, ""); in test_rindex()
759 check (rindex (one, 'b') == NULL, 7); /* Empty string. */ in test_rindex()
760 check (rindex (one, '\0') == one, 8); /* NUL in empty string. */ in test_rindex()
768 (void) strcpy(one, "abcd"); in test_strpbrk()
769 check(strpbrk(one, "c") == one+2, 2); /* Basic test. */ in test_strpbrk()
770 check(strpbrk(one, "d") == one+3, 3); /* End of string. */ in test_strpbrk()
771 check(strpbrk(one, "a") == one, 4); /* Beginning. */ in test_strpbrk()
772 check(strpbrk(one, "") == NULL, 5); /* Empty search list. */ in test_strpbrk()
773 check(strpbrk(one, "cb") == one+1, 6); /* Multiple search. */ in test_strpbrk()
774 (void) strcpy(one, "abcabdea"); in test_strpbrk()
775 check(strpbrk(one, "b") == one+1, 7); /* Finding first. */ in test_strpbrk()
776 check(strpbrk(one, "cb") == one+1, 8); /* With multiple search. */ in test_strpbrk()
777 check(strpbrk(one, "db") == one+1, 9); /* Another variant. */ in test_strpbrk()
778 (void) strcpy(one, ""); in test_strpbrk()
779 check(strpbrk(one, "bc") == NULL, 10); /* Empty string. */ in test_strpbrk()
780 (void) strcpy(one, ""); in test_strpbrk()
781 check(strpbrk(one, "bcd") == NULL, 11); /* Empty string. */ in test_strpbrk()
782 (void) strcpy(one, ""); in test_strpbrk()
783 check(strpbrk(one, "bcde") == NULL, 12); /* Empty string. */ in test_strpbrk()
784 check(strpbrk(one, "") == NULL, 13); /* Both strings empty. */ in test_strpbrk()
785 (void) strcpy(one, "abcabdea"); in test_strpbrk()
786 check(strpbrk(one, "befg") == one+1, 14); /* Finding first. */ in test_strpbrk()
787 check(strpbrk(one, "cbr") == one+1, 15); /* With multiple search. */ in test_strpbrk()
788 check(strpbrk(one, "db") == one+1, 16); /* Another variant. */ in test_strpbrk()
789 check(strpbrk(one, "efgh") == one+6, 17); /* And yet another. */ in test_strpbrk()
798 (void) strcpy(one, "abcd"); in test_strstr()
799 check(strstr(one, "c") == one+2, 3); /* Basic test. */ in test_strstr()
800 check(strstr(one, "bc") == one+1, 4); /* Multichar. */ in test_strstr()
801 check(strstr(one, "d") == one+3, 5); /* End of string. */ in test_strstr()
802 check(strstr(one, "cd") == one+2, 6); /* Tail of string. */ in test_strstr()
803 check(strstr(one, "abc") == one, 7); /* Beginning. */ in test_strstr()
804 check(strstr(one, "abcd") == one, 8); /* Exact match. */ in test_strstr()
805 check(strstr(one, "abcde") == NULL, 9); /* Too long. */ in test_strstr()
806 check(strstr(one, "de") == NULL, 10); /* Past end. */ in test_strstr()
807 check(strstr(one, "") == one, 11); /* Finding empty. */ in test_strstr()
808 (void) strcpy(one, "ababa"); in test_strstr()
809 check(strstr(one, "ba") == one+1, 12); /* Finding first. */ in test_strstr()
810 (void) strcpy(one, ""); in test_strstr()
811 check(strstr(one, "b") == NULL, 13); /* Empty string. */ in test_strstr()
812 check(strstr(one, "") == one, 14); /* Empty in empty string. */ in test_strstr()
813 (void) strcpy(one, "bcbca"); in test_strstr()
814 check(strstr(one, "bca") == one+2, 15); /* False start. */ in test_strstr()
815 (void) strcpy(one, "bbbcabbca"); in test_strstr()
816 check(strstr(one, "bbca") == one+1, 16); /* With overlap. */ in test_strstr()
845 (void) strcpy(one, "first, second, third"); in test_strtok()
846 equal(strtok(one, ", "), "first", 1); /* Basic test. */ in test_strtok()
847 equal(one, "first", 2); in test_strtok()
851 (void) strcpy(one, ", first, "); in test_strtok()
852 equal(strtok(one, ", "), "first", 6); /* Extra delims, 1 tok. */ in test_strtok()
854 (void) strcpy(one, "1a, 1b; 2a, 2b"); in test_strtok()
855 equal(strtok(one, ", "), "1a", 8); /* Changing delim lists. */ in test_strtok()
862 (void) strcpy(one, "a,b, c,, ,d"); in test_strtok()
863 equal(strtok(one, ", "), "a", 14); /* Different separators. */ in test_strtok()
869 (void) strcpy(one, ", "); in test_strtok()
870 check(strtok(one, ", ") == NULL, 20); /* No tokens. */ in test_strtok()
871 (void) strcpy(one, ""); in test_strtok()
872 check(strtok(one, ", ") == NULL, 21); /* Empty string. */ in test_strtok()
873 (void) strcpy(one, "abc"); in test_strtok()
874 equal(strtok(one, ", "), "abc", 22); /* No delimiters. */ in test_strtok()
876 (void) strcpy(one, "abc"); in test_strtok()
877 equal(strtok(one, ""), "abc", 24); /* Empty delimiter list. */ in test_strtok()
879 (void) strcpy(one, "abcdefgh"); in test_strtok()
880 (void) strcpy(one, "a,b,c"); in test_strtok()
881 equal(strtok(one, ","), "a", 26); /* Basics again... */ in test_strtok()
885 equal(one+6, "gh", 30); /* Stomped past end? */ in test_strtok()
886 equal(one, "a", 31); /* Stomped old tokens? */ in test_strtok()
887 equal(one+2, "b", 32); in test_strtok()
888 equal(one+4, "c", 33); in test_strtok()
895 (void) strcpy(one, "first, second, third"); in test_strtok_r()
897 equal(strtok_r(one, ", ", &cp), "first", 1); /* Basic test. */ in test_strtok_r()
898 equal(one, "first", 2); in test_strtok_r()
902 (void) strcpy(one, ", first, "); in test_strtok_r()
904 equal(strtok_r(one, ", ", &cp), "first", 6); /* Extra delims, 1 tok. */ in test_strtok_r()
906 (void) strcpy(one, "1a, 1b; 2a, 2b"); in test_strtok_r()
908 equal(strtok_r(one, ", ", &cp), "1a", 8); /* Changing delim lists. */ in test_strtok_r()
916 (void) strcpy(one, "a,b, c,, ,d"); in test_strtok_r()
918 equal(strtok_r(one, ", ", &cp), "a", 14); /* Different separators. */ in test_strtok_r()
924 (void) strcpy(one, ", "); in test_strtok_r()
926 check(strtok_r(one, ", ", &cp) == NULL, 20); /* No tokens. */ in test_strtok_r()
927 (void) strcpy(one, ""); in test_strtok_r()
929 check(strtok_r(one, ", ", &cp) == NULL, 21); /* Empty string. */ in test_strtok_r()
931 (void) strcpy(one, "abc"); in test_strtok_r()
933 equal(strtok_r(one, ", ", &cp), "abc", 23); /* No delimiters. */ in test_strtok_r()
935 (void) strcpy(one, "abc"); in test_strtok_r()
937 equal(strtok_r(one, "", &cp), "abc", 25); /* Empty delimiter list. */ in test_strtok_r()
939 (void) strcpy(one, "abcdefgh"); in test_strtok_r()
940 (void) strcpy(one, "a,b,c"); in test_strtok_r()
942 equal(strtok_r(one, ",", &cp), "a", 27); /* Basics again... */ in test_strtok_r()
946 equal(one+6, "gh", 31); /* Stomped past end? */ in test_strtok_r()
947 equal(one, "a", 32); /* Stomped old tokens? */ in test_strtok_r()
948 equal(one+2, "b", 33); in test_strtok_r()
949 equal(one+4, "c", 34); in test_strtok_r()
950 strcpy (one, ":::"); in test_strtok_r()
952 check (strtok_r (one, ":", &cp) == NULL, 35); /* Must store pointer in cp. */ in test_strtok_r()
961 cp = strcpy(one, "first, second, third"); in test_strsep()
963 equal(one, "first", 2); in test_strsep()
969 cp = strcpy(one, ", first, "); in test_strsep()
976 cp = strcpy(one, "1a, 1b; 2a, 2b"); in test_strsep()
986 cp = strcpy(one, "a,b, c,, ,d "); in test_strsep()
998 cp = strcpy(one, ", "); in test_strsep()
1003 cp = strcpy(one, ""); in test_strsep()
1006 cp = strcpy(one, "abc"); in test_strsep()
1009 cp = strcpy(one, "abc"); in test_strsep()
1012 (void) strcpy(one, "abcdefgh"); in test_strsep()
1013 cp = strcpy(one, "a,b,c"); in test_strsep()
1018 equal(one+6, "gh", 47); /* Stomped past end? */ in test_strsep()
1019 equal(one, "a", 48); /* Stomped old tokens? */ in test_strsep()
1020 equal(one+2, "b", 49); in test_strsep()
1021 equal(one+4, "c", 50); in test_strsep()
1033 cp = strcpy(one, "a,b, c,, ,d,"); in test_strsep()
1044 cp = strcpy(one, "a,b, c,, ,d,"); in test_strsep()
1055 cp = strcpy(one, "ABC"); in test_strsep()
1056 one[4] = ':'; in test_strsep()
1060 check(ptr == one + 3, 76); in test_strsep()
1063 cp = strcpy(one, "ABC"); in test_strsep()
1064 one[4] = ':'; in test_strsep()
1068 check(ptr == one + 3, 80); in test_strsep()
1070 cp = strcpy(one, "ABC"); /* No token in string. */ in test_strsep()
1074 *one = '\0'; /* Empty string. */ in test_strsep()
1075 cp = one; in test_strsep()
1078 check(ptr == one, 84); in test_strsep()
1081 *one = '\0'; /* Empty string and no token. */ in test_strsep()
1082 cp = one; in test_strsep()
1085 check(ptr == one , 87); in test_strsep()
1093 char one[21]; in test_memcmp() local
1112 char *a = one + i; in test_memcmp()
1126 (void) strcpy(one, "abcd"); in test_memchr()
1127 check(memchr(one, 'c', 4) == one+2, 2); /* Basic test. */ in test_memchr()
1128 check(memchr(one, ~0xff|'c', 4) == one+2, 2); /* ignore highorder bits. */ in test_memchr()
1129 check(memchr(one, 'd', 4) == one+3, 3); /* End of string. */ in test_memchr()
1130 check(memchr(one, 'a', 4) == one, 4); /* Beginning. */ in test_memchr()
1131 check(memchr(one, '\0', 5) == one+4, 5); /* Finding NUL. */ in test_memchr()
1132 (void) strcpy(one, "ababa"); in test_memchr()
1133 check(memchr(one, 'b', 5) == one+1, 6); /* Finding first. */ in test_memchr()
1134 check(memchr(one, 'b', 0) == NULL, 7); /* Zero count. */ in test_memchr()
1135 check(memchr(one, 'a', 1) == one, 8); /* Singleton case. */ in test_memchr()
1136 (void) strcpy(one, "a\203b"); in test_memchr()
1137 check(memchr(one, 0203, 3) == one+1, 9); /* Unsignedness. */ in test_memchr()
1169 check(memcpy(one, "abc", 4) == one, 1); /* Returned value. */ in test_memcpy()
1170 equal(one, "abc", 2); /* Did the copy go right? */ in test_memcpy()
1172 (void) strcpy(one, "abcdefgh"); in test_memcpy()
1173 (void) memcpy(one+1, "xyz", 2); in test_memcpy()
1174 equal(one, "axydefgh", 3); /* Basic test. */ in test_memcpy()
1176 (void) strcpy(one, "abc"); in test_memcpy()
1177 (void) memcpy(one, "xyz", 0); in test_memcpy()
1178 equal(one, "abc", 4); /* Zero-length copy. */ in test_memcpy()
1180 (void) strcpy(one, "hi there"); in test_memcpy()
1182 (void) memcpy(two, one, 9); in test_memcpy()
1184 equal(one, "hi there", 6); /* Stomped on source? */ in test_memcpy()
1189 strcpy (one, x); in test_memcpy()
1190 check (memcpy (one + i, "hi there", 9) == one + i, in test_memcpy()
1192 check (memcmp (one, x, i) == 0, 8 + (i * 6)); /* Wrote under? */ in test_memcpy()
1193 equal (one + i, "hi there", 9 + (i * 6)); in test_memcpy()
1194 check (one[i + 9] == 'x', 10 + (i * 6)); /* Wrote over? */ in test_memcpy()
1195 check (memcpy (two, one + i, 9) == two, in test_memcpy()
1206 check(mempcpy(one, "abc", 4) == one + 4, 1); /* Returned value. */ in test_mempcpy()
1207 equal(one, "abc", 2); /* Did the copy go right? */ in test_mempcpy()
1209 (void) strcpy(one, "abcdefgh"); in test_mempcpy()
1210 (void) mempcpy(one+1, "xyz", 2); in test_mempcpy()
1211 equal(one, "axydefgh", 3); /* Basic test. */ in test_mempcpy()
1213 (void) strcpy(one, "abc"); in test_mempcpy()
1214 (void) mempcpy(one, "xyz", 0); in test_mempcpy()
1215 equal(one, "abc", 4); /* Zero-length copy. */ in test_mempcpy()
1217 (void) strcpy(one, "hi there"); in test_mempcpy()
1219 (void) mempcpy(two, one, 9); in test_mempcpy()
1221 equal(one, "hi there", 6); /* Stomped on source? */ in test_mempcpy()
1226 strcpy (one, x); in test_mempcpy()
1227 check (mempcpy (one + i, "hi there", 9) == one + i + 9, in test_mempcpy()
1229 check (memcmp (one, x, i) == 0, 8 + (i * 6)); /* Wrote under? */ in test_mempcpy()
1230 equal (one + i, "hi there", 9 + (i * 6)); in test_mempcpy()
1231 check (one[i + 9] == 'x', 10 + (i * 6)); /* Wrote over? */ in test_mempcpy()
1232 check (mempcpy (two, one + i, 9) == two + 9, in test_mempcpy()
1242 check(memmove(one, "abc", 4) == one, 1); /* Returned value. */ in test_memmove()
1243 equal(one, "abc", 2); /* Did the copy go right? */ in test_memmove()
1245 (void) strcpy(one, "abcdefgh"); in test_memmove()
1246 (void) memmove(one+1, "xyz", 2); in test_memmove()
1247 equal(one, "axydefgh", 3); /* Basic test. */ in test_memmove()
1249 (void) strcpy(one, "abc"); in test_memmove()
1250 (void) memmove(one, "xyz", 0); in test_memmove()
1251 equal(one, "abc", 4); /* Zero-length copy. */ in test_memmove()
1253 (void) strcpy(one, "hi there"); in test_memmove()
1255 (void) memmove(two, one, 9); in test_memmove()
1257 equal(one, "hi there", 6); /* Stomped on source? */ in test_memmove()
1259 (void) strcpy(one, "abcdefgh"); in test_memmove()
1260 (void) memmove(one+1, one, 9); in test_memmove()
1261 equal(one, "aabcdefgh", 7); /* Overlap, right-to-left. */ in test_memmove()
1263 (void) strcpy(one, "abcdefgh"); in test_memmove()
1264 (void) memmove(one+1, one+2, 7); in test_memmove()
1265 equal(one, "acdefgh", 8); /* Overlap, left-to-right. */ in test_memmove()
1267 (void) strcpy(one, "abcdefgh"); in test_memmove()
1268 (void) memmove(one, one, 9); in test_memmove()
1269 equal(one, "abcdefgh", 9); /* 100% overlap. */ in test_memmove()
1280 check(memccpy(one, "abc", 'q', 4) == NULL, 1); /* Returned value. */ in test_memccpy()
1281 equal(one, "abc", 2); /* Did the copy go right? */ in test_memccpy()
1283 (void) strcpy(one, "abcdefgh"); in test_memccpy()
1284 (void) memccpy(one+1, "xyz", 'q', 2); in test_memccpy()
1285 equal(one, "axydefgh", 3); /* Basic test. */ in test_memccpy()
1287 (void) strcpy(one, "abc"); in test_memccpy()
1288 (void) memccpy(one, "xyz", 'q', 0); in test_memccpy()
1289 equal(one, "abc", 4); /* Zero-length copy. */ in test_memccpy()
1291 (void) strcpy(one, "hi there"); in test_memccpy()
1293 (void) memccpy(two, one, 'q', 9); in test_memccpy()
1295 equal(one, "hi there", 6); /* Stomped on source? */ in test_memccpy()
1297 (void) strcpy(one, "abcdefgh"); in test_memccpy()
1299 check(memccpy(two, one, 'f', 9) == two+6, 7); /* Returned value. */ in test_memccpy()
1300 equal(one, "abcdefgh", 8); /* Source intact? */ in test_memccpy()
1303 (void) strcpy(one, "abcd"); in test_memccpy()
1305 check(memccpy(two, one, 'a', 4) == two+1, 10); /* First char. */ in test_memccpy()
1307 check(memccpy(two, one, 'd', 4) == two+4, 12); /* Last char. */ in test_memccpy()
1309 (void) strcpy(one, "xyz"); in test_memccpy()
1310 check(memccpy(two, one, 'x', 1) == two+1, 14); /* Singleton. */ in test_memccpy()
1320 (void) strcpy(one, "abcdefgh"); in test_memset()
1321 check(memset(one+1, 'x', 3) == one+1, 1); /* Return value. */ in test_memset()
1322 equal(one, "axxxefgh", 2); /* Basic test. */ in test_memset()
1324 (void) memset(one+2, 'y', 0); in test_memset()
1325 equal(one, "axxxefgh", 3); /* Zero-length set. */ in test_memset()
1327 (void) memset(one+5, 0, 1); in test_memset()
1328 equal(one, "axxxe", 4); /* Zero fill. */ in test_memset()
1329 equal(one+6, "gh", 5); /* And the leftover. */ in test_memset()
1331 (void) memset(one+2, 010045, 1); in test_memset()
1332 equal(one, "ax\045xe", 6); /* Unsigned char convert. */ in test_memset()
1335 memset (one, 0x101, sizeof (one)); in test_memset()
1336 for (i = 0; i < (int) sizeof (one); ++i) in test_memset()
1337 check (one[i] == '\01', 7); in test_memset()
1382 (void) bcopy("abc", one, 4); in test_bcopy()
1383 equal(one, "abc", 1); /* Simple copy. */ in test_bcopy()
1385 (void) strcpy(one, "abcdefgh"); in test_bcopy()
1386 (void) bcopy("xyz", one+1, 2); in test_bcopy()
1387 equal(one, "axydefgh", 2); /* Basic test. */ in test_bcopy()
1389 (void) strcpy(one, "abc"); in test_bcopy()
1390 (void) bcopy("xyz", one, 0); in test_bcopy()
1391 equal(one, "abc", 3); /* Zero-length copy. */ in test_bcopy()
1393 (void) strcpy(one, "hi there"); in test_bcopy()
1395 (void) bcopy(one, two, 9); in test_bcopy()
1397 equal(one, "hi there", 5); /* Stomped on source? */ in test_bcopy()
1404 (void) strcpy(one, "abcdef"); in test_bzero()
1405 bzero(one+2, 2); in test_bzero()
1406 equal(one, "ab", 1); /* Basic test. */ in test_bzero()
1407 equal(one+3, "", 2); in test_bzero()
1408 equal(one+4, "ef", 3); in test_bzero()
1410 (void) strcpy(one, "abcdef"); in test_bzero()
1411 bzero(one+2, 0); in test_bzero()
1412 equal(one, "abcdef", 4); /* Zero-length copy. */ in test_bzero()