+ local = local_name(ctx);
+
+ if (!local)
+ return NULL;
+
+ /* first try busybox tftp args */
+
+ p = argv;
+ *p++ = pb_system_apps.tftp; /* 1 */
+ *p++ = "-g"; /* 2 */
+ *p++ = "-l"; /* 3 */
+ *p++ = local; /* 4 */
+ *p++ = "-r"; /* 5 */
+ *p++ = url->path; /* 6 */
+ *p++ = url->host; /* 7 */
+ if (url->port)
+ *p++ = url->port; /* 8 */
+ *p++ = NULL; /* 9 */
+
+ result = pb_run_cmd(argv, 1, 0);
+
+ if (!result)
+ return local;
+
+ /* next try tftp-hpa args */
+
+ p = argv;
+ *p++ = pb_system_apps.tftp; /* 1 */
+ *p++ = "-m"; /* 2 */
+ *p++ = "binary"; /* 3 */
+ *p++ = url->host; /* 4 */
+ if (url->port)
+ *p++ = url->port; /* 5 */
+ *p++ = "-c"; /* 6 */
+ *p++ = "get"; /* 7 */
+ *p++ = url->path; /* 8 */
+ *p++ = local; /* 9 */
+ *p++ = NULL; /* 10 */
+
+ result = pb_run_cmd(argv, 1, 0);
+
+ if (!result)
+ return local;
+
+ talloc_free(local);
+ return NULL;