Author | Jamozed <[email protected]> |
Date | 2022-03-06 04:10:01 |
Commit | 03b01d21c0e46f69f8c6da4e608e3b7a9551a49c |
Parent | 50616ef4d698033f05678b361649f908dfe17594 |
util: Update libutil licence headers
Diffstat
M | src/util/base32.c | | | 31 | ++----------------------------- |
M | src/util/base32.h | | | 39 | ++++++++++----------------------------- |
M | src/util/crypt.h | | | 39 | ++++++++++----------------------------- |
M | src/util/endian.h | | | 39 | ++++++++++----------------------------- |
M | src/util/error.c | | | 31 | ++----------------------------- |
M | src/util/error.h | | | 39 | ++++++++++----------------------------- |
M | src/util/optget.c | | | 31 | ++----------------------------- |
M | src/util/optget.h | | | 39 | ++++++++++----------------------------- |
M | src/util/rc2.c | | | 31 | ++----------------------------- |
M | src/util/rc2.h | | | 39 | ++++++++++----------------------------- |
M | src/util/strconv.h | | | 56 | +++++++++++++++++++------------------------------------- |
M | src/util/strtos.c | | | 32 | ++------------------------------ |
M | src/util/strtou.c | | | 31 | ++----------------------------- |
M | src/util/util.h | | | 39 | ++++++++++----------------------------- |
14 files changed, 101 insertions, 415 deletions
diff --git a/src/util/base32.c b/src/util/base32.c index 09af30c..8b7eaef 100644 --- a/src/util/base32.c +++ b/src/util/base32.c @@ -1,34 +1,7 @@ -// util/base32.c, version 1.0.3 +// util/base32.c, version 1.0.4 // Base32 source file from libutil // Copyright (C) 2021, Jakob Wakeling -// All rights reserved. - -/* -OMKOV Permissive Licence, version 1.0 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimers. -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimers in the documentation and/or - other materials provided with the distribution. -* Neither the names of the copyright holders, nor the names of its contributors - may be used to endorse or promote products derived from this Software without - specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -*/ +// MIT Licence #include "base32.h" diff --git a/src/util/base32.h b/src/util/base32.h index 98fc671..ca6d3b4 100644 --- a/src/util/base32.h +++ b/src/util/base32.h @@ -1,38 +1,15 @@ -// util/base32.h, version 1.0.3 +// util/base32.h, version 1.0.4 // Base32 header file from libutil // Copyright (C) 2021, Jakob Wakeling -// All rights reserved. - -/* -OMKOV Permissive Licence, version 1.0 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimers. -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimers in the documentation and/or - other materials provided with the distribution. -* Neither the names of the copyright holders, nor the names of its contributors - may be used to endorse or promote products derived from this Software without - specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -*/ +// MIT Licence #ifndef UTIL_BASE32_H_2PSMZTB0 #define UTIL_BASE32_H_2PSMZTB0 +#ifdef __cplusplus +extern "C" { +#endif + #include <stdint.h> #include <stdlib.h> @@ -42,4 +19,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. extern size_t b32encode(uint8_t *dst, uint8_t *src, size_t len); extern size_t b32decode(uint8_t *dst, uint8_t *src, size_t len); +#ifdef __cplusplus +} // extern "C" +#endif + #endif // UTIL_BASE32_H_2PSMZTB0 diff --git a/src/util/crypt.h b/src/util/crypt.h index 29a2cff..813e908 100644 --- a/src/util/crypt.h +++ b/src/util/crypt.h @@ -1,38 +1,15 @@ -// util/crypt.h, version 0.1.1 +// util/crypt.h, version 0.1.2 // Crypt header file from libutil // Copyright (C) 2021, Jakob Wakeling -// All rights reserved. - -/* -OMKOV Permissive Licence, version 1.0 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimers. -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimers in the documentation and/or - other materials provided with the distribution. -* Neither the names of the copyright holders, nor the names of its contributors - may be used to endorse or promote products derived from this Software without - specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -*/ +// MIT Licence #ifndef UTIL_CRYPT_H_RDY6J5JV #define UTIL_CRYPT_H_RDY6J5JV +#ifdef __cplusplus +extern "C" { +#endif + #include <stdint.h> /* Circular shift left */ @@ -47,4 +24,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. #define ROR32(x, n) (uint32_t)(((x) >> (n)) | ((x) << (32 - (n)))) #define ROR64(x, n) (uint64_t)(((x) >> (n)) | ((x) << (64 - (n)))) +#ifdef __cplusplus +} // extern "C" +#endif + #endif // UTIL_CRYPT_H_RDY6J5JV diff --git a/src/util/endian.h b/src/util/endian.h index 96b90b3..23413c0 100644 --- a/src/util/endian.h +++ b/src/util/endian.h @@ -1,38 +1,15 @@ -// util/endian.h, version 1.0.1 +// util/endian.h, version 1.0.2 // Endian header file from libutil // Copyright (C) 2021, Jakob Wakeling -// All rights reserved. - -/* -OMKOV Permissive Licence, version 1.0 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimers. -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimers in the documentation and/or - other materials provided with the distribution. -* Neither the names of the copyright holders, nor the names of its contributors - may be used to endorse or promote products derived from this Software without - specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -*/ +// MIT Licence #ifndef UTIL_ENDIAN_H_G7AID2RQ #define UTIL_ENDIAN_H_G7AID2RQ +#ifdef __cplusplus +extern "C" { +#endif + #include <stdint.h> /* Byte swap a 16-bit integer */ @@ -150,4 +127,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. ((uint8_t *)(p))[6] = ((uint64_t)(x) >> 8) & 0xFFu; \ ((uint8_t *)(p))[7] = ((uint64_t)(x) >> 0) & 0xFFu +#ifdef __cplusplus +} // extern "C" +#endif + #endif // UTIL_ENDIAN_H_G7AID2RQ diff --git a/src/util/error.c b/src/util/error.c index 0e306e9..68f230b 100644 --- a/src/util/error.c +++ b/src/util/error.c @@ -1,34 +1,7 @@ -// util/error.h, version 1.1.1 +// util/error.h, version 1.1.2 // Error source file from libutil // Copyright (C) 2020, Jakob Wakeling -// All rights reserved. - -/* -OMKOV Permissive Licence, version 1.0 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimers. -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimers in the documentation and/or - other materials provided with the distribution. -* Neither the names of the copyright holders, nor the names of its contributors - may be used to endorse or promote products derived from this Software without - specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -*/ +// MIT Licence #include "error.h" diff --git a/src/util/error.h b/src/util/error.h index 794e5c3..1dbe3a2 100644 --- a/src/util/error.h +++ b/src/util/error.h @@ -1,38 +1,15 @@ -// util/error.h, version 1.1.1 +// util/error.h, version 1.1.2 // Error header file from libutil // Copyright (C) 2020, Jakob Wakeling -// All rights reserved. - -/* -OMKOV Permissive Licence, version 1.0 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimers. -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimers in the documentation and/or - other materials provided with the distribution. -* Neither the names of the copyright holders, nor the names of its contributors - may be used to endorse or promote products derived from this Software without - specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -*/ +// MIT Licence #ifndef UTIL_ERROR_H_38W06M3W #define UTIL_ERROR_H_38W06M3W +#ifdef __cplusplus +extern "C" { +#endif + #include <errno.h> #include <stdbool.h> #include <stdnoreturn.h> @@ -84,4 +61,8 @@ extern void alert(const char *format, ...); /* Shorthand for strerror(errno). DEPRECIATED, use the SERR macro. */ extern char *serr(void); +#ifdef __cplusplus +} // extern "C" +#endif + #endif // UTIL_ERROR_H_38W06M3W diff --git a/src/util/optget.c b/src/util/optget.c index 24d334d..62b6272 100644 --- a/src/util/optget.c +++ b/src/util/optget.c @@ -1,34 +1,7 @@ -// util/optget.h, version 1.6.1 +// util/optget.h, version 1.6.2 // optget source file from libutil // Copyright (C) 2020, Jakob Wakeling -// All rights reserved. - -/* -OMKOV Permissive Licence, version 1.0 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimers. -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimers in the documentation and/or - other materials provided with the distribution. -* Neither the names of the copyright holders, nor the names of its contributors - may be used to endorse or promote products derived from this Software without - specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -*/ +// MIT Licence #include "error.h" #include "optget.h" diff --git a/src/util/optget.h b/src/util/optget.h index e3065fb..0ee1b84 100644 --- a/src/util/optget.h +++ b/src/util/optget.h @@ -1,38 +1,15 @@ -// util/optget.h, version 1.6.1 +// util/optget.h, version 1.6.2 // optget header file from libutil // Copyright (C) 2020, Jakob Wakeling -// All rights reserved. - -/* -OMKOV Permissive Licence, version 1.0 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimers. -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimers in the documentation and/or - other materials provided with the distribution. -* Neither the names of the copyright holders, nor the names of its contributors - may be used to endorse or promote products derived from this Software without - specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -*/ +// MIT Licence #ifndef UTIL_OPTGET_H_W3LIZK1S #define UTIL_OPTGET_H_W3LIZK1S +#ifdef __cplusplus +extern "C" { +#endif + #define ARG_NUL 0 #define ARG_REQ 1 #define ARG_OPT 2 @@ -52,4 +29,8 @@ extern const struct opt OPTGET_INIT; extern int optget(struct opt *opt, char *av[], int flags); +#ifdef __cplusplus +} // extern "C" +#endif + #endif // UTIL_OPTGET_H_W3LIZK1S diff --git a/src/util/rc2.c b/src/util/rc2.c index 104b8c9..cc359e0 100644 --- a/src/util/rc2.c +++ b/src/util/rc2.c @@ -1,34 +1,7 @@ -// util/rc2.c, version 1.0.0 +// util/rc2.c, version 1.0.1 // RC2 source file from libutil // Copyright (C) 2021, Jakob Wakeling -// All rights reserved. - -/* -OMKOV Permissive Licence, version 1.0 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimers. -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimers in the documentation and/or - other materials provided with the distribution. -* Neither the names of the copyright holders, nor the names of its contributors - may be used to endorse or promote products derived from this Software without - specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -*/ +// MIT Licence #include "rc2.h" diff --git a/src/util/rc2.h b/src/util/rc2.h index ee6ef1e..eb0f40f 100644 --- a/src/util/rc2.h +++ b/src/util/rc2.h @@ -1,38 +1,15 @@ -// util/rc2.h, version 1.0.0 +// util/rc2.h, version 1.0.1 // RC2 header file from libutil // Copyright (C) 2021, Jakob Wakeling -// All rights reserved. - -/* -OMKOV Permissive Licence, version 1.0 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimers. -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimers in the documentation and/or - other materials provided with the distribution. -* Neither the names of the copyright holders, nor the names of its contributors - may be used to endorse or promote products derived from this Software without - specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -*/ +// MIT Licence #ifndef UTIL_RC2_H_PMXL29JH #define UTIL_RC2_H_PMXL29JH +#ifdef __cplusplus +extern "C" { +#endif + #include <stdint.h> #include <stdlib.h> @@ -42,4 +19,8 @@ extern void rc2expand(struct rc2 *ctx, const uint8_t *key, int len, int ekl); extern void rc2encrypt(struct rc2 *ctx, uint8_t *in, uint8_t *out); extern void rc2decrypt(struct rc2 *ctx, uint8_t *in, uint8_t *out); +#ifdef __cplusplus +} // extern "C" +#endif + #endif // UTIL_RC2_H_PMXL29JH diff --git a/src/util/strconv.h b/src/util/strconv.h index 5901fcb..bdfaff1 100644 --- a/src/util/strconv.h +++ b/src/util/strconv.h @@ -1,48 +1,30 @@ -// util/strconv.h, version 1.1.2 +// util/strconv.h // String conversion header file from libutil // Copyright (C) 2021, Jakob Wakeling -// All rights reserved. - -/* -OMKOV Permissive Licence, version 1.0 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimers. -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimers in the documentation and/or - other materials provided with the distribution. -* Neither the names of the copyright holders, nor the names of its contributors - may be used to endorse or promote products derived from this Software without - specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -*/ +// MIT Licence #ifndef UTIL_STRCONV_H_3EQMSZZK #define UTIL_STRCONV_H_3EQMSZZK +#define UTIL_STRCONV_H_VERSION "1.1.3" + +#ifdef __cplusplus +extern "C" { +#endif #include "util.h" -s8 strtos8(const char *nptr, char **endptr, register int base); -s16 strtos16(const char *nptr, char **endptr, register int base); -s32 strtos32(const char *nptr, char **endptr, register int base); -s64 strtos64(const char *nptr, char **endptr, register int base); +extern s8 strtos8(const char *nptr, char **endptr, register int base); +extern s16 strtos16(const char *nptr, char **endptr, register int base); +extern s32 strtos32(const char *nptr, char **endptr, register int base); +extern s64 strtos64(const char *nptr, char **endptr, register int base); + +extern u8 strtou8(const char *nptr, char **endptr, register int base); +extern u16 strtou16(const char *nptr, char **endptr, register int base); +extern u32 strtou32(const char *nptr, char **endptr, register int base); +extern u64 strtou64(const char *nptr, char **endptr, register int base); -u8 strtou8(const char *nptr, char **endptr, register int base); -u16 strtou16(const char *nptr, char **endptr, register int base); -u32 strtou32(const char *nptr, char **endptr, register int base); -u64 strtou64(const char *nptr, char **endptr, register int base); +#ifdef __cplusplus +} // extern "C" +#endif #endif // UTIL_STRCONV_H_3EQMSZZK diff --git a/src/util/strtos.c b/src/util/strtos.c index c09c2e3..5aff849 100644 --- a/src/util/strtos.c +++ b/src/util/strtos.c @@ -1,40 +1,12 @@ -// util/strtos.c, version 1.1.2 +// util/strtos.c // String conversion source file from libutil // Copyright (C) 2021, Jakob Wakeling -// All rights reserved. - -/* -OMKOV Permissive Licence, version 1.0 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimers. -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimers in the documentation and/or - other materials provided with the distribution. -* Neither the names of the copyright holders, nor the names of its contributors - may be used to endorse or promote products derived from this Software without - specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -*/ +// MIT Licence #include "util.h" #include <ctype.h> #include <errno.h> -#include <stdbool.h> /* Convert a string to a signed 8-bit integer */ s8 strtos8(const char *nptr, char **endptr, register int base) { diff --git a/src/util/strtou.c b/src/util/strtou.c index e865866..5e0a01c 100644 --- a/src/util/strtou.c +++ b/src/util/strtou.c @@ -1,34 +1,7 @@ -// util/strtou.c, version 1.1.2 +// util/strtou.c // String conversion source file from libutil // Copyright (C) 2021, Jakob Wakeling -// All rights reserved. - -/* -OMKOV Permissive Licence, version 1.0 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimers. -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimers in the documentation and/or - other materials provided with the distribution. -* Neither the names of the copyright holders, nor the names of its contributors - may be used to endorse or promote products derived from this Software without - specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -*/ +// MIT Licence #include "util.h" diff --git a/src/util/util.h b/src/util/util.h index 3b3d167..3d85789 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -1,38 +1,15 @@ -// util/util.h, version 1.0.0 +// util/util.h, version 1.0.1 // Utility header file from libutil // Copyright (C) 2021, Jakob Wakeling -// All rights reserved. - -/* -OMKOV Permissive Licence, version 1.0 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimers. -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimers in the documentation and/or - other materials provided with the distribution. -* Neither the names of the copyright holders, nor the names of its contributors - may be used to endorse or promote products derived from this Software without - specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -*/ +// MIT Licence #ifndef UTIL_UTIL_H_KP8NS9DC #define UTIL_UTIL_H_KP8NS9DC +#ifdef __cplusplus +extern "C" { +#endif + #include <assert.h> #include <float.h> #include <stdbool.h> @@ -89,4 +66,8 @@ typedef long double f128; /* Miscellaneous */ #define BIT(x) (1 << (x)) +#ifdef __cplusplus +} // extern "C" +#endif + #endif // UTIL_UTIL_H_KP8NS9DC