Browse Source

util: Update libutil licence headers

master
Jake Wakeling 1 year ago
parent
commit
03b01d21c0
  1. 31
      src/util/base32.c
  2. 39
      src/util/base32.h
  3. 39
      src/util/crypt.h
  4. 39
      src/util/endian.h
  5. 31
      src/util/error.c
  6. 39
      src/util/error.h
  7. 31
      src/util/optget.c
  8. 39
      src/util/optget.h
  9. 31
      src/util/rc2.c
  10. 39
      src/util/rc2.h
  11. 56
      src/util/strconv.h
  12. 32
      src/util/strtos.c
  13. 31
      src/util/strtou.c
  14. 39
      src/util/util.h

31
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"

39
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

39
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

39
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

31
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"

39
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

31
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"

39
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

31
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"

39
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

56
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

32
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) {

31
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"

39
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

Loading…
Cancel
Save