Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/netpgp/dist/src When setting up res (res...



details:   https://anonhg.NetBSD.org/src/rev/ab18ef956fdc
branches:  trunk
changeset: 754920:ab18ef956fdc
user:      agc <agc%NetBSD.org@localhost>
date:      Sun May 16 06:48:52 2010 +0000

description:
When setting up res (results), errs (error) and outs (outputs) streams,
change the pre-defined stdio streams to be denoted by "<stdout>" and
"<stderr>", to distinguish them from file names.

In netpgpkeys(1), send the default "res" (results) stream to stdout,
rather than stderr. Requested by Anon Ymous (and makes perfect sense).

diffstat:

 crypto/external/bsd/netpgp/dist/src/lib/netpgp.c            |  28 +++++++-----
 crypto/external/bsd/netpgp/dist/src/netpgpkeys/netpgpkeys.c |   3 +-
 2 files changed, 19 insertions(+), 12 deletions(-)

diffs (71 lines):

diff -r e1b626ddf3a9 -r ab18ef956fdc crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c  Sun May 16 06:21:14 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c  Sun May 16 06:48:52 2010 +0000
@@ -34,7 +34,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: netpgp.c,v 1.49 2010/05/16 06:21:14 agc Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.50 2010/05/16 06:48:52 agc Exp $");
 #endif
 
 #include <sys/types.h>
@@ -419,22 +419,28 @@
                return 0;
        }
        io->outs = stdout;
-       if ((stream = netpgp_getvar(netpgp, "stdout")) != NULL &&
-           strcmp(stream, "stderr") == 0) {
+       if ((stream = netpgp_getvar(netpgp, "outs")) != NULL &&
+           strcmp(stream, "<stderr>") == 0) {
                io->outs = stderr;
        }
        io->errs = stderr;
-       if ((stream = netpgp_getvar(netpgp, "stderr")) != NULL &&
-           strcmp(stream, "stdout") == 0) {
+       if ((stream = netpgp_getvar(netpgp, "errs")) != NULL &&
+           strcmp(stream, "<stdout>") == 0) {
                io->errs = stdout;
        }
-       if ((results = netpgp_getvar(netpgp, "results")) == NULL) {
+       if ((results = netpgp_getvar(netpgp, "res")) == NULL) {
                io->res = io->errs;
-       } else if ((io->res = fopen(results, "w")) == NULL) {
-               (void) fprintf(io->errs, "Can't open results %s for writing\n",
-                       results);
-               free(io);
-               return 0;
+       } else if (strcmp(results, "<stdout>") == 0) {
+               io->res = stdout;
+       } else if (strcmp(results, "<stderr>") == 0) {
+               io->res = stderr;
+       } else {
+               if ((io->res = fopen(results, "w")) == NULL) {
+                       (void) fprintf(io->errs, "Can't open results %s for writing\n",
+                               results);
+                       free(io);
+                       return 0;
+               }
        }
        netpgp->io = io;
        if ((passfd = netpgp_getvar(netpgp, "pass-fd")) != NULL &&
diff -r e1b626ddf3a9 -r ab18ef956fdc crypto/external/bsd/netpgp/dist/src/netpgpkeys/netpgpkeys.c
--- a/crypto/external/bsd/netpgp/dist/src/netpgpkeys/netpgpkeys.c       Sun May 16 06:21:14 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/netpgpkeys/netpgpkeys.c       Sun May 16 06:48:52 2010 +0000
@@ -205,6 +205,7 @@
        /* set some defaults */
        netpgp_set_homedir(&netpgp, getenv("HOME"), "/.gnupg", 1);
        netpgp_setvar(&netpgp, "sshkeydir", "/etc/ssh");
+       netpgp_setvar(&netpgp, "res", "<stdout>");
        optindex = 0;
        while ((ch = getopt_long(argc, argv, "", options, &optindex)) != -1) {
                switch (options[optindex].val) {
@@ -288,7 +289,7 @@
                                "No output filename argument provided\n");
                                exit(EXIT_ERROR);
                        }
-                       netpgp_setvar(&netpgp, "results", optarg);
+                       netpgp_setvar(&netpgp, "res", optarg);
                        break;
                case SSHKEYFILE:
                        netpgp_setvar(&netpgp, "sshkeyfile", optarg);



Home | Main Index | Thread Index | Old Index