Start development on BSD 2
[unix-history] / .ref-BSD-1 / pxp / string.c
CommitLineData
2febe727
CH
1#
2/*
3 * pxp - Pascal execution profiler
4 *
5 * Bill Joy UCB
6 * Version 1.0 August 1977
7 */
8
9#include "0.h"
10
11/*
12 * STRING SPACE DECLARATIONS
13 *
14 * Strng is the base of the current
15 * string space and strngp the
16 * base of the free area therein.
17 * No array of descriptors is needed
18 * as string space is never freed.
19 */
20STATIC char strings[STRINC];
21STATIC char *strng strings;
22STATIC char *strngp strings;
23
24/*
25initstring()
26{
27
28}
29 */
30/*
31 * Copy a string into the string area.
32 */
33savestr(cp)
34 register char *cp;
35{
36 register int i;
37
38 i = strlen(cp) + 1;
39 if (strngp + i >= strng + STRINC) {
40 strngp = alloc(STRINC);
41 if (strngp == -1) {
42 yerror("Ran out of memory (string)");
43 pexit(DIED);
44 }
45 strng = strngp;
46 }
47 strcpy(strngp, cp);
48 cp = strngp;
49 strngp = cp + i;
50 return (cp);
51}
52
53esavestr(cp)
54 char *cp;
55{
56
57 strngp = (strngp + 1) &~ 1;
58 return (savestr(cp));
59}