diff options
author | Lukas Larsson <[email protected]> | 2015-07-02 11:13:32 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2015-07-10 14:15:37 +0200 |
commit | c431a065ba515d27830f01c852f70940efb3003b (patch) | |
tree | 3fffccb470dc6cfa81bc397f4f35d5b5eb226d17 /erts/etc/unix/safe_string.h | |
parent | db2e9773f95a79b40e197031c7b8782392fa9d02 (diff) | |
download | otp-c431a065ba515d27830f01c852f70940efb3003b.tar.gz otp-c431a065ba515d27830f01c852f70940efb3003b.tar.bz2 otp-c431a065ba515d27830f01c852f70940efb3003b.zip |
ose: Remove all code related to the OSE port
The OSE port is no longer supported and this commit removed it
and any changes related to it. The things that were general
improvements have been left in the code.
Diffstat (limited to 'erts/etc/unix/safe_string.h')
-rw-r--r-- | erts/etc/unix/safe_string.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/erts/etc/unix/safe_string.h b/erts/etc/unix/safe_string.h new file mode 100644 index 0000000000..5a471f10de --- /dev/null +++ b/erts/etc/unix/safe_string.h @@ -0,0 +1,66 @@ +/* + * %CopyrightBegin% + * + * Copyright Ericsson AB 2008-2009. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * %CopyrightEnd% + */ +/* + * Module: safe_string.h + * + * This is an interface to a bunch of generic string operation + * that are safe regarding buffer overflow. + * + * All string functions terminate the process with an error message + * on buffer overflow. + */ + +#include <stdio.h> +#include <stdarg.h> + +/* Like vsnprintf() + */ +int vsn_printf(char* dst, size_t size, const char* format, va_list args); + +/* Like snprintf() + */ +int sn_printf(char* dst, size_t size, const char* format, ...); + +/* Like strncpy() + * Returns length of copied string. + */ +int strn_cpy(char* dst, size_t size, const char* src); + +/* Almost like strncat() + * size is sizeof entire dst buffer. + * Returns length of resulting string. + */ +int strn_cat(char* dst, size_t size, const char* src); + +/* Combination of strncat() and snprintf() + * size is sizeof entire dst buffer. + * Returns length of resulting string. + */ +int strn_catf(char* dst, size_t size, const char* format, ...); + +/* Simular to strstr() but search size bytes of haystack + * without regard to '\0' characters. + */ +char* find_str(const char* haystack, int size, const char* needle); + +#ifndef HAVE_MEMMOVE +void* memmove(void *dest, const void *src, size_t n); +#endif + |