X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/3f07a40e5a17c2bce4d90e1a154f8a73d476aaaa..82a0d609e39bb052f31efb7b70fe3b84fe4221a3:/src/plugins/bind.sml diff --git a/src/plugins/bind.sml b/src/plugins/bind.sml index 9a05dce..217ef45 100644 --- a/src/plugins/bind.sml +++ b/src/plugins/bind.sml @@ -131,7 +131,7 @@ val monthToInt = fn Date.Jan => 1 fun padBy ch amt s = if size s < amt then - CharVector.tabulate (amt, fn _ => ch) ^ s + CharVector.tabulate (amt - size s, fn _ => ch) ^ s else s @@ -177,13 +177,15 @@ val () = Slave.registerFileHandler (fn fs => val min = readILine inf val () = TextIO.closeIn inf + val serialPath = OS.Path.joinDirFile {dir = Config.serialDir, + file = #domain fs} + val oldSerial = let - val inf = TextIO.openIn (OS.Path.joinDirFile {dir = #dir fs, - file = "serial"}) + val inf = TextIO.openIn serialPath in SOME (readLine inf) before TextIO.closeIn inf - end handle IO.Io _ => NONE + end handle IO.Io {name, ...} => NONE val newSerial = case serial of @@ -205,8 +207,7 @@ val () = Slave.registerFileHandler (fn fs => "00") end - val outf = TextIO.openOut (OS.Path.joinDirFile {dir = #dir fs, - file = "serial"}) + val outf = TextIO.openOut serialPath val _ = TextIO.output (outf, newSerial) val _ = TextIO.closeOut outf