Subversion Repositories SvarDOS

Rev

Rev 533 | Rev 1137 | 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 33... Line 33...
33
static enum cmd_result cmd_set(struct cmd_funcparam *p) {
33
static enum cmd_result cmd_set(struct cmd_funcparam *p) {
34
  char far *env = MK_FP(p->env_seg, 0);
34
  char far *env = MK_FP(p->env_seg, 0);
35
  char *buff = p->BUFFER;
35
  char *buff = p->BUFFER;
36
 
36
 
37
  if (cmd_ishlp(p)) {
37
  if (cmd_ishlp(p)) {
38
    outputnl("Displays, sets, or removes DOS environment variables");
38
    nls_outputnl(23,0); /* "Displays, sets, or removes DOS environment variables"); */
39
    outputnl("");
39
    outputnl("");
40
    outputnl("SET [variable=[string]]");
40
    nls_outputnl(23,1); /* "SET [variable=[string]]" */
41
    outputnl("");
41
    outputnl("");
42
    outputnl("variable  Specifies the environment-variable name");
42
    nls_outputnl(23,2); /* "variable  Specifies the environment-variable name" */
43
    outputnl("string    Specifies a series of characters to assign to the variable");
43
    nls_outputnl(23,3); /* "string    Specifies a series of characters to assign to the variable" */
44
    outputnl("");
44
    outputnl("");
45
    outputnl("Type SET without parameters to display the current environment variables.");
45
    nls_outputnl(23,4); /* "Type SET without parameters to display the current environment variables." */
46
    return(CMD_OK);
46
    return(CMD_OK);
47
  }
47
  }
48
 
48
 
49
  /* no arguments - display content */
49
  /* no arguments - display content */
50
  if (p->argc == 0) {
50
  if (p->argc == 0) {
Line 85... Line 85...
85
 
85
 
86
    /* commit variable to environment */
86
    /* commit variable to environment */
87
    i = env_setvar(p->env_seg, buff);
87
    i = env_setvar(p->env_seg, buff);
88
    if (i == ENV_INVSYNT) goto syntax_err;
88
    if (i == ENV_INVSYNT) goto syntax_err;
89
    if (i == ENV_NOTENOM) {
89
    if (i == ENV_NOTENOM) {
90
      outputnl("Not enough available space within the environment block");
90
      nls_outputnl(23,5); /* "Not enough available space within the environment block" */
91
      return(CMD_FAIL);
91
      return(CMD_FAIL);
92
    }
92
    }
93
  }
93
  }
94
  return(CMD_OK);
94
  return(CMD_OK);
95
 
95
 
96
  syntax_err:
96
  syntax_err:
97
 
97
 
98
  outputnl("Syntax error");
98
  nls_outputnl(0,1); /* "Invalid syntax" */
99
  return(CMD_FAIL);
99
  return(CMD_FAIL);
100
}
100
}