From 4b1b26ce1df737f8ce5a937d681183c6ff9caf84 Mon Sep 17 00:00:00 2001 From: Joey Schulze Date: Sun, 11 Nov 2001 16:41:31 +0000 Subject: [PATCH] Added support for special files "-" as placeholder for stdin/stdout for dtaus and control files --- dtaus.c | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/dtaus.c b/dtaus.c index 0a5602c..35ebd44 100644 --- a/dtaus.c +++ b/dtaus.c @@ -720,18 +720,25 @@ void dtaus2control (char *cdtaus, char *ccontrol) char x[30]; int index, countC; - if (!cdtaus) + if (!cdtaus) {{ if (!(fdtaus = fopen("DTAUS0.TXT", "r"))) if (!(fdtaus = fopen("dtaus0.txt", "r"))) return; - if (cdtaus) - if (!(fdtaus = fopen(cdtaus, "r"))) - return; - if (!ccontrol) + } else { + if (!strcmp (cdtaus, "-")) + fdtaus = stdin; + else + if (!(fdtaus = fopen(cdtaus, "r"))) + return; + } + if (!ccontrol) fcontrol = stdout; else - if (!(fcontrol = fopen(ccontrol, "w"))) - return; + if (!strcmp (ccontrol, "-")) + fcontrol = stdout; + else + if (!(fcontrol = fopen(ccontrol, "w"))) + return; if (!(buf = (char *)malloc (512))) return; @@ -856,25 +863,34 @@ int control2dtaus (char *ccontrol, char *cdtaus, char *cbeleg, char *ccheck) char *cp; int textindex = 0; - if (!cdtaus) + if (!cdtaus) { if (!(fdtaus = fopen("dtaus0.txt", "w"))) return 0; - if (cdtaus) - if (!(fdtaus = fopen(cdtaus, "w"))) - return 0; - if (!ccontrol) + } else { + if (!strcmp (cdtaus, "-")) + fdtaus = stdout; + else + if (!(fdtaus = fopen(cdtaus, "w"))) + return 0; + } + if (!ccontrol) { if (!(fcontrol = fopen("dtaus0.ctl", "r"))) if (!(fcontrol = fopen("DTAUS0.CTL", "r"))) return 0; - if (ccontrol) - if (!(fcontrol = fopen(ccontrol, "r"))) - return 0; - if (!cbeleg) + } else { + if (!strcmp (ccontrol, "-")) + fcontrol = stdin; + else + if (!(fcontrol = fopen(ccontrol, "r"))) + return 0; + } + if (!cbeleg) { if (!(fbeleg = fopen("dtaus0.doc", "w"))) return 0; - if (cbeleg) + } else { if (!(fbeleg = fopen(cbeleg, "w"))) return 0; + } if (!ccheck) fcheck = stdout; else -- 2.20.1