home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Tools / nShell™ 1.0.3 / MoreSource / echo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-24  |  1.1 KB  |  55 lines  |  [TEXT/KAHL]

  1. /* ========== the commmand file: ==========
  2.  
  3.     echo.c
  4.     
  5.     Copyright (c) 1993,1994 Newport Software Development
  6.     
  7.     You may distribute unmodified copies of this file for
  8.     noncommercial purposes.  You may use this file as a
  9.     reference when writing your own nShell(tm) commands.
  10.     
  11.     All other rights are reserved.
  12.     
  13.    ========== the commmand file: ========== */
  14.  
  15. #ifdef __MWERKS__            // CodeWarrior requires an A4 setup
  16. #include <A4Stuff.h>
  17. #endif
  18.  
  19. #include "nshc.h"
  20. #include "nshc_utl.proto.h"
  21.  
  22. /* ======================================== */
  23.  
  24. void main(t_nshc_parms *nshc_parms, t_nshc_calls *nshc_calls)
  25. {
  26.     int arg, argc;
  27.     
  28. #ifdef __MWERKS__
  29.     long oldA4  = SetCurrentA4();
  30. #endif
  31.     
  32.     if ( !nshc_bad_version( nshc_parms, nshc_calls, NSHC_VERSION ) ) {
  33.         
  34.         nshc_parms->action = nsh_idle;
  35.         nshc_parms->result = NSHC_NO_ERR;
  36.         
  37.         arg = 1;
  38.         argc = nshc_parms->argc;
  39.         
  40.         while ( arg < argc ) {
  41.             if ( arg > 1 )
  42.                 nshc_calls->NSH_putchar( ' ' );
  43.             nshc_calls->NSH_puts( &nshc_parms->arg_buf[nshc_parms->argv[arg]] );
  44.             arg++;
  45.             }
  46.             
  47.         if ( argc > 1 ) nshc_calls->NSH_putchar( '\r' );    
  48.                 
  49.         }
  50.  
  51. #ifdef __MWERKS__
  52.     SetA4(oldA4);
  53. #endif
  54. }
  55.