summaryrefslogtreecommitdiff
path: root/dviware/umddvi/lib/strsave.c
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /dviware/umddvi/lib/strsave.c
Initial commit
Diffstat (limited to 'dviware/umddvi/lib/strsave.c')
-rw-r--r--dviware/umddvi/lib/strsave.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/dviware/umddvi/lib/strsave.c b/dviware/umddvi/lib/strsave.c
new file mode 100644
index 0000000000..47e29326cb
--- /dev/null
+++ b/dviware/umddvi/lib/strsave.c
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 1987 University of Maryland Department of Computer Science.
+ * All rights reserved. Permission to copy for any purpose is hereby granted
+ * so long as this copyright notice remains intact.
+ */
+
+/*
+ * Save a string in managed memory.
+ */
+
+char *malloc(), *realloc();
+extern int errno;
+
+char *
+strsave(s)
+ register char *s;
+{
+ register int l = strlen(s) + 1;
+ register char *p = malloc((unsigned) l);
+
+ if (p == 0)
+ error(1, errno, "no room for %d bytes of string", l);
+ bcopy(s, p, l);
+ return (p);
+}