#include "parser.tab.h"
/* Public */
void scanner_quit(void);
-int scanner_scanpath(char const*);
int scanner_scandir(DIR*);
/* Private */
static
int lexer_lexdir(uint8_t*);
extern //lexer.rl
void lexer_closedir(void);
-/* Scan the provided path
- Changes working directory to the provided pathname and, if successful, sends
- a directory stream of the provided path to scanner_scandir
-*/
-int scanner_scanpath
-( char const* pathname )
-{ DIR* dirp;
- errno = 0;
- if ((dirp = opendir(pathname)) == NULL || errno)
- { fprintf(stderr, "Path %s could not be accessed\n", pathname);
- return -1;
- }
- if (chdir(pathname))
- return -1;
- return scanner_scandir(dirp);
-}
/* Scan directory stream
Recursively scans the provided directory, sending CLOPEN and CLCLOSE tokens