Changeset 14588 for trunk/base


Ignore:
Timestamp:
Oct 13, 2005, 12:59:16 AM (19 years ago)
Author:
jberry
Message:
  • Make a cmdname global to carry the shortened argv0
  • Use this instead of repeatedly coming to the same conclusion
  • Add our cmdname to --version message to make it a bit more clear, in a nod to Joe Auty, but without going into toooo much detail.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port/port.tcl

    r14586 r14588  
    33exec @TCLSH@ "$0" "$@"
    44# port.tcl
    5 # $Id: port.tcl,v 1.133 2005/10/12 22:36:18 jberry Exp $
     5# $Id: port.tcl,v 1.134 2005/10/13 00:59:16 jberry Exp $
    66#
    77# Copyright (c) 2004 Robert Shaw <rshaw@opendarwin.org>
     
    5454array set boot_env [array get env]
    5555
     56global argv0
     57set cmdname [file tail $argv0]
     58
    5659# UI Instantiations
    5760# ui_options(ports_debug) - If set, output debugging messages.
     
    135138# Standard procedures
    136139proc print_usage args {
    137         global argv0
    138         set cmd [file tail $argv0]
     140        global cmdname
    139141        set usage { [-vdqfonasbckt] [-D portdir] [-u porturl] action [actionflags]
    140142[[portname|pseudo-portname|port-url] [version] [+-variant]... [option=value]...]...
    141143}
    142144               
    143         puts "Usage: $cmd $usage"
    144         puts "\"$cmd help\" or \"man 1 port\" for more information."
     145        puts "Usage: $cmdname$usage"
     146        puts "\"$cmdname help\" or \"man 1 port\" for more information."
    145147}
    146148
    147149
    148150proc print_help args {
    149         global argv0
     151        global cmdname
    150152       
    151153        set help { [-vdqfonasbckt] [-D portdir] [-u porturl] action [actionflags]
     
    186188        }
    187189       
    188         puts "[file tail $argv0]$help"
     190        puts "$cmdname$help"
    189191}
    190192
     
    10751077                # Process long arguments
    10761078                switch -- $arg {
    1077                         --version       { ui_warn {(please use "version" to get version information)}; set action "version" }
     1079                        --version       { ui_warn "(please use \"$cmdname version\" to get version information)"; set action "version" }
    10781080                        default         { print_usage; exit 1 }
    10791081                }
Note: See TracChangeset for help on using the changeset viewer.