From bffb0092211399185f60f57eb0717bc8f72e41ba Mon Sep 17 00:00:00 2001 From: Bill Joy Date: Sat, 20 Oct 1979 01:25:09 -0800 Subject: [PATCH] BSD 3 development Work on file usr/src/cmd/pxp/string.c Synthesized-from: 3bsd --- usr/src/cmd/pxp/string.c | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 usr/src/cmd/pxp/string.c diff --git a/usr/src/cmd/pxp/string.c b/usr/src/cmd/pxp/string.c new file mode 100644 index 0000000000..9f4d31a1c3 --- /dev/null +++ b/usr/src/cmd/pxp/string.c @@ -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)); +} -- 2.20.1