OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [test/] [args/] [arg_test.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/* 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,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 <unistd.h>
27
 
28
int main( int argc, char **argv)
29
{
30
        int i=0;
31
        char** index=__environ;
32
 
33
#ifdef __powerpc__
34
        {
35
                unsigned long sp;
36
                sp = (unsigned long) __builtin_frame_address(0);
37
                if(sp&0xf){
38
                        fprintf(stderr, "stack pointer is unaligned! (%08lx)\n", sp);
39
                }
40
        }
41
#endif
42
 
43
        fprintf(stderr, "argc=%d\n", argc);
44
 
45
        for(i=0;i<argc;i++){
46
                fprintf(stderr, "argv[%d]='%s'\n", i, argv[i]);
47
        }
48
 
49
        i=0;
50
        while(*index) {
51
                fprintf(stderr, "environ[%d]='%s'\n", i++, *index++);
52
        }
53
 
54
        exit(0);
55
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.