blob: 86f31575a3ccef1638c1541debd7ccaf763c9a47 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/* vi: set sw=4 ts=4: */
2/*
3 * Test application for argc and argv handling
4 * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
5 *
6 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7 */
8
9#include <stdio.h>
10#include <stdlib.h>
11#include <unistd.h>
12
13int main(int argc, char **argv)
14{
15 int i=0;
16 char** index=__environ;
17
18#ifdef __powerpc__
19 {
20 unsigned long sp;
21 sp = (unsigned long) __builtin_frame_address(0);
22 if(sp&0xf){
23 printf("stack pointer is unaligned! (%08lx)\n", sp);
24 }
25 }
26#endif
27
28 printf("argc=%d\n", argc);
29
30 for(i=0;i<argc;i++) {
31 printf("argv[%d]='%s'\n", i, argv[i]);
32 }
33
34 i=0;
35 while(*index) {
36 printf("environ[%d]='%s'\n", i++, *index++);
37 }
38
39 exit(0);
40}