diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/constraint_handler.c | 17 | ||||
-rw-r--r-- | src/extlib.c | 15 | ||||
-rw-r--r-- | src/extlib.h | 26 | ||||
-rw-r--r-- | src/extstring.c | 17 | ||||
-rw-r--r-- | src/memset_s.c | 18 |
5 files changed, 19 insertions, 74 deletions
diff --git a/src/constraint_handler.c b/src/constraint_handler.c index ca4e9d2..450632e 100644 --- a/src/constraint_handler.c +++ b/src/constraint_handler.c @@ -1,20 +1,5 @@ /* constraint_handler.c - * - * Copyright 2024 axtlos <axtlos@disroot.org> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - * - * SPDX-License-Identifier: LGPL-3.0-only + * SPDX-License-Identifier: BSD-3-Clause */ diff --git a/src/extlib.c b/src/extlib.c index 107e8b4..ce11709 100644 --- a/src/extlib.c +++ b/src/extlib.c @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * - * SPDX-License-Identifier: LGPL-3.0-only + * SPDX-License-Identifier: BSD-3-Clause */ @@ -58,20 +58,25 @@ memvcmp (void *str, return memcmp (str, str2, n); } -void -fcopy(FILE *f1, FILE *f2) +size_t +fcopy (FILE *src, FILE *dst) { char buffer[BUFSIZ]; - size_t n; + size_t n, copied = 0; + + if (src == NULL || dst == NULL) + return -1; while ((n = fread (buffer, sizeof (char), sizeof (buffer), f1)) > 0) { if (fwrite (buffer, sizeof (char), n, f2) != n) { fprintf (stderr, "Failed to copy data"); - return; + return -1; } fflush (f2); + copied += n; } + return copied; } int diff --git a/src/extlib.h b/src/extlib.h index fc7a3d2..5264195 100644 --- a/src/extlib.h +++ b/src/extlib.h @@ -1,20 +1,5 @@ -/* extlib.h - * - * Copyright 2024 axtlos <axtlos@disroot.org> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - * - * SPDX-License-Identifier: LGPL-3.0-only +/* extlib.c + * SPDX-License-Identifier: BSD-3-Clause */ #include <stdlib.h> @@ -52,8 +37,9 @@ void ignore_handler_s (const char *__restrict, void *__restrict, errno_t); #endif -/// Copy the data of one filestream to another */ -void fcopy(FILE *f1, FILE *f2); +/// Copy the data of one filestream to another +/// Returns the amount of bytes copied. +size_t fcopy(FILE *src, FILE *dst); #if (_XOPEN_SOURCE == 500) /// Recursively remove a directory pathname. @@ -73,6 +59,6 @@ char *strupr(char *s); /// Trim spaces from a string char *trim (char *s, int *rem_front, int *rem_back); -/// Match string old and replace it with string replace +/// Match string s for old and replace it with string replace char *replace_str (char *s, char *old, char *replace); diff --git a/src/extstring.c b/src/extstring.c index 477f5f7..8b82bb3 100644 --- a/src/extstring.c +++ b/src/extstring.c @@ -1,20 +1,5 @@ /* extstring.c - * - * Copyright 2024 axtlos <axtlos@disroot.org> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - * - * SPDX-License-Identifier: LGPL-3.0-only + * SPDX-License-Identifier: BSD-3-Clause */ #define USE_SECURE_MEM diff --git a/src/memset_s.c b/src/memset_s.c index deda5d7..dbe26ca 100644 --- a/src/memset_s.c +++ b/src/memset_s.c @@ -1,23 +1,7 @@ /* memset_s.c - * - * Copyright 2024 axtlos <axtlos@disroot.org> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - * - * SPDX-License-Identifier: LGPL-3.0-only + * SPDX-License-Identifier: BSD-3-Clause */ - #define __STDC_WANT_LIB_EXT1__ 1 #include "extlib.h" #include <errno.h> |