savestring.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* savestring.c - function version of savestring for backwards compatibility */
  2. /* Copyright (C) 1998,2003 Free Software Foundation, Inc.
  3. This file is part of the GNU Readline Library (Readline), a library
  4. for reading lines of text with interactive input and history editing.
  5. Readline is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. Readline is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Readline. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #define READLINE_LIBRARY
  17. #include <config.h>
  18. #ifdef HAVE_STRING_H
  19. # include <string.h>
  20. #endif
  21. #include "xmalloc.h"
  22. /* Backwards compatibility, now that savestring has been removed from
  23. all `public' readline header files. */
  24. char *
  25. savestring (s)
  26. const char *s;
  27. {
  28. char *ret;
  29. ret = (char *)xmalloc (strlen (s) + 1);
  30. strcpy (ret, s);
  31. return ret;
  32. }