diff options
author | Juli Mallett <jmallett@FreeBSD.org> | 2002-06-22 12:58:42 +0000 |
---|---|---|
committer | Juli Mallett <jmallett@FreeBSD.org> | 2002-06-22 12:58:42 +0000 |
commit | 5058dcb497254b4188415d8b02e3f0eedd12b560 (patch) | |
tree | 03c9d22367316a2f7388386291cfb5d1ec71d3aa /usr.bin/xargs | |
parent | af03a3cbd6517c0fd427d3d882491b82eb674bfd (diff) | |
download | src-test2-5058dcb497254b4188415d8b02e3f0eedd12b560.tar.gz src-test2-5058dcb497254b4188415d8b02e3f0eedd12b560.zip |
Notes
Diffstat (limited to 'usr.bin/xargs')
-rw-r--r-- | usr.bin/xargs/strnsubst.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/usr.bin/xargs/strnsubst.c b/usr.bin/xargs/strnsubst.c index b6668b7071b3..fc00ea0db321 100644 --- a/usr.bin/xargs/strnsubst.c +++ b/usr.bin/xargs/strnsubst.c @@ -73,14 +73,25 @@ done: int main(void) { - char *x, *y; + char *x, *y, *z, *za; - y = x = "{}{}{}"; - strnsubst(&x, "{}", "v ybir whyv! ", 12); - if (strcmp(x, "v ybir whyv! ") == 0) - printf("strnsubst() seems to work as expected.\n"); - printf("x: %s\ny: %s\n", x, y); + x = "{}%$"; + strnsubst(&x, "%$", "{} enpury!", 255); + y = x; + strnsubst(&y, "}{}", "ybir", 255); + z = y; + strnsubst(&z, "{", "v ", 255); + za = z; + strnsubst(&z, NULL, za, 255); + if (strcmp(z, "v ybir enpury!") == 0) + printf("strnsubst() seems to work!\n"); + else + printf("strnsubst() is broken.\n"); + printf("%s\n", z); free(x); + free(y); + free(z); + free(za); return 0; } #endif |