From: Jarkko Hietaniemi Date: Tue, 19 Jun 2001 00:51:44 +0000 (+0000) Subject: Make libnetcfg by default display the libnet configuration, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a6fb92f118926bc004bb5d79ae6bed5680cf4957;p=p5sagit%2Fp5-mst-13.2.git Make libnetcfg by default display the libnet configuration, -c to change, add -i for old config, document all options, regen toc. p4raw-id: //depot/perl@10701 --- diff --git a/pod/perltoc.pod b/pod/perltoc.pod index c355166..1094d8c 100644 --- a/pod/perltoc.pod +++ b/pod/perltoc.pod @@ -839,10 +839,10 @@ cmd, H -number, q or ^D, R, |dbcmd, ||dbcmd, command, m expr, man [manpage] C, C, C, C, C, C, C, C, C, C, -C, C, C, C, C, -C, C, C, C, C, -C, C, C, C, C, -C, C, C, C, C +C, C, C, C, C, +C, C, C, C, C, +C, C, C, C, C, +C, C, C, C, C, C =item Debugger input/output @@ -2170,6 +2170,8 @@ chcp, dataset access, OS/390, z/OS iconv, locales =item Perl Modules +=item Making your module threadsafe + =back =item SEE ALSO @@ -2205,30 +2207,34 @@ Class::Struct, Cwd, DB, DB_File, Devel::SelfStubber, Digest, DirHandle, Dumpvalue, Encode, Encode::EncodeFormat, Encode::Tcl, English, Env, Exporter, Exporter::Heavy, ExtUtils::Command, ExtUtils::Constant, ExtUtils::Embed, ExtUtils::Install, ExtUtils::Installed, ExtUtils::Liblist, -ExtUtils::MM_Cygwin, ExtUtils::MM_OS2, ExtUtils::MM_Unix, ExtUtils::MM_VMS, -ExtUtils::MM_Win32, ExtUtils::MakeMaker, ExtUtils::Manifest, -ExtUtils::Mkbootstrap, ExtUtils::Mksymlists, ExtUtils::Packlist, -ExtUtils::testlib, Fatal, Fcntl, File::Basename, File::CheckTree, -File::Compare, File::Copy, File::DosGlob, File::Find, File::Path, -File::Spec, File::Spec::Epoc, File::Spec::Functions, File::Spec::Mac, -File::Spec::OS2, File::Spec::Unix, File::Spec::VMS, File::Spec::Win32, -File::Temp, File::stat, FileCache, FileHandle, Filter::Simple, FindBin, -Getopt::Long, Getopt::Std, I18N::Collate, I18N::LangTags, -I18N::LangTags::List, IO, IPC::Open2, IPC::Open3, Locale::Constants, -Locale::Country, Locale::Currency, Locale::Language, Locale::Maketext, -Locale::Maketext::TPJ13, Math::BigFloat, Math::BigInt, Math::Complex, -Math::Trig, NDBM_File, NEXT, Net::Ping, Net::hostent, Net::netent, -Net::protoent, Net::servent, O, ODBM_File, Opcode, POSIX, PerlIO, -Pod::Checker, Pod::Find, Pod::Html, Pod::InputObjects, Pod::LaTeX, -Pod::Man, Pod::ParseUtils, Pod::Parser, Pod::Plainer, Pod::Select, -Pod::Text, Pod::Text::Color, Pod::Text::Overstrike, Pod::Text::Termcap, -Pod::Usage, SDBM_File, Safe, Search::Dict, SelectSaver, SelfLoader, Shell, -Socket, Storable, Switch, Symbol, Term::ANSIColor, Term::Cap, -Term::Complete, Term::ReadLine, Test, Test::Harness, Text::Abbrev, -Text::Balanced, Text::ParseWords, Text::Soundex, Text::Tabs, Text::Wrap, -Tie::Array, Tie::Handle, Tie::Hash, Tie::RefHash, Tie::Scalar, -Tie::SubstrHash, Time::Local, Time::gmtime, Time::localtime, Time::tm, -UNIVERSAL, User::grent, User::pwent, Win32 +ExtUtils::MM_Cygwin, ExtUtils::MM_NW5, ExtUtils::MM_OS2, ExtUtils::MM_Unix, +ExtUtils::MM_VMS, ExtUtils::MM_Win32, ExtUtils::MakeMaker, +ExtUtils::Manifest, ExtUtils::Mkbootstrap, ExtUtils::Mksymlists, +ExtUtils::Packlist, ExtUtils::testlib, Fatal, Fcntl, File::Basename, +File::CheckTree, File::Compare, File::Copy, File::DosGlob, File::Find, +File::Path, File::Spec, File::Spec::Epoc, File::Spec::Functions, +File::Spec::Mac, File::Spec::OS2, File::Spec::Unix, File::Spec::VMS, +File::Spec::Win32, File::Temp, File::stat, FileCache, FileHandle, +Filter::Simple, FindBin, Getopt::Long, Getopt::Std, I18N::Collate, +I18N::LangTags, I18N::LangTags::List, IO, IPC::Open2, IPC::Open3, +Locale::Constants, Locale::Country, Locale::Currency, Locale::Language, +Locale::Maketext, Locale::Maketext::TPJ13, Math::BigFloat, Math::BigInt, +Math::Complex, Math::Trig, Memoize, Memoize::AnyDBM_File, Memoize::Expire, +Memoize::ExpireFile, Memoize::ExpireTest, Memoize::NDBM_File, +Memoize::SDBM_File, Memoize::Saves, Memoize::Storable, NDBM_File, NEXT, +Net::Cmd, Net::Config, Net::Domain, Net::DummyInetd, Net::FTP, Net::NNTP, +Net::Netrc, Net::PH, Net::POP3, Net::Ping, Net::SMTP, Net::SNPP, Net::Time, +Net::hostent, Net::libnetFAQ, Net::netent, Net::protoent, Net::servent, O, +ODBM_File, Opcode, POSIX, PerlIO, Pod::Checker, Pod::Find, Pod::Html, +Pod::InputObjects, Pod::LaTeX, Pod::Man, Pod::ParseUtils, Pod::Parser, +Pod::Plainer, Pod::Select, Pod::Text, Pod::Text::Color, +Pod::Text::Overstrike, Pod::Text::Termcap, Pod::Usage, SDBM_File, Safe, +Search::Dict, SelectSaver, SelfLoader, Shell, Socket, Storable, Switch, +Symbol, Term::ANSIColor, Term::Cap, Term::Complete, Term::ReadLine, Test, +Test::Harness, Text::Abbrev, Text::Balanced, Text::ParseWords, +Text::Soundex, Text::Tabs, Text::Wrap, Tie::Array, Tie::Handle, Tie::Hash, +Tie::RefHash, Tie::Scalar, Tie::SubstrHash, Time::Local, Time::gmtime, +Time::localtime, Time::tm, UNIVERSAL, User::grent, User::pwent, Win32 =item Extension Modules @@ -3787,15 +3793,19 @@ callback =item DOCUMENTATION -L, L, L and -L, L and L, -L, L, L, -L, L +L, L and L, +L and L, L, +L, L, L, +L =item CONVERTORS L, L, L +=item Administration + +L + =item Development L, L, L and L, @@ -3888,44 +3898,53 @@ hv_iterval, hv_magic, hv_store, hv_store_ent, hv_undef, isALNUM, isALPHA, isDIGIT, isLOWER, isSPACE, isUPPER, is_utf8_char, is_utf8_string, items, ix, LEAVE, load_module, looks_like_number, MARK, mg_clear, mg_copy, mg_find, mg_free, mg_get, mg_length, mg_magical, mg_set, Move, New, newAV, -Newc, newCONSTSUB, newHV, newRV_inc, newRV_noinc, NEWSV, newSViv, newSVnv, -newSVpv, newSVpvf, newSVpvn, newSVpvn_share, newSVrv, newSVsv, newSVuv, -newXS, newXSproto, Newz, Nullav, Nullch, Nullcv, Nullhv, Nullsv, ORIGMARK, -perl_alloc, perl_construct, perl_destruct, perl_free, perl_parse, perl_run, -PL_modglobal, PL_na, PL_sv_no, PL_sv_undef, PL_sv_yes, POPi, POPl, POPn, -POPp, POPpbytex, POPpx, POPs, PUSHi, PUSHMARK, PUSHn, PUSHp, PUSHs, PUSHu, -PUTBACK, Renew, Renewc, require_pv, RETVAL, Safefree, savepv, savepvn, -SAVETMPS, SP, SPAGAIN, ST, strEQ, strGE, strGT, strLE, strLT, strNE, -strnEQ, strnNE, StructCopy, SvCUR, SvCUR_set, SvEND, SvGETMAGIC, SvGROW, -SvIOK, SvIOKp, SvIOK_notUV, SvIOK_off, SvIOK_on, SvIOK_only, SvIOK_only_UV, -SvIOK_UV, SvIV, SvIVX, SvLEN, SvNIOK, SvNIOKp, SvNIOK_off, SvNOK, SvNOKp, -SvNOK_off, SvNOK_on, SvNOK_only, SvNV, SvNVX, SvOK, SvOOK, SvPOK, SvPOKp, -SvPOK_off, SvPOK_on, SvPOK_only, SvPOK_only_UTF8, SvPV, SvPVX, SvPV_force, +Newc, newCONSTSUB, newHV, newRV_inc, newRV_noinc, newSV, NEWSV, newSViv, +newSVnv, newSVpv, newSVpvf, newSVpvn, newSVpvn_share, newSVrv, newSVsv, +newSVuv, newXS, newXSproto, Newz, Nullav, Nullch, Nullcv, Nullhv, Nullsv, +ORIGMARK, perl_alloc, perl_clone, perl_construct, perl_destruct, perl_free, +perl_parse, perl_run, PL_modglobal, PL_na, PL_sv_no, PL_sv_undef, +PL_sv_yes, POPi, POPl, POPn, POPp, POPpbytex, POPpx, POPs, PUSHi, PUSHMARK, +PUSHn, PUSHp, PUSHs, PUSHu, PUTBACK, Renew, Renewc, require_pv, RETVAL, +Safefree, savepv, savepvn, SAVETMPS, SP, SPAGAIN, ST, strEQ, strGE, strGT, +strLE, strLT, strNE, strnEQ, strnNE, StructCopy, SvCUR, SvCUR_set, SvEND, +SvGETMAGIC, SvGROW, SvIOK, SvIOKp, SvIOK_notUV, SvIOK_off, SvIOK_on, +SvIOK_only, SvIOK_only_UV, SvIOK_UV, SvIV, SvIVx, SvIVX, SvLEN, SvNIOK, +SvNIOKp, SvNIOK_off, SvNOK, SvNOKp, SvNOK_off, SvNOK_on, SvNOK_only, SvNV, +SvNVx, SvNVX, SvOK, SvOOK, SvPOK, SvPOKp, SvPOK_off, SvPOK_on, SvPOK_only, +SvPOK_only_UTF8, SvPV, SvPVbyte, SvPVbytex, SvPVbytex_force, +SvPVbyte_force, SvPVbyte_nolen, SvPVutf8, SvPVutf8x, SvPVutf8x_force, +SvPVutf8_force, SvPVutf8_nolen, SvPVx, SvPVX, SvPV_force, SvPV_force_nomg, SvPV_nolen, SvREFCNT, SvREFCNT_dec, SvREFCNT_inc, SvROK, SvROK_off, -SvROK_on, SvRV, SvSETMAGIC, SvSetSV, SvSetSV_nosteal, SvSTASH, SvTAINT, -SvTAINTED, SvTAINTED_off, SvTAINTED_on, SvTRUE, svtype, SvTYPE, SVt_IV, -SVt_NV, SVt_PV, SVt_PVAV, SVt_PVCV, SVt_PVHV, SVt_PVMG, SvUOK, SvUPGRADE, -SvUTF8, SvUTF8_off, SvUTF8_on, SvUV, SvUVX, sv_2mortal, sv_bless, sv_catpv, -sv_catpvf, sv_catpvf_mg, sv_catpvn, sv_catpvn_flags, sv_catpvn_mg, -sv_catpv_mg, sv_catsv, sv_catsv_flags, sv_catsv_mg, sv_chop, sv_clear, -sv_cmp, sv_cmp_locale, sv_dec, sv_derived_from, sv_eq, sv_free, sv_getcwd, -sv_gets, sv_grow, sv_inc, sv_insert, sv_isa, sv_isobject, sv_len, -sv_len_utf8, sv_magic, sv_mortalcopy, sv_newmortal, sv_pvn_force, -sv_pvn_force_flags, sv_pvutf8n_force, sv_realpath, sv_reftype, sv_replace, -sv_rvweaken, sv_setiv, sv_setiv_mg, sv_setnv, sv_setnv_mg, sv_setpv, -sv_setpvf, sv_setpvf_mg, sv_setpviv, sv_setpviv_mg, sv_setpvn, +SvROK_on, SvRV, SvSETMAGIC, SvSetMagicSV, SvSetMagicSV_nosteal, SvSetSV, +SvSetSV_nosteal, SvSTASH, SvTAINT, SvTAINTED, SvTAINTED_off, SvTAINTED_on, +SvTRUE, svtype, SvTYPE, SVt_IV, SVt_NV, SVt_PV, SVt_PVAV, SVt_PVCV, +SVt_PVHV, SVt_PVMG, SvUOK, SvUPGRADE, SvUTF8, SvUTF8_off, SvUTF8_on, SvUV, +SvUVx, SvUVX, sv_2bool, sv_2cv, sv_2io, sv_2iv, sv_2mortal, sv_2nv, +sv_2pvbyte, sv_2pvbyte_nolen, sv_2pvutf8, sv_2pvutf8_nolen, sv_2pv_flags, +sv_2pv_nolen, sv_2uv, sv_backoff, sv_bless, sv_catpv, sv_catpvf, +sv_catpvf_mg, sv_catpvn, sv_catpvn_flags, sv_catpvn_mg, sv_catpv_mg, +sv_catsv, sv_catsv_flags, sv_catsv_mg, sv_chop, sv_clear, sv_cmp, +sv_cmp_locale, sv_collxfrm, sv_dec, sv_derived_from, sv_eq, +sv_force_normal, sv_force_normal_flags, sv_free, sv_getcwd, sv_gets, +sv_grow, sv_inc, sv_insert, sv_isa, sv_isobject, sv_iv, sv_len, +sv_len_utf8, sv_magic, sv_mortalcopy, sv_newmortal, sv_newref, sv_nv, +sv_pos_b2u, sv_pos_u2b, sv_pv, sv_pvbyte, sv_pvbyten, sv_pvbyten_force, +sv_pvn, sv_pvn_force, sv_pvn_force_flags, sv_pvutf8, sv_pvutf8n, +sv_pvutf8n_force, sv_realpath, sv_reftype, sv_replace, sv_report_used, +sv_reset, sv_rvweaken, sv_setiv, sv_setiv_mg, sv_setnv, sv_setnv_mg, +sv_setpv, sv_setpvf, sv_setpvf_mg, sv_setpviv, sv_setpviv_mg, sv_setpvn, sv_setpvn_mg, sv_setpv_mg, sv_setref_iv, sv_setref_nv, sv_setref_pv, sv_setref_pvn, sv_setref_uv, sv_setsv, sv_setsv_flags, sv_setsv_mg, -sv_setuv, sv_setuv_mg, sv_true, sv_unmagic, sv_unref, sv_unref_flags, -sv_upgrade, sv_usepvn, sv_usepvn_mg, sv_utf8_decode, sv_utf8_downgrade, -sv_utf8_encode, sv_utf8_upgrade, sv_utf8_upgrade_flags, sv_vcatpvfn, -sv_vsetpvfn, THIS, toLOWER, toUPPER, utf8n_to_uvchr, utf8n_to_uvuni, -utf8_distance, utf8_hop, utf8_length, utf8_to_bytes, utf8_to_uvchr, -utf8_to_uvuni, uvchr_to_utf8, uvuni_to_utf8, warn, XPUSHi, XPUSHn, XPUSHp, -XPUSHs, XPUSHu, XS, XSRETURN, XSRETURN_EMPTY, XSRETURN_IV, XSRETURN_NO, -XSRETURN_NV, XSRETURN_PV, XSRETURN_UNDEF, XSRETURN_YES, XST_mIV, XST_mNO, -XST_mNV, XST_mPV, XST_mUNDEF, XST_mYES, XS_VERSION, XS_VERSION_BOOTCHECK, -Zero +sv_setuv, sv_setuv_mg, sv_taint, sv_tainted, sv_true, sv_unmagic, sv_unref, +sv_unref_flags, sv_untaint, sv_upgrade, sv_usepvn, sv_usepvn_mg, +sv_utf8_decode, sv_utf8_downgrade, sv_utf8_encode, sv_utf8_upgrade, +sv_utf8_upgrade_flags, sv_uv, sv_vcatpvfn, sv_vsetpvfn, THIS, toLOWER, +toUPPER, utf8n_to_uvchr, utf8n_to_uvuni, utf8_distance, utf8_hop, +utf8_length, utf8_to_bytes, utf8_to_uvchr, utf8_to_uvuni, uvchr_to_utf8, +uvuni_to_utf8, warn, XPUSHi, XPUSHn, XPUSHp, XPUSHs, XPUSHu, XS, XSRETURN, +XSRETURN_EMPTY, XSRETURN_IV, XSRETURN_NO, XSRETURN_NV, XSRETURN_PV, +XSRETURN_UNDEF, XSRETURN_YES, XST_mIV, XST_mNO, XST_mNV, XST_mPV, +XST_mUNDEF, XST_mYES, XS_VERSION, XS_VERSION_BOOTCHECK, Zero =item AUTHORS @@ -3941,7 +3960,8 @@ Zero =item DESCRIPTION djSP, is_gv_magical, LVRET, PL_DBsingle, PL_DBsub, PL_DBtrace, PL_dowarn, -PL_last_in_gv, PL_ofs_sv, PL_rs, start_glob +PL_last_in_gv, PL_ofs_sv, PL_rs, report_uninit, start_glob, sv_add_arena, +sv_clean_all, sv_clean_objs, sv_free_arenas =item AUTHORS @@ -4067,6 +4087,8 @@ PerlIO_apply_layers(f,mode,layers), PerlIO_binmode(f,ptype,imode,layers), =item Eliminate need for "use utf8"; +=item Create a char *sv_printify(sv, STRLEN *lenp, UV flags) function + =item Autoload byte.pm =item Make "\u{XXXX}" et al work @@ -4397,6 +4419,8 @@ PerlIO_apply_layers(f,mode,layers), PerlIO_binmode(f,ptype,imode,layers), =item Lazy evaluation / tail recursion removal +=item Make "use utf8" the default + =back =back diff --git a/pod/perlutil.pod b/pod/perlutil.pod index 293a1bb..93b9e0b 100644 --- a/pod/perlutil.pod +++ b/pod/perlutil.pod @@ -15,11 +15,6 @@ if appropriate. =over 3 -=item L - -Starting from Perl 5.8 the libnet has been part of the standard -distribution. To configure libnet run the libnetcfg command. - =item L The main interface to Perl's documentation is C, although @@ -128,6 +123,16 @@ As well as these filters for converting other languages, the L utility will help you convert old-style Perl 4 libraries to new-style Perl5 modules. +=head2 Administration + +=over 3 + +=item L + +To display and change the libnet configuration run the libnetcfg command. + +=back + =head2 Development There are a set of utilities which help you in developing Perl programs, diff --git a/utils/libnetcfg.PL b/utils/libnetcfg.PL index 3418dd1..8af4991 100644 --- a/utils/libnetcfg.PL +++ b/utils/libnetcfg.PL @@ -35,14 +35,74 @@ $Config{startperl} print OUT <<'!NO!SUBS!'; +=head1 NAME + +libnetcfg - configure libnet + +=head1 DESCRIPTION + +The libnetcfg utility can be be used to configure the libnet. +Starting from perl 5.8 libnet is part of the standard Perl +distribution, but the libnetcfg can be be used for any libnet +installation. + +=head1 USAGE + +Without arguments libnetcfg displays the current configuration. + + $ libnetcfg + # old config ./libnet.cfg + daytime_hosts ntp1.none.such + ftp_int_passive 0 + ftp_testhost ftp.funet.fi + inet_domain none.such + nntp_hosts nntp.none.such + ph_hosts + pop3_hosts pop.none.such + smtp_hosts smtp.none.such + snpp_hosts + test_exist 1 + test_hosts 1 + time_hosts ntp.none.such + # ./libnetcfg5.7.1 -h for help + $ + +It tells where the old configuration file was found (if found). + +The C<-h> option will show a usage message. + +To change the configuration you will need to use either the C<-c> or +the C<-d> options. + +The default name of the old configuration file is by default +"libnet.cfg", unless otherwise specified using the -i option, and it +is searched from your module path, C<-i oldfile>. + +The default name of new configuration file is "libnet.cfg", and by +default it is written to the current directory, unless otherwise +specified using the -o option, C<-o newfile>. + +=head1 SEE ALSO + +L, L + +=head1 AUTHORS + +Graham Barr, the original Configure script of libnet. + +Jarkko Hietaniemi, conversion into libnet cfg for inclusion into Perl 5.8. + +=cut + # $Id: Configure,v 1.8 1997/03/04 09:22:32 gbarr Exp $ use strict; use IO::File; use Getopt::Std; use ExtUtils::MakeMaker qw(prompt); +use File::Spec; -use vars qw($opt_d $opt_o); +use vars qw($opt_d $opt_c $opt_h $opt_o $opt_i); ## ## @@ -51,7 +111,7 @@ use vars qw($opt_d $opt_o); my %cfg = (); my @cfg = (); -my($libnet_cfg,$msg,$ans,$def,$have_old); +my($libnet_cfg_in,$libnet_cfg_out,$msg,$ans,$def,$have_old); ## ## @@ -268,17 +328,20 @@ sub default_hostname ## ## -getopts('do:'); +getopts('dcho:i:'); + +$libnet_cfg_in = "libnet.cfg" + unless(defined($libnet_cfg_in = $opt_i)); -$libnet_cfg = "libnet.cfg" - unless(defined($libnet_cfg = $opt_o)); +$libnet_cfg_out = "libnet.cfg" + unless(defined($libnet_cfg_out = $opt_o)); my %oldcfg = (); $Net::Config::CONFIGURE = 1; # Suppress load of user overrides -if( -f $libnet_cfg ) +if( -f $libnet_cfg_in ) { - %oldcfg = ( %{ do $libnet_cfg } ); + %oldcfg = ( %{ do $libnet_cfg_in } ); } elsif (eval { require Net::Config }) { @@ -288,6 +351,59 @@ elsif (eval { require Net::Config }) map { $cfg{lc $_} = $cfg{$_}; delete $cfg{$_} if /[A-Z]/ } keys %cfg; +#--------------------------------------------------------------------------- + +if ($opt_h) { + print <catfile($_, $libnet_cfg_in); + if (-f $trycfgfile && -r $trycfgfile) { + $oldcfgfile = $trycfgfile; + last; + } + } + print "# old config $oldcfgfile\n" if defined $oldcfgfile; + for (sort keys %oldcfg) { + printf "%-20s %s\n", $_, + ref $oldcfg{$_} ? @{$oldcfg{$_}} : $oldcfg{$_}; + } + unless ($opt_c || $opt_d) { + print "# $0 -h for help\n"; + exit(0); + } +} + +#--------------------------------------------------------------------------- + $oldcfg{'test_exist'} = 1 unless exists $oldcfg{'test_exist'}; $oldcfg{'test_hosts'} = 1 unless exists $oldcfg{'test_hosts'}; @@ -595,10 +711,10 @@ print "\n"; #--------------------------------------------------------------------------- -my $fh = IO::File->new($libnet_cfg, "w") or - die "Cannot create `$libnet_cfg': $!"; +my $fh = IO::File->new($libnet_cfg_out, "w") or + die "Cannot create `$libnet_cfg_out': $!"; -print "Writing $libnet_cfg\n"; +print "Writing $libnet_cfg_out\n"; print $fh "{\n";