Subversion Repositories SvarDOS

Rev

Rev 475 | Rev 534 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 475 Rev 533
Line 24... Line 24...
24
 
24
 
25
/*
25
/*
26
 * echo
26
 * echo
27
 */
27
 */
28
 
28
 
29
static int cmd_echo(struct cmd_funcparam *p) {
29
static enum cmd_result cmd_echo(struct cmd_funcparam *p) {
30
  unsigned short offs = FP_OFF(p->cmdline) + 5;
30
  unsigned short offs = FP_OFF(p->cmdline) + 5;
31
  unsigned short segm = FP_SEG(p->cmdline);
31
  unsigned short segm = FP_SEG(p->cmdline);
32
 
32
 
33
  /* display help only if /? is the only argument */
33
  /* display help only if /? is the only argument */
34
  if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) {
34
  if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) {
Line 36... Line 36...
36
    outputnl("");
36
    outputnl("");
37
    outputnl("ECHO [ON | OFF]");
37
    outputnl("ECHO [ON | OFF]");
38
    outputnl("ECHO [message]");
38
    outputnl("ECHO [message]");
39
    outputnl("");
39
    outputnl("");
40
    outputnl("Type ECHO without parameters to display the current echo setting.");
40
    outputnl("Type ECHO without parameters to display the current echo setting.");
41
    return(-1);
41
    return(CMD_OK);
42
  }
42
  }
43
 
43
 
44
  /* ECHO without any parameter: display current state */
44
  /* ECHO without any parameter: display current state */
45
  if (p->argc == 0) {
45
  if (p->argc == 0) {
46
    if (p->rmod->flags & FLAG_ECHOFLAG) {
46
    if (p->rmod->flags & FLAG_ECHOFLAG) {
47
      outputnl("ECHO is on");
47
      outputnl("ECHO is on");
48
    } else {
48
    } else {
49
      outputnl("ECHO is off");
49
      outputnl("ECHO is off");
50
    }
50
    }
51
    return(-1);
51
    return(CMD_OK);
52
  }
52
  }
53
 
53
 
54
  /* ECHO ON */
54
  /* ECHO ON */
55
  if ((p->argc == 1) && (imatch(p->argv[0], "on"))) {
55
  if ((p->argc == 1) && (imatch(p->argv[0], "on"))) {
56
    p->rmod->flags |= FLAG_ECHOFLAG;
56
    p->rmod->flags |= FLAG_ECHOFLAG;
57
    return(-1);
57
    return(CMD_OK);
58
  }
58
  }
59
 
59
 
60
  /* ECHO OFF */
60
  /* ECHO OFF */
61
  if ((p->argc == 1) && (imatch(p->argv[0], "off"))) {
61
  if ((p->argc == 1) && (imatch(p->argv[0], "off"))) {
62
    p->rmod->flags &= ~FLAG_ECHOFLAG;
62
    p->rmod->flags &= ~FLAG_ECHOFLAG;
63
    return(-1);
63
    return(CMD_OK);
64
  }
64
  }
65
 
65
 
66
  /* ECHO MSG (start at cmdline+5 since first 5 are "ECHO" + separator) */
66
  /* ECHO MSG (start at cmdline+5 since first 5 are "ECHO" + separator) */
67
  _asm {
67
  _asm {
68
    push ax
68
    push ax
Line 93... Line 93...
93
    pop ds
93
    pop ds
94
    pop dx
94
    pop dx
95
    pop ax
95
    pop ax
96
  }
96
  }
97
 
97
 
98
  return(-1);
98
  return(CMD_OK);
99
}
99
}