summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/sprintf
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2025-04-14 17:32:06 +0000
committercvs2svn <admin@example.com>2025-04-14 17:32:06 +0000
commiteb8dd9dca1228af0cd132f515509051ecfabf6f6 (patch)
treeedb6da6af7e865d488dc1a29309f1e1ec226e603 /src/regress/lib/libc/sprintf
parent247f0352e0ed72a4f476db9dc91f4d982bc83eb2 (diff)
downloadopenbsd-tb_20250414.tar.gz
openbsd-tb_20250414.tar.bz2
openbsd-tb_20250414.zip
This commit was manufactured by cvs2git to create tag 'tb_20250414'.tb_20250414
Diffstat (limited to '')
-rw-r--r--src/regress/lib/libc/sprintf/Makefile7
-rw-r--r--src/regress/lib/libc/sprintf/sprintf_test.c90
2 files changed, 0 insertions, 97 deletions
diff --git a/src/regress/lib/libc/sprintf/Makefile b/src/regress/lib/libc/sprintf/Makefile
deleted file mode 100644
index 514d795f2f..0000000000
--- a/src/regress/lib/libc/sprintf/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
1# $OpenBSD: Makefile,v 1.2 2017/07/27 15:08:37 bluhm Exp $
2
3PROG = sprintf_test
4CFLAGS = -Wno-format
5CPPFLAGS = -I${.CURDIR}/../../../../lib/libc
6
7.include <bsd.regress.mk>
diff --git a/src/regress/lib/libc/sprintf/sprintf_test.c b/src/regress/lib/libc/sprintf/sprintf_test.c
deleted file mode 100644
index 0cdd170911..0000000000
--- a/src/regress/lib/libc/sprintf/sprintf_test.c
+++ /dev/null
@@ -1,90 +0,0 @@
1/* $OpenBSD: sprintf_test.c,v 1.5 2021/09/02 09:46:21 deraadt Exp $ */
2
3/*
4 * Copyright (c) 2003 Theo de Raadt
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * - Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * - Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#include <stddef.h>
33#include <stdio.h>
34#include <stdlib.h>
35#include <string.h>
36#include <signal.h>
37
38char correct[] =
39 "|xx 01 02 03 04\n"
40 "|xx 05 06 07 08\n"
41 "|xx 09 10 11 12\n"
42 "|xx 13 14 15 16\n"
43 "|xx 17 18 19 20\n"
44 "|xx 21 22 23 24\n"
45 "|xx 25 26 27 28\n"
46 "|xx 29 30 31 32\n"
47 "|xx 33 34 35 36\n"
48 "|xx 37 38 39 40\n"
49 "|xx 41 42 43 44\n"
50 "|xx 45 -1 1 -1 1\n";
51
52char correct2[] =
53 "1 0 -1 1 1 2 1 3 -1 4 1 \n"
54 "1 -1 1 1 -1 1 \n";
55
56int
57main(int argc, char *argv[])
58{
59 char buf[1024];
60 size_t sz1, sz2, sz3, sz4;
61 ptrdiff_t p1, p2, p3, p4;
62
63 /* Test positional arguments */
64 snprintf(buf, sizeof buf,
65 "|xx %1$s %2$s %3$s %4$s\n"
66 "|xx %5$s %6$s %7$s %8$s\n"
67 "|xx %9$s %10$s %11$s %12$s\n"
68 "|xx %13$s %14$s %15$s %16$s\n"
69 "|xx %17$s %18$s %19$s %20$s\n"
70 "|xx %21$s %22$s %23$s %24$s\n"
71 "|xx %25$s %26$s %27$s %28$s\n"
72 "|xx %29$s %30$s %31$s %32$s\n"
73 "|xx %33$s %34$s %35$s %36$s\n"
74 "|xx %37$s %38$s %39$s %40$s\n"
75 "|xx %41$s %42$s %43$s %44$s\n"
76 "|xx %45$d %46$ld %47$lld %48$d %49$lld\n",
77 "01", "02", "03", "04", "05", "06",
78 "07", "08", "09", "10", "11", "12",
79 "13", "14", "15", "16", "17", "18",
80 "19", "20", "21", "22", "23", "24",
81 "25", "26", "27", "28", "29", "30",
82 "31", "32", "33", "34", "35", "36",
83 "37", "38", "39", "40", "41", "42",
84 "43", "44", 45, -1L, 1LL, -1, 1LL
85 );
86
87 if (strcmp(buf, correct) != 0)
88 exit(1);
89 exit(0);
90}