is_mangled

Christopher R. Hertel crh at NTS.Umn.EDU
Mon Mar 30 23:34:49 GMT 1998


Perhaps I'm splitting hairs but Jeremy warned me about playing around
inside mangle.c.  I've written a new is_mangled function which is a bit
more selective and doesn't use recursion.  The main behavioral change is
that it tests the two characters following the magic character to see if 
they are in the basechars set.

If no one objects, I *will* make this change.

Chris -)-----

/* ************************************************************************** **
 * Test a name in 8.3 format to see if it *might be* a mangled name.
 * ************************************************************************** **
 */
int is_mangled( char *s )
  {
  char *magic = strchr( s, magic_char );

  if( !magic || (strlen(magic) < 3) )
    return( 0 );

  if( strchr( basechars, toupper(magic[1]) )
   && strchr( basechars, toupper(magic[2]) )
   && strchr( ".", magic[3] )
    )
    return( 1 );

  return( 0 ); 
  } /* new_is_mangled */

-- 
Christopher R. Hertel -)-----                   University of Minnesota
crh at nts.umn.edu              Networking and Telecommunications Services


More information about the samba-technical mailing list