src/lib/edit.c
bool is_name_valid(const char *name, POOLMEM **msg)
{
   int len;
   const char *p;
   /* Special characters to accept */
   const char *accept = ":.-_ ";

   /* No name is invalid */
   if (!name) {
      if (msg) {
         Mmsg(msg, _("Empty name not allowed.\n"));
      }
      return false;
   }
   /* Restrict the characters permitted in the Volume name */
   for (p=name; *p; p++) {
      if (B_ISALPHA(*p) || B_ISDIGIT(*p) || strchr(accept, (int)(*p))) {
         continue;
      }
      if (msg) {
         Mmsg(msg, _("Illegal character \"%c\" in name.\n"), *p);
      }
      return false;
   }
   len = p - name;
   if (len >= MAX_NAME_LENGTH) {
      if (msg) {
         Mmsg(msg, _("Name too long.\n"));
      }
      return false;
   }
   if (len == 0) {
      if (msg) {
         Mmsg(msg,  _("Volume name must be at least one character long.\n"));
      }
      return false;
   }
   return true;
}
/*
 * Check if the Volume name has legal characters
 * If ua is non-NULL send the message
 */
Check if the Volume name has legal characters
If ua is non-NULL send the message
Check if the Volume name has legal characters If ua is non - NULL send the message
bool is_name_valid(const char *name, POOLMEM **msg)
{
   int len;
   const char *p;
   const char *accept = ":.-_ ";
   if (!name) {
      if (msg) {
         Mmsg(msg, _("Empty name not allowed.\n"));
      }
      return false;
   }
   for (p=name; *p; p++) {
      if (B_ISALPHA(*p) || B_ISDIGIT(*p) || strchr(accept, (int)(*p))) {
         continue;
      }
      if (msg) {
         Mmsg(msg, _("Illegal character \"%c\" in name.\n"), *p);
      }
      return false;
   }
   len = p - name;
   if (len >= MAX_NAME_LENGTH) {
      if (msg) {
         Mmsg(msg, _("Name too long.\n"));
      }
      return false;
   }
   if (len == 0) {
      if (msg) {
         Mmsg(msg,  _("Volume name must be at least one character long.\n"));
      }
      return false;
   }
   return true;
}
bool is_name_valid ( const char * name , POOLMEM * * msg ) { int len ; const char * p ; const char * accept = " " ; if ( ! name ) { if ( msg ) { Mmsg ( msg , _ ( " \n " ) ) ; } return false ; } for ( p = name ; * p ; p ++ ) { if ( B_ISALPHA ( * p ) || B_ISDIGIT ( * p ) || strchr ( accept , ( int ) ( * p ) ) ) { continue ; } if ( msg ) { Mmsg ( msg , _ ( " \" \" \n " ) , * p ) ; } return false ; } len = p - name ; if ( len >= MAX_NAME_LENGTH ) { if ( msg ) { Mmsg ( msg , _ ( " \n " ) ) ; } return false ; } if ( len == 0 ) { if ( msg ) { Mmsg ( msg , _ ( " \n " ) ) ; } return false ; } return true ; }
Check if the Volume name has legal characters
 If ua is non-NULL send the message
Check if the Volume name has legal characters If ua is non - NULL send the message
/* Special characters to accept */ /* No name is invalid */ /* Restrict the characters permitted in the Volume name */