home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 6 / FM Towns Free Software Collection 6.iso / t_os / helper / source / chk.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-08  |  620 b   |  30 lines

  1. #include    <stdio.h>
  2. #include    <stdlib.h>
  3. #include    <string.h>
  4. #include    <ctype.h>
  5.  
  6. main()
  7. {
  8.     char *p;
  9.     char buf[BUFSIZ];
  10.  
  11.     while ( fgets(buf,BUFSIZ,stdin) != NULL ) {
  12.     if ( (p = strchr(buf,'\n')) != NULL )
  13.         *p = '\0';
  14.  
  15.     for ( p = buf ; *p != '\0' ; p++ ) {
  16.         if ( !isalpha(*p) && !isdigit(*p) &&
  17.          *p != '_' && *p != '.' && *p != ':' && *p != '\\' ) {
  18.         printf("%s Bad Char '%c'\n",buf,*p);
  19.         break;
  20.         }
  21.     }
  22.  
  23.     if ( (p = strrchr(buf,'\\')) != NULL ) {
  24.         *p = '\0';
  25.         if ( (p = strchr(buf,'.')) != NULL )
  26.         printf("%s Bad Directory '%s'\n",buf,p);
  27.     }
  28.     }
  29. }
  30.