btar
Check-in [a485a53b98]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1 Hash:a485a53b9873965afccfe283d35f9b32cb6368cd
Date: 2012-06-08 20:26:53
User: viric
Comment:Adding the file string.c I forgot in my previous commit.
Tags And Properties
Changes
hide diffs unified diffs patch

Added string.c

> 1 /* > 2 btar - no-tape archiver. > 3 Copyright (C) 2012 Lluis Batlle i Rossell > 4 > 5 This program is free software: you can redistribute it and/or modify > 6 it under the terms of the GNU General Public License as published by > 7 the Free Software Foundation, either version 3 of the License, or > 8 (at your option) any later version. > 9 > 10 This program is distributed in the hope that it will be useful, > 11 but WITHOUT ANY WARRANTY; without even the implied warranty of > 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > 13 GNU General Public License for more details. > 14 > 15 You should have received a copy of the GNU General Public License > 16 along with this program. If not, see <http://www.gnu.org/licenses/>. > 17 */ > 18 > 19 #include "main.h" > 20 > 21 /* Fastest than strncpy, because it does not write all 'n' characters. Additionally, > 22 * it ensures the null-ending. */ > 23 void > 24 strcpyn(char *dest, const char *src, size_t n) > 25 { > 26 size_t i; > 27 > 28 for(i=0; i<n; ++i) > 29 { > 30 dest[i] = src[i]; > 31 if (src[i] == '\0') > 32 break; > 33 } > 34 dest[n-1] = '\0'; > 35 }