Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.8 KiB

  1. #
  2. # updtnum.pl
  3. #
  4. # Author: MikeCarl
  5. #
  6. # Written: 11-12-1999
  7. #
  8. # Abstract:
  9. # updtnum.pl will examine a specified file and update the build version
  10. # information located in it. the file will look something like
  11. # BUILDDATE=1999-11-12-2300
  12. # which means the current build is the build begun at 11pm on 11/12/1999.
  13. # the current file is set to %_NTBINDIR%\__blddate__
  14. #
  15. # simple test for usage
  16. if ( @ARGV > 0 ) {
  17. print( "\n" );
  18. print( "updtnum.pl\n\n" );
  19. print( " updtnum.pl takes no arguments, and will examine the file\n" );
  20. print( " %_NTBINDIR%\\__blddate__. It will increment the daily build\n" );
  21. print( " number, or if a new day has arrived, update the day and\n" );
  22. print( " reset the daily build number to zero.\n\n" );
  23. exit( 1 );
  24. }
  25. #define our defaults
  26. $BldDateFileName = "__blddate__";
  27. # set the full path to the root
  28. $BldDateFileFullPath = "$ENV{'_NTBINDIR'}\\$BldDateFileName";
  29. # get the current date
  30. ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =
  31. localtime( time );
  32. # perl docs _claim_ that the year has 1900 subtracted from it,
  33. # so add 1900 to the year
  34. if ($year >= 100) {
  35. $year -= 100;
  36. }
  37. # also note that $mon is 0..11, but i've chosen to add 1 when it's used below.
  38. # don't ask me why.
  39. # finally, if the hour/minute/month is less than 10, put a zero in front of it.
  40. if ( ($year) < 10 ) { $DateString .= "0"; }
  41. $DateString .= $year;
  42. if ( ($mon+1) < 10 ) { $DateString .= "0"; }
  43. $DateString .= ($mon + 1);
  44. if ( $mday < 10 ) { $DateString .= "0"; }
  45. $DateString .= $mday . "-";
  46. if ( $hour < 10 ) { $DateString .= "0"; }
  47. $DateString .= $hour;
  48. if ( $min < 10 ) { $DateString .= "0"; }
  49. $DateString .= $min;
  50. unless ( open( OUTFILE, ">$BldDateFileFullPath" ) ) {
  51. print( "Cannot open $BldDateFileFullPath for writing, exiting.\n" );
  52. exit( 1 );
  53. }
  54. if( (lc("$ENV{_BuildBranch}") eq lc("lab06_n")) && (-f "$ENV{_NTBINDIR}\\developer\\$ENV{USERNAME}\\__lb06dat__") ) {
  55. print( OUTFILE "BUILDDATE=", `type $ENV{_NTBINDIR}\\developer\\$ENV{USERNAME}\\__lb06dat__` );
  56. close( OUTFILE );
  57. unlink "$ENV{_NTBINDIR}\\developer\\$ENV{USERNAME}\\__lb06dat__";
  58. exit( 0 );
  59. }
  60. if( (lc("$ENV{_BuildBranch}") eq lc("lab07_n")) && (-f "$ENV{_NTBINDIR}\\developer\\$ENV{USERNAME}\\__lb07dat__") ) {
  61. print( OUTFILE "BUILDDATE=", `type $ENV{_NTBINDIR}\\developer\\$ENV{USERNAME}\\__lb07dat__` );
  62. close( OUTFILE );
  63. exit( 0 );
  64. }
  65. if( (lc("$ENV{_BuildBranch}") eq lc("jasbr")) && (-f "$ENV{_NTBINDIR}\\developer\\$ENV{USERNAME}\\__jasbrdat__") ) {
  66. print( OUTFILE "BUILDDATE=", `type $ENV{_NTBINDIR}\\developer\\$ENV{USERNAME}\\__jasbrdat__` );
  67. close( OUTFILE );
  68. exit( 0 );
  69. }
  70. print( OUTFILE "BUILDDATE=$DateString" );
  71. # uncomment the next line if you want a \n in the _blddate.h file
  72. # print( OUTFILE "\n" );
  73. close( OUTFILE );
  74. exit( 0 );