--- 1/draft-ietf-netmod-artwork-folding-06.txt 2019-07-24 11:13:37.721637337 -0700 +++ 2/draft-ietf-netmod-artwork-folding-07.txt 2019-07-24 11:13:37.769638550 -0700 @@ -1,21 +1,21 @@ NETMOD Working Group K. Watsen Internet-Draft Watsen Networks Intended status: Best Current Practice A. Farrel -Expires: December 29, 2019 Old Dog Consulting +Expires: January 24, 2020 Old Dog Consulting Q. Wu Huawei Technologies - June 27, 2019 + July 23, 2019 Handling Long Lines in Inclusions in Internet-Drafts and RFCs - draft-ietf-netmod-artwork-folding-06 + draft-ietf-netmod-artwork-folding-07 Abstract This document defines two strategies for handling long lines in width-bounded text content. One strategy is based on the historic use of a single backslash ('\') character to indicate where line- folding has occurred, with the continuation occurring with the first non-space (' ') character on the next line. The second strategy extends the first strategy by adding a second backslash character to identify where the continuation begins and thereby able to handle @@ -31,21 +31,21 @@ Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." - This Internet-Draft will expire on December 29, 2019. + This Internet-Draft will expire on January 24, 2020. Copyright Notice Copyright (c) 2019 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents @@ -94,21 +94,21 @@ 9.3.1. Using '\' . . . . . . . . . . . . . . . . . . . . . . 14 9.3.2. Using '\\' . . . . . . . . . . . . . . . . . . . . . 15 10. Security Considerations . . . . . . . . . . . . . . . . . . . 16 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 16 12.1. Normative References . . . . . . . . . . . . . . . . . . 16 12.2. Informative References . . . . . . . . . . . . . . . . . 16 Appendix A. POSIX Shell Script: rfcfold . . . . . . . . . . . . 18 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 26 - Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26 + Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 27 1. Introduction [RFC7994] sets out the requirements for plain-text RFCs and states that each line of an RFC (and hence of an Internet-Draft) must be limited to 72 characters followed by the character sequence that denotes an end-of-line (EOL). Internet-Drafts and RFCs often include example text or code fragments. Many times the example text or code exceeds the 72 @@ -791,73 +791,108 @@ purposely added to the script so as to ensure that the script is itself not folded in this document, thus simplify the ability to copy/paste the script for local use. As should be evident by the lack of the mandatory header described in Section 7.1.1, these backslashes do not designate a folded line, such as described in Section 7. #!/bin/bash --posix - # must use `bash` (not `sh`) # This script may need some adjustments to work on a given system. # For instance, the utilities `pcregrep` and `gsed` may need to - # be installed. + # be installed. Also, please be advised that `bash` (not `sh`) + # must be used. + + # Copyright (c) 2019 IETF Trust, Kent Watsen, and Erik Auerswald. + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions + # are met: + # + # * Redistributions of source code must retain the above copyright + # notice, this list of conditions and the following disclaimer. + # + # * Redistributions in binary form must reproduce the above + # copyright notice, this list of conditions and the following + # disclaimer in the documentation and/or other materials + # provided with the distribution. + # + # * Neither the name of Internet Society, IETF or IETF Trust, nor + # the names of specific contributors, may be used to endorse or + # promote products derived from this software without specific + # prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. print_usage() { - echo - echo "Folds the text file, only if needed, at the specified" - echo "column, according to BCP XX." - echo - echo "Usage: $0 [-s ] [-c ] [-r] -i " - echo " -o " - echo - echo " -s: strategy to use, '1' or '2' (default: try 1, else 2)" - echo " -c: column to fold on (default: 69)" - echo " -r: reverses the operation" - echo " -i: the input filename" - echo " -o: the output filename" - echo " -d: show debug messages" - echo " -q: quiet (suppress error messages)" - echo " -h: show this message" - echo - echo "Exit status code: zero on success, non-zero otherwise." - echo + printf "\n" + printf "Folds or unfolds the input text file according to BCP XX" + printf " (RFC XXXX).\n" + printf "\n" + printf "Usage: rfcfold [-s ] [-c ] [-r] -i " + printf " -o \n" + printf "\n" + printf " -s: strategy to use, '1' or '2' (default: try 1," + printf " else 2)\n" + printf " -c: column to fold on (default: 69)\n" + printf " -r: reverses the operation\n" + printf " -i: the input filename\n" + printf " -o: the output filename\n" + printf " -d: show debug messages\n" + printf " -q: quiet (suppress error messages)\n" + printf " -h: show this message\n" + printf "\n" + printf "Exit status code: 1 on error, 0 on success, -1 on no-op.\n" + printf "\n" } # global vars, do not edit strategy=0 # auto debug=0 quiet=0 reversed=0 infile="" outfile="" maxcol=69 # default, may be overridden by param hdr_txt_1="NOTE: '\\' line wrapping per BCP XX (RFC XXXX)" hdr_txt_2="NOTE: '\\\\' line wrapping per BCP XX (RFC XXXX)" - equal_chars="==============================================" + equal_chars="=======================================================" space_chars=" " temp_dir="" # determine name of [g]sed binary type gsed > /dev/null 2>&1 && SED=gsed || SED=sed # warn if a non-GNU sed utility is used "$SED" --version < /dev/null 2> /dev/null \ - | grep GNU >/dev/null 2>&1 || echo 'Warning: not using GNU sed' + | grep GNU >/dev/null 2>&1 || echo 'Warning: not using GNU `sed`.' # verify the availability of pcregrep type pcregrep > /dev/null 2>&1 || { echo 'Error: missing utility `pcregrep`' exit 1 } + cleanup() { rm -rf "$temp_dir" } trap 'cleanup' EXIT fold_it_1() { # ensure input file doesn't contain the fold-sequence already pcregrep -M "\\\\\n" $infile >> /dev/null 2>&1 if [[ $? -eq 0 ]]; then if [[ $quiet -eq 0 ]]; then