[Pkg-voip-commits] [dahdi-tools] 115/285: dahdi_cfg: can optionally read config from stdin

tzafrir at debian.org tzafrir at debian.org
Thu Jul 7 19:18:41 UTC 2016


This is an automated email from the git hooks/post-receive script.

tzafrir pushed a commit to branch master
in repository dahdi-tools.

commit dc5c7de9fcd3080fd8ae0a455d22368f4af81f9f
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Sun Oct 6 16:10:48 2013 +0300

    dahdi_cfg: can optionally read config from stdin
    
    Allow for the convention of '-' marking stdin:
    
      dahdi_cfg -c -
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
---
 dahdi_cfg.c     | 5 ++++-
 doc/dahdi_cfg.8 | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/dahdi_cfg.c b/dahdi_cfg.c
index 3dfaf42..349a0af 100644
--- a/dahdi_cfg.c
+++ b/dahdi_cfg.c
@@ -1500,7 +1500,10 @@ int main(int argc, char *argv[])
 		error("Unable to open master device '%s'\n", MASTER_DEVICE);
 		goto finish;
 	}
-	cf = fopen(filename, "r");
+	if (strcmp(filename, "-") == 0)
+		cf = fdopen(STDIN_FILENO, "r");
+	else
+		cf = fopen(filename, "r");
 	if (cf) {
 		while((buf = readline())) {
 			if (*buf == 10) /* skip new line */
diff --git a/doc/dahdi_cfg.8 b/doc/dahdi_cfg.8
index 5e1eaa2..a5d0595 100644
--- a/doc/dahdi_cfg.8
+++ b/doc/dahdi_cfg.8
@@ -24,6 +24,8 @@ the DAHDI init script.
 .RS
 Use an alternative configuration file instead of
 .I /etc/dahdi/system.conf
+
+If \fICFG_FILE\fR is '\fB\-\fR', it is read from stdin.
 .RE
 
 .B \-C \fICHANNELS

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/dahdi-tools.git



More information about the Pkg-voip-commits mailing list