File: string.c

package info (click to toggle)
mush 7.2.5unoff2-6
  • links: PTS
  • area: non-free
  • in suites: hamm
  • size: 1,664 kB
  • ctags: 1,329
  • sloc: ansic: 21,901; sh: 796; csh: 87; makefile: 72
file content (18 lines) | stat: -rw-r--r-- 241 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

#include "mush.h"

char *
savestr(s)
register char *s;
{
    register char *p;

    if (!s)
	s = "";
    if (!(p = malloc((unsigned) (strlen(s) + 1)))) {
	error("out of memory saving %s", s);
	return NULL;
    }
    return strcpy(p, s);
}