File: regFixer.pl

package info (click to toggle)
wine 0.0.20000109-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 22,652 kB
  • ctags: 59,973
  • sloc: ansic: 342,054; perl: 3,697; yacc: 3,059; tcl: 2,647; makefile: 2,466; lex: 1,494; sh: 394
file content (41 lines) | stat: -rwxr-xr-x 1,147 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/perl

# This script takes as STDIN an output from the Registry 
# (export from regedit.exe) and prefixes every subkey-value 
# pair by their hkey,key data member
#
# Copyright 1999 Sylvain St-Germain
# 

${prefix} = "";
${line}   = "";   

LINE: while(<>) {
  chomp;                    # Get rid of 0x0a

  next LINE if(/^$/);       # This is an empty line

  if( /^\[/ ) {
    ${prefix} = ${_};       # assign the prefix for the forthcomming section
    next LINE;
  }
  s/\\\\/\\/g;              # Still some more substitutions... To fix paths...

  s/^  //;                  # Get rid of the stupid two spaces at the begining
                            # they are there in the case of a multi-line thing

  if (/\\$/) {              # The line ends with '\', it means it is a multi
    s/\\$//;                # line thing, remove it.
    
    ${line} = "${line}${_}";# Add the current line to the line to output
    next LINE;              # process the next line
  }

  ${line} = "${line}${_}";  # Set line to the multi line thing+the current line

  print "${prefix}${line}\n";  
  ${line} = "";             # start over...
}