xref: /freebsd/contrib/sendmail/libsm/t-streq.c (revision ebacd8013fe5f7fdf9f6a5b286f6680dd2891036)
1 /*
2  * Copyright (c) 2020 Proofpoint, Inc. and its suppliers.
3  *	All rights reserved.
4  *
5  * By using this file, you agree to the terms and conditions set
6  * forth in the LICENSE file which can be found at the top level of
7  * the sendmail distribution.
8  */
9 
10 #include <sm/gen.h>
11 SM_IDSTR(id, "@(#)$Id: t-qic.c,v 1.10 2013-11-22 20:51:43 ca Exp $")
12 
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <unistd.h>
16 #include <sm/sendmail.h>
17 #include <sm/ixlen.h>
18 #include <sm/test.h>
19 
20 #if _FFR_8BITENVADDR
21 extern bool SmTestVerbose;
22 
23 static int
24 tstrncaseeq(s1, s2, len)
25 	char *s1;
26 	char *s2;
27 	size_t len;
28 {
29 	return SM_STRNCASEEQ(s1, s2, len);
30 }
31 
32 static void
33 usage(prg)
34 	const char *prg;
35 {
36 	fprintf(stderr, "usage: %s [options]\n", prg);
37 	fprintf(stderr, "options:\n");
38 }
39 
40 int
41 main(argc, argv)
42 	int argc;
43 	char *argv[];
44 {
45 	int o, len;
46 #define MAXL	1024
47 	char s1[MAXL], s2[MAXL];
48 
49 	while ((o = getopt(argc, argv, "h")) != -1)
50 	{
51 		switch ((char) o)
52 		{
53 		  default:
54 			usage(argv[0]);
55 			exit(1);
56 		}
57 	}
58 
59 	sm_test_begin(argc, argv, "test strncaseeq");
60 
61 	while (fscanf(stdin, "%d:%s\n", &len, s1) == 2 &&
62 		fscanf(stdin, "%d:%s\n", &o,s2) == 2)
63 	{
64 		SM_TEST(tstrncaseeq(s1, s2, len) == o);
65 	}
66 
67 	return sm_test_end();
68 }
69 #else /* _FFR_8BITENVADDR */
70 int
71 main(argc, argv)
72 	int argc;
73 	char *argv[];
74 {
75 	return 0;
76 }
77 #endif /* _FFR_8BITENVADDR */
78