OSDN Git Service

sync with glibc
[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,2001 by Erik Andersen <andersen@uclibc.org>
7  * Written by Erik Andersen <andersen@uclibc.org>
8  *
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Library General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or (at your
12  * option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
17  * for more details.
18  *
19  * You should have received a copy of the GNU Library General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  *
23  */
24
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <unistd.h>
28
29 int main(void) 
30 {
31         char *foo;
32         char junk[12];
33         char crap[100];
34         foo = getcwd(NULL, 0);
35         printf("getcwd(NULL, 0)='%s'\n", foo);
36         if (foo) { free(foo); }
37         foo = getcwd(NULL, 100);
38         printf("\ngetcwd(NULL, 100)='%s'\n", foo);
39         if (foo) { free(foo); }
40         foo = getcwd(junk, sizeof(junk));
41         printf("\nchar junk[12];\n");
42         printf("getcwd(junk, sizeof(junk))='%s'\n", foo);
43         foo = getcwd(crap, sizeof(crap));
44         printf("\nchar crap[100];\n");
45         printf("getcwd(crap, sizeof(crap))='%s'\n", foo);
46         return EXIT_SUCCESS;
47 }
48
49 /*
50 Local Variables:
51 c-file-style: "linux"
52 c-basic-offset: 4
53 tab-width: 4
54 End:
55 */