Skip to content
Permalink
Browse files

Add channel parameter to ui_puts to select between stderr and stdout.

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@1452 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
Kevin Van Vechten
Kevin Van Vechten committed Dec 18, 2002
1 parent 9dbd514 commit 7e3d1d02b157289036896d65cc113c5ea449d4b7
Showing with 10 additions and 10 deletions.
  1. +9 −9 src/darwinports1.0/darwinportsui.tcl
  2. +1 −1 src/port1.0/portutil.tcl
@@ -108,14 +108,14 @@ proc ui_enabled {} {
# the UI model in use. If you don't want newlines to be output, you
# must pass "-nonewline" as the second argument.

proc ui_puts {str {nonl ""}} {
proc ui_puts {chan str {nonl ""}} {
if ![ui_enabled] return

if {$nonl == "-nonewline"} {
puts -nonewline stdout "$str"
flush stdout
puts -nonewline $chan "$str"
flush $chan
} else {
puts "$str"
puts $chan "$str"
}
}

@@ -133,7 +133,7 @@ proc ui_info {str {nonl ""}} {
global system_options

if [isset ports_verbose] {
ui_puts "$str" $nonl
ui_puts stdout "$str" $nonl
}
}

@@ -142,13 +142,13 @@ proc ui_msg {str {nonl ""}} {
global system_options

if ![isset ports_quiet] {
ui_puts "$str" $nonl
ui_puts stdout "$str" $nonl
}
}

# Output message unconditionally as an error message.
proc ui_error {str} {
ui_puts "Error: $str"
ui_puts stderr "Error: $str"
}

# Get a line of input from the user and store in str, returning the
@@ -172,7 +172,7 @@ proc ui_gets {str} {
proc ui_yesno {promptstr {defvalue ""}} {
set satisfaction no
while {$satisfaction == "no"} {
ui_puts $promptstr -nonewline
ui_puts stdout $promptstr -nonewline
if {[ui_gets mystr] == 0} {
if {[string length $defvalue] > 0} {
set mystr $defvalue
@@ -198,7 +198,7 @@ proc ui_yesno {promptstr {defvalue ""}} {
# the user's acknowledgement of the prompt string passed in
# "promptstr". There is no return value.
proc ui_confirm {promptstr} {
ui_puts "$promptstr" -nonewline
ui_puts stdout "$promptstr" -nonewline
ui_gets garbagestr
}

@@ -621,7 +621,7 @@ proc open_statefile {args} {
set fd [open $statefile a+]
if [catch {flock $fd -exclusive -noblock} result] {
if {"$result" == "EAGAIN"} {
ui_puts "Waiting for lock on $statefile"
ui_msg "Waiting for lock on $statefile"
} elseif {"$result" == "EOPNOTSUPP"} {
# Locking not supported, just return
return $fd

0 comments on commit 7e3d1d0

Please sign in to comment.
You can’t perform that action at this time.