forked from FDOS/freecom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
echo.c
60 lines (51 loc) · 1.09 KB
/
echo.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* $Id$
* ECHO.C - echo command.
*
* Comments:
*
* 16 Jul 1998 (Hans B Pufal)
* started.
*
* 16 Jul 1998 (John P Price)
* Seperated commands into individual files.
*
* 27-Jul-1998 (John P Price <[email protected]>)
* - added config.h include
*
* 1999/04/27 ska
* add: "ECHO." displays empty line
*/
#include "../config.h"
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../include/batch.h"
#include "../include/cmdline.h"
#include "../include/command.h"
#include "../strings.h"
int cmd_echo(char *param)
{ int nostatus;
dprintf( ("[ECHO: %s]\n", param) );
if(param && *param) {
nostatus = !isspace(*param);
/* Unlike other internal commands, puncation characters
are not removed by ECHO */
++param;
} else nostatus = 0;
switch(onoffStr(param)) {
case OO_Null: case OO_Empty:
default:
if(nostatus)
outc('\n');
else
displayString(TEXT_MSG_ECHO_STATE, echo ? D_ON : D_OFF);
break;
case OO_Off: echo = 0; break;
case OO_On: echo = 1; break;
case OO_Other:
puts(param);
}
return 0;
}