home *** CD-ROM | disk | FTP | other *** search
-
- /* This module lists the directory of a wadfile to stdout. */
-
- #include <stdio.h>
- #include <ctype.h>
- #include "doomdefs.h"
- #include "directory.h"
-
- #define ISMISSION(X) ( \
- X[0] == 'E' && isdigit(X[1]) && X[2] == 'M' && isdigit(X[3]) && !X[4] \
- )
-
- int waddir(int fd)
- {
- dir_entry entry;
-
- if ( set_directory(fd) < 0 ) {
- fprintf(stderr, "Can't find the directory entries.\n");
- return(-1);
- }
- while ( read(fd, (char *)&entry, ENTRY_SIZE) == ENTRY_SIZE ) {
- /* Null terminate the name */
- entry.name[8]='\0';
-
- /* Print it out, if it is a level... */
- if ( ISMISSION(entry.name) ) printf("%s\n", entry.name);
-
- if ( strcasecmp(WADDIR_END, entry.name) == 0 )
- break;
- }
- return(0);
- }
-
-