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

static void writedir ( const char *  p,
unsigned  length,
FILE *  file 
) [static]

display a block of data as a directory

Parameters:
p the data buffer
length number of bytes in the buffer
file output file

fall through

Definition at line 105 of file rdfile.c.

References contents, end, link1, link2, loadaddr1, loadaddr2, number1, number2, writedir_lineno, and writedir_state.

Referenced by rdfile_do().

{
  while (length > 0) {
    switch (writedir_state) {
    case loadaddr1:
    case loadaddr2:
      writedir_state++;
      break;
    case link2:
      if (!*p) {
      writedir_state = end;
      break;
      }
      /** fall through */
    case link1:
      writedir_state++;
      break;
    case number1:
      writedir_state++;
      writedir_lineno = (unsigned char) *p;
      break;
    case number2:
      writedir_state++;
      writedir_lineno += 256 * (unsigned) (unsigned char) *p;
      fprintf (file, " %u ", writedir_lineno);
      break;
    case contents:
      if (*p == 0) {
      writedir_state = link1;
      putc ('\n', file);
      }
      else
      putc (*p, file);
      break;
    case end:
      /* ignore any bytes after the end */
      break;
    }
    length--;
    p++;
  }
}


Generated by  Doxygen 1.6.0   Back to index