OSDN Git Service

fix license notice
[uclinux-h8/uclibc-ng.git] / test / args / arg_test.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * Test application for argc and argv handling
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(int argc, char **argv)
17 {
18         int i=0;
19         char** index=__environ;
20
21 #ifdef __powerpc__
22         {
23                 unsigned long sp;
24                 sp = (unsigned long) __builtin_frame_address(0);
25                 if(sp&0xf){
26                         printf("stack pointer is unaligned! (%08lx)\n", sp);
27                 }
28         }
29 #endif
30         
31         printf("argc=%d\n", argc);
32
33         for(i=0;i<argc;i++) {
34                 printf("argv[%d]='%s'\n", i, argv[i]);
35         }
36
37         i=0;
38         while(*index) {
39                 printf("environ[%d]='%s'\n", i++, *index++);
40         }
41
42         exit(0);
43 }