/*-------------------------------------------------------------------*/ /* mainparams.c */ /* The parameters of the main function. */ /*-------------------------------------------------------------------*/ #include int main (int argc, char *argv[], char *envp[]) { int i; printf("argc:\n"); printf("%d\n", argc); printf("\n"); printf("argv:\n"); for (i = 0; argv[i] != NULL; i++) printf("%s\n", argv[i]); printf("\n"); printf("envp:\n"); for (i = 0; envp[i] != NULL; i++) printf("%s\n", envp[i]); printf("\n"); return 0; } /* Sample executions: --> gcc -Wall -ansi -pedantic -o mainparams mainparams.c mainparams.c:9: warning: third argument of `main' is deprecated -->mainparams argc: 1 argv: mainparams envp: LOGNAME=rdondero SSH2_CLIENT=209.246.215.127 1053 128.112.128.89 22 MAIL=/var/mail/rdondero TERM=vt100 HOSTTYPE=sparc PATH=/u/cs217/bin:/bin:/usr/bin:/usr/ucb:/usr/bin/X11:/usr/local/bin:/usr/local/bin:/usr/princeton/bin:/usr/bin:/usr/openwin/bin:/usr/ccs/bin:/opt/SUNWspro/bin:/usr/princeton/bin/X11:. PRINTER=xefriend017d HOME=/u/rdondero SHELL=/usr/princeton/bin/bash USER=rdondero MANPATH=/usr/princeton/man:/usr/man:/usr/openwin/man:/opt/SUNWspro/man:/usr/kerberos/man:/usr/local/man SHLVL=1 BASH=/usr/princeton/bin/bash TZ=US/Eastern _=./mainparams --> mainparams one two argc: 3 argv: mainparams one two envp: LOGNAME=rdondero SSH2_CLIENT=209.246.215.127 1053 128.112.128.89 22 MAIL=/var/mail/rdondero TERM=vt100 HOSTTYPE=sparc PATH=/u/cs217/bin:/bin:/usr/bin:/usr/ucb:/usr/bin/X11:/usr/local/bin:/usr/local/bin:/usr/princeton/bin:/usr/bin:/usr/openwin/bin:/usr/ccs/bin:/opt/SUNWspro/bin:/usr/princeton/bin/X11:. PRINTER=xefriend017d HOME=/u/rdondero SHELL=/usr/princeton/bin/bash USER=rdondero MANPATH=/usr/princeton/man:/usr/man:/usr/openwin/man:/opt/SUNWspro/man:/usr/kerberos/man:/usr/local/man SHLVL=1 BASH=/usr/princeton/bin/bash TZ=US/Eastern _=./mainparams --> */