From 1a4696492e3cd478080e438950a7664a68fefcd6 Mon Sep 17 00:00:00 2001 From: axtloss Date: Sat, 13 Jul 2024 13:32:53 +0200 Subject: Add manpages for each extlib function --- src/extlib.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/extlib.c') 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 . * - * 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 -- cgit v1.2.3