blob: 614e44048c5cc1ef73ca62d0a573b1fde946e059 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include <stdio.h>
#include "libhashtable.h"
extern char **environ;
int main(int argc,char *argv[]) {
struct hashtable ht;
int i;
char *name;
char *value;
inittable(&ht);
for(i=0;environ[i];i++) {
name=strdup(environ[i]);
if((value=strchr(name,'=') )){
*value=0;
value++;
}
//printf("'%s' = '%s'\n",name,value);
ht_setkey(&ht,name,value);
free(name);
}
printf("PATH='%s'\n",ht_getvalue(&ht,"PATH"));
return 0;
}
|