Lines Matching refs:cp
67 char *cp;
122 char *cp; \
126 for (cp = one, __n = 0; __n < n; ++__n, ++cp) \
127 check (*cp == '0' + (n % 10), ntest); \
128 check (*cp == '\0', ntest); \
476 cp = strchrnul ((os = "abcd"), 'z');
477 check (*cp == '\0', 1); /* Not found. */
478 check (cp == os + 4, 2);
498 cp = strchrnul (p, '/');
499 check (*cp == '\0', 9+2*i);
500 check (cp == p+2, 10+2*i);
781 cp = NULL; /* Always initialize cp to make sure it doesn't point to some old data. */
782 equal(strtok_r(one, ", ", &cp), "first", 1); /* Basic test. */
784 equal(strtok_r((char *)NULL, ", ", &cp), "second", 3);
785 equal(strtok_r((char *)NULL, ", ", &cp), "third", 4);
786 check(strtok_r((char *)NULL, ", ", &cp) == NULL, 5);
788 cp = NULL;
789 equal(strtok_r(one, ", ", &cp), "first", 6); /* Extra delims, 1 tok. */
790 check(strtok_r((char *)NULL, ", ", &cp) == NULL, 7);
792 cp = NULL;
793 equal(strtok_r(one, ", ", &cp), "1a", 8); /* Changing delim lists. */
794 equal(strtok_r((char *)NULL, "; ", &cp), "1b", 9);
795 equal(strtok_r((char *)NULL, ", ", &cp), "2a", 10);
797 cp = NULL;
798 equal(strtok_r(two, "-", &cp), "x", 11); /* New string before done. */
799 equal(strtok_r((char *)NULL, "-", &cp), "y", 12);
800 check(strtok_r((char *)NULL, "-", &cp) == NULL, 13);
802 cp = NULL;
803 equal(strtok_r(one, ", ", &cp), "a", 14); /* Different separators. */
804 equal(strtok_r((char *)NULL, ", ", &cp), "b", 15);
805 equal(strtok_r((char *)NULL, " ,", &cp), "c", 16); /* Permute list too. */
806 equal(strtok_r((char *)NULL, " ,", &cp), "d", 17);
807 check(strtok_r((char *)NULL, ", ", &cp) == NULL, 18);
808 check(strtok_r((char *)NULL, ", ", &cp) == NULL, 19); /* Persistence. */
810 cp = NULL;
811 check(strtok_r(one, ", ", &cp) == NULL, 20); /* No tokens. */
813 cp = NULL;
814 check(strtok_r(one, ", ", &cp) == NULL, 21); /* Empty string. */
815 check(strtok_r((char *)NULL, ", ", &cp) == NULL, 22); /* Persistence. */
817 cp = NULL;
818 equal(strtok_r(one, ", ", &cp), "abc", 23); /* No delimiters. */
819 check(strtok_r((char *)NULL, ", ", &cp) == NULL, 24);
821 cp = NULL;
822 equal(strtok_r(one, "", &cp), "abc", 25); /* Empty delimiter list. */
823 check(strtok_r((char *)NULL, "", &cp) == NULL, 26);
826 cp = NULL;
827 equal(strtok_r(one, ",", &cp), "a", 27); /* Basics again... */
828 equal(strtok_r((char *)NULL, ",", &cp), "b", 28);
829 equal(strtok_r((char *)NULL, ",", &cp), "c", 29);
830 check(strtok_r((char *)NULL, ",", &cp) == NULL, 30);
842 cp = strcpy(one, "first, second, third");
843 equal(strsep(&cp, ", "), "first", 1); /* Basic test. */
845 equal(strsep(&cp, ", "), "", 3);
846 equal(strsep(&cp, ", "), "second", 4);
847 equal(strsep(&cp, ", "), "", 5);
848 equal(strsep(&cp, ", "), "third", 6);
849 check(strsep(&cp, ", ") == NULL, 7);
850 cp = strcpy(one, ", first, ");
851 equal(strsep(&cp, ", "), "", 8);
852 equal(strsep(&cp, ", "), "", 9);
853 equal(strsep(&cp, ", "), "first", 10); /* Extra delims, 1 tok. */
854 equal(strsep(&cp, ", "), "", 11);
855 equal(strsep(&cp, ", "), "", 12);
856 check(strsep(&cp, ", ") == NULL, 13);
857 cp = strcpy(one, "1a, 1b; 2a, 2b");
858 equal(strsep(&cp, ", "), "1a", 14); /* Changing delim lists. */
859 equal(strsep(&cp, ", "), "", 15);
860 equal(strsep(&cp, "; "), "1b", 16);
861 equal(strsep(&cp, ", "), "", 17);
862 equal(strsep(&cp, ", "), "2a", 18);
863 cp = strcpy(two, "x-y");
864 equal(strsep(&cp, "-"), "x", 19); /* New string before done. */
865 equal(strsep(&cp, "-"), "y", 20);
866 check(strsep(&cp, "-") == NULL, 21);
867 cp = strcpy(one, "a,b, c,, ,d ");
868 equal(strsep(&cp, ", "), "a", 22); /* Different separators. */
869 equal(strsep(&cp, ", "), "b", 23);
870 equal(strsep(&cp, " ,"), "", 24);
871 equal(strsep(&cp, " ,"), "c", 25); /* Permute list too. */
872 equal(strsep(&cp, " ,"), "", 26);
873 equal(strsep(&cp, " ,"), "", 27);
874 equal(strsep(&cp, " ,"), "", 28);
875 equal(strsep(&cp, " ,"), "d", 29);
876 equal(strsep(&cp, " ,"), "", 30);
877 check(strsep(&cp, ", ") == NULL, 31);
878 check(strsep(&cp, ", ") == NULL, 32); /* Persistence. */
879 cp = strcpy(one, ", ");
880 equal(strsep(&cp, ", "), "", 33);
881 equal(strsep(&cp, ", "), "", 34);
882 equal(strsep(&cp, ", "), "", 35);
883 check(strsep(&cp, ", ") == NULL, 36); /* No tokens. */
884 cp = strcpy(one, "");
885 equal(strsep(&cp, ", "), "", 37);
886 check(strsep(&cp, ", ") == NULL, 38); /* Empty string. */
887 cp = strcpy(one, "abc");
888 equal(strsep(&cp, ", "), "abc", 39); /* No delimiters. */
889 check(strsep(&cp, ", ") == NULL, 40);
890 cp = strcpy(one, "abc");
891 equal(strsep(&cp, ""), "abc", 41); /* Empty delimiter list. */
892 check(strsep(&cp, "") == NULL, 42);
894 cp = strcpy(one, "a,b,c");
895 equal(strsep(&cp, ","), "a", 43); /* Basics again... */
896 equal(strsep(&cp, ","), "b", 44);
897 equal(strsep(&cp, ","), "c", 45);
898 check(strsep(&cp, ",") == NULL, 46);
916 cp = strcpy(one, "a,b, c,, ,d,");
917 equal(strsep(&cp, ","), "a", 56); /* Different separators. */
918 equal(strsep(&cp, ","), "b", 57);
919 equal(strsep(&cp, ","), " c", 58); /* Permute list too. */
920 equal(strsep(&cp, ","), "", 59);
921 equal(strsep(&cp, ","), " ", 60);
922 equal(strsep(&cp, ","), "d", 61);
923 equal(strsep(&cp, ","), "", 62);
924 check(strsep(&cp, ",") == NULL, 63);
925 check(strsep(&cp, ",") == NULL, 64); /* Persistence. */
927 cp = strcpy(one, "a,b, c,, ,d,");
928 equal(strsep(&cp, "xy,"), "a", 65); /* Different separators. */
929 equal(strsep(&cp, "x,y"), "b", 66);
930 equal(strsep(&cp, ",xy"), " c", 67); /* Permute list too. */
931 equal(strsep(&cp, "xy,"), "", 68);
932 equal(strsep(&cp, "x,y"), " ", 69);
933 equal(strsep(&cp, ",xy"), "d", 70);
934 equal(strsep(&cp, "xy,"), "", 71);
935 check(strsep(&cp, "x,y") == NULL, 72);
936 check(strsep(&cp, ",xy") == NULL, 73); /* Persistence. */
938 cp = strcpy(one, "ABC");
940 equal(strsep(&cp, "C"), "AB", 74); /* Access beyond NUL. */
941 ptr = strsep(&cp, ":");
944 check(cp == NULL, 77);
946 cp = strcpy(one, "ABC");
948 equal(strsep(&cp, "CD"), "AB", 78); /* Access beyond NUL. */
949 ptr = strsep(&cp, ":.");
953 cp = strcpy(one, "ABC"); /* No token in string. */
954 equal(strsep(&cp, ","), "ABC", 81);
955 check(cp == NULL, 82);
958 cp = one;
959 ptr = strsep(&cp, ",");
962 check(cp == NULL, 85);
965 cp = one;
966 ptr = strsep(&cp, "");
969 check(cp == NULL, 88);