diff --git a/cdist/conf/type/__ini_value/files/comment.awk b/cdist/conf/type/__ini_value/files/comment.awk new file mode 100644 index 00000000..1d3c04b7 --- /dev/null +++ b/cdist/conf/type/__ini_value/files/comment.awk @@ -0,0 +1,57 @@ +# We try to find a comment block -- how? +# check how much paragraphs it has +# check if +# +# this code is crap - at least not well written + +# Check the buffer if the comment was found +function check_comments() { + _lastline = bufindex - (buflen - 1) + _comm_size = length(comments) + + lastfreeline = 0 + lastfreecommline = 0 + comm_index = 0 + + # go through all lines + for(i = bufindex; i < _lastline; i++) { + _line = trim(linebuf[i]) + + # empty line? + if(_line == "") { + lastfreeline = i + continue + } + + # line start matched + if(_line == trim(comments[comm_index])) { + # end? else continue + if(comm_index < _comm_size) { + continue + } + else { + + } + } + # reset again cause not matched + else comm_index = 0 + + # empty comment line + if(is_comment(_line)) { + _comment = trim(substr(_line, 2)) + + # check if empty comment + if(_comment == "") { + lastfreecommline = i + } + } + + # check if comments fit in or is too big + if((_lastline - bufindex) < _comm_size) { + # too short + } + else { + #if() + } + } +}