OSDN Git Service

fix license notice
[uclinux-h8/uclibc-ng.git] / test / unistd / getcwd.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * fork test for uClibc
4  *
5  * Copyright (C) 2000 by Lineo, inc. and Erik Andersen
6  * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
7  * Written by Erik Andersen <andersen@uclibc.org>
8  *
9  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
10  */
11
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <unistd.h>
15
16 int main(void) 
17 {
18         char *foo;
19         char junk[12];
20         char crap[100];
21         foo = getcwd(NULL, 0);
22         printf("getcwd(NULL, 0)='%s'\n", foo);
23         if (foo) { free(foo); }
24         foo = getcwd(NULL, 100);
25         printf("\ngetcwd(NULL, 100)='%s'\n", foo);
26         if (foo) { free(foo); }
27         foo = getcwd(junk, sizeof(junk));
28         printf("\nchar junk[12];\n");
29         printf("getcwd(junk, sizeof(junk))='%s'\n", foo);
30         foo = getcwd(crap, sizeof(crap));
31         printf("\nchar crap[100];\n");
32         printf("getcwd(crap, sizeof(crap))='%s'\n", foo);
33         return EXIT_SUCCESS;
34 }
35
36 /*
37 Local Variables:
38 c-file-style: "linux"
39 c-basic-offset: 4
40 tab-width: 4
41 End:
42 */