Code Monkey home page Code Monkey logo

typescript2txt's Introduction

#typescript2txt

typescript2txt is a program to strip out (some of) the extra control characters from the output of the unix script command.

It attempts to address the bug mentioned in the unix man page:

 Script places everything in the log file, including linefeeds and
 backspaces.  This is not what the naive user expects.

And generate output closer to what the naive user would expect.

#Usage

typescript2txt < output_of_script_cmd > output_as_plain_text

#Compilation

The code is set up to compile under linux using gcc and gmake.

make

Will compile everything and produce a typescript2txt executable. No install target has been created. You'll need to copy the executable to an appropriate directory.

#History

This program was inspired by code written by John C. McCabe-Dansted ([email protected]) in 2008 and posted at https://launchpadlibrarian.net/14571190/script2txt.c as part of a bug report on launchpad. It had some memory access problems (that kept RadixSeven from using it as-is) so he decided to fix it. In order to share it with the world, he made a github repo for it.

After fixing the memory access and trying to fix other things RadixSeven realized the process of making it usable would be much faster and produce better code if he just rewrote everything from scratch. This resulted in the code you see here.

#Testing Philosophy

You can run the tests assuming you have diff installed.

The tests are very minimal. It takes a lot of time to write good tests. The initial author did not want to invest that time. There is usually only one test for a code. So most of the complexity of the implementation is not tested.

Further, only tests for codes actually implemented are included. This means that any code that is supposed to generate a warning or a code that is ignored is likely to be absent from the test suite.

Anyone who would like to is welcome to make things more robust by fleshing out the test cases to really check the functionality. Other users should be aware that there are likely to be major bugs that didn't interfere with the purposes of the earlier authors.

The test cases were created by:

  1. Creating a file containing the desired input named *_input.txt

  2. Dumping that file to a terminal window (either Gnome's terminal or Konsole depending on which computer the developer was using at the time)

  3. Copying the new contents of the terminal window to the expected_output.txt file

#Source for console codes

The files I used to crib the console codes from are in the reference directory. Their original locations are http://www.kernel.org/doc/man-pages/online/pages/man4/console_codes.4.html and http://www.kitebird.com/csh-tcsh-book/ctlseqs.pdf

typescript2txt's People

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.