6 int main(int argc
, char **argv
)
16 b
= Strncpy(a
, "hello", sizeof(a
));
17 b
= Strncat(b
, "world", sizeof(a
));
18 printf("1: result=[%s] should be=[%s]\n",
23 for (i
=0; i
<sizeof(c
); i
++)
25 b
= Strncpy(c
, "testing", sizeof(c
) - 2);
26 #if (STRN_ZERO_PAD == 1)
27 for (i
=7; i
<sizeof(c
) - 2; i
++) {
29 printf("2: did not clear to end of buffer\n");
34 for (i
=sizeof(c
) - 2; i
<sizeof(c
); i
++) {
36 printf("2: overwrote buffer\n");
41 for (i
=0; i
<sizeof(c
); i
++)
43 b
= Strncpy(c
, "testing", sizeof(c
) - 2);
44 b
= Strncat(b
, " still", sizeof(c
) - 2);
45 #if (STRN_ZERO_PAD == 1)
46 for (i
=13; i
<sizeof(c
) - 2; i
++) {
48 printf("3: did not clear to end of buffer\n");
53 for (i
=sizeof(c
) - 2; i
<sizeof(c
); i
++) {
55 printf("3: overwrote buffer\n");
62 b
= Strnpcpy(a
, "hello", sizeof(a
));
64 b
= Strnpcat(a
, "world", sizeof(a
));
66 printf("4: result=[%s] should be=[%s] len1=%d len2=%d\n",
73 for (i
=0; i
<sizeof(c
); i
++)
75 b
= Strnpcpy(c
, "testing", sizeof(c
) - 2);
76 #if (STRNP_ZERO_PAD == 1)
77 for (i
=7; i
<sizeof(c
) - 2; i
++) {
79 printf("5: did not clear to end of buffer\n");
84 for (i
=sizeof(c
) - 2; i
<sizeof(c
); i
++) {
86 printf("5: overwrote buffer\n");
91 for (i
=0; i
<sizeof(c
); i
++)
93 b
= Strnpcpy(c
, "testing", sizeof(c
) - 2);
94 b
= Strnpcat(c
, " still", sizeof(c
) - 2);
95 #if (STRNP_ZERO_PAD == 1)
96 for (i
=13; i
<sizeof(c
) - 2; i
++) {
98 printf("6: did not clear to end of buffer\n");
103 for (i
=sizeof(c
) - 2; i
<sizeof(c
); i
++) {
105 printf("6: overwrote buffer\n");
115 if (Dynscat(&str
, "this is a test", 0) == NULL
) {
116 printf("7a: fail\n");
117 } else if (strcmp(str
, "this is a test") != 0) {
118 printf("7b: fail\n");
123 if (Dynscat(&str
, "this is a test", 0) == NULL
) {
124 printf("7c: fail\n");
125 } else if (strcmp(str
, "this is a test") != 0) {
126 printf("7d: fail\n");
127 } else if (Dynscat(&str
, " ", "", "and", " ", "so is this", 0) == NULL
) {
128 printf("7e: fail\n");
129 } else if (strcmp(str
, "this is a test and so is this") != 0) {
130 printf("7f: fail\n");