1 /* vi: set sw=4 ts=4: */
3 * feature.c --- convert between features and strings
5 * Copyright (C) 1999 Theodore Ts'o <tytso@mit.edu>
7 * This file can be redistributed under the terms of the GNU Library General
25 static const struct hash hash_list[] = {
26 { EXT2_HASH_LEGACY, "legacy" },
27 { EXT2_HASH_HALF_MD4, "half_md4" },
28 { EXT2_HASH_TEA, "tea" },
32 const char *e2p_hash2string(int num)
37 for (p = hash_list; p->string; p++) {
41 sprintf(buf, "HASHALG_%d", num);
46 * Returns the hash algorithm, or -1 on error
48 int e2p_string2hash(char *string)
54 for (p = hash_list; p->string; p++) {
55 if (!strcasecmp(string, p->string)) {
59 if (strncasecmp(string, "HASHALG_", 8))
64 num = strtol(string+8, &eptr, 10);
65 if (num > 255 || num < 0)