home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / system / mail / transpor / ifmail23.z / ifmail23 / ifmail / misc / contrib / ifreq < prev   
Encoding:
Text File  |  1994-02-13  |  1.5 KB  |  59 lines

  1. #!/usr/bin/perl
  2. $ver = "0.3";
  3. #
  4. # this perl script is designed for the ifmail package by eugene crosser.
  5. #
  6. # request a file (first argument) from a fido-node (second argument),
  7. # only 2-d addressing is supported!!! don't forget to quote if you use
  8. # wildcards, e.g.:  ifreq 'files*' 2410/305
  9. # this perl script does only add an entry to the corresponding flo-file,
  10. # the mailer ifcico is not started!
  11. #
  12. # rasca, berlin 1994 (rasca@marie.physik.tu-berlin.de, 2:2410/305.4)
  13. #
  14.  
  15. # change this to the default node, where requests should go to.
  16. $default_node = "2410/305";
  17.  
  18. # this is the directory, where the req-files are stored.
  19. $flo_path = "/var/spool/fnet/out";
  20.  
  21.  
  22. # main()
  23. #
  24. if ((@ARGV < 1) || $ARGV[0] eq "-?") {
  25.     &usage;
  26. } elsif ($ARGV[1] eq "") {
  27.     $node = $default_node;
  28. } else {
  29.     $node = $ARGV[1];
  30. }
  31.  
  32. $file = $ARGV[0];
  33. $reqfile = sprintf("%04x%04x", split(/\//, $node));
  34.  
  35. if ($reqfile eq "00000000") {
  36.     print ("can't resolve the fido address \"$node\"\n");
  37.     exit 2;
  38. } else {
  39.     $reqfile = $flo_path . "/" . $reqfile . ".req";
  40.  
  41.     # open the flofile for appending
  42.     open(FLOFILE, ">>" . $reqfile) || die "can't open $reqfile";
  43.         print (FLOFILE $file, "\n");
  44.     close(FLOFILE);
  45.  
  46.     print ("--- fido request $ver ---------------------------\n");
  47.     print ("requesting \"$file\" from fido-node $node\n");
  48.     print ("--- executing ifstat .. ------------------------\n");
  49.     system("ifstat");
  50. }
  51.  
  52. # subroutine "usage"
  53. #
  54. sub usage {
  55.     printf ("--- fido request %s -------------\n", $ver);
  56.     printf ("usage: fidoreq <file> [<2-d address>]\n");
  57.     exit 1;
  58. }
  59.