Revision: 9282 https://osdn.net/projects/ttssh2/scm/svn/commits/9282 Author: zmatsuo Date: 2021-05-25 23:03:07 +0900 (Tue, 25 May 2021) Log Message: ----------- 標準入力から読めるよう2sjis.plを修正 Modified Paths: -------------- trunk/doc/convtext.bat trunk/installer/2sjis.pl -------------- next part -------------- Modified: trunk/doc/convtext.bat =================================================================== --- trunk/doc/convtext.bat 2021-05-25 14:02:57 UTC (rev 9281) +++ trunk/doc/convtext.bat 2021-05-25 14:03:07 UTC (rev 9282) @@ -16,17 +16,13 @@ %TOSJIS% -i ..\cygterm\COPYING -o %REF_J%\CygTerm+-LICENSE.txt -l unix %ZLIBCP% -i ..\libs\zlib\README -o %REF_E%\zlib-LICENSE.txt -l unix %ZLIBCP% -i ..\libs\zlib\README -o %REF_J%\zlib-LICENSE.txt -l unix +%TOSJIS% -i ..\libs\cJSON\LICENSE -o %REF_E%\cJSON-LICENSE.txt -l crlf %TOSJIS% -i ..\libs\cJSON\LICENSE -o %REF_J%\cJSON-LICENSE.txt -l crlf -%TOSJIS% -i ..\libs\cJSON\LICENSE -o %REF_E%\cJSON-LICENSE.txt -l crlf %TOSJIS% -i ..\libs\argon2\LICENSE -o %REF_E%\argon2-LICENSE.txt -l unix %TOSJIS% -i ..\libs\argon2\LICENSE -o %REF_J%\argon2-LICENSE.txt -l unix -perl -C0 -pe "s/^\xef\xbb\xbf//" ja/html/reference/build_with_cmake.md | perl Markdown_1.0.1/Markdown.pl > ja/html/reference/build_with_cmake_utf8.html -%TOSJIS% -i ja/html/reference/build_with_cmake_utf8.html -o ja/html/reference/build_with_cmake.html -c utf8 -perl -C0 -pe "s/^\xef\xbb\xbf//" en/html/reference/build_with_cmake.md | perl Markdown_1.0.1/Markdown.pl > en/html/reference/build_with_cmake_utf8.html -%TOSJIS% -i en/html/reference/build_with_cmake_utf8.html -o en/html/reference/build_with_cmake.html -c utf8 +perl -C0 -pe "s/^\xef\xbb\xbf//" %REF_J%/build_with_cmake.md | perl Markdown_1.0.1/Markdown.pl | %TOSJIS% -i - -o %REF_J%/build_with_cmake.html -c utf8 +perl -C0 -pe "s/^\xef\xbb\xbf//" %REF_E%/build_with_cmake.md | perl Markdown_1.0.1/Markdown.pl | %TOSJIS% -i - -o %REF_E%/build_with_cmake.html -c utf8 -perl -C0 -pe "s/^\xef\xbb\xbf//" ja/html/reference/build_library_with_cmake.md | perl Markdown_1.0.1/Markdown.pl > ja/html/reference/build_library_with_cmake_utf8.html -%TOSJIS% -i ja/html/reference/build_library_with_cmake_utf8.html -o ja/html/reference/build_library_with_cmake.html -c utf8 -perl -C0 -pe "s/^\xef\xbb\xbf//" en/html/reference/build_library_with_cmake.md | perl Markdown_1.0.1/Markdown.pl > en/html/reference/build_library_with_cmake_utf8.html -%TOSJIS% -i en/html/reference/build_library_with_cmake_utf8.html -o en/html/reference/build_library_with_cmake.html -c utf8 +perl -C0 -pe "s/^\xef\xbb\xbf//" %REF_J%/build_library_with_cmake.md | perl Markdown_1.0.1/Markdown.pl | %TOSJIS% -i - -o %REF_J%/build_library_with_cmake.html -c utf8 +perl -C0 -pe "s/^\xef\xbb\xbf//" %REF_E%/build_library_with_cmake.md | perl Markdown_1.0.1/Markdown.pl | %TOSJIS% -i - -o %REF_E%/build_library_with_cmake.html -c utf8 Modified: trunk/installer/2sjis.pl =================================================================== --- trunk/installer/2sjis.pl 2021-05-25 14:02:57 UTC (rev 9281) +++ trunk/installer/2sjis.pl 2021-05-25 14:03:07 UTC (rev 9282) @@ -1,33 +1,41 @@ -#!/usr/bin/perl -w - -require 5.8.0; -use strict; -use Encode; -use utf8; -use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat); - -my($in, $out, $coding, $lf, $result); - -# default setting -$coding = "shiftjis"; -$lf = "crlf"; - -$result = GetOptions('in|i=s' => \$in, - 'out|o=s' => \$out, - 'coding|c=s' => \$coding, - 'lf|l=s' => \$lf); - -if (!(defined($in) && defined($out))) { - die "Usage: $0 --in file --out file [ --coding input_encoding ] [ --lf line_format ]\n"; -} - -open (IN, "<:$lf:encoding($coding)", $in); -open (OUT, '>:crlf:encoding(shiftjis)', $out); -while (<IN>) { - print OUT $_; -} -close OUT; -close IN; - -my(@filestat) = stat $in; -utime $filestat[8], $filestat[9], $out; +#!/usr/bin/perl -w + +require 5.8.0; +use strict; +use Encode; +use utf8; +use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat); + +my($in, $out, $coding, $lf, $result); + +# default setting +$coding = "shiftjis"; +$lf = "crlf"; + +$result = GetOptions('in|i=s' => \$in, + 'out|o=s' => \$out, + 'coding|c=s' => \$coding, + 'lf|l=s' => \$lf); + +if (!(defined($in) && defined($out))) { + die "Usage: $0 --in file --out file [ --coding input_encoding ] [ --lf line_format ]\n"; +} + +my $IN; +if ($in eq "-") { + binmode STDIN, ":$lf:encoding($coding)"; + $IN = *STDIN; +} else { + open ($IN, "<:$lf:encoding($coding)", $in); +} +open (OUT, '>:crlf:encoding(shiftjis)', $out); +while (<$IN>) { + print OUT $_; +} +close OUT; +close $IN; + +if ($in ne "-") { + my(@filestat) = stat $in; + utime $filestat[8], $filestat[9], $out; +}