Tagging 1.99.1
[linux_from_scratch.git] / lfscmd / src / env.c
blob3852d9a560a7b0f884b90ec94b77b396363e2425
1 /*
2 * Copyright (C) 2003 Timothy Bauscher <timothy@linuxfromscratch.org>
3 */
5 #include <stdio.h>
6 #include <stdlib.h>
8 #include "string.h"
9 #include "env.h"
11 char *locate_book (const char *varname) {
12 char *envptr, *env;
14 envptr=getenv(varname);
15 if (NULL == envptr) return(NULL);
16 else {
17 /* Out of memory */
18 if (NULL==(env = (char *) malloc((string_len(envptr)+1) * sizeof(char)) ))
19 exit(-1);
21 env = string_cpy(envptr);
24 return(env);