Subversion Repositories SvarDOS

Rev

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

Rev 514 Rev 533
Line 24... Line 24...
24
 
24
 
25
/*
25
/*
26
 * shift
26
 * shift
27
 */
27
 */
28
 
28
 
29
static int cmd_shift(struct cmd_funcparam *p) {
29
static enum cmd_result cmd_shift(struct cmd_funcparam *p) {
30
  char far *batargv = p->rmod->batargv;
30
  char far *batargv = p->rmod->batargv;
31
  char far *nextarg;
31
  char far *nextarg;
32
 
32
 
33
  if (cmd_ishlp(p)) {
33
  if (cmd_ishlp(p)) {
34
    nls_outputnl(16, 0);
34
    nls_outputnl(16, 0);
35
    nls_outputnl(16, 1);
35
    nls_outputnl(16, 1);
36
    outputnl("");
36
    outputnl("");
37
    outputnl("SHIFT");
37
    outputnl("SHIFT");
38
    return(-1);
38
    return(CMD_OK);
39
  }
39
  }
40
 
40
 
41
  /* abort if batargv is empty */
41
  /* abort if batargv is empty */
42
  if (*batargv == 0) return(-1);
42
  if (*batargv == 0) return(CMD_OK);
43
 
43
 
44
  /* find the next argument in batargv */
44
  /* find the next argument in batargv */
45
  for (nextarg = batargv + 1; *nextarg != 0; nextarg++);
45
  for (nextarg = batargv + 1; *nextarg != 0; nextarg++);
46
  nextarg++; /* move ptr past the zero terminator */
46
  nextarg++; /* move ptr past the zero terminator */
47
 
47
 
48
  /* move down batargv so 2nd argument is at the head now */
48
  /* move down batargv so 2nd argument is at the head now */
49
  _fmemmove(batargv, nextarg, sizeof(p->rmod->batargv) - (nextarg - batargv));
49
  _fmemmove(batargv, nextarg, sizeof(p->rmod->batargv) - (nextarg - batargv));
50
 
50
 
51
  return(-1);
51
  return(CMD_OK);
52
}
52
}