-
Notifications
You must be signed in to change notification settings - Fork 0
/
catdup.h
70 lines (63 loc) · 2.52 KB
/
catdup.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* -*- Mode: C ; c-basic-offset: 4 -*- */
/* SPDX-FileCopyrightText: Copyright © 2009-2023 Nedko Arnaudov */
/* SPDX-License-Identifier: ( GPL-2.0-or-later OR LGPL-2.1-or-later OR MIT OR AFL-2.1 ) */
/**
* @file catdup.h
* @brief String concatenation into newly allocated buffer
*/
/**************************************************************************
* This file contains prototypes of the catdup() functions
**************************************************************************/
#ifndef CATDUP_H__D42302F1_4D96_4EE4_AC09_E97ED5748277__INCLUDED
#define CATDUP_H__D42302F1_4D96_4EE4_AC09_E97ED5748277__INCLUDED
/**
* @brief Concatenate two strings into a newly allocated buffer
*
* @param s1 First string to concatenate
* @param s2 Second string to concatenate
*
* @return Newly allocated buffer where the input strings are concatenated into.
*/
char * catdup(const char * s1, const char * s2);
/**
* @brief Concatenate three strings into a newly allocated buffer
*
* @param s1 First string to concatenate
* @param s2 Second string to concatenate
* @param s3 Third string to concatenate
*
* @return Newly allocated buffer where the input strings are concatenated into.
*/
char * catdup3(const char * s1, const char * s2, const char * s3);
/**
* @brief Concatenate four strings into a newly allocated buffer
*
* @param s1 First string to concatenate
* @param s2 Second string to concatenate
* @param s3 Third string to concatenate
* @param s4 Fourth string to concatenate
*
* @return Newly allocated buffer where the input strings are concatenated into.
*/
char * catdup4(const char * s1, const char * s2, const char * s3, const char * s4);
/**
* @brief Concatenate any number of strings into a newly allocated buffer
*
* @param s1 First string to concatenate
* @param s2 Second string to concatenate
* @param ... Other strings to concatenate, NULL delimits end of list.
*
* @return Newly allocated buffer where the input strings are concatenated into.
*/
char * catdupv(const char * s1, const char * s2, ...);
/**
* @brief Concatenate strings specified as array into a newly allocated buffer,
* with optional delimiter,
*
* @param array NULL terminated array of input strings to concatenate
* @param delimiter Optional (can be NULL) string to insert in between input strings.
*
* @return Newly allocated buffer where the input strings are concatenated into.
*/
char * catdup_array(const char * const * array, const char * delimiter);
#endif /* #ifndef CATDUP_H__D42302F1_4D96_4EE4_AC09_E97ED5748277__INCLUDED */