annotate lib/strdup.c @ 17463:203c036eb0c6

bootstrap: support checksum utils without a --status option * build-aux/bootstrap: Only look for sha1sum if updating po files. Add sha1 to the list of supported checksum utils since it's now supported through adjustments below. (update_po_files): Remove the use of --status in a way that will suppress all error messages, but since this is only used to minimize updates, it shouldn't cause an issue. Exit early if there is a problem updating the po file checksums. (find_tool): Remove the check for --version support as this is optional as per commit 86186b17. Don't even check for the presence of the command as if that is needed, it's supported through configuring prerequisites in bootstrap.conf. Prompt that when a tool isn't found, one can define an environment variable to add to the hardcoded search list.
author Pádraig Brady <P@draigBrady.com>
date Thu, 08 Aug 2013 11:08:49 +0100
parents e542fd46ad6f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 16366
diff changeset
1 /* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2013 Free Software
14079
97fc9a21a8fb maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents: 12559
diff changeset
2 Foundation, Inc.
4691
ce37d22a271f Remove K&R cruft.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4582
diff changeset
3
3943
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
4 This file is part of the GNU C Library.
5
41c9d08b09d7 Initial revision
Jim Meyering <jim@meyering.net>
parents:
diff changeset
5
4020
7158a1db8695 change license to gpl.
Karl Berry <karl@freefriends.org>
parents: 3997
diff changeset
6 This program is free software; you can redistribute it and/or modify
7158a1db8695 change license to gpl.
Karl Berry <karl@freefriends.org>
parents: 3997
diff changeset
7 it under the terms of the GNU General Public License as published by
7158a1db8695 change license to gpl.
Karl Berry <karl@freefriends.org>
parents: 3997
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
7158a1db8695 change license to gpl.
Karl Berry <karl@freefriends.org>
parents: 3997
diff changeset
9 any later version.
5
41c9d08b09d7 Initial revision
Jim Meyering <jim@meyering.net>
parents:
diff changeset
10
4020
7158a1db8695 change license to gpl.
Karl Berry <karl@freefriends.org>
parents: 3997
diff changeset
11 This program is distributed in the hope that it will be useful,
5
41c9d08b09d7 Initial revision
Jim Meyering <jim@meyering.net>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
4020
7158a1db8695 change license to gpl.
Karl Berry <karl@freefriends.org>
parents: 3997
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7158a1db8695 change license to gpl.
Karl Berry <karl@freefriends.org>
parents: 3997
diff changeset
14 GNU General Public License for more details.
5
41c9d08b09d7 Initial revision
Jim Meyering <jim@meyering.net>
parents:
diff changeset
15
4020
7158a1db8695 change license to gpl.
Karl Berry <karl@freefriends.org>
parents: 3997
diff changeset
16 You should have received a copy of the GNU General Public License along
16366
bb182ee4a09d maint: replace FSF snail-mail addresses with URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
17 with this program; if not, see <http://www.gnu.org/licenses/>. */
647
9ef1f8f1109f update fsf address
Jim Meyering <jim@meyering.net>
parents: 5
diff changeset
18
7302
8a1a9361108c * _fpending.c: Include <config.h> unconditionally, since we no
Paul Eggert <eggert@cs.ucla.edu>
parents: 5848
diff changeset
19 #ifndef _LIBC
4704
b7a1b14802c8 Correct cpp indentation.
Jim Meyering <jim@meyering.net>
parents: 4691
diff changeset
20 # include <config.h>
4962
6bec4bfbd56e Include strdup.h. From Simon Josefsson.
Bruno Haible <bruno@clisp.org>
parents: 4704
diff changeset
21 #endif
6bec4bfbd56e Include strdup.h. From Simon Josefsson.
Bruno Haible <bruno@clisp.org>
parents: 4704
diff changeset
22
7944
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7473
diff changeset
23 /* Get specification. */
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7473
diff changeset
24 #include <string.h>
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7473
diff changeset
25
4691
ce37d22a271f Remove K&R cruft.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4582
diff changeset
26 #include <stdlib.h>
3943
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
27
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
28 #undef __strdup
7473
44fe37f21d92 Make it possible to alias stpcpy and strdup.
Bruno Haible <bruno@clisp.org>
parents: 7302
diff changeset
29 #ifdef _LIBC
44fe37f21d92 Make it possible to alias stpcpy and strdup.
Bruno Haible <bruno@clisp.org>
parents: 7302
diff changeset
30 # undef strdup
44fe37f21d92 Make it possible to alias stpcpy and strdup.
Bruno Haible <bruno@clisp.org>
parents: 7302
diff changeset
31 #endif
3943
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
32
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
33 #ifndef weak_alias
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
34 # define __strdup strdup
5
41c9d08b09d7 Initial revision
Jim Meyering <jim@meyering.net>
parents:
diff changeset
35 #endif
41c9d08b09d7 Initial revision
Jim Meyering <jim@meyering.net>
parents:
diff changeset
36
4039
7c15210f0e35 copy strdup.c from libc again.
Karl Berry <karl@freefriends.org>
parents: 4020
diff changeset
37 /* Duplicate S, returning an identical malloc'd string. */
5
41c9d08b09d7 Initial revision
Jim Meyering <jim@meyering.net>
parents:
diff changeset
38 char *
3943
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
39 __strdup (const char *s)
5
41c9d08b09d7 Initial revision
Jim Meyering <jim@meyering.net>
parents:
diff changeset
40 {
3943
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
41 size_t len = strlen (s) + 1;
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
42 void *new = malloc (len);
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
43
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
44 if (new == NULL)
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
45 return NULL;
5
41c9d08b09d7 Initial revision
Jim Meyering <jim@meyering.net>
parents:
diff changeset
46
3943
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
47 return (char *) memcpy (new, s, len);
5
41c9d08b09d7 Initial revision
Jim Meyering <jim@meyering.net>
parents:
diff changeset
48 }
3943
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
49 #ifdef libc_hidden_def
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
50 libc_hidden_def (__strdup)
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
51 #endif
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
52 #ifdef weak_alias
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
53 weak_alias (__strdup, strdup)
3e25885877b3 copy from libc/string (via ../config/srclist*).
Karl Berry <karl@freefriends.org>
parents: 2807
diff changeset
54 #endif