]> xenbits.xensource.com Git - pvdrivers/win/xenhid.git/commit
Scripted replacement of Copyright notices in source
authorOwen Smith <owen.smith@cloud.com>
Tue, 28 Mar 2023 11:50:40 +0000 (12:50 +0100)
committerPaul Durrant <pdurrant@amazon.com>
Fri, 31 Mar 2023 19:19:46 +0000 (20:19 +0100)
commit9485a0c881ff9f4f7a2f32b71b12aa2b07ab312f
tree4378df0a64e2985278c438e5dfd716c3294338de
parent199f585d3f4b9125f802423796a8badf19fbbe29
Scripted replacement of Copyright notices in source

Due to a transfer of copyright ownership from Citrix to Cloud Software Group,
the copyright notices in all source files should be updated.

Using the powershell script below replace "Copyright (c) Citrix Systems, Inc."
with "Copyright (c) Xen Project." and "Copyright (c) Cloud Software Group, Inc."

Function Multiline-Replace {
    param(
        [string]$Filename,
        [string]$ToReplace,
        [array]$ReplaceWith
    )

    $content = Get-Content $Filename
    $replace = $false
    $output = ""
    $content | ForEach {
        $line = $_
        if ($line.Contains($ToReplace)) {
            $replace = $true
            $ReplaceWith | ForEach {
                $output += $line.Replace($ToReplace, $_) + "`n"
            }
        } else {
            $output += $line + "`n"
        }
    }
    if ($replace) {
        Write-Host "Replacing: " $Filename
        $output | Set-Content $Filename
    } else {
        Write-Host "Ignoring:  " $Filename
    }
}

Function Replace-Filestrings {
    param(
        [array]$FilleTypes,
        [string]$ToReplace,
        [array]$Replacements,
        [array]$ExcludeList
    )

    $FileTypes | ForEach {
        Get-ChildItem $_ -Recurse | ForEach-Object {
            $filename = $_
            if (($ExcludeList | %{ $filename -Like $_ }) -Contains $True) {
                Write-Host "Excluding: " $filename
            } else {
                Multiline-Replace $_ $ToReplace $Replacements
            }
        }
    }
}

$ExcludeList = @("*include\xen\*", "*\obj\*")
$Replace = "Copyright (c) Citrix Systems Inc."

$Replacements = @("/* Copyright (c) Xen Project.", " * Copyright (c) Cloud Software Group, Inc.")
$FileTypes = @("*.c", "*.h", "*.rc")
Replace-Filestrings $FileTypes ('/* ' + $Replace) $Replacements $ExcludeList

$Replacements = @("; // Copyright (c) Xen Project.", "; // Copyright (c) Cloud Software Group, Inc.")
$FileTypes = @("*.mc")
Replace-Filestrings $FileTypes ('; // ' + $Replace) $Replacements $ExcludeList

$Replacements = @("; Copyright (c) Xen Project.", "; Copyright (c) Cloud Software Group, Inc.")
$FileTypes = @("*.inf", "*.def")
Replace-Filestrings $FileTypes ('; ' + $Replace) $Replacements $ExcludeList

$Replacements = @("Copyright (c) Xen Project.", "Copyright (c) Cloud Software Group, Inc.")
$FileTypes = @("LICENSE")
Replace-Filestrings $FileTypes $Replace $Replacements $ExcludeList

Signed-off-by: Owen Smith <owen.smith@citrix.com>
Manually fixed whitespace at end of files.

Signed-off-by: Owen Smith <owen.smith@citrix.com>
22 files changed:
LICENSE
include/hid_interface.h
include/store_interface.h
include/suspend_interface.h
src/coinst/coinst.c
src/coinst/xenhid_coinst.def
src/coinst/xenhid_coinst.rc
src/xenhid.inf
src/xenhid/assert.h
src/xenhid/dbg_print.h
src/xenhid/driver.c
src/xenhid/driver.h
src/xenhid/fdo.c
src/xenhid/fdo.h
src/xenhid/names.h
src/xenhid/string.c
src/xenhid/string.h
src/xenhid/thread.c
src/xenhid/thread.h
src/xenhid/types.h
src/xenhid/util.h
src/xenhid/xenhid.rc