Subversion Repositories SvarDOS

Rev

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

Rev 501 Rev 502
Line 62... Line 62...
62
 
62
 
63
/* copies src to dst, overwriting or appending to the destination.
63
/* copies src to dst, overwriting or appending to the destination.
64
 * - copy is performed in ASCII mode if asciiflag set (stop at first EOF in src
64
 * - copy is performed in ASCII mode if asciiflag set (stop at first EOF in src
65
 *   and append an EOF in dst).
65
 *   and append an EOF in dst).
66
 * - returns zero on success, DOS error code on error */
66
 * - returns zero on success, DOS error code on error */
67
unsigned short cmd_copy_internal(const char *dst, char dstascii, const char *src, char srcascii, unsigned char appendflag, void *buff, unsigned short buffsz) {
67
static unsigned short cmd_copy_internal(const char *dst, char dstascii, const char *src, char srcascii, unsigned char appendflag, void *buff, unsigned short buffsz) {
68
  unsigned short errcode = 0;
68
  unsigned short errcode = 0;
69
  unsigned short srch = 0xffff, dsth = 0xffff;
69
  unsigned short srch = 0xffff, dsth = 0xffff;
70
  _asm {
70
  _asm {
71
 
71
 
72
    /* open src */
72
    /* open src */
73
    OPENSRC:
73
    OPENSRC:
74
    mov ax, 0x3d00 /* DOS 2+ -- open an existing file, read access mode */
74
    mov ax, 0x3d00 /* DOS 2+ -- open an existing file, read access mode */
75
    mov dx, src    /* ASCIIZ fname */
75
    mov dx, src    /* ASCIIZ fname */
76
    int 0x21       /* CF clear on success, handle in AX */
76
    int 0x21       /* CF clear on success, handle in AX */
-
 
77
    jc FAIL
77
    mov [srch], ax /* store src handle in memory */
78
    mov [srch], ax /* store src handle in memory */
78
 
79
 
79
    /* check appendflag so I know if I have to try opening dst for append */
80
    /* check appendflag so I know if I have to try opening dst for append */
80
    xor al, al
81
    xor al, al
81
    or al, [appendflag]
82
    or al, [appendflag]