os/boardsupport/haitest/bspsvs/suite/bsp/uart/group/uartscript.pl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/boardsupport/haitest/bspsvs/suite/bsp/uart/group/uartscript.pl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,79 @@
     1.4 +#
     1.5 +# Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +# All rights reserved.
     1.7 +# This component and the accompanying materials are made available
     1.8 +# under the terms of "Eclipse Public License v1.0"
     1.9 +# which accompanies this distribution, and is available
    1.10 +# at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +#
    1.12 +# Initial Contributors:
    1.13 +# Nokia Corporation - initial contribution.
    1.14 +#
    1.15 +# Contributors:
    1.16 +#
    1.17 +# Description:
    1.18 +#
    1.19 +
    1.20 +use Getopt::Long;
    1.21 +
    1.22 +sub Usage()
    1.23 +	{
    1.24 +	print <<USAGE_EOF;
    1.25 +Usage
    1.26 +perl uartscript.pl --in=FileNameIn --out=FileNameOut --port=Port --baud=Baud --help
    1.27 +
    1.28 +    --in=FileNameIn             : Input file name
    1.29 +
    1.30 +    --out=FileNameOut           : Output file name
    1.31 +
    1.32 +    --port=Port                 : Serial port number
    1.33 +
    1.34 +    --baud=Baud                 : Baud rate of the port
    1.35 +
    1.36 +    --help                      : This help
    1.37 +USAGE_EOF
    1.38 +	exit( 0 )
    1.39 +	}
    1.40 +
    1.41 +sub main()
    1.42 +{
    1.43 +	my	$help='';
    1.44 +	my	$input="";
    1.45 +	my	$output="";
    1.46 +	my	$port="";
    1.47 +	my	$baud="";
    1.48 +
    1.49 +	GetOptions(
    1.50 +		'in=s'		=> \$input,
    1.51 +		'out=s'		=> \$output,
    1.52 +		'port=s'	=> \$port,
    1.53 +		'baud=s'	=> \$baud,
    1.54 +		'help' 		=> \$help
    1.55 +	);
    1.56 +
    1.57 +	if($help or ($input eq "") or ($output eq "") or ($port eq "") or ($baud eq ""))
    1.58 +		{
    1.59 +		Usage();
    1.60 +		exit(0);
    1.61 +		}
    1.62 +
    1.63 +	open(FIN, $input);
    1.64 +	open(FOUT, ">$output");
    1.65 +
    1.66 +	foreach (<FIN>)
    1.67 +	{
    1.68 +		if (/<port>/)
    1.69 +		{
    1.70 +			s/<port>/$port/;
    1.71 +		}
    1.72 +		if (/<baud>/)
    1.73 +		{
    1.74 +			s/<baud>/$baud/;
    1.75 +		}
    1.76 +		print FOUT $_;
    1.77 +	}
    1.78 +	close(FIN);
    1.79 +	close(FOUT);
    1.80 +}
    1.81 +
    1.82 +main();