home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / source / util2src / args.c next >
Encoding:
C/C++ Source or Header  |  1991-04-29  |  1.5 KB  |  53 lines

  1. /*===========================================================================*
  2.  * == main program ==
  3.  * args.c - Print all command line arguments.
  4.  *
  5.  * (C)Copyright IBM Corporation, 1989, 1991.               Brian E. Yoder
  6.  *
  7.  * 11/08/89 - Created.
  8.  * 11/08/89 - Initial version completed, for AIX PS/2.
  9.  * 04/03/91 - Updated for C/2 and DOS.
  10.  * 04/29/91 - Include <os2.h> to be sure we can get to it.
  11.  *===========================================================================*/
  12.  
  13. char ver[] = "args (C)IBM Corp. 1989";
  14. char author[] = "Brian E. Yoder";
  15.  
  16. #include <stdio.h>
  17. #include <errno.h>
  18. #include <string.h>
  19. #include <sys\types.h>
  20. #include <os2.h>
  21.  
  22. /*===========================================================================*
  23.  * Main program entry point
  24.  *===========================================================================*/
  25.  
  26. main(argc, argv, envp)
  27.  
  28. int    argc;
  29. char **argv;
  30. char **envp;
  31.  
  32. {
  33.   int rc;                      /* Return code storage */
  34.  
  35.   /* Display first argument: our program name */
  36.  
  37.   printf("Invoked as: %s\n\n", *argv);
  38.  
  39.   argc--;                      /* Ignore 1st argument (program name) */
  40.   argv++;
  41.  
  42.   /* Display each successive argument */
  43.  
  44.   while (argc != 0)            /* For each successive argument: */
  45.   {
  46.      printf("%s\n", *argv);          /* Display argument */
  47.      argc--;                         /* Decrement arg count */
  48.      argv++;                         /* Point to next argument */
  49.   }
  50.  
  51.   return(0);                   /* Return */
  52. }
  53.