....................................../////.===Shadow-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 217.79.180.202  /  Your IP : 216.73.216.107
Web Server : Apache
System : Linux vps2460721.fastwebserver.de 5.15.0-122-generic #132-Ubuntu SMP Thu Aug 29 13:45:52 UTC 2024 x86_64
User : tecnoelite ( 1001)
PHP Version : 8.1.2-1ubuntu2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/groff/groffer/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/groff/groffer/man.pl
#! /usr/bin/perl

# groffer - display groff files

# Source file position: <groff-source>/contrib/groffer/man.pl
# Installed position: <prefix>/lib/groff/groffer/man.pl

# Copyright (C) 2006-2018 Free Software Foundation, Inc.
# Written by Bernd Warken <groff-bernd.warken-72@web.de>.

# This file is part of 'groffer', which is part of 'groff'.

# 'groff' is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.

# 'groff' is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see
# <http://www.gnu.org/licenses/gpl-2.0.html>.

########################################################################

use strict;
use warnings;

########################################################################
# functions for apropos, man, whatis
########################################################################

##########
# apropos_filespec()
#
# Compose temporary file for filspec.
#
# Globals:  in: $main::Opt{'APROPOS'}, $main::Special_Setup, $main::Filespec_Arg,
#               $main::Apropos_Prog, $main::Opt{'APROPOS_SECTIONS'}, $main::Opt{'SECTIONS'}
#          out: $main::Special_Filespec
#
sub apropos_filespec {
  return 0 unless $main::Opt{'APROPOS'};
  die 'apropos_filespec(): apropos_setup() must be run first;'
    unless $main::Special_Setup;
  die 'apropos_filespec(): no $main::Filespec_Arg is set;'
    unless defined $main::Filespec_Arg;
  $main::Special_Filespec = 1;

  my $s;
  if ($main::No_Filespecs) {
    &to_tmp_line('.SH no filespec');
    $s = `$main::Apropos_Prog`;
    $s =~ s/^/\\\&/;
    &to_tmp_line($s);
    return 1;
  }

  $s = $main::Filespec_Arg;
  $s =~ s/[^\\]-/\\-/g;
  &to_tmp_line(".SH $s");

  if ( $main::Opt{'APROPOS_SECTIONS'} ) {
    $s = qr/^[^\(]*\([$main::Opt{'APROPOS_SECTIONS'}]/;
  } else {
    if ( $main::Opt{'SECTIONS'} ) {
      $s = $main::Opt{'SECTIONS'};
      $s = qr/^[^\(]*\([$s]/;
    } else {
      $s = qr/^.*\(.+\).*$/;
    }
  }

### apropos_filespec()
  my $filespec = $main::Filespec_Arg;
  $filespec =~ s#/#\\/#g;
  $filespec =~ s#\.#\\./#g;
  my @ap;
  foreach ( `$main::Apropos_Prog $main::Filespec_Arg 2>$main::Dev_Null` ) {
    chomp;
    if (/^$filespec:\s/) {	# for error messages of this script
      my $line = $_;
      $line =~ s/^(.*)$/\\\&$1/s;
      push @ap, $line;
    }
    if (/$s/) {
      push @ap, $_;
    }
  }
  my @res;
  foreach (sort @ap) {
    s/^
      ([^\(]+\(+[$main::Man{'AUTO_SEC_CHARS'}][^\)]*\)+)
      (\s*-*)*\s*
      (.*)
      $/.br\n.TP 15\n.BR "$1"\n\\\&$3\n/sx;
    push @res, $_;
  }
  &to_tmp_line(@res);
  1;
}				# apropos_filespec()


##########
# apropos_setup()
#
# Setup for the --apropos* options, just 2 global variables are set.
#
# Globals:  in: $main::Opt{'APROPOS'}
#          out: $main::Special_Setup, $main::Apropos_Prog
#
sub apropos_setup {
  return 0 unless $main::Opt{'APROPOS'};
  if ( &where_is_prog('apropos') ) {
    $main::Apropos_Prog = 'apropos';
  } elsif ( &where_is_prog('man') ) {
    if (! system("man --apropos man >$main::Dev_Null 2>$main::Dev_Null")) {
      $main::Apropos_Prog = 'man --apropos';
    } elsif (! system("man -k man >$main::Dev_Null 2>$main::Dev_Null")) {
      $main::Apropos_Prog = 'man --k';
    }
  }				# test man
  die 'apropos_setup(): no apropos program available;'
    unless $main::Apropos_Prog;
  &to_tmp_line('.TH GROFFER APROPOS');
  $main::Special_Setup = 1;
  $main::Opt{'TITLE'} = 'apropos' unless $main::Opt{'TITLE'};
  1;
}				# apropos_setup()


##########
# is_man(<man_sec_ext-hash-ref>)
#
# Test whether the argument hash exists as man page (from is_man()).
#
# Globals: in: $main::Man{AUTO_SEC_CHARS},$main::Man{SEC_CHARS},
#              $main::Man{EXT}, $tmpdir
#         out: $main::Manspec
#
# Arguments: 1, a hash reference with keys 'name', 'sec', 'ext', where
#               'sec' is a string of one or several section characters
#
sub is_man {
  my $n = @_;
  die "is_man(): one argument is needed, you used $n;"
    unless $n == 1;
  die "is_man(): the argument is not a hash reference '$_[0]';"
    if ref($_[0]) ne 'HASH';
  die 'is_man(): temporary directory is not set;' unless $main::tmpdir;
  die 'is_man(): man_setup() must be run first;' unless $main::Man{'IS_SETUP'};

  my $name = $_[0]->{'name'};
  unless ($name) {
    $main::Manspec = '';
    return 0;
  }

  my $sec;
  $sec = $_[0]->{'sec'};
  $sec = $main::Man{'SEC_CHARS'} unless $sec;
  $sec = $main::Man{'AUTO_SEC_CHARS'} unless $sec;
  $sec = '' unless defined $sec;
  # take care, $sec may be several sections

### is_man()
  my $ext;
  $ext = $_[0]->{'ext'};
  $ext = $main::Man{'EXT'} unless $ext;
  $ext = '' unless defined $ext;

  $main::Manspec = "$name.$sec,$ext";
  my @m;
  if (exists $main::Man{'MANSPEC'}{$main::Manspec}) {
    return 1;
  } else {
    foreach my $p ( @{$main::Man{'PATH'}} ) {
      foreach my $s (split //, $sec) {
	my $dir = File::Spec->catdir($p, "man$s");
	next unless -d $dir;
	my $file = File::Spec->catfile($dir, "$name.$s$ext");
	push @m, glob("$file*");
      }
    }
    $main::Man{'MANSPEC'}{$main::Manspec} = \@m;
  }
  return 0 unless (@m);
  return 1;
} # is_man()


##########
# man_get (<man_sec_ext-hash-ref>)
#
# Write a man page to the temporary file.
#
# Globals in: $main::Manspec, $main::Man{MANSPEC}, $main::Man{SEC_CHARS},
#             $main::Man{EXT}, $main::Man{ALL}
#
# Arguments: 1, a hash reference with keys 'name', 'sec', 'ext', where
#               'sec' is a string of one or several section characters
#
sub man_get {
  my $n = @_;
  die "man_get(): one argument is needed, you used $n;"
    unless $n == 1;
  die "man_get(): the argument is not a hash reference '$_[0]';"
    if ref($_[0]) ne 'HASH';
  die "man_get(): is_man() must be run first on the argument;"
    unless $main::Manspec;
  die "man_get(): wrong hash reference '$_[0]', no 'name' key;"
    unless exists $_[0]->{'name'};

  my ($name, $sec, $ext, $f, $path);
  $name = $_[0]->{'name'};
  die "man_get(): empty 'name' key in the argument;" unless $name;

  $sec = $_[0]->{'sec'};
  $sec = $main::Man{'SEC_CHARS'} if (! $sec) and $main::Man{'SEC_CHARS'};
  $sec = '' unless defined $sec;
  # take care $sec may be several sections

### man_get()
  $ext = $_[0]->{'ext'};
  $ext = $main::Man{'EXT'} unless $ext;
  $ext = '' unless defined $ext;

  die 'man_get(): $main::Manspec does not suit the arguments;'
    if ($main::Manspec ne "$name.$sec,$ext") and
      (! exists $main::Man{'MANSPEC'}{$main::Manspec});

  if ($main::Man{'ALL'}) {
    my $ok;
    my %list;
    foreach ( @{$main::Man{'MANSPEC'}{$main::Manspec}} ) {
      next if exists $list{$_};
      if (-f $_ and -r $_) {
	$list{$_} = 1;
	&to_tmp($_);
	$ok = 1;
      }
    }
    &register_title("man:$name") if $ok;
    return 1;
  }

  # not $main::Man{'ALL'}

  if ($_[0]->{'sec'}) {
    my $path = File::Spec->catfile('', "man$sec", $name);
    if ($ext) {
      foreach $f ( @{$main::Man{'MANSPEC'}{$main::Manspec}} ) {
	if ($f =~ m#$path\.$sec$ext($|\..*$)#) {
	  if (-f $f && -r $f) {
	    &register_file($f);
	    return 1;
	  }
	}			# if $f =~
      }				# foreach $f
### man_get()
      foreach $f ( @{$main::Man{'MANSPEC'}{$main::Manspec}} ) {
	if ($f =~ m#$path\.$sec$ext.*$#) {
	  if (-f $f && -r $f) {
	    &register_file($f);
	    return 1;
	  }
	}			# if $f =~
      }				# foreach $f
    } else {			# $ext is empty
      foreach $f ( @{$main::Man{'MANSPEC'}{$main::Manspec}} ) {
	if ($f =~ m#$path\.$sec($|\..*$)#) {
	  if (-f $f && -r $f) {
	    #	    &to_tmp($f) && &register_file($f);
	    &register_file($f);
	    return 1;
	  }
	}			# if $f =~
      }				# foreach $f
      foreach $f ( @{$main::Man{'MANSPEC'}{$main::Manspec}} ) {
	if ($f =~ m#$path\.$sec.*$#) {
	  if (-f $f && -r $f) {
	    #	    &to_tmp($f) && &register_file($f);
	    &register_file($f);
	    return 1;
	  }
	}			# if $f =~
      }				# foreach $f
    }				# if $ext
### man_get()
  } else {			# sec is empty
    my $m = $main::Man{'SEC_CHARS'};
    $m = $main::Man{'AUTO_SEC_CHARS'} unless $m;
    foreach my $s (split //, $m) {
      my $path = File::Spec->catfile('', "man$s", $name);
      unless ($ext) {
	foreach my $f ( @{$main::Man{'MANSPEC'}{$main::Manspec}} ) {
	  if ( $f =~ m#$path\.$s($|\..*$)# ) {
	    if (-f $f && -r $f) {
	      #	      &to_tmp($f) && &register_file($f);
	      &register_file($f);
	      return 1;
	    }
	  }			# if $f =~
	}			# foreach $f
      }				# unless $ext
      foreach $f ( @{$main::Man{'MANSPEC'}{$main::Manspec}} ) {
	if ($f =~ m#$path\.$s$ext.*$#) {
	  if (-f $f && -r $f) {
	    #	    &to_tmp($f) && &register_file($f);
	    &register_file($f);
	    return 1;
	  }
	}			# if $f =~
      }				# foreach $f
    }				# foreach $s
  }				# if sec

  1;
} # man_get()


##########
# man_setup ()
#
# Setup the variables in %MAN needed for man page searching.
#
# Globals:
#   in:     %OPT, $LANG, $LC_MESSAGES, $LC_ALL,
#           $MANPATH, $MANSEC, $PAGER, $SYSTEM, $MANOPT.
#   out:    $main::Man{PATH}, $main::Man{LANG}, $main::Man{LANG2}, $main::Man{SYS},
#           $main::Man{SEC}, $main::Man{ALL}
#   in/out: $main::Man{ENABLE}
#
# The precedence for the variables related to 'man' is that of GNU
# 'man', i.e.
#
# $LANG; overridden by
# $LC_MESSAGES; overridden by
# $LC_ALL; this has the same precedence as
# $MANPATH, $MANSEC, $PAGER, $SYSTEM; overridden by
# $MANOPT; overridden by
# the groffer command-line options.
#
# $MANROFFSEQ is ignored because grog determines the preprocessors.
#
sub man_setup {
  return 1 if $main::Man{'IS_SETUP'};
  $main::Man{'IS_SETUP'} = 1;
  return 1 unless $main::Man{'ENABLE'};

  # determine basic path for man pages
  my $path;
  if (defined $main::Opt{'MANPATH'}) {
    $path = $main::Opt{'MANPATH'};
  } elsif ($ENV{'MANPATH'}) {
    $path = $ENV{'MANPATH'};
  } elsif ( &where_is_prog('manpath') ) {
    $path = `manpath 2>$main::Dev_Null`;
  }
  if ($path) {
    chomp $path;
    $main::Man{'PATH'} = [split /:/, $path];
  } else {
    $main::Man{'PATH'} = [];
    &manpath_set_from_path();
  }
  unless ( @{$main::Man{'PATH'}} ) {
    $main::Man{'ENABLE'} = 0;
    warn "man_setup(): man path is empty;";
    return 1;
  }

### man_setup()
  # make man path list consisting of unique existing directories
  @{$main::Man{'PATH'}} = &path_uniq( @{$main::Man{'PATH'}} );

  unless ($main::Man{'ALL'}) {
    $main::Man{'ALL'} = $main::Opt{'ALL'} ? 1 : 0;
  }

  # handle man systems
  my $sys = $ENV{'SYSTEM'};
  $sys = $main::Opt{'SYSTEMS'} if $main::Opt{'SYSTEMS'};
  if ($sys) {
    chomp $sys;
    $main::Man{'SYS'} = [split /,/, $sys];
  } else {
    $main::Man{'SYS'} = [];
    $sys = '';
  }

### man_setup()
  # handle language
  my $lang = '';
  $lang = $main::Opt{'LANG'} if $main::Opt{'LANG'};
  unless ($lang) {
    foreach ('LC_ALL', 'LC_MESSAGES', 'LANG') {
      if ($ENV{$_}) {
	$lang = $ENV{$_};
	last;
      }
    }
  }
  if ($lang) {
    if ($lang eq 'C' or $lang eq 'POSIX') {
      $main::Man{'LANG'} = '';
      $main::Man{'LANG2'} = '';
    } elsif ($lang =~ /^.$/) {
      $main::Man{'LANG'} = $lang;
      $main::Man{'LANG2'} = '';
    } elsif ($lang =~ /^..$/) {
      $main::Man{'LANG'} = $lang;
      $main::Man{'LANG2'} = $lang;
    } else {
      $main::Man{'LANG'} = $lang;
      $main::Man{'LANG2'} = $lang;
      $main::Man{'LANG2'} =~ s/^(..).*$/$1/;
    }
  }				# if ($lang)
  # from now on, use only $main::Man{LANG*},
  # forget about $main::Opt{LANG}, $ENV{LC_*}.

  &manpath_add_lang_sys();

### man_setup()
  # section
  my $sec;
  $sec = $main::Opt{'SECTIONS'} if $main::Opt{'SECTIONS'};
  unless ($sec) {
    $sec = $ENV{'MANSEC'} if $ENV{'MANSEC'};
  }
  $main::Man{'SEC'} = [];
  $main::Man{'SEC_CHARS'} = '';
  if ($sec) {
    foreach (split /:/, $sec) {
      push @{$main::Man{'SEC'}}, $_ if /^[$main::Man{'AUTO_SEC_CHARS'}]$/;
    }
    $main::Man{'SEC_CHARS'} = join '', @{$main::Man{'SEC'}} if @{$main::Man{'SEC'}};
  }				# if ($sec)

  # extension
  my $ext = '';
  $ext = $main::Opt{'EXTENSION'} if $main::Opt{'EXTENSION'};
  unless ($ext) {
    $ext = $ENV{'EXTENSION'} if $ENV{'EXTENSION'};
  }
  $main::Man{'EXT'} = $ext;

  # creation of man temporary is omitted, because of globs in perl
  1;
} # man_setup()


##########
# manpath_add_lang_sys()
#
# Add language and operating system specific directories to man path.
#
# Globals:
#   in:     $main::Man{SYS}: a list of names of operating systems.
#           $main::Man{LANG} and $main::Man{LANG2}: each a single name
#   in/out: @{$main::Man{PATH}}: list of directories which shall have the 'man?'
#           subdirectories.
#
sub manpath_add_lang_sys {
  return 1 unless $main::Man{'PATH'};
  return 1 unless @{$main::Man{'PATH'}};

  my @mp;

  if ( @{$main::Man{'SYS'}} ) {
    foreach ( @{$main::Man{'SYS'}} ) {
      if ($_ eq 'man') {
	@mp = (@mp, @{$main::Man{'PATH'}});
      } elsif ($_) {
	my $sys = $_;
	foreach my $p (@{$main::Man{'PATH'}}) {
	  my $dir = File::Spec->catdir($p, $sys);
	  push @mp, $dir;
	}
      }				# if eq 'man'
    }				# foreach SYS
  } else {			# no SYS
    @mp = @{$main::Man{'PATH'}};
  }

  if (@mp && $main::Man{'LANG'}) {
    my @lang_path;
    my $man_lang2 = '';
    $man_lang2 = $main::Man{'LANG2'} if $main::Man{'LANG'} ne $main::Man{'LANG2'};
    foreach my $i ($main::Man{'LANG'}, $man_lang2) {
      next unless $i;
      my $lang = $i;
      foreach my $p (@mp) {
	my $dir = File::Spec->catdir($p, $lang);
	push @lang_path, $dir;
      }				# foreach $p
    }				# foreach $i
    @mp = (@lang_path, @mp);
  }				# if $mp

  $main::Man{PATH} = [&path_uniq(@mp)];
  1;
} # manpath_add_lang_sys()


##########
# manpath_set_from_path()
#
# Determine basic search path for man pages from $PATH.
#
# Return:    '1' if a valid man path was retrieved.
# Output:    none
# Globals:
#   in:  $PATH
#   out: $_MAN_PATH
#
sub manpath_set_from_path {
  my @path =
    qw( /usr/local /usr /usr/X11R6 /usr/openwin /opt /opt/gnome /opt/kde );
  # get a basic man path from $ENV{PATH}
  my @path2 = @main::Path;
  foreach (@path2) {
    s#bin/*$##;
    push @path, $_;
  }
  @path = &path_uniq(@path);
  foreach my $d (@path) {
    foreach my $e ( File::Spec->catdir( qw(share man) ),
		 File::Spec->catdir( qw(share MAN) ),
		 'man',  'MAN' ) {
      my $dir = File::Spec->catdir($d, $e);
      push @{$main::Man{'PATH'}}, $dir if -d $dir;
    }
  }
  1;
} # manpath_set_from_path()


##########
# special_filespec()
#
# Handle special modes like whatis and apropos.  Run their filespec
# functions if suitable.
#
# Globals:  in: $main::Opt{'APROPOS'}, $main::Opt{'WHATIS'}, $main::Special_Setup
#          out: $main::Special_Filespec (internal)
#
sub special_filespec {
  return 0 unless $main::Opt{'APROPOS'} || $main::Opt{'WHATIS'};
  die 'special_filespec(): setup for apropos or whatis must be run first;'
    unless $main::Special_Setup;
  if ( $main::Opt{'APROPOS'} ) {
    die "special_setup(): both apropos and whatis option variables are set;"
      if $main::Opt{'WHATIS'};
    return &apropos_filespec() ? 1 : 0;
  }
  if ( $main::Opt{'WHATIS'} ) {
    return &whatis_filespec() ? 1 : 0;
  }
  0;
} # special_filespec


##########
# special_setup()
#
# Handle special modes like whatis and apropos.  Run their setup
# functions if suitable.
#
sub special_setup {
  if ( $main::Opt{'APROPOS'} ) {
    die "special_setup(): both --apropos and --whatis option variables " .
      "are set;" if $main::Opt{'WHATIS'};
    return &apropos_setup() ? 1 : 0;
  }
  if ( $main::Opt{'WHATIS'} ) {
    return &whatis_setup() ? 1 : 0;
  }
  0;
} # special_setup()


##########
# whatis_filename(<filename>)
#
# Interpret <filename> as a man page and display its 'whatis'
# information as a fragment written in the groff language.
#
# Globals:  in: $main::Opt{'WHATIS'}, $main::Special_Setup, $main::Special_Filespec,
#               $main::Filespec_Arg
#
sub whatis_filename {
  my $n = @_;
  die "whatis_filename(): one argument is needed; you used $n;"
    unless $n == 1;
  die "whatis_filename(): whatis is not setup;" unless $main::Opt{'WHATIS'};
  die "whatis_filename(): setup for whatis must be run first;"
    unless $main::Special_Setup;
  die "whatis_filename(): whatis_filespec() must be run first;"
    unless $main::Special_Filespec;
  die 'whatis_filename(): no $main::Filespec_Arg is set;'
    unless defined $main::Filespec_Arg;

  my $arg = $_[0];
  die "whatis_file_name(): $arg is not an existing file" unless -f $arg;
  die "whatis_file_name(): could not read file $arg" unless -r $arg;
  return 1 if -z $arg;
  $arg = 'stdin' if $main::Filespec_Arg eq '-';

  &to_tmp_line('.br', '\\f[CR]' . $arg . '\\f[]:', '.br');

### whatis_filename()
  # get the parts of the file name according to the naming of man pages
  my ($dir, $name) = &split_path( $_[0] );
  my $section = $_[0];
  my $path = File::Spec->catfile('', 'man');
  $section =~ s#^.*$path([$main::Man{'AUTO_SEC_CHARS'}]).*$#$1#;
  $section = '' if $section eq $_[0];
  if ($section) {
    if ($name =~ m#^.*\.$section.*$#) {
      $name =~ s/^(.*)\.$section.*$/$1/;
    } else {
      $section = '';
    }
  }

  # traditional man style; grep the line containing '.TH' macro, if any
  my @catz = &cat_z($_[0]);
  my $res;
  my $test;
  foreach (@catz) {
    if (/^[\.']\s*TH\s/) {		# search .TH, traditional man style
      $test = 1;
      last;
    }
  }				# foreach (@catz)
### whatis_filename()
  if ($test) {			# traditional man style
    # get the first line after the first '.SH' macro before the next '.SH'
    my $test1;
    foreach (@catz) {
      if ($test1) {
	chomp;
	next unless $_;
	next if /^[\.']?\s*$/;
	last if /^[\.']/;		# especially for .SH
	if ($res) {
	  $res = "$res $_";
	} else {
	  $res = $_;
	}
      } else {			# $test1 is empty
	$test1 = 1 if (/^[\.']\s*SH\s/);
      }				# if ($test1)
    }				# foreach (@catz)

    if ($section) {
      if ($res =~ m|^
		    $name
		    \s
		    [^-]*
		    -
		    \s*
		    (.*)
		    $|sx) {
	$res = "$name ($section) \\[em] $1";
      }
    }				# if ($section)
### whatis_filename()
    &to_tmp_line($res, '.br', '', '.br');
    return 1;
  }				# if ($test)

  # mdoc style (BSD doc); grep the line containing '.Nd' macro, if any
  foreach (@catz) {
    if (/^[\.']\s*Nd\s/) {		# BSD doc style
      $res =~ s/^(.*)$/$name ($section) \\[em] $1/;
      &to_tmp_line($res);
      return 1;
    }
  }

  &to_tmp_line('is not a man page', '.br', '', '.br');
  1;
} # whatis_filename()


##########
# whatis_filespec()
#
# Print the filespec name as .SH to the temporary cat file.
#
# Globals: in: $main::Opt{'WHATIS'}, $main::Filespec_Arg
#      in/out: $main::Special_Filespec
#
sub whatis_filespec {
  return 0 unless ($main::Opt{'WHATIS'});
  die 'whatis_filespec(): whatis_setup() must be run first.'
    unless $main::Special_Setup;
  die 'whatis_filespec(): no $main::Filespec_Arg is set;'
    unless defined $main::Filespec_Arg;
  $main::Special_Filespec = 1;
  my $arg = $main::Filespec_Arg;
  $arg =~ s/[^\\]-/\\-/g;
  to_tmp_line(".SH $arg");
} # whatis_filespec()


##########
# whatis_setup ()
#
# Print the whatis header to the temporary cat file; this is the setup
# for whatis.
#
# Globals:  in: $main::Opt{'WHATIS'}
#          out: $main::Special_Setup
sub whatis_setup {
  if ( $main::Opt{'WHATIS'} ) {
    &to_tmp_line('.TH GROFFER WHATIS');
    $main::Special_Setup = 1;
    $main::Opt{'TITLE'} = 'whatis' unless $main::Opt{'TITLE'};
    return 1;
  }
  0;
} # whatis_setup ()

1;
########################################################################
### Emacs settings
# Local Variables:
# mode: CPerl
# End:

Youez - 2016 - github.com/yon3zu
LinuXploit