summaryrefslogtreecommitdiff
path: root/web/noweb/src/c/strsave.nw
diff options
context:
space:
mode:
Diffstat (limited to 'web/noweb/src/c/strsave.nw')
-rw-r--r--web/noweb/src/c/strsave.nw21
1 files changed, 21 insertions, 0 deletions
diff --git a/web/noweb/src/c/strsave.nw b/web/noweb/src/c/strsave.nw
new file mode 100644
index 0000000000..658e58857c
--- /dev/null
+++ b/web/noweb/src/c/strsave.nw
@@ -0,0 +1,21 @@
+% Copyright 1991 by Norman Ramsey. All rights reserved.
+% See file COPYRIGHT for more information.
+<<header>>=
+char *strsave (char *s); /* returns a pointer to a fresh copy of s */
+<<*>>=
+static char rcsid[] = "$Id: strsave.nw,v 2.21 2008/10/06 01:03:05 nr Exp nr $";
+static char rcsname[] = "$Name: v2_12 $";
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "strsave.h"
+#include "errors.h"
+
+char *strsave (char *s) {
+ char *t = malloc (strlen(s)+1);
+ checkptr(t);
+ strcpy(t,s);
+ (void)rcsid; /* avoid a warning */
+ (void)rcsname; /* avoid a warning */
+ return t;
+}