mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
20 lines
300 B
C
20 lines
300 B
C
|
/*
|
||
|
* Allocate a duplicate of an ordinary C NUL-terminated string.
|
||
|
*/
|
||
|
|
||
|
#include <string.h>
|
||
|
|
||
|
#include "defs.h"
|
||
|
#include "misc.h"
|
||
|
|
||
|
char *dupstr(const char *s)
|
||
|
{
|
||
|
char *p = NULL;
|
||
|
if (s) {
|
||
|
int len = strlen(s);
|
||
|
p = snewn(len + 1, char);
|
||
|
strcpy(p, s);
|
||
|
}
|
||
|
return p;
|
||
|
}
|