diff --git a/bin/cgilib.rc b/bin/cgilib.rc index 1dc3ad3..1bc9cc3 100644 --- a/bin/cgilib.rc +++ b/bin/cgilib.rc @@ -94,6 +94,20 @@ BEGIN { ' } +fn crop_text { + max_chars = $0 + awk -v max'='^$max_chars^' ' ' + { + nc += 1 + length; + if(nc > max) { + print substr($0, 1, nc - max) "..." + exit + } + print + }' +} + + # Cookies fn set_cookie { # TODO: should check input values more carefully