Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
14406989
Unverified
Commit
14406989
authored
Jun 20, 2018
by
Stéphane Graber
Committed by
GitHub
Jun 20, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2420 from brauner/2018-06-20/strlcat
include: add strlcat() implementation
parents
d2ff3f89
9a5e7ac4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
0 deletions
+70
-0
configure.ac
configure.ac
+4
-0
strlcat.c
src/include/strlcat.c
+37
-0
strlcat.h
src/include/strlcat.h
+29
-0
No files found.
configure.ac
View file @
14406989
...
@@ -632,6 +632,10 @@ AC_CHECK_FUNCS([strlcpy],
...
@@ -632,6 +632,10 @@ AC_CHECK_FUNCS([strlcpy],
AM_CONDITIONAL(HAVE_STRLCPY, true)
AM_CONDITIONAL(HAVE_STRLCPY, true)
AC_DEFINE(HAVE_STRLCPY,1,[Have strlcpy]),
AC_DEFINE(HAVE_STRLCPY,1,[Have strlcpy]),
AM_CONDITIONAL(HAVE_STRLCPY, false))
AM_CONDITIONAL(HAVE_STRLCPY, false))
AC_CHECK_FUNCS([strlcat],
AM_CONDITIONAL(HAVE_STRLCAT, true)
AC_DEFINE(HAVE_STRLCAT,1,[Have strlcat]),
AM_CONDITIONAL(HAVE_STRLCAT, false))
# Check for some libraries
# Check for some libraries
AX_PTHREAD
AX_PTHREAD
...
...
src/include/strlcat.c
0 → 100644
View file @
14406989
/* liblxcapi
*
* Copyright © 2018 Christian Brauner <christian@brauner.io>.
* Copyright © 2018 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* This function has been copied from musl.
*/
#include <limits.h>
#include <stdint.h>
#include <string.h>
#ifndef HAVE_STRLCPY
#include "strlcpy.h"
#endif
size_t
strlcat
(
char
*
d
,
const
char
*
s
,
size_t
n
)
{
size_t
l
=
strnlen
(
d
,
n
);
if
(
l
==
n
)
return
l
+
strlen
(
s
);
return
l
+
strlcpy
(
d
+
l
,
s
,
n
-
l
);
}
src/include/strlcat.h
0 → 100644
View file @
14406989
/* liblxcapi
*
* Copyright © 2018 Christian Brauner <christian@brauner.io>.
* Copyright © 2018 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* This function has been copied from musl.
*/
#ifndef _STRLCAT_H
#define _STRLCAT_H
#include <stdio.h>
extern
size_t
strlcat
(
char
*
d
,
const
char
*
s
,
size_t
n
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment