36 const struct { SquashLicense value;
const char* name; } licenses[] = {
37 { SQUASH_LICENSE_PUBLIC_DOMAIN,
"Public Domain" },
38 { SQUASH_LICENSE_BSD2,
"BSD2" },
39 { SQUASH_LICENSE_BSD3,
"BSD3" },
40 { SQUASH_LICENSE_BSD4,
"BSD4" },
41 { SQUASH_LICENSE_MIT,
"MIT" },
42 { SQUASH_LICENSE_ZLIB,
"zlib" },
43 { SQUASH_LICENSE_WTFPL,
"WTFPL" },
44 { SQUASH_LICENSE_X11,
"X11" },
45 { SQUASH_LICENSE_APACHE,
"Apache 2.0" },
46 { SQUASH_LICENSE_APACHE2,
"Apache" },
47 { SQUASH_LICENSE_CDDL,
"CDDL" },
48 { SQUASH_LICENSE_MSPL,
"MsPL" },
49 { SQUASH_LICENSE_MPL,
"MPL" },
50 { SQUASH_LICENSE_LGPL2P1,
"LGPLv2.1" },
51 { SQUASH_LICENSE_LGPL2P1_PLUS,
"LGPLv2.1+" },
52 { SQUASH_LICENSE_LGPL3,
"LGPLv3" },
53 { SQUASH_LICENSE_LGPL3_PLUS,
"LGPLv3+" },
54 { SQUASH_LICENSE_GPL1,
"GPLv1" },
55 { SQUASH_LICENSE_GPL1_PLUS,
"GPLv1+" },
56 { SQUASH_LICENSE_GPL2,
"GPLv2" },
57 { SQUASH_LICENSE_GPL2_PLUS,
"GPLv2+" },
58 { SQUASH_LICENSE_GPL3,
"GPLv3" },
59 { SQUASH_LICENSE_GPL3_PLUS,
"GPLv3+" },
60 { SQUASH_LICENSE_PROPRIETARY,
"Proprietary" },
62 { SQUASH_LICENSE_UNKNOWN, NULL }
66 squash_license_to_string (SquashLicense license) {
68 for (i = 0 ; licenses[i].value != SQUASH_LICENSE_UNKNOWN ; i++)
69 if (license == licenses[i].value)
70 return licenses[i].name;
75 squash_license_from_string (
const char* license) {
77 for (i = 0 ; licenses[i].value != SQUASH_LICENSE_UNKNOWN ; i++)
78 if (strcasecmp (license, licenses[i].name) == 0)
79 return licenses[i].value;
81 return SQUASH_LICENSE_UNKNOWN;