home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / hcshdemo.zip / csh-os2.zip / SAMPLES / MYECHO.C < prev    next >
C/C++ Source or Header  |  1993-09-28  |  815b  |  27 lines

  1. /***************************************************************************/
  2. /*                                                                                                    */
  3. /*                                                                                                    */
  4. /*            A variant of echo that prints quotes around each argument.            */
  5. /*    Copyright (c) 1989-1992 by Hamilton Laboratories.  All rights reserved.    */
  6. /*                                                                                                    */
  7. /*                                                                                                    */
  8. /***************************************************************************/
  9.         
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include    <string.h>
  13.  
  14. void cdecl main ( int argc, char *argv[] )
  15.         {
  16.         int i, length = 0;
  17.         for (i = 0;  i < argc - 1; i++)
  18.             {
  19.             length += strlen(argv[i]) + 1;
  20.             printf ("'%s' ", argv[i]);
  21.             }
  22.         length += strlen(argv[i]) + 1;
  23.         printf("'%s'\n", argv[i]);
  24.         printf("arg length = %d characters\n", length);
  25.         exit(0);
  26.         }
  27.