Subversion Repositories SvarDOS

Rev

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

Rev 421 Rev 533
Line 33... Line 33...
33
 * Type CD drive: to display the current directory in the specified drive.
33
 * Type CD drive: to display the current directory in the specified drive.
34
 * Type CD without parameters to display the current drive and directory.
34
 * Type CD without parameters to display the current drive and directory.
35
 */
35
 */
36
 
36
 
37
 
37
 
38
static int cmd_cd(struct cmd_funcparam *p) {
38
static enum cmd_result cmd_cd(struct cmd_funcparam *p) {
39
  char *buffptr = p->BUFFER;
39
  char *buffptr = p->BUFFER;
40
 
40
 
41
  /* CD /? */
41
  /* CD /? */
42
  if (cmd_ishlp(p)) {
42
  if (cmd_ishlp(p)) {
43
    outputnl("Displays the name of or changes the current directory.");
43
    outputnl("Displays the name of or changes the current directory.");
Line 49... Line 49...
49
    outputnl("");
49
    outputnl("");
50
    outputnl(".. Specifies that you want to change to the parent directory.");
50
    outputnl(".. Specifies that you want to change to the parent directory.");
51
    outputnl("");
51
    outputnl("");
52
    outputnl("Type CD drive: to display the current directory in the specified drive.");
52
    outputnl("Type CD drive: to display the current directory in the specified drive.");
53
    outputnl("Type CD without parameters to display the current drive and directory.");
53
    outputnl("Type CD without parameters to display the current drive and directory.");
54
    return(-1);
54
    return(CMD_OK);
55
  }
55
  }
56
 
56
 
57
  /* one argument max */
57
  /* one argument max */
58
  if (p->argc > 1) {
58
  if (p->argc > 1) {
59
    outputnl("Too many parameters");
59
    outputnl("Too many parameters");
60
    return(-1);
60
    return(CMD_FAIL);
61
  }
61
  }
62
 
62
 
63
  /* no argument? display current drive and dir ("CWD") */
63
  /* no argument? display current drive and dir ("CWD") */
64
  if (p->argc == 0) {
64
  if (p->argc == 0) {
65
    curpathfordrv(buffptr, 0);
65
    curpathfordrv(buffptr, 0);
66
    outputnl(buffptr);
66
    outputnl(buffptr);
67
    return(-1);
67
    return(CMD_OK);
68
  }
68
  }
69
 
69
 
70
  /* argument can be either a drive (D:) or a path */
70
  /* argument can be either a drive (D:) or a path */
71
  if (p->argc == 1) {
71
  if (p->argc == 1) {
72
    const char *arg = p->argv[0];
72
    const char *arg = p->argv[0];
Line 96... Line 96...
96
        pop dx
96
        pop dx
97
      }
97
      }
98
    }
98
    }
99
    if (err != 0) {
99
    if (err != 0) {
100
      outputnl(doserr(err));
100
      outputnl(doserr(err));
-
 
101
      return(CMD_FAIL);
101
    }
102
    }
102
  }
103
  }
103
 
104
 
104
  return(-1);
105
  return(CMD_OK);
105
}
106
}