security/nss/coreconf/coreconf.pl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 #
     2 # This Source Code Form is subject to the terms of the Mozilla Public
     3 # License, v. 2.0. If a copy of the MPL was not distributed with this
     4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
     5 sub recursive_copy {
     6     local($fromdir);
     7     local($todir);
     8     local(@dirlist);
     9     $fromdir = shift;
    10     $todir = shift;
    12     print STDERR "recursive copy called with $fromdir, $todir\n";
    14 #remove any trailing slashes.
    15     $fromdir =~ s/\/$//;
    16     $todir =~ s/\/$//;
    18     opendir(DIR, $fromdir);
    19     @dirlist = readdir DIR;
    20     close DIR;
    23     foreach $file (@dirlist) {
    24 	if  (! (($file eq "." ) || ($file eq "..") )) {
    26 	    if (-d "$fromdir/$file") {
    27 		print STDERR "handling directory $todir/$file\n";
    28 		&rec_mkdir("$todir/$file");
    29 		&recursive_copy("$fromdir/$file","$todir/$file");
    30 	    }
    31 	    else {
    32 		print STDERR "handling file $fromdir/$file\n";
    33 		&my_copy("$fromdir/$file","$todir/$file");
    34 	    }
    35 	}
    36     }
    37 }
    39 sub parse_argv {
    41 #    print STDERR "Parsing Variables\n";
    43     foreach $q ( @ARGV ) {
    44 	if (! ($q =~ /=/)) {
    45 	    $var{$lastassigned} .= " $q";
    46 	}
    47 	else {
    48 	   $q =~ /^([^=]*)=(.*)/;
    49 	   $left = $1;
    50 	   $right = $2;
    52 	   $right =~ s/ *$//;
    53 	   $var{$left} = $right;
    55 	   $lastassigned = $left;
    57 	   }
    58 	print STDERR "Assigned $lastassigned = $var{$lastassigned}\n";
    59     }
    60 }
    63 # usage: &my_copy("dir/fromfile","dir2/tofile");
    64 # do a 'copy' - files only, 'to' MUST be a filename, not a directory.
    66 # fix this to be able to use copy on win nt.
    68 sub my_copy {
    69     local($from);
    70     local($to);
    71     local($cpcmd);
    73     $from = shift;
    74     $to = shift;
    76     if ( ! defined $var{OS_ARCH}) {
    77 	die "OS_ARCH not defined!";
    78     }
    79     else {
    80 	if ($var{OS_ARCH} eq 'WINNT') {
    81 	    $cpcmd = 'cp';
    82 	    	}
    83 	else {
    84 	    $cpcmd = 'cp';
    85 	    }
    86 	print STDERR "COPYING: $cpcmd $from $to\n";
    87 	system("$cpcmd $from $to");
    88     }
    89 }
    92 sub old_my_copy {
    93     local($from);
    94     local($to);
    96     $from = shift;
    97     $to = shift;
    98     open(FIN, "<$from") || die("Can't read from file $from\n");
    99     if ( ! open(FOUT,">$to")) {
   100 	close FIN;
   101 	die "Can't write to file $to\n";
   102     }
   103     while (read(FIN, $buf, 100000)) {
   104 	print FOUT $buf;
   105     }
   106     close (FIN);
   107     close (FOUT);
   108 }
   110 sub rec_mkdir {
   111     local($arg);
   112     local($t);
   113     local($q);
   115     $arg = shift;
   116     $t = "";
   117     foreach $q (split(/\//,$arg)) {
   118 	$t .= $q;
   119 	if (! ($t =~ /\.\.$/)) {
   120 	    if ($t =~ /./) {
   121 		mkdir($t,0775);
   122 	    }
   123 	}
   124 	$t.= '/';
   125     }
   126 }
   128 1;

mercurial