Fetching machine platform info from tcl_platform array

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Fetching machine platform info from tcl_platform array

  • Creator
    Topic
  • #53074
    Faraz Khan
    Participant

      Here’s the function code for fetching machine info from tcl_platform array:

      Following values can be passed as parameter:

      “byteOrder” , “debug”, “machine”, “os”, “osVersion”, “platform”, “threaded”, “user”, “wordSize”, “pointerSize”.

      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      proc fnGetPlatformInfo { key args} {

      upvar tcl_platform   tcl_platform

      set kee $key

      if [ catch {

      foreach {key value} [array get tcl_platform] {

      if {$key == $kee} {

      return $value

      }

      }

      } err ] {

      return $err

      }

      return $value

        }

      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      Usage Sample:

      #To get process user:

      set user [fnGetPlatformInfo “user”]

      puts “Process executing by user: $user”

      #To get Operating system:

      set oS [fnGetPlatformInfo “os”]

      puts “Operating System: $oS”

      #To get Operating System version:

      set oSv [fnGetPlatformInfo “osVersion”]

      puts “Operating System version: $oSv”

    • The forum ‘Cloverleaf’ is closed to new topics and replies.