|
NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/connect/ncbi_ansi_ext.h |
source navigation diff markup identifier search freetext search file search |
1 #ifndef CONNECT___NCBI_ANSI_EXT__H
2 #define CONNECT___NCBI_ANSI_EXT__H
3
4 /* $Id: ncbi_ansi_ext.h,v 6.18 2009/10/08 13:39:50 kazimird Exp $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Author: Anton Lavrentiev
30 *
31 * File Description:
32 * Non-ANSI, yet widely used functions
33 *
34 */
35 #include <connect/connect_export.h>
36 #include "ncbi_config.h"
37 #include <stddef.h>
38 #if !defined(NCBI_CXX_TOOLKIT) && !defined(_GNU_SOURCE)
39 # define _GNU_SOURCE
40 #endif /*!NCBI_CXX_TOOLKIT && !_GNU_SOURCE*/
41 #include <string.h>
42
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48
49 #ifndef HAVE_STRDUP
50
51 # ifdef strdup
52 # undef strdup
53 # endif
54 # define strdup NCBI_strdup
55
56 /* Create a copy of string "str".
57 * Return an identical malloc'ed string, which must be explicitly freed
58 * by free() when no longer needed.
59 */
60 extern NCBI_XCONNECT_EXPORT
61 char* strdup(const char* str);
62
63 #endif /*HAVE_STRDUP*/
64
65
66 #ifndef HAVE_STRNDUP
67
68 # ifdef strndup
69 # undef strndup
70 # endif
71 # define strndup NCBI_strndup
72
73 /* Create a copy of up to "n" first characters of string "str".
74 * Return a malloc'ed and '\0'-terminated string, which must be
75 * explicitly freed by free() when no longer needed.
76 */
77 extern NCBI_XCONNECT_EXPORT
78 char* strndup(const char* str, size_t n);
79
80 #endif /*HAVE_STRNDUP*/
81
82
83 #ifndef HAVE_STRCASECMP
84
85 # ifdef strcasecmp
86 # undef strcasecmp
87 # undef strncasecmp
88 # endif
89 # define strcasecmp NCBI_strcasecmp
90 # define strncasecmp NCBI_strncasecmp
91
92 /* Compare "s1" and "s2", ignoring case.
93 * Return less than, equal to or greater than zero if
94 * "s1" is lexicographically less than, equal to or greater than "s2".
95 */
96 extern NCBI_XCONNECT_EXPORT
97 int strcasecmp(const char* s1, const char* s2);
98
99 /* Compare not more than "n" characters of "s1" and "s2", ignoring case.
100 * Return less than, equal to or greater than zero if
101 * "s1" is lexicographically less than, equal to or greater than "s2".
102 */
103 extern NCBI_XCONNECT_EXPORT
104 int strncasecmp(const char* s1, const char* s2, size_t n);
105
106 #endif/*HAVE_STRCASECMP*/
107
108
109 #ifdef strupr
110 # undef strupr
111 # undef strlwr
112 #endif
113 #define strupr NCBI_strupr
114 #define strlwr NCBI_strlwr
115
116 /* Convert a string to uppercase, then return pointer to
117 * the altered string. Because the conversion is made in place, the
118 * returned pointer is the same as the passed one.
119 */
120 extern NCBI_XCONNECT_EXPORT
121 char* strupr(char* s);
122
123 /* Convert a string to lowercase, then return pointer to
124 * the altered string. Because the conversion is made in place, the
125 * returned pointer is the same as the passed one.
126 */
127 extern NCBI_XCONNECT_EXPORT
128 char* strlwr(char* s);
129
130
131 /* Copy not more than "n" characters from string "s2" into "s1"
132 * and return the result, which is always null-terminated.
133 * NOTE: The difference of this function from standard strncpy() is in
134 * that the result is always null-terminated and that the function does not
135 * pad "s1" with null bytes should "s2" be shorter than "n" characters.
136 */
137 extern NCBI_XCONNECT_EXPORT
138 char* strncpy0(char* s1, const char* s2, size_t n);
139
140
141 #ifdef __cplusplus
142 } /* extern "C" */
143 #endif
144
145 #endif /* CONNECT___NCBI_ANSI_EXT__H */
146 |
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |