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 989
Line 1... Line 1...
1
/* This file is part of the SvarCOM project and is published under the terms
1
/* This file is part of the SvarCOM project and is published under the terms
2
 * of the MIT license.
2
 * of the MIT license.
3
 *
3
 *
4
 * Copyright (C) 2021 Mateusz Viste
4
 * Copyright (C) 2021-2022 Mateusz Viste
5
 *
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a
6
 * Permission is hereby granted, free of charge, to any person obtaining a
7
 * copy of this software and associated documentation files (the "Software"),
7
 * copy of this software and associated documentation files (the "Software"),
8
 * to deal in the Software without restriction, including without limitation
8
 * to deal in the Software without restriction, including without limitation
9
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Line 31... Line 31...
31
static enum cmd_result cmd_path(struct cmd_funcparam *p) {
31
static enum cmd_result cmd_path(struct cmd_funcparam *p) {
32
  char *buff = p->BUFFER;
32
  char *buff = p->BUFFER;
33
 
33
 
34
  /* help screen (/?) */
34
  /* help screen (/?) */
35
  if (cmd_ishlp(p)) {
35
  if (cmd_ishlp(p)) {
36
    output("Displays or sets a search path for executable files.\r\n"
36
    nls_outputnl(27,0); /* "Displays or sets a search path for executable files." */
37
           "\r\n"
37
    outputnl("");
38
           "PATH [[drive:]path[;...]]\r\n"
38
    nls_outputnl(27,1); /* "PATH [[drive:]path[;...]]" */
39
           "PATH ;\r\n"
39
    outputnl("PATH ;");
40
           "\r\n"
40
    outputnl("");
41
           "Type PATH ; to clear all search-path settings and direct DOS to search\r\n"
41
    nls_outputnl(27,2); /* "Type PATH ; to clear all search-path settings and (...)" */
42
           "only in the current directory.\r\n"
-
 
43
           "\r\n"
42
    outputnl("");
44
           "Type PATH without parameters to display the current path.\r\n");
43
    nls_outputnl(27,3); /* "Type PATH without parameters to display the current path." */
45
    return(CMD_OK);
44
    return(CMD_OK);
46
  }
45
  }
47
 
46
 
48
  /* no parameter - display current path */
47
  /* no parameter - display current path */
49
  if (p->argc == 0) {
48
  if (p->argc == 0) {
50
    char far *curpath = env_lookup(p->env_seg, "PATH");
49
    char far *curpath = env_lookup(p->env_seg, "PATH");
51
    if (curpath == NULL) {
50
    if (curpath == NULL) {
52
      outputnl("No Path");
51
      nls_outputnl(27,4); /* "No Path" */
53
    } else {
52
    } else {
54
      unsigned short i;
53
      unsigned short i;
55
      for (i = 0;; i++) {
54
      for (i = 0;; i++) {
56
        buff[i] = curpath[i];
55
        buff[i] = curpath[i];
57
        if (buff[i] == 0) break;
56
        if (buff[i] == 0) break;
Line 61... Line 60...
61
    return(CMD_FAIL);
60
    return(CMD_FAIL);
62
  }
61
  }
63
 
62
 
64
  /* more than 1 parameter */
63
  /* more than 1 parameter */
65
  if (p->argc > 1) {
64
  if (p->argc > 1) {
66
    outputnl("Too many parameters");
65
    nls_outputnl(0,4); /* "Too many parameters" */
67
    return(CMD_FAIL);
66
    return(CMD_FAIL);
68
  }
67
  }
69
 
68
 
70
  /* IF HERE: THERE IS EXACTLY 1 ARGUMENT (argc == 1) */
69
  /* IF HERE: THERE IS EXACTLY 1 ARGUMENT (argc == 1) */
71
 
70