root/user/uw-testbin/argtest/argtest.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. main

   1 /*
   2  * Program to test argument passing: it displays the argc and all
   3  * of argv, and then exits.
   4  *
   5  * Intended for the basic system calls assignment. This may help
   6  * debugging the argument handling of execv().
   7  */
   8 
   9 #include <stdio.h>
  10 
  11 int
  12 main(int argc, char *argv[])
  13 {
  14         const char *tmp;
  15         int i;
  16 
  17         printf("argc   : %d\n", argc);
  18         printf("&tmp   : %p\n", &tmp);
  19         printf("&i     : %p\n", &i);
  20         printf("&argc  : %p\n", &argc);
  21         printf("&argv  : %p\n", &argv);
  22         printf("argv   : %p\n", argv);
  23         printf("\n");
  24 
  25         for (i=0; i<=argc; i++) {
  26                 printf("&argv[%d] : %p\n", i, &argv[i]);
  27         }
  28         printf("\n");
  29 
  30         for (i=0; i<=argc; i++) {
  31                 printf("argv[%d] : %p\n", i, argv[i]);
  32         }
  33         printf("\n");
  34 
  35         for (i=0; i<=argc; i++) {
  36                 tmp = argv[i];
  37                 if (tmp == NULL) {
  38                         tmp = "[NULL]";
  39                 }
  40                 printf("argv[%d] -> %s\n", i, tmp);
  41         }
  42 
  43         return 0;
  44 }

/* [<][>][^][v][top][bottom][index][help] */