Remove building with NOCRYPTO option
[minix3.git] / minix / lib / libsffs / name.c
blob80585ea0dc57b7aee08b60c1d7fd974db7f89aff
1 /* This file contains path component name utility functions.
3 * The entry points into this file are:
4 * normalize_name normalize a path component name for hashing purposes
5 * compare_name check whether two path component names are equivalent
7 * Created:
8 * April 2009 (D.C. van Moolenbroek)
9 */
11 #include "inc.h"
13 #include <ctype.h>
15 /*===========================================================================*
16 * normalize_name *
17 *===========================================================================*/
18 void normalize_name(char dst[NAME_MAX+1], char *src)
20 /* Normalize the given path component name, storing the result in the given
21 * buffer.
23 size_t i, size;
25 size = strlen(src) + 1;
27 assert(size <= NAME_MAX+1);
29 if (sffs_params->p_case_insens) {
30 for (i = 0; i < size; i++)
31 *dst++ = tolower((int)*src++);
33 else memcpy(dst, src, size);
36 /*===========================================================================*
37 * compare_name *
38 *===========================================================================*/
39 int compare_name(char *name1, char *name2)
41 /* Return TRUE if the given path component names are equivalent, FALSE
42 * otherwise.
44 int r;
46 if (sffs_params->p_case_insens)
47 r = strcasecmp(name1, name2);
48 else
49 r = strcmp(name1, name2);
51 return r ? FALSE : TRUE;