X-Git-Url: https://git.efficios.com/?a=blobdiff_plain;f=readline%2Fsavestring.c;h=af9853801649a8f1f200a8492c625800edb6e408;hb=9600246debb2489725a76334cc237dd289f6b5de;hp=3f53a87bcd14fa32d323c4a8da9f0157a6e199ef;hpb=abd8680d6efd97e7ba848a6392ee3ad72be18cd0;p=deliverable%2Fbinutils-gdb.git diff --git a/readline/savestring.c b/readline/savestring.c index 3f53a87bcd..af98538016 100644 --- a/readline/savestring.c +++ b/readline/savestring.c @@ -1,33 +1,41 @@ -/* savestring.c */ +/* savestring.c - function version of savestring for backwards compatibility */ -/* Copyright (C) 1998 Free Software Foundation, Inc. +/* Copyright (C) 1998,2003 Free Software Foundation, Inc. - This file is part of the GNU Readline Library, a library for - reading lines of text with interactive input and history editing. + This file is part of the GNU Readline Library (Readline), a library + for reading lines of text with interactive input and history editing. - The GNU Readline Library is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 1, or + Readline is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - The GNU Readline Library 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 + Readline 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. - The GNU General Public License is often shipped with GNU software, and - is generally kept in a file called COPYING or LICENSE. If you do not - have a copy of the license, write to the Free Software Foundation, - 675 Mass Ave, Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU General Public License + along with Readline. If not, see . +*/ -extern char *strcpy (); -extern char *xmalloc (); +#define READLINE_LIBRARY + +#include +#ifdef HAVE_STRING_H +# include +#endif +#include "xmalloc.h" /* Backwards compatibility, now that savestring has been removed from all `public' readline header files. */ char * savestring (s) - char *s; + const char *s; { - return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s))); + char *ret; + + ret = (char *)xmalloc (strlen (s) + 1); + strcpy (ret, s); + return ret; }