- FILE *fp;
- char *command;
- int maxsize = *datalen;
- char *localbuf;
-
- command = dupprintf("xauth list %s 2>/dev/null", display);
- fp = popen(command, "r");
- sfree(command);
-
- if (!fp)
- return; /* assume no auth */
-
- localbuf = smalloc(maxsize);
-
- while (1) {
- /*
- * Read a line from stdin, and attempt to parse it into a
- * display name (ignored), auth protocol, and auth string.
- */
- int c, i, hexdigit, proto;
- char protoname[64];
-
- /* Skip the display name. */
- while (c = getc(fp), c != EOF && c != '\n' && !isspace(c));
- if (c == EOF) break;
- if (c == '\n') continue;