2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
9 /******************************************************************************
13 Echo [<string>] [NOLINE] [FIRST <n>] [LEN <n>] [TO <filename>]
17 STRING/M,NOLINE/S,FIRST/K/N,LEN/K/N,TO/K
29 STRING -- the strings to display
30 NOLINE -- no newline at end of string
31 FIRST -- first displayed character
32 LEN -- number of characters to display
33 TO -- file or device to output to
49 ******************************************************************************/
53 #include <exec/execbase.h>
54 #include <exec/libraries.h>
55 #include <proto/exec.h>
57 #include <proto/dos.h>
59 #include <aros/shcommands.h>
63 AROS_SHA(STRPTR
*, , , /M
, NULL
),
64 AROS_SHA(BOOL
, , NOLINE
, /S
, FALSE
),
65 AROS_SHA(ULONG
*, , FIRST
, /K
/N
, NULL
),
66 AROS_SHA(ULONG
*, , LEN
, /K
/N
, NULL
),
67 AROS_SHA(STRPTR
, , TO
, /K
, NULL
))
76 #define ERROR(a) { error=a; goto end; }
86 out
= Open(SHArg(TO
),MODE_NEWFILE
);
96 if (a
) while (*a
!= NULL
)
105 if (SHArg(FIRST
) && *SHArg(FIRST
))
107 if (*SHArg(FIRST
) - 1 < l
)
109 b
+= *SHArg(FIRST
)-1;
113 b
+= l
- 1; // Original Echo always prints at least the latest character
125 if (FPutC(out
, *b
++) < 0)
135 if (FPutC(out
,' ') < 0)
144 if (FPutC(out
, '\n') < 0)
156 if (error
) PrintFault( IoErr(), "Echo");
158 if (SHArg(TO
) && out
)