svnno****@sourc*****
svnno****@sourc*****
2013年 3月 23日 (土) 20:04:58 JST
Revision: 5166 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5166 Author: yutakapon Date: 2013-03-23 20:04:58 +0900 (Sat, 23 Mar 2013) Log Message: ----------- logrotate マクロコマンドのサイズに、KB/MB指定をできるようにした。 Modified Paths: -------------- trunk/doc/en/html/macro/command/logrotate.html trunk/doc/ja/html/macro/command/logrotate.html trunk/teraterm/ttpmacro/ttl.c -------------- next part -------------- Modified: trunk/doc/en/html/macro/command/logrotate.html =================================================================== --- trunk/doc/en/html/macro/command/logrotate.html 2013-03-23 10:39:50 UTC (rev 5165) +++ trunk/doc/en/html/macro/command/logrotate.html 2013-03-23 11:04:58 UTC (rev 5166) @@ -18,7 +18,7 @@ </p> <pre class="macro-syntax"> -logrotate 'size' <size> +logrotate 'size' '<size>' logrotate 'rotate' <count> logrotate 'halt' </pre> @@ -28,7 +28,9 @@ <dl> <dt class="macro">'size' <size></dt> <dd>When a log file size is over <size> byte, the log file is be rotated.<br> - The <size> value must be larger than 128.</dd> + The <size> value must be larger than 128.<br> + If the <size> is followed by K, the size is assumed to be in kilobytes. + If the M is used, the size is in megabytes.</dd> <dt class="macro">'rotate' <count></dt> <dd>Log files are rotated <count> times before being removed.<br> @@ -47,7 +49,7 @@ logopen 'teraterm_sample.log' 0 0 ; Start log rotation -logrotate 'size' 2048 +logrotate 'size' '32K' logrotate 'rotate' 3 pause 600 Modified: trunk/doc/ja/html/macro/command/logrotate.html =================================================================== --- trunk/doc/ja/html/macro/command/logrotate.html 2013-03-23 10:39:50 UTC (rev 5165) +++ trunk/doc/ja/html/macro/command/logrotate.html 2013-03-23 11:04:58 UTC (rev 5166) @@ -18,7 +18,7 @@ </p> <pre class="macro-syntax"> -logrotate 'size' <size> +logrotate 'size' '<size>' logrotate 'rotate' <count> logrotate 'halt' </pre> @@ -27,9 +27,10 @@ <h2>\x83p\x83\x89\x83\x81\x81[\x83^</h2> <dl> - <dt class="macro">'size' <size></dt> + <dt class="macro">'size' '<size>'</dt> <dd>\x83\x8D\x83O\x82̃T\x83C\x83Y\x82\xAA<size>\x83o\x83C\x83g\x82\xA6\x82Ă\xA2\x82\xEA\x82A\x83\x8D\x81[\x83e\x81[\x83V\x83\x87\x83\x93\x82\xF0\x8Ds\x82\xA4\x81B<br> - <size>\x82\xCD128\x88ȏ\xE3\x82ł\xA0\x82邱\x82ƁB</dd> + <size>\x82\xCD128\x88ȏ\xE3\x82ł\xA0\x82邱\x82ƁB<br> + \x96\x96\x94\xF6\x82\xC9"K"\x82\xAA\x82\xA0\x82\xE9\x82ƃL\x83\x8D\x83o\x83C\x83g\x92P\x88ʁA"M"\x82\xAA\x82\xA0\x82\xE9\x82ƃ\x81\x83K\x83o\x83C\x83g\x92P\x88ʂɂȂ\xE9\x81B</dd> <dt class="macro">'rotate' <count></dt> <dd>\x83\x8D\x83O\x83t\x83@\x83C\x83\x8B\x82̐\xA2\x91\xE3\x82\xF0<count>\x82ɂ\xB7\x82\xE9\x81B<br> @@ -49,7 +50,7 @@ logopen 'teraterm_sample.log' 0 0 ; Start log rotation -logrotate 'size' 2048 +logrotate 'size' '32K' logrotate 'rotate' 3 pause 600 Modified: trunk/teraterm/ttpmacro/ttl.c =================================================================== --- trunk/teraterm/ttpmacro/ttl.c 2013-03-23 10:39:50 UTC (rev 5165) +++ trunk/teraterm/ttpmacro/ttl.c 2013-03-23 11:04:58 UTC (rev 5166) @@ -2871,8 +2871,9 @@ { WORD Err; char Str[MaxStrLen]; + char Str2[MaxStrLen]; char buf[MaxStrLen*2]; - int size, num; + int size, num, len; Err = 0; GetStrVal(Str, &Err); @@ -2885,7 +2886,23 @@ if (CheckParameterGiven()) { Err = 0; size = 0; - GetIntVal(&size, &Err); + GetStrVal(Str2, &Err); + if (Err == 0) { + len = strlen(Str2); + if (isdigit(Str2[len-1])) { + num = 1; + } else if (Str2[len-1] == 'K') { + Str2[len-1] = 0; + num = 1024; + } else if (Str2[len-1] == 'M') { + Str2[len-1] = 0; + num = 1024*1024; + } else { + Err = ErrSyntax; + } + size = atoi(Str2) * num; + } + if (size < 128) Err = ErrSyntax; if (Err == 0)