BSD 1 development
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Tue, 6 Dec 1977 19:08:59 +0000 (11:08 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Tue, 6 Dec 1977 19:08:59 +0000 (11:08 -0800)
Work on file pxp/string.c

Synthesized-from: 1bsd

pxp/string.c [new file with mode: 0644]

diff --git a/pxp/string.c b/pxp/string.c
new file mode 100644 (file)
index 0000000..e8a816b
--- /dev/null
@@ -0,0 +1,59 @@
+#
+/*
+ * pxp - Pascal execution profiler
+ *
+ * Bill Joy UCB
+ * Version 1.0 August 1977
+ */
+
+#include "0.h"
+
+/*
+ * STRING SPACE DECLARATIONS
+ *
+ * Strng is the base of the current
+ * string space and strngp the
+ * base of the free area therein.
+ * No array of descriptors is needed
+ * as string space is never freed.
+ */
+STATIC char strings[STRINC];
+STATIC char *strng strings;
+STATIC char *strngp strings;
+
+/*
+initstring()
+{
+
+}
+ */
+/*
+ * Copy a string into the string area.
+ */
+savestr(cp)
+       register char *cp;
+{
+       register int i;
+
+       i = strlen(cp) + 1;
+       if (strngp + i >= strng + STRINC) {
+               strngp = alloc(STRINC);
+               if (strngp == -1) {
+                       yerror("Ran out of memory (string)");
+                       pexit(DIED);
+               }
+               strng = strngp;
+       }
+       strcpy(strngp, cp);
+       cp = strngp;
+       strngp = cp + i;
+       return (cp);
+}
+
+esavestr(cp)
+       char *cp;
+{
+
+       strngp = (strngp + 1) &~ 1;
+       return (savestr(cp));
+}