Subversion Repositories SvarDOS

Rev

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

Rev 533 Rev 949
Line 25... Line 25...
25
/*
25
/*
26
 * shift
26
 * shift
27
 */
27
 */
28
 
28
 
29
static enum cmd_result 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;
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);
Line 37... Line 37...
37
    outputnl("SHIFT");
37
    outputnl("SHIFT");
38
    return(CMD_OK);
38
    return(CMD_OK);
39
  }
39
  }
40
 
40
 
41
  /* abort if batargv is empty */
41
  /* abort if batargv is empty */
-
 
42
  if ((p->rmod->bat == NULL) || (p->rmod->bat->argv[0] == 0)) return(CMD_OK);
42
  if (*batargv == 0) return(CMD_OK);
43
  batargv = p->rmod->bat->argv;
43
 
44
 
44
  /* find the next argument in batargv */
45
  /* find the next argument in batargv */
45
  for (nextarg = batargv + 1; *nextarg != 0; nextarg++);
46
  for (nextarg = batargv + 1; *nextarg != 0; nextarg++);
46
  nextarg++; /* move ptr past the zero terminator */
47
  nextarg++; /* move ptr past the zero terminator */
47
 
48
 
48
  /* move down batargv so 2nd argument is at the head now */
49
  /* move down batargv so 2nd argument is at the head now */
49
  _fmemmove(batargv, nextarg, sizeof(p->rmod->batargv) - (nextarg - batargv));
50
  _fmemmove(batargv, nextarg, sizeof(p->rmod->bat->argv) - (nextarg - batargv));
50
 
51
 
51
  return(CMD_OK);
52
  return(CMD_OK);
52
}
53
}