Add -i (interactive) option to vvp.

This forces <stdout> to be unbuffered. This is useful when using the
mintty terminal emulator in Windows (as used by MSYS2 and CygWin),
which identifies as a pipe, not a tty.
This commit is contained in:
Martin Whitaker 2015-05-16 00:39:03 +01:00
parent b6304129fa
commit c75498b1d4
2 changed files with 10 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2013 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2015 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -316,12 +316,13 @@ int main(int argc, char*argv[])
/* For non-interactive runs we do not want to run the interactive
* debugger, so make $stop just execute a $finish. */
stop_is_finish = false;
while ((opt = getopt(argc, argv, "+hl:M:m:nNsvV")) != EOF) switch (opt) {
while ((opt = getopt(argc, argv, "+hil:M:m:nNsvV")) != EOF) switch (opt) {
case 'h':
fprintf(stderr,
"Usage: vvp [options] input-file [+plusargs...]\n"
"Options:\n"
" -h Print this help message.\n"
" -i Interactive mode (unbuffered stdio).\n"
" -l file Logfile, '-' for <stderr>\n"
" -M path VPI module directory\n"
" -M - Clear VPI module path\n"
@ -332,6 +333,9 @@ int main(int argc, char*argv[])
" -v Verbose progress messages.\n"
" -V Print the version information.\n" );
exit(0);
case 'i':
setvbuf(stdout, 0, _IONBF, 0);
break;
case 'l':
logfile_name = optarg;
break;

View File

@ -4,7 +4,7 @@ vvp - Icarus Verilog vvp runtime engine
.SH SYNOPSIS
.B vvp
[\-nNsvV] [\-Mpath] [\-mmodule] [\-llogfile] inputfile [extended-args...]
[\-inNsvV] [\-Mpath] [\-mmodule] [\-llogfile] inputfile [extended-args...]
.SH DESCRIPTION
.PP
@ -16,6 +16,9 @@ command is not by itself executable on any platform. Instead, the
.SH OPTIONS
\fIvvp\fP accepts the following options:
.TP 8
.B -i
This flag causes all output to <stdout> to be unbuffered.
.TP 8
.B -l\fIlogfile\fP
This flag specifies a logfile where all MCI <stdlog> output goes.
Specify logfile as '\-' to send log output to <stderr>. $display and