File: string.c

package info (click to toggle)
mush 7.2.5unoff2-15
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 1,684 kB
  • ctags: 1,338
  • sloc: ansic: 21,932; sh: 795; csh: 87; makefile: 48
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);
}