strsave.cc 284 B

1234567891011121314151617
  1. // -*- C++ -*-
  2. /* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
  3. Written by James Clark (jjc@jclark.com) */
  4. #include <string.h>
  5. char *
  6. strsave(const char *s)
  7. {
  8. if (s == 0)
  9. return 0;
  10. char *p = new char[strlen(s) + 1];
  11. strcpy(p, s);
  12. return p;
  13. }