403Webshell
Server IP : 82.208.35.60  /  Your IP : 216.73.217.33
Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31
System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64
User : studiokobylisy_cz ( 1008)
PHP Version : 7.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/local/share/doc/slang/tm/tools/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/share/doc/slang/tm/tools/fixtxt
#!/usr/bin/env jed-script

if (__argc != 2)
{
   () = fprintf (stderr, "Usage: %s file.txt\n", __argv[0]);
   exit (1);
}

% The txt file looks ugly and the contents at the beginning are
% totally misleading.

static define process_file (file)
{
   variable txt;

   () = read_file (file);
   % trim excess blank lines
   trim_buffer ();

   % fix the underscore chars
   bob ();
   while (fsearch ("_.ds h "))
     {
	deln (7);
	insert ("_");
	% Unfortunately, there are other things associated with this that are
	% messed up.  See my debian linuxdoc bug report.  In particular, the
	% table of contents associated with this are hosed and possibly the
	% rest of the text on this line.  Here is a fix for contents.
	push_spot ();
	bol_skip_white ();
	push_mark ();
	skip_chars ("0-9.");
	variable sect = bufsubstr ();
	skip_white ();
	push_mark ();
	eol ();
	txt = bufsubstr ();
	eob ();
	() = bsearch ("Table of Contents");
	sect = strcat ("  ",sect," ");
	if (bol_fsearch (sect))
	  {
	     go_right(strlen (sect));
	     del_eol ();
	     insert (txt);
	  }
	pop_spot ();
     }

   % Delete the contents at the beginning.  They are wrong.
   bob ();
   if (fsearch ("Table of Contents"))
     {
	bol ();
	push_mark ();
	if (fsearch ("____________________________________________"))
	  {
	     go_down(1);
	     del_region ();
	     % Grab the contents from the bottom
	     push_spot ();
	     eob ();
	     () = bsearch ("Table of Contents");
	     bol ();
	     push_mark ();
	     % Get rid of . . . stufff since the page numbers are meaningless
	     while (re_fsearch ("\\d$"))
	       {
		  eol ();
		  push_mark ();
		  bskip_chars ("[0-9]");
		  bskip_chars (" .");
		  del_region ();
	       }
	     eob ();
	     txt = bufsubstr_delete ();
	     pop_spot ();
	     insert (txt);
	  }
	else pop_mark (0);
     }

   save_buffer ();
}

process_file (__argv[1]);
exit (0);


Youez - 2016 - github.com/yon3zu
LinuXploit