/
file.coretag
35 lines (34 loc) · 952 Bytes
/
file.coretag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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.
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