summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/basename
diff options
context:
space:
mode:
authorderaadt <>2021-12-13 16:56:48 +0000
committerderaadt <>2021-12-13 16:56:48 +0000
commit8d21fee22ec79324eef6e9a88c83bd6cf32315d6 (patch)
tree4d79dae357e2afe076d7157a01ff32c7b7546acc /src/regress/lib/libc/basename
parentff932a8c105e55b70f9248f6e57a9157c7969ef4 (diff)
downloadopenbsd-8d21fee22ec79324eef6e9a88c83bd6cf32315d6.tar.gz
openbsd-8d21fee22ec79324eef6e9a88c83bd6cf32315d6.tar.bz2
openbsd-8d21fee22ec79324eef6e9a88c83bd6cf32315d6.zip
remove a couple hundred sys/param.h includes in userland code, and
also whack some sys/cdefs.h early includes which is such a brutally bad pattern ok bluhm mbuhl
Diffstat (limited to 'src/regress/lib/libc/basename')
-rw-r--r--src/regress/lib/libc/basename/basename_test.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/regress/lib/libc/basename/basename_test.c b/src/regress/lib/libc/basename/basename_test.c
index 34e138c726..7272c46b1d 100644
--- a/src/regress/lib/libc/basename/basename_test.c
+++ b/src/regress/lib/libc/basename/basename_test.c
@@ -4,8 +4,6 @@
4 * Public domain. 4 * Public domain.
5 */ 5 */
6 6
7#include <sys/param.h>
8
9#include <libgen.h> 7#include <libgen.h>
10#include <stdio.h> 8#include <stdio.h>
11#include <string.h> 9#include <string.h>
@@ -15,7 +13,7 @@
15int 13int
16main(void) 14main(void)
17{ 15{
18 char path[2 * MAXPATHLEN]; 16 char path[2 * PATH_MAX];
19 const char *dir = "junk/"; 17 const char *dir = "junk/";
20 const char *fname = "file.name.ext"; 18 const char *fname = "file.name.ext";
21 char *str; 19 char *str;
@@ -35,7 +33,7 @@ main(void)
35 * 1) path is NULL 33 * 1) path is NULL
36 * 2) path is the empty string 34 * 2) path is the empty string
37 * 3) path is composed entirely of slashes 35 * 3) path is composed entirely of slashes
38 * 4) the resulting name is larger than MAXPATHLEN 36 * 4) the resulting name is larger than PATH_MAX
39 * 37 *
40 * The first two cases require that a pointer 38 * The first two cases require that a pointer
41 * to the string "." be returned. 39 * to the string "." be returned.
@@ -58,7 +56,7 @@ main(void)
58 goto fail; 56 goto fail;
59 57
60 /* Case 3 */ 58 /* Case 3 */
61 for (i = 0; i < MAXPATHLEN - 1; i++) 59 for (i = 0; i < PATH_MAX - 1; i++)
62 strlcat(path, "/", sizeof(path)); /* path cleared above */ 60 strlcat(path, "/", sizeof(path)); /* path cleared above */
63 str = basename(path); 61 str = basename(path);
64 if (strcmp(str, "/") != 0) 62 if (strcmp(str, "/") != 0)
@@ -67,7 +65,7 @@ main(void)
67 /* Case 4 */ 65 /* Case 4 */
68 strlcpy(path, "/", sizeof(path)); 66 strlcpy(path, "/", sizeof(path));
69 strlcat(path, dir, sizeof(path)); 67 strlcat(path, dir, sizeof(path));
70 for (i = 0; i <= MAXPATHLEN; i += sizeof(fname)) 68 for (i = 0; i <= PATH_MAX; i += sizeof(fname))
71 strlcat(path, fname, sizeof(path)); 69 strlcat(path, fname, sizeof(path));
72 str = basename(path); 70 str = basename(path);
73 if (str != NULL || errno != ENAMETOOLONG) 71 if (str != NULL || errno != ENAMETOOLONG)