VM: restore >4k secondary cache functionality
[minix.git] / lib / libsffs / name.c
blob8aeee562cb3e6472c47027a583c8a7d436dc3012
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(dst, src)
19 char dst[NAME_MAX+1];
20 char *src;
22 /* Normalize the given path component name, storing the result in the given
23 * buffer.
25 size_t i, size;
27 size = strlen(src) + 1;
29 assert(size <= NAME_MAX+1);
31 if (sffs_params->p_case_insens) {
32 for (i = 0; i < size; i++)
33 *dst++ = tolower(*src++);
35 else memcpy(dst, src, size);
38 /*===========================================================================*
39 * compare_name *
40 *===========================================================================*/
41 int compare_name(name1, name2)
42 char *name1;
43 char *name2;
45 /* Return TRUE if the given path component names are equivalent, FALSE
46 * otherwise.
48 int r;
50 if (sffs_params->p_case_insens)
51 r = strcasecmp(name1, name2);
52 else
53 r = strcmp(name1, name2);
55 return r ? FALSE : TRUE;