diff options
Diffstat (limited to 'src/regress/lib/libc/alloca')
-rw-r--r-- | src/regress/lib/libc/alloca/Makefile | 5 | ||||
-rw-r--r-- | src/regress/lib/libc/alloca/alloca.c | 21 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/regress/lib/libc/alloca/Makefile b/src/regress/lib/libc/alloca/Makefile new file mode 100644 index 0000000000..f31417cda7 --- /dev/null +++ b/src/regress/lib/libc/alloca/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # $OpenBSD: Makefile,v 1.1 2003/02/12 06:49:04 mickey Exp $ | ||
2 | |||
3 | PROG= alloca | ||
4 | |||
5 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libc/alloca/alloca.c b/src/regress/lib/libc/alloca/alloca.c new file mode 100644 index 0000000000..54fa90edae --- /dev/null +++ b/src/regress/lib/libc/alloca/alloca.c | |||
@@ -0,0 +1,21 @@ | |||
1 | /* $OpenBSD: alloca.c,v 1.7 2004/03/10 01:17:45 deraadt Exp $ */ | ||
2 | |||
3 | /* Written by Michael Shalayeff, 2003, Public Domain. */ | ||
4 | |||
5 | #include <stdio.h> | ||
6 | #include <stdlib.h> | ||
7 | #include <string.h> | ||
8 | |||
9 | int | ||
10 | main(int argc, char *argv[]) | ||
11 | { | ||
12 | char *q, *p; | ||
13 | |||
14 | p = alloca(41); | ||
15 | strlcpy(p, "hellow world", 41); | ||
16 | |||
17 | q = alloca(53); | ||
18 | strlcpy(q, "hellow world", 53); | ||
19 | |||
20 | exit(strcmp(p, q)); | ||
21 | } | ||