diff options
author | axtloss <axtlos@getcryst.al> | 2024-07-13 13:32:53 +0200 |
---|---|---|
committer | axtloss <axtlos@getcryst.al> | 2024-07-14 16:43:24 +0200 |
commit | 1a4696492e3cd478080e438950a7664a68fefcd6 (patch) | |
tree | 3b6e6658d5d56d3a28c6c83a8c6b64cffaa27555 /src/extlib.c | |
parent | 3e85fcb0270c9224ab95dac02c737e6676974c8e (diff) | |
download | extlib-1a4696492e3cd478080e438950a7664a68fefcd6.tar.gz extlib-1a4696492e3cd478080e438950a7664a68fefcd6.tar.bz2 |
Add manpages for each extlib function
Diffstat (limited to 'src/extlib.c')
-rw-r--r-- | src/extlib.c | 15 |
1 files changed, 10 insertions, 5 deletions
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 |