In these posts I am going to be rewriting functions found in the base DOS system. Why? I hear you ask, well firstly because I can (so why not) and id like to have a system where the (in part) system is written by me. So I intend to rewrite several functions one-by-one, including those that are built into the traditional command.com
With these, id like to have them as small/cut down as possible. Having separate apps that are not bundled and built into the command.com will actually be larger in the system. Most DOS functions also have a lot of features that are rarely used. So cutting these down to their “RAW” functions should keep things down.
ECHO Function
So, what is the echo function. Simply, it writes back to the screen any argument is passed to it. It’s most commonly used in batch files to write to screen. See here for a full breakdown of the command.

SO………LETS GET CODING:
/*
* ECHO -- althash.net
* Copyright (C) 2025 Free Software Foundation, Inc.
*
* ECHO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ECHO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ECHO. If not, see <http://www.gnu.org/licenses/>.
*/
// VERSION 0.1 - 09/FEB/2025 - INITIAL VERSION
// althash.net
#include <stdio.h>
int main(int argc, char *argv[]) {
int i; // Declare the loop variable outside the loop
// Loop through all command-line arguments starting from the first one
for (i = 1; i < argc; i++) {
// Print the argument followed by a space
printf("%s ", argv[i]);
}
// Print a newline at the end
printf("\n");
return 0;
}
Building the Code
I use OPENWATCOM (LINK)
wcl echo.exe

FILES/LINKS