1 /**
2   @file
3 
4   @ingroup util
5 
6   @brief String copying.
7 
8   @copyright@parblock
9   Copyright (c) 1994-1998 The Regents of the Univ. of California.
10   All rights reserved.
11 
12   Permission is hereby granted, without written agreement and without license
13   or royalty fees, to use, copy, modify, and distribute this software and its
14   documentation for any purpose, provided that the above copyright notice and
15   the following two paragraphs appear in all copies of this software.
16 
17   IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
18   DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
19   OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
20   CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 
22   THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
23   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
24   FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
25   "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
26   MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
27   @endparblock
28 
29   @copyright@parblock
30   Copyright (c) 1999-2015, Regents of the University of Colorado
31 
32   All rights reserved.
33 
34   Redistribution and use in source and binary forms, with or without
35   modification, are permitted provided that the following conditions
36   are met:
37 
38   Redistributions of source code must retain the above copyright
39   notice, this list of conditions and the following disclaimer.
40 
41   Redistributions in binary form must reproduce the above copyright
42   notice, this list of conditions and the following disclaimer in the
43   documentation and/or other materials provided with the distribution.
44 
45   Neither the name of the University of Colorado nor the names of its
46   contributors may be used to endorse or promote products derived from
47   this software without specific prior written permission.
48 
49   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
52   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
53   COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
56   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
57   CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
59   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
60   POSSIBILITY OF SUCH DAMAGE.
61   @endparblock
62 
63 */
64 
65 #include "util.h"
66 
67 /**
68  *  @brief Returns a copy of a string.
69  */
70 char *
util_strsav(char const * s)71 util_strsav(char const *s)
72 {
73     return strcpy(ALLOC(char, strlen(s)+1), s);
74 }
75