Hamilton LaboratoriesHamilton C shell 2012User guideSamples

myecho.c

Oregon Coast

myecho.c
Previous | Next

/***************************************************************************/
/*                                                                         */
/*                                                                         */
/*       A variant of echo that prints quotes around each argument.        */
/* Copyright (c) 1989-2012 by Hamilton Laboratories.  All rights reserved. */
/*                                                                         */
/*                                                                         */
/***************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "internat.h"

void cdecl main ( int argc, char *argv[] )
      {
      int i, length = 0;
      Internationalize();
      for (i = 0;  i < argc - 1; i++)
         {
         length += strlen(argv[i]) + 1;
         printf ("'%s' ", argv[i]);
         }
      length += strlen(argv[i]) + 1;
      printf("'%s'\n", argv[i]);
      printf("arg length = %d characters\n", length);
      exit(0);
      }

Previous | Next