Posted to tcl by kostix at Thu Aug 30 22:16:32 GMT 2007view raw

  1. proc FrobnicateFoo args {
  2. set dircmd ""
  3. set filecmd ""
  4.  
  5. foreach {opt val} {
  6. switch -- $opt {
  7. -dircmd -
  8. -dircommand {
  9. set dircmd $val
  10. }
  11. -filecmd -
  12. -filecommand {
  13. set filecmd $val
  14. }
  15. default {
  16. return -code error "bad option \"$opt\":
  17. must be one of -dircommand or -filecommand"
  18. }
  19. }
  20. }
  21.  
  22. ...
  23. }
  24.