Subversion Repositories SvarDOS

Rev

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

Rev 413 Rev 415
Line 33... Line 33...
33
  char lastitemwasplus;
33
  char lastitemwasplus;
34
  char databuf[BUFFER_SIZE - 1024];
34
  char databuf[BUFFER_SIZE - 1024];
35
};
35
};
36
 
36
 
37
 
37
 
38
/* appends a backslash if path is a directory
-
 
39
 * returns the (possibly updated) length of path */
-
 
40
static unsigned short cmd_copy_addbkslash_if_dir(char *path) {
-
 
41
  unsigned short len;
-
 
42
  int attr;
-
 
43
  for (len = 0; path[len] != 0; len++);
-
 
44
  if (len == 0) return(0);
-
 
45
  if (path[len - 1] == '\\') return(len);
-
 
46
  /* */
-
 
47
  attr = file_getattr(path);
-
 
48
  if ((attr > 0) && (attr & DOS_ATTR_DIR)) {
-
 
49
    path[len++] = '\\';
-
 
50
    path[len] = 0;
-
 
51
  }
-
 
52
  return(len);
-
 
53
}
-
 
54
 
-
 
55
 
-
 
56
/* copies src to dst, overwriting or appending to the destination.
38
/* copies src to dst, overwriting or appending to the destination.
57
 * - copy is performed in ASCII mode if asciiflag set (stop at first EOF in src
39
 * - copy is performed in ASCII mode if asciiflag set (stop at first EOF in src
58
 *   and append an EOF in dst).
40
 *   and append an EOF in dst).
59
 * - returns zero on success, DOS error code on error */
41
 * - returns zero on success, DOS error code on error */
60
unsigned short cmd_copy_internal(const char *dst, char dstascii, const char *src, char srcascii, unsigned char appendflag, void *buff, unsigned short buffsz) {
42
unsigned short cmd_copy_internal(const char *dst, char dstascii, const char *src, char srcascii, unsigned char appendflag, void *buff, unsigned short buffsz) {
Line 237... Line 219...
237
      outputnl("Invalid destination");
219
      outputnl("Invalid destination");
238
      return(-1);
220
      return(-1);
239
    }
221
    }
240
    setup->dst_asciimode = setup->last_asciimode;
222
    setup->dst_asciimode = setup->last_asciimode;
241
    /* if dst is a directory then append a backslash */
223
    /* if dst is a directory then append a backslash */
242
    setup->dstlen = cmd_copy_addbkslash_if_dir(setup->dst);
224
    setup->dstlen = path_appendbkslash_if_dir(setup->dst);
243
  }
225
  }
244
 
226
 
245
  /* DEBUG: output setup content ("if 1" to enable) */
227
  /* DEBUG: output setup content ("if 1" to enable) */
246
  #if 1
228
  #if 1
247
  printf("src: ");
229
  printf("src: ");
Line 280... Line 262...
280
 
262
 
281
    /* if length zero, skip (not sure why this would be possible, though) */
263
    /* if length zero, skip (not sure why this would be possible, though) */
282
    if (databuflen == 0) continue;
264
    if (databuflen == 0) continue;
283
 
265
 
284
    /* if src does not end with a backslash AND it is a directory then append a backslash */
266
    /* if src does not end with a backslash AND it is a directory then append a backslash */
285
    databuflen = cmd_copy_addbkslash_if_dir(setup->databuf);
267
    databuflen = path_appendbkslash_if_dir(setup->databuf);
286
 
268
 
287
    /* if src ends with a '\' then append *.* */
269
    /* if src ends with a '\' then append *.* */
288
    if (setup->databuf[databuflen - 1] == '\\') {
270
    if (setup->databuf[databuflen - 1] == '\\') {
289
      strcat(setup->databuf, "*.*");
271
      strcat(setup->databuf, "*.*");
290
    }
272
    }