Giter VIP home page Giter VIP logo

rfcfold's Introduction

rfcfold

rfcfold is a Bash script that folds or unfolds a text file according to RFC 8792, Handling Long Lines in Content of Internet-Drafts and RFCs. The (un)folding operations are implemented with grep and sed.

rfcfold Usage

Invoking rfcfold with the -h option shows usage information:

Folds or unfolds the input text file according to RFC 8792.

Usage: rfcfold [-h] [-V] [-d] [-q] [-s <strategy>] [-c <col>] [-r] -i <infile> -o <outfile>

  -s: strategy to use, '1' or '2' (default: try 1, else 2)
  -c: column to fold on (default: 69)
  -r: reverses the operation
  -i: the input filename
  -o: the output filename
  -d: show debug messages (unless -q is given)
  -q: quiet (suppress error and debug messages)
  -h: show this message
  -V: print version information

Exit status code: 1 on error, 0 on success, 255 on no-op.

Examples

  1. Fold the file original.txt and write the result to folded.txt:

    rfcfold -i original.txt -o folded.txt

  2. Unfold the file folded.txt and write the result to unfolded.txt:

    rfcfold -r -i folded.txt -o unfolded.txt

Changes between versions

Noteworthy changes between versions of rfcfold can be found in the NEWS.md file.

Limitations

rfcfold has some limitations, because its primary intended use is for text file inclusions in IETF RFC and Internet-Draft (I-D) documents, and because it is implemented as a Bash script relying on grep and sed.

TAB is Prohibited

The primary application of rfcfold lies in creating text files that can be included in IETF RFC and I-D documents by ensuring a maximum line length (in characters). Thus the input file is not allowed to contain TAB characters, because they are not allowed for text fragments in an RFC.

ASCII Control and Non-ASCII is Unsupported

Most ASCII control characters and non-ASCII characters are problematic in the context of IETF RFC and I-D documents, and rfcfold emits a warning if it finds them in the input data. IETF RFC and I-D documents allow limited use of UTF-8 encoded Unicode characters, but rfcfold does not take Unicode specifics into account.

Unicode is Unsupported

Depending on the operating system respectively the available grep and sed implementations, rfcfold may be able to process Unicode text files, but with limitations. The display width of Unicode characters is not taken into consideration when folding. Every character is assumed to have single width. Since printable Unicode characters can be wider than single width, and some implementations even display some single width characters with more than single width, the end result may not look as expected. There are additional complications with Unicode, e.g., combining characters, none of which are taken into account by rfcfold. As such Unicode is not supported by rfcfold.

grep and sed

Usage of both grep and sed conforms to the POSIX specification.

On non-GNU systems, GNU tools are often installed to complement the system-provided ones. On such systems, GNU grep and GNU sed are used if they are available as ggrep and gsed.

Use of both GNU grep and GNU sed may increase the maximum usable value for the folding column over using system-provided grep and sed.

rfcfold's People

Contributors

auerswal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.