.c code: showVals.c


This program reports on its command line and on its environment variables.
 

#include 

int main(int argcnt, char **argval, char **envval) {
  int tmp1=0;
  fprintf(stdout, "Command Line:\n");
  for (tmp1=0; tmp1 < argcnt; tmp1++) {
    fprintf(stdout, "    %d %s\n", tmp1, argval[tmp1]);
  }
  fprintf(stdout, "Environment:\n");
  tmp1=0;
  while (envval != 0 && *envval != 0) {
    fprintf(stdout, "    %d %s\n", tmp1, *envval++);
    tmp1++;
  }
  fprintf(stdout, "end.\n");
}