"Fossies" - the Fresh Open Source Software Archive

Member "workman.sh" (16 Jul 2018, 618 Bytes) of package /linux/misc/tzcode2018i.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "workman.sh": 2018e_vs_2018f.

    1 #! /bin/sh
    2 # Convert manual page troff stdin to formatted .txt stdout.
    3 
    4 # This file is in the public domain, so clarified as of
    5 # 2009-05-17 by Arthur David Olson.
    6 
    7 # Tell groff not to emit SGR escape sequences (ANSI color escapes).
    8 GROFF_NO_SGR=1
    9 export GROFF_NO_SGR
   10 
   11 echo ".am TH
   12 .hy 0
   13 .na
   14 ..
   15 .rm }H
   16 .rm }F" | nroff -man - ${1+"$@"} | perl -ne '
   17     binmode STDIN, '\'':encoding(utf8)'\'';
   18     binmode STDOUT, '\'':encoding(utf8)'\'';
   19     chomp;
   20     s/.\010//g;
   21     s/\s*$//;
   22     if (/^$/) {
   23         $sawblank = 1;
   24         next;
   25     } else {
   26         if ($sawblank && $didprint) {
   27             print "\n";
   28             $sawblank = 0;
   29         }
   30         print "$_\n";
   31         $didprint = 1;
   32     }
   33 '