DoctorD90

VersChk.tcl 1.0.0

Apr 22nd, 2013
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 1.59 KB | None | 0 0
  1. ### VersChk.tcl 1.0.0 mQARWRMG
  2.  
  3. #REQUIREMENTS
  4. # PBinSrc.tcl fMrtKqyq
  5.  
  6. #LICENSE
  7. # Copyright © 2013 Alberto Dietze "DoctorD90"
  8. #
  9. #    This program is free software: you can redistribute it and/or modify
  10. #    it under the terms of the GNU General Public License as published by
  11. #    the Free Software Foundation, either version 3 of the License, or
  12. #    (at your option) any later version.
  13. #
  14. #    This program is distributed in the hope that it will be useful,
  15. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. #    GNU General Public License for more details.
  18. #
  19. #    You should have received a copy of the GNU General Public License
  20. #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  21. #
  22. # Full GPLv3 Text: http://www.gnu.org/licenses/gpl.txt
  23.  
  24. #PATERNITY
  25. #Coder: DoctorD90
  26. #Network: irc.OnlineGamesNet.net
  27. #Chan: #eHito
  28.  
  29. #PURPOSE
  30. #Compare 2 versions number made up of 3 numbers, and know if 2nd is newer than 1st.
  31.  
  32. #USAGE
  33. #Split versions numbers in lists of
  34. #elements (ex. 1.0.0 -> [split "1.0.0" "."]).
  35. #If it returns 1, 2nd is newer than 1st,
  36. #else it is not.
  37.  
  38.  
  39. ### DON'T EDIT ANYTHING BELOW ###
  40.  
  41. proc vers_chker {v1 v2} {
  42.   #base vers
  43.   set v11 [lindex $v1 0]
  44.   set v12 [lindex $v1 1]
  45.   set v13 [lindex $v1 2]
  46.   #chk vers
  47.   set v21 [lindex $v2 0]
  48.   set v22 [lindex $v2 1]
  49.   set v23 [lindex $v2 2]
  50.   if {$v21 > $v11} { return 1 }
  51.   if {$v22 > $v12} { return 1 }
  52.   if {$v23 > $v13} { return 1 }
  53.   return 0
  54. }
  55.  
  56. ###
  57. putlog "VersChk.tcl LOADED"
Advertisement