=== modified file 'stagebuilder.prolog' --- stagebuilder.prolog 2011-10-22 22:34:58 +0000 +++ stagebuilder.prolog 2011-10-21 17:27:15 +0000 @@ -59,18 +59,6 @@ is_list(X) -> X = S; atom(X) -> name(X, S). -str(A + B, S) :- - str(A, AS), - str(B, BS), - append(AS, BS, S). - -str(A +/+ B, E) :- - str(A, AS), - str(B, BS), - rstrip("/", AS, AP), - lstrip("/", BS, BP), - concat([AP, "/", BP], E). - escape(U, ES) :- str(U, US), (( @@ -85,6 +73,8 @@ escape(variable(Name), E) :- concat(["${", Name, "}"], E). +escape(A+B, E) :- concat([A, B], S), escape(S, E). + escape(A+B, E) :- escape(A, AE), escape(B, BE), @@ -253,15 +243,9 @@ cmd_tokens(chroot(Dir, Args), E) :- cmd_tokens(run([Dir +/+ 'chroot.sh'|Args]), E). -format_cmds([], []). -format_cmds([Cmd|R], [S|SR]) :- +print_cmds([]). +print_cmds([Cmd|R]) :- cmd_tokens(Cmd, Tokens), strjoin(" ", Tokens, S), - format_cmds(R, SR). - -print_cmds([]). -print_cmds(Commands) :- - format_cmds(Commands, Lines), - strjoin("\n", Lines, S), name(N,S), - write(N). + write(N), write('\n'), print_cmds(R).