File: regRestorer.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 (51 lines) | stat: -rwxr-xr-x 1,336 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
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/perl

# This script takes as STDIN an output from the regFixer.pl
# and reformat the file as if it would have been exported from the registry
#
# Note: the output file is not exactly the one we get when exporting from
#       regedit, the tiny difference is that multilines (which were 
#       single-linized by regFixer.pl) values are not re-multi-linized by 
#       this script.
#
# Copyright 1999 Sylvain St-Germain
# 

${newkey} = "";
${key}    = "";   
${data}   = "";   

# I do not validate the integrity of the file, I am assuming that 
# the input file comes from the output of regFixer.pl, therefore things 
# should be ok, if they are not, investigate and send me an email...

LINE: while(<>) {
  chomp;                             # get rid of new line

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

  (${key}, ${data}, ${rest})= split /]/,$_ ; # Extract the values from the line

  ${key}  = "${key}]";               # put the ']' back there...

  if (${rest} ne "")                 # concat we had more than 1 ']' 
  {                                  # on the line
    ${data} = "${data}]${rest}"; 
  }

  if (${key} eq ${newkey})
  {
    print "${data}\n";
  }
  else
  {
    ${newkey} = ${key};             # assign it

    print "\n";
    print "${key}\n";
    print "${data}\n";
  }
}