BSD 3 development
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Sat, 20 Oct 1979 09:25:09 +0000 (01:25 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Sat, 20 Oct 1979 09:25:09 +0000 (01:25 -0800)
Work on file usr/src/cmd/pxp/string.c

Synthesized-from: 3bsd

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

diff --git a/usr/src/cmd/pxp/string.c b/usr/src/cmd/pxp/string.c
new file mode 100644 (file)
index 0000000..9f4d31a
--- /dev/null
@@ -0,0 +1,60 @@
+/* Copyright (c) 1979 Regents of the University of California */
+#
+/*
+ * pxp - Pascal execution profiler
+ *
+ * Bill Joy UCB
+ * Version 1.2 January 1979
+ */
+
+#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 = (int)(strngp + (sizeof (int) - 1)) &~ (sizeof (int) - 1);
+       return (savestr(cp));
+}