home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 May / macformat-024.iso / Shareware City / Developers / nshellmegasource1.50 / mega src / commands / echo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-26  |  1.2 KB  |  68 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__            // Get the appropriate A4 stuff
  16. #include <A4Stuff.h>
  17. #else
  18. #include <SetUpA4.h>
  19. #endif
  20.  
  21. #include "nshc.h"
  22.  
  23. #include "buf_utl.proto.h"
  24. #include "nshc_utl.proto.h"
  25.  
  26. /* ======================================== */
  27.  
  28. void main(t_nshc_parms *nshc_parms, t_nshc_calls *nshc_calls)
  29. {
  30.     int arg, argc;
  31.     
  32. #ifdef __MWERKS__
  33.     long oldA4  = SetCurrentA4();
  34. #else
  35.     RememberA0();
  36.     SetUpA4();
  37. #endif
  38.     
  39.     if ( !nshc_bad_version( nshc_parms, nshc_calls, NSHC_VERSION ) ) {
  40.     
  41.         buf_init( nshc_calls );
  42.         
  43.         nshc_parms->action = nsh_idle;
  44.         nshc_parms->result = NSHC_NO_ERR;
  45.         
  46.         arg = 1;
  47.         argc = nshc_parms->argc;
  48.         
  49.         while ( arg < argc ) {
  50.             if ( arg > 1 )
  51.                 buf_putchar( ' ' );
  52.             buf_puts( &nshc_parms->arg_buf[nshc_parms->argv[arg]] );
  53.             arg++;
  54.             }
  55.             
  56.         if ( argc > 1 ) buf_putchar( '\r' );
  57.         
  58.         buf_flush();
  59.                 
  60.         }
  61.  
  62. #ifdef __MWERKS__
  63.     SetA4(oldA4);
  64. #else
  65.     RestoreA4();
  66. #endif
  67. }
  68.