From f3196bbd10295ad341d3e21dc138d0ca7a6671d2 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sun, 9 Apr 2023 02:12:54 +0200 Subject: [PATCH] -b option: redirect stdout/stderr to /dev/null, better explain -b in help, update manpage, and docs --- doc/manpages/xschem.1.in | 10 +++++++++- doc/xschem_man/run_xschem.html | 2 +- src/main.c | 8 +++++++- src/xschem.help | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/manpages/xschem.1.in b/doc/manpages/xschem.1.in index fb78049a..0c56ea8b 100644 --- a/doc/manpages/xschem.1.in +++ b/doc/manpages/xschem.1.in @@ -39,7 +39,7 @@ Print help and exit. .TP .B -b, --detach -Detach xschem from console. +Detach xschem from console (no output and no input from console) .TP .B -n, --netlist @@ -66,6 +66,10 @@ Set netlist type to Verilog. Execute specified tcl instructions before any other action, this can be used to change xschemrc variables. .TP +.B --preinit +Execute specified tcl instructions before any other action and before loading xschemrc. +.TP + .B --command Execute specified tcl commands after completing startup. .TP @@ -74,6 +78,10 @@ Execute specified tcl commands after completing startup. Execute specified tcl file as a command script (perhaps with xschem commands). .TP +.B --diff +Show differences with given file. +.TP + .B --tcp-port Listen to specified tcp port for client connections. (number >=1024). .TP diff --git a/doc/xschem_man/run_xschem.html b/doc/xschem_man/run_xschem.html index 4f08612c..9d5ae7fb 100644 --- a/doc/xschem_man/run_xschem.html +++ b/doc/xschem_man/run_xschem.html @@ -47,7 +47,7 @@ user:~$ xschem .../xschem_library/examples/0_examples_top.sch usage: xschem [options] [schematic | symbol ] Options: -h --help Print this help. - -b --detach Detach Xschem from console and fork in the background. + -b --detach Detach Xschem from console (no output and no input from console) -n --netlist Do a netlist of the given schematic cell. -v --version Print version information and exit. -V --vhdl Set netlist type to VHDL. diff --git a/src/main.c b/src/main.c index 526ea826..647ac7b1 100644 --- a/src/main.c +++ b/src/main.c @@ -101,7 +101,13 @@ int main(int argc, char **argv) } - if(detach) fclose(stdin); + if(detach) { + fclose(stdin); + #ifdef __unix__ + freopen("/dev/null", "w", stdout); + freopen("/dev/null", "w", stderr); + #endif + } if(detach && has_x) { Tcl_FindExecutable(argv[0]); /* tcl stores executable name for its internal usage */ interp = Tcl_CreateInterp(); /* create the tcl interpreter */ diff --git a/src/xschem.help b/src/xschem.help index 8d23c329..26ca1676 100644 --- a/src/xschem.help +++ b/src/xschem.help @@ -1,7 +1,7 @@ usage: xschem [options] [schematic | symbol ] Options: -h --help Print this help. - -b --detach Detach Xschem from console and fork in the background. + -b --detach Detach Xschem from console (no output and no input from console) -n --netlist Do a netlist of the given schematic cell. -v --version Print version information and exit. -V --vhdl Set netlist type to VHDL.