File: strsave.c

package info (click to toggle)
lookup 1.08b-5
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 1,108 kB
  • ctags: 1,305
  • sloc: ansic: 12,634; makefile: 236; perl: 174; sh: 53
file content (18 lines) | stat: -rw-r--r-- 438 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef _USING_DGUX /* DGUX has its own */
#include "xmalloc.h"
#include "strsave.h"

/* return a private copy of the given string, die if out of memory */

#ifndef strcpy
 extern char *strcpy(char *, const char *);
#endif

unsigned char *strsave(const unsigned char *str)
{
    unsigned char *ptr;
    ptr = xmalloc((unsigned)strlen((void *)str)+1);
    (void)strcpy((void *)ptr, (void *)str);
    return ptr;
}
#endif /* _USING_DGUX */