equal
  deleted
  inserted
  replaced
  
    
    
|         |      1 # Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). | 
|         |      2 # All rights reserved. | 
|         |      3 # This component and the accompanying materials are made available | 
|         |      4 # under the terms of "Eclipse Public License v1.0" | 
|         |      5 # which accompanies this distribution, and is available | 
|         |      6 # at the URL "http://www.eclipse.org/legal/epl-v10.html". | 
|         |      7 # | 
|         |      8 # Initial Contributors: | 
|         |      9 # Nokia Corporation - initial contribution. | 
|         |     10 # | 
|         |     11 # Contributors: | 
|         |     12 # | 
|         |     13 # Description: | 
|         |     14 # | 
|         |     15  | 
|         |     16 #!perl | 
|         |     17  | 
|         |     18 $count = @ARGV; | 
|         |     19 die "ERROR: Bad arguments\n\nUsage: \n\nlogsplit logfilename\n\n" if ($count!=1); | 
|         |     20  | 
|         |     21 $state = 1; | 
|         |     22 while (<>) { | 
|         |     23 	if ($state==1) { | 
|         |     24 		# regular expression here searching for ---->START | 
|         |     25 		if (/=====> START /) { | 
|         |     26 			@fields = split /\[/; | 
|         |     27 			shift @fields; | 
|         |     28 			@fields = split /\]/; | 
|         |     29 			$_ = shift @fields; | 
|         |     30 			@fields = split / /; | 
|         |     31 			$filename = $fields[2]; | 
|         |     32 			@fields = split /\\/, $filename; | 
|         |     33 			$filename = $fields[@fields-1]; | 
|         |     34 			# open file here | 
|         |     35 			print "$filename \n"; | 
|         |     36 			open LOGHANDLE, ">$filename" | 
|         |     37 				or die "FAILED: opening file $filename.\n($!)\n"; | 
|         |     38 			$state=2; | 
|         |     39 		} | 
|         |     40 	} | 
|         |     41 	elsif ($state==2) { | 
|         |     42 		# regular expression here searching for ---->STOP | 
|         |     43 		if (/=====> STOP /) { | 
|         |     44 			# check that start and stop matches ? | 
|         |     45 			# close file here | 
|         |     46 			close LOGHANDLE; | 
|         |     47 			$state=1; | 
|         |     48 		} | 
|         |     49 		elsif (/=====> START /) { | 
|         |     50 			# Start found during a file...? | 
|         |     51 			close LOGHANDLE; | 
|         |     52 			die "FAILED: source file corrupt!\n\n"; | 
|         |     53 		} | 
|         |     54 		else { | 
|         |     55 			print LOGHANDLE $_; | 
|         |     56 			# write line to file | 
|         |     57 		} | 
|         |     58 	} | 
|         |     59 } |