File: man.sl

package info (click to toggle)
jed 0.98.7-14
  • links: PTS
  • area: main
  • in suites: slink
  • size: 3,088 kB
  • ctags: 3,851
  • sloc: ansic: 29,315; makefile: 257; sh: 248
file content (48 lines) | stat: -rw-r--r-- 1,060 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
%%
%%  execute man then remove backspaces
%%

%!% remove _^H and ^H combinations and multiple blank lines (man page)
define man_clean_manpage ()
{
   variable clean = "Cleaning man page...";

   push_spot_bob ();

   flush (clean);
   replace ("_\010", Null_String);	% remove _^H underscores
   while ( fsearch ("\010") )
     {
	del ();
	del ();
     }				% remove overstrike
   trim_buffer ();		% remove multiple blank lines
   pop_spot ();

   flush (strcat (clean, "done"));
}

%!% retrieve a man page entry and use clean_manpage to clean it up
define unix_man ()
{
   variable subj, buf = "*manual-entry*", msg = "Getting man page...";

   subj = read_mini ("man", Null_String, Null_String);
   !if ( strlen (subj) ) return;

   pop2buf (buf);
   set_readonly (0);
   erase_buffer ();
   flush (msg);
#ifdef OS2
   () = run_shell_cmd (sprintf ("man %s 2> nul", subj));
#else
   () = run_shell_cmd (sprintf ("man %s 2> /dev/null", subj));
#endif
   man_clean_manpage ();
   bob ();
   set_buffer_modified_flag (0);
   most_mode ();
   set_readonly (1);
}