legal_name.c

Go to the documentation of this file.
00001 #include "gis.h"
00002 #include "glocale.h"
00003 /**********************************************************************
00004  *
00005  *   char *
00006  *   G_legal_filename (name)
00007  *      char *name           filename to be checked
00008  *
00009  *   returns:    1  if name is OK
00010  *              -1  if name begins with ".", if name contains a "/",
00011  *                  if name contains a quote character,
00012  *                  or if name contains a non-printing character.
00013  **********************************************************************/
00014 
00015 
00025 int G_legal_filename (char *s)
00026 {
00027     if (*s == '.' || *s == 0) {
00028         fprintf(stderr, _("Illegal filename.  Cannot be '.' or 'NULL'\n"));
00029         return -1;
00030     }
00031 
00032     for ( ; *s; s++)
00033         if (*s == '/' || *s == '"' || *s == '\'' || *s <= ' ' || *s > 0176) {
00034                 fprintf(stderr, _("Illegal filename. character <%c> not allowed."), *s);
00035             return -1;
00036         }
00037 
00038     return 1;
00039 }

Generated on Wed Aug 23 17:49:22 2006 for GRASS by  doxygen 1.4.7