$Id: update-patches 24 2008-08-31 14:56:13Z wbx $
--- atftp-0.7.orig/tftp.c	2004-03-16 00:55:56.000000000 +0100
+++ atftp-0.7/tftp.c	2008-10-09 11:58:48.000000000 +0200
@@ -409,7 +409,7 @@ int process_cmd(int argc, char **argv)
 int set_peer(int argc, char **argv)
 {
      struct hostent *host;      /* for host name lookup */
-     struct servent *sp;        /* server entry for tftp service */
+     int port = htons(69);
 
      /* sanity check */
      if ((argc < 2) || (argc > 3))
@@ -418,13 +418,6 @@ int set_peer(int argc, char **argv)
           return ERR;
      }
 
-     /* get the server entry */
-     sp = getservbyname("tftp", "udp");
-     if (sp == 0) {
-          fprintf(stderr, "tftp: udp/tftp, unknown service.\n");
-          return ERR;
-     }
-
      /* look up the host */
      host = gethostbyname(argv[1]);
      /* if valid, update s_inn structure */
@@ -437,7 +430,7 @@ int set_peer(int argc, char **argv)
           Strncpy(data.hostname, host->h_name,
                   sizeof(data.hostname));
           data.hostname[sizeof(data.hostname)-1] = 0;
-          data.sa_peer.sin_port = sp->s_port;
+          data.sa_peer.sin_port = port;
      } 
      else
      {
@@ -448,17 +441,17 @@ int set_peer(int argc, char **argv)
      /* get the server port */
      if (argc == 3)
      {
-          sp->s_port = htons(atoi(argv[2]));
-          if (sp->s_port < 0)
+          port = htons(atoi(argv[2]));
+          if (port < 0)
           {
                fprintf(stderr, "%s: bad port number.\n", argv[2]);
                data.connected = 0;
                return ERR;
           }
-          data.sa_peer.sin_port = sp->s_port;
+          data.sa_peer.sin_port = port;
      }
      /* copy port number to data structure */
-     data.port = ntohs(sp->s_port);
+     data.port = ntohs(port);
 
      data.connected = 1;
      return OK;
@@ -974,6 +967,7 @@ int tftp_cmd_line_options(int argc, char
           { "tftp-timeout", 1, NULL, 'T'},
           { "mode", 1, NULL, 'M'},
           { "option", 1, NULL, 'O'},
+		  { "retry", 1, NULL, 'R'},
 #if 1
           { "timeout", 1, NULL, 't'},
           { "blksize", 1, NULL, 'b'},
@@ -993,11 +987,16 @@ int tftp_cmd_line_options(int argc, char
      };
 
      /* Support old argument until 0.8 */
-     while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:sm",
+     while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:smR:",
                              options, &option_index)) != EOF)
      {
           switch (c)
           {
+		  case 'R':
+               snprintf(string, sizeof(string), "option retry %s", optarg);
+               make_arg(string, &ac, &av);
+               process_cmd(ac, av);
+		       break;
           case 'g':
                interactive = 0;
                if ((action == PUT) || (action == MGET))
