Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
**********/
#include <string.h>
#include "ngspice/ngspice.h"
#include "ngspice/cpdefs.h"
void
cp_printword(char *string, FILE *fp)
{
char *s;
if (string)
for (s = string; *s; s++)
(void) putc((*s), fp);
}
* if they are present */
char *
cp_unquote(const char *p_src)
{
if (!p_src) {
return (char *) NULL;
}
const size_t len_src = strlen(p_src);
size_t len_dst;
* make the destination length 2 chars less */
if (len_src >= 2 && *p_src == '"' && p_src[len_src - 1] == '"') {
len_dst = len_src - 2;
++p_src;
}
else {
len_dst = len_src;
}
char * const p_dst = TMALLOC(char, len_dst + 1);
strncpy(p_dst, p_src, len_dst);
p_dst[len_dst] = '\0';
return p_dst;
}