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

enum WrStatus Write9660 ( const struct Filename name,
const byte_t data,
size_t  length,
char **  newname,
log_t  log 

Write a file in raw format, using ISO 9660 compliant filenames

name native (PETSCII) name of the file
data the contents of the file
length length of the file contents
newname (output) the converted file name
log Call-back function for diagnostic output
status of the operation

Definition at line 365 of file write.c.

References do_it(), Errors, filename2char(), filesuffix(), TruncateName(), and WrFail.

  char* filename;
  int i;
  struct stat statbuf;

  if (!filename2char (name, newname))
    return WrFail;

  if (!(filename = malloc (TruncateName ((unsigned char*)*newname) + 4 + 1)))
    return WrFail;

  /* try the basic file name */
  sprintf (filename, "%s%.4s", *newname, filesuffix (name));
  if (stat (filename, &statbuf)) {
    free (*newname);
    *newname = filename;
    return do_it (data, length, newname, name, log);

  /* try with .000-style file names */
  for (i = 0; i < 1000; i++) {
    sprintf (filename, "%s.%03u", *newname, i);
    if (stat (filename, &statbuf)) { /* found an available file name */
      free (*newname);
      *newname = filename;
      return do_it (data, length, newname, name, log);

  (*log) (Errors, name, "out of file name space");
  return WrFail;

Generated by  Doxygen 1.6.0   Back to index