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.

83 lines
2.1 KiB

  1. @rem = 'Perl from *.bat boilerplate
  2. @goto endofperl
  3. ';
  4. #=============================================================================
  5. #!perl
  6. #============================================================================
  7. # This file prints out the out-of-sync state of the current SLM subdirectory.
  8. # It attempts to print out only those changes that will be effected during a
  9. # "ssync -r" command.
  10. $usage1 = "Use -h for help.\n";
  11. $usage = <<END_OF_USAGE
  12. sstat: Print synchronization status for a SLM subtree.
  13. usage: sstat
  14. sstat prints out changes to files and directories that would be effected during
  15. an "ssync -r" command. It prints out the status for the subtree rooted at the
  16. current working directory.
  17. END_OF_USAGE
  18. ;
  19. die $usage if ($ARGV[0] ne ''); # Print usage info if requested.
  20. # Run the "status -rx" command to view the state of the tree.
  21. open (IN, "status -rx |")
  22. || die "Couldn't open input stream from \"status -rx\".\n$usage1";
  23. # Scan through each line, keeping track of the current subdirectory, and
  24. # printing out the status of out-of-sync files.
  25. while (<IN>) {
  26. chop;
  27. # If the current line specifies a new subdirectory, record it.
  28. if (/^Subdirectory /) {
  29. ($subdir = $_) =~ s/^Subdirectory \\([^ ]+), version.*/$1/;
  30. $subdir =~ s:\\:/:g;
  31. next;
  32. }
  33. # Skip non-file lines in the output.
  34. next if /^file / || /^$/ || /^Status for/;
  35. # Grab the file and state, and skip lines that are uninteresting.
  36. s/\s*$//;
  37. s/^(\S*)\s*(.*)/\1\2/;
  38. $file = $1;
  39. $stat = $2;
  40. next if ( ($stat =~ /in$/)
  41. || ($stat =~ /out$/)
  42. || ($stat =~ /deleted$/)
  43. || ($stat =~ /ghost$/)
  44. || ($stat =~ /\(dir\)$/)
  45. );
  46. $stat =~ s/^.*\*//;
  47. # Print out the status.
  48. print "$stat\t$subdir/$file\n";
  49. }
  50. close (IN);
  51. __END__
  52. #=============================================================================
  53. :endofperl
  54. @echo off
  55. set file=%0.bat
  56. set args=%1 %2 %3 %4 %5 %6 %7 %8 %9
  57. :loop
  58. shift
  59. set args=%args% %9
  60. if not "%9"=="" goto loop
  61. perl -S %file% %args%