# Copyright 2002-2007 Interchange Development Group and others
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.  See the LICENSE file for details.
# 
# $Id: file.coretag,v 1.6 2007-03-30 23:40:49 pajamian Exp $

UserTag file                Order        name type
UserTag file                PosNumber    2
UserTag file                Version      $Revision: 1.6 $
UserTag file                Routine      <<EOR
sub {
	my ($file, $type) = @_;
    return readfile($file)
		unless $type;
	return readfile($file, undef, 0)
		if $type eq 'raw';
	my $text = readfile($file);
	if($type =~ /mac/i) {
		$text =~ tr/\n/\r/;
	}
	elsif($type =~ /dos|window/i) {
		$text =~ s/\n/\r\n/g;
	}
	elsif($type =~ /unix/i) {
		if($text=~ /\n/) {
			$text =~ tr/\r/\n/;
		}
		else {
			$text =~ s/\r\n/\n/g;
		}
	}
	return $text;
}
EOR
