Ignore files generated in the dependency checks.
[libpri-bristuff.git] / copy_string.c
blobccc40c080cd8d33fb9c2b0033ead5be2ad56cae8
1 /*
2 * libpri: An implementation of Primary Rate ISDN
4 * Written by Mark Spencer <markster@digium.com>
6 * Copyright (C) 2005, Digium, Inc.
7 * All Rights Reserved.
8 */
11 * See http://www.asterisk.org for more information about
12 * the Asterisk project. Please do not directly contact
13 * any of the maintainers of this project for assistance;
14 * the project provides a web site, mailing lists and IRC
15 * channels for your use.
17 * This program is free software, distributed under the terms of
18 * the GNU General Public License Version 2 as published by the
19 * Free Software Foundation. See the LICENSE file included with
20 * this program for more details.
22 * In addition, when this program is distributed with Asterisk in
23 * any form that would qualify as a 'combined work' or as a
24 * 'derivative work' (but not mere aggregation), you can redistribute
25 * and/or modify the combination under the terms of the license
26 * provided with that copy of Asterisk, instead of the license
27 * terms granted here.
30 #include <string.h>
31 #include <unistd.h>
32 #include <stdlib.h>
34 #include "compiler.h"
35 #include "libpri.h"
36 #include "pri_internal.h"
38 void libpri_copy_string(char *dst, const char *src, size_t size)
40 while (*src && size) {
41 *dst++ = *src++;
42 size--;
44 if (__builtin_expect(!size, 0))
45 dst--;
46 *dst = '\0';