+ process_release(process);
+ return type;
+}
+
+static void load_tftp(struct load_task *task)
+{
+ const char *port = "69";
+ const char *argv[10] = {
+ pb_system_apps.tftp,
+ };
+
+ if (task->url->port)
+ port = task->url->port;
+
+ if (tftp_type == TFTP_TYPE_UNKNOWN)
+ tftp_type = check_tftp_type(task);
+
+ if (tftp_type == TFTP_TYPE_BUSYBOX) {
+ argv[1] = "-g";
+ argv[2] = "-l";
+ argv[3] = NULL; /* 3: local file */
+ argv[4] = "-r";
+ argv[5] = task->url->path;
+ argv[6] = task->url->host;
+ argv[7] = port;
+ argv[8] = NULL;
+
+ load_process_to_local_file(task, argv, 3);
+
+ } else if (tftp_type == TFTP_TYPE_HPA) {
+ argv[1] = "-m";
+ argv[2] = "binary";
+ argv[3] = task->url->host;
+ argv[4] = port;
+ argv[5] = "-c";
+ argv[6] = "get";
+ argv[7] = task->url->path;
+ argv[8] = NULL; /* 8: local file */
+ argv[9] = NULL;
+ load_process_to_local_file(task, argv, 8);
+
+ } else
+ task->result->status = LOAD_ERROR;
+}
+
+enum wget_flags {
+ wget_empty = 0,
+ wget_no_check_certificate = 1,
+};
+
+/**
+ * pb_load_wget - Loads a remote file via wget and returns the local file path.
+ *
+ * Returns the local file path in a talloc'ed character string on success,
+ * or NULL on error.
+ */
+
+static void load_wget(struct load_task *task, int flags)
+{
+ const char *argv[] = {
+ pb_system_apps.wget,
+ "-O",
+ NULL, /* 2: local file */
+ NULL, /* 3 (optional): --quiet */
+ NULL, /* 4 (optional): --no-check-certificate */
+ NULL, /* 5: URL */
+ NULL,
+ };
+ int i;
+
+ i = 3;
+#if !defined(DEBUG)
+ argv[i++] = "--quiet";
+#endif
+ if (flags & wget_no_check_certificate)
+ argv[i++] = "--no-check-certificate";
+
+ argv[i] = task->url->full;