#!/usr/bin/perl
# Copyright (C) 2004-2008, The Perl Foundation.
# $Id: /mirror/trunk/tools/dev/vms-patch 34494 2008-12-28T03:06:13.193195Z jkeenan  $

# usage:
# tools/dev/vms-patch < the_patch | patch -p0
# or some such

use warnings;
use strict;

# mangle vms-ish files to std patch format
# --- config/auto/snprintf.pm;1   Wed Aug 30 19:03:40 2006
# +++ config/auto/snprintf.pm;    Sun Sep  3 23:21:26 2006

while (<>) {
    m/^(---\s+.*?);\d+(\s+.*)/ && do {
	print "$1.old $2\n";
	next;
    };
    m/^(\+\+\+\s+.*?);(\s+.*)/ && do {
	print "$1 $2\n";
	next;
    };
    print;
}

