10 int isnumeric(char *str)
23 static char retbuf[1024];
32 ret = read(fd, readbuf + dlen, sizeof(readbuf) - dlen);
34 perror("read environ");
39 while((p = memchr(readbuf, 0, dlen)) != NULL) {
40 if((p2 = strchr(readbuf, '=')) != NULL) {
42 if(!strcasecmp(readbuf, "KRB5CCNAME") && !strncasecmp(p2, "FILE:", 5)) {
43 if(strlen(p2 + 5) >= sizeof(retbuf)) {
44 fprintf(stderr, "really long ccname!\n");
47 strcpy(retbuf, p2 + 5);
52 memmove(readbuf, p, dlen -= (p - readbuf));
58 int main(int argc, char **argv)
66 if((proc = opendir("/proc")) == NULL) {
70 while((de = readdir(proc)) != NULL) {
71 if(!isnumeric(de->d_name))
73 if(strlen(de->d_name) > 30)
79 strcpy(p, de->d_name);
80 p += strlen(de->d_name);
84 if((fd = open(envbuf, O_RDONLY)) < 0)
90 printf("%s %s\n", de->d_name, cc);