Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/src/cmd/tex/unbackslsh.awk

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#! /usr/bin/awk -f
# The relevant lines look like `  \'.
/^ *\\$/{
	  if (!backslashed)
	    {
	      #print "not backslashed -- setting to empty backslash";
	      backslashed = $0;
	    }
	  next;
	}
/\\$/	{
          if (backslashed)
            {
              #print "already backslashed";
              print backslashed;
            }
            
          backslashed = $0;
          #print "setting bs to " backslashed;
          next;
        }

/^ *$/	{ 
          if (backslashed)
	    {
	      #print "spaces only -- prev was backslashed";
	      print substr (backslashed, 1, length (backslashed) - 1);
  	      backslashed = "";
	    }
	  else
	    {
	      #print "spaces only -- prev not backslashed";
	      print;
	    }
	  next;
	}

	{ 
          if (backslashed)
	    {
	      #print "normal line -- prev backslashed";
  	      print backslashed;
  	      backslashed = "";
	    }
	  print
	}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.