/* tirdbl - Web log-style directory HTML index generator */

/* Copyright 20nn David Meyer <[email protected]> +JMJ
*
* Copying and distribution of this file, with or without
* modification, are permitted in any medium without royalty
* provided the copyright notice and this notice are preserved.
* This file is offered as-is, without any warranty.
*
* tirdbl is part of Tears In Rain
*/

#include <dirent.h>
#include <stdio.h>
#include <string.h>
#include "krcompat.h"

#ifdef (TOPS20)
#define DIRNAMECHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.$"
#else
#define DIRNAMECHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_."
#endif

int ngdirname PARAMS((char *name));

int main(argc, argv)
    int argc;
    char *argv[];
{
 int i;

 printf("argc: %d\n", argc);
 for (i = 0; i < argc; ++ i) {
   printf("argv[%d]: %s\n", i, argv[i]);
 }

 if (ngdirname(argv[1])) {
   printf("%s is an invalid directory name\n", argv[1]);
 }
 else {
   printf("%s is a valid directory name\n", argv[1]);
 }
}

int ngdirname(name)
    char *name[];
{
 size_t len = strlen(name);

 return strspn(name, DIRNAMECHARS);
}