Line | |
---|
1 | /*
|
---|
2 | * Copyright (C) 2003 by Martin Pool
|
---|
3 | *
|
---|
4 | * Test harness for strstr_m
|
---|
5 | */
|
---|
6 |
|
---|
7 | #include "includes.h"
|
---|
8 |
|
---|
9 | int main(int argc, char *argv[])
|
---|
10 | {
|
---|
11 | int i;
|
---|
12 | int iters = 1;
|
---|
13 |
|
---|
14 | const char *ret = NULL;
|
---|
15 |
|
---|
16 | /* Needed to initialize character set */
|
---|
17 | lp_load("/dev/null", True, False, False, True);
|
---|
18 |
|
---|
19 | if (argc < 3) {
|
---|
20 | fprintf(stderr, "usage: %s STRING1 STRING2 [ITERS]\n"
|
---|
21 | "Compares two strings, prints the results of strstr_m\n",
|
---|
22 | argv[0]);
|
---|
23 | return 2;
|
---|
24 | }
|
---|
25 | if (argc >= 4)
|
---|
26 | iters = atoi(argv[3]);
|
---|
27 |
|
---|
28 | for (i = 0; i < iters; i++) {
|
---|
29 | ret = strstr_m(argv[1], argv[2]);
|
---|
30 | }
|
---|
31 |
|
---|
32 | if (ret == NULL)
|
---|
33 | ret = "(null)";
|
---|
34 |
|
---|
35 | printf("%s\n", ret);
|
---|
36 |
|
---|
37 | return 0;
|
---|
38 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.