8 fprint(2, "auth/pemdecode section [file]\n");
13 main(int argc, char **argv)
27 if(argc != 1 && argc != 2)
36 if((fd = open(file, OREAD)) < 0)
37 sysfatal("open %s: %r", file);
41 buf = realloc(buf, tot+8192);
43 sysfatal("realloc: %r");
44 if((n = read(fd, buf+tot, 8192)) < 0)
51 bin = decodePEM(buf, tag, &len, nil);
53 sysfatal("cannot extract section '%s' from pem", tag);
54 if((n=write(1, bin, len)) != len)
55 sysfatal("writing %d bytes got %ld: %r", len, n);