#116567 doc-rfc-std: /usr/bin/rfc script

Package:
doc-rfc-std
Source:
doc-rfc
Submitter:
Christian Hammers
Date:
2025-02-14 21:12:01 UTC
Severity:
wishlist
Tags:
#116567#5
Date:
2001-10-21 19:20:44 UTC
From:
To:
Hello

I always wanted to have a "/usr/bin/rfc 911" or "/usr/bin/rfc tcp" command,
that gives me easy access without remembering, that the rfcs are somewhere
under /usr/share/doc/RFC/links or /usr/share/doc/doc-rfc/all-included-rfcs
or whereever...
Also I tend to forget the number of the RFC numbers for the most often
used ones (ip/tcp/..., pop3/http11/...).

Therefore I wrote a little perl script that works like described above.
Very simple but very usefull. In case you want to include a script that
needs perl I wrote a little wrapper that checks for perl and if its found
calls the script that translates some names into numbers else just works
for numbers. Both use /usr/bin/sensible-pager and fall back to zless.

bye,

 -christian-
--------------------------------- /usr/bin/rfc --------------------
#!/bin/sh -e

if [ -z "`which perl`" ]; then
  rfc-flexible.pl $*
else
  if [ -z "$1" ]; then
    echo "Usage: rfc <number>"
    exit 1
  fi
  P=sensible-pager; if [ ! -x "$P" ]; then P=zless fi
  $P /usr/share/doc/RFC/links/rfc$1.txt.gz
fi

e strict;

my($DIR) = "/usr/share/doc/RFC/links";

my(%P) = (
        "dns"           => \%{ {"nr"=>1034, "off"=>1} },
        "ftp"           => \%{ {"nr"=>765,  "off"=>1} },
        "http11"        => \%{ {"nr"=>2068, "off"=>1} },
        "icmp"          => \%{ {"nr"=>792,  "off"=>1108} },
        "ip"            => \%{ {"nr"=>791,  "off"=>830} },
        "pop3"          => \%{ {"nr"=>1939, "off"=>1} },
        "requirements"  => \%{ {"nr"=>1122, "off"=>1} },
        "tcp"           => \%{ {"nr"=>793,  "off"=>1075} },
        "udp"           => \%{ {"nr"=>768,  "off"=>26} },
);

if ((not defined @ARGV) or ($#ARGV!=0)) {
        printf("Usage: rfc <keyword>|<number>\n\n".
               "Where keyword is one of:\n".
               "%s\n",
               join(" ", map { "$_ " } sort keys %P));
        exit(1);
}

my($PAGER) = "sensible-pager";
$PAGER = "zless" if ("`which sensible-pager`" eq "");

if (defined $P{$ARGV[0]}) {
  system("$PAGER +".$P{$ARGV[0]}{"off"}." $DIR/rfc".$P{$ARGV[0]}{"nr"}.".txt.gz"
);
} else {
  system("$PAGER $DIR/rfc".$ARGV[0].".txt.gz");
}

#116567#16
Date:
2003-07-03 07:33:56 UTC
From:
To:
Christian, it seems you did not send the scripts properly. Attached are two
scripts which seem to work like you wanted them too, feel free to send in
new scripts. I've tagged this package with 'patch' since you are including
the way to fix the bug.

Also notice that it might be interesting to contact the author of the RFC
tool available at http://www.dewn.com/rfc/. Martin Quinson has opened up an
ITP (Bug #199692: ITP: rfc-tool -- Tool to search in the RFCs and display
them) which will try to include this tool. That package could probably
include a merged command line tool than looks for the RFC under
/usr/share/doc/rfc:


     a) if it's there displays it using sensible-pager
     b) if it's not it tries to download it from the Internet into a common
        location (/var/share/rfc?) in such a way that it's available to the
        user and to other's (which might be useful if running in a
multiuser environment)


Regards

Javi

#116567#21
Date:
2025-01-19 21:40:41 UTC
From:
To:
So whats the status here? Will this ever be done, or is it wontfix,
or are the patches not good enough?

#116567#26
Date:
2025-02-14 21:09:49 UTC
From:
To:
Looking at the patches, I think just the rfc should be packaged.
Maintaining a list of "name/topic" to numbers in a shell or perl script
doesn't seem worth to me.

I'll integrate a copy of 'rfc' into the package once I manage to package
a new upstream version. Upstream broke one of the rsync modules, I'm
trying to get clarification.

thanks,
iustin