Logo Search packages:      
Sourcecode: cbmlink version File versions  Download package

static int rdfile_copy ( const struct comm comm,
const char *  filename,
FILE *  file,
char *  buf,
unsigned  directory 
) [static]

read a file either as raw or decoded as a directory listing

Parameters:
comm the communication primitives
filename file name search pattern (including drive unit number)
file output file (0=none)
buf at least 256-byte transfer buffer
directory flag: decode the file as a directory
Returns:
zero on success, nonzero on error

Definition at line 237 of file rdfile.c.

References rdfile_do().

Referenced by rdfile(), and rdfile_directory().

{
  unsigned i;
  for (i = 0; filename[i]; i++);
  if (i > (directory ? 126 : 127))
    return fputs ("rdfile: too long file name\n", stderr), 2;
  memcpy (directory ? buf + 2 : buf + 1, filename, i + 1);
  if (directory)
    buf[1] = '$', i++;
  *buf = i, buf[i + 1] = 0;
  return rdfile_do (comm, file, buf, directory);
}


Generated by  Doxygen 1.6.0   Back to index