Subversion Repositories SvarDOS

Rev

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

Rev 538 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
  char *buff2 = p->BUFFER + 1024;
33
  char *buff2 = p->BUFFER + 1024;
34
  unsigned short i, fnameoffset;
34
  unsigned short i, fnameoffset;
35
  struct DTA *dta = (void *)0x80; /* use default DTA in PSP */
35
  struct DTA *dta = (void *)0x80; /* use default DTA in PSP */
36
 
36
 
37
  if (cmd_ishlp(p)) {
37
  if (cmd_ishlp(p)) {
38
    outputnl("Renames a file or files");
38
    nls_outputnl(25,0); /* "Renames a file" */
39
    outputnl("");
39
    outputnl("");
40
    outputnl("RENAME [drive:][path]filename1 filename2");
40
    nls_outputnl(25,1); /* "RENAME [drive:][path]filename1 filename2" */
41
    outputnl("REN [drive:][path]filename1 filename2");
41
    nls_outputnl(25,2); /* "REN [drive:][path]filename1 filename2" */
42
    outputnl("");
42
    outputnl("");
43
    outputnl("Note that you cannot specify a new drive or path for your destination file.");
43
    nls_outputnl(25,3); /* "Note that you cannot specify a new drive or (...)" */
44
    outputnl("Use MOVE to rename a directory, or to move files from one directory to another.");
-
 
45
    return(CMD_OK);
44
    return(CMD_OK);
46
  }
45
  }
47
 
46
 
48
  /* I expect exactly two arguments */
47
  /* I expect exactly two arguments */
49
  if (p->argc != 2) {
48
  if (p->argc != 2) {
50
    outputnl("Invalid syntax");
49
    nls_outputnl(0,1); /* "Invalid syntax" */
51
    return(CMD_FAIL);
50
    return(CMD_FAIL);
52
  }
51
  }
53
 
52
 
54
  /* convert src to truename format */
53
  /* convert src to truename format */
55
  i = file_truename(p->argv[0], src);
54
  i = file_truename(p->argv[0], src);
Line 71... Line 70...
71
  for (i = 0;; i++) {
70
  for (i = 0;; i++) {
72
    switch (p->argv[1][i]) {
71
    switch (p->argv[1][i]) {
73
      case ':':
72
      case ':':
74
      case '\\':
73
      case '\\':
75
      case '/':
74
      case '/':
76
        outputnl("Invalid destination");
75
        nls_outputnl(25,4); /* "Invalid destination" */
77
        return(CMD_FAIL);
76
        return(CMD_FAIL);
78
    }
77
    }
79
    buff1[fnameoffset + i] = p->argv[1][i];
78
    buff1[fnameoffset + i] = p->argv[1][i];
80
    if (buff1[fnameoffset + i] == 0) break;
79
    if (buff1[fnameoffset + i] == 0) break;
81
  }
80
  }