3 * Murray Jensen, CSIRO-MIT, <Murray.Jensen@csiro.au>
5 * SPDX-License-Identifier: GPL-2.0+
11 /* imports from input.c */
12 extern int hymod_get_ethaddr (void);
15 fetch_and_parse (char *fn, ulong addr, int (*cback)(uchar *, uchar *))
21 while ((ethaddr = getenv ("ethaddr")) == NULL || *ethaddr == '\0') {
23 printf ("*** Ethernet address is%s not set\n",
24 count == 0 ? "" : " STILL");
26 if ((rc = hymod_get_ethaddr ()) < 0) {
28 puts ("\n*** interrupted!");
30 puts ("\n*** timeout!");
31 printf (" - fetch of '%s' aborted\n", fn);
38 copy_filename (BootFile, fn, sizeof (BootFile));
40 NetBootFileXferSize = 0;
42 if (NetLoop(TFTPGET) == 0) {
43 printf ("tftp transfer of file '%s' failed\n", fn);
47 if (NetBootFileXferSize == 0) {
48 printf ("can't determine size of file '%s'\n", fn);
52 fp = (uchar *)load_addr;
53 efp = fp + NetBootFileXferSize;
58 if (*fp == '#' || *fp == '\n') {
60 while (fp < efp && *fp++ != '\n')
67 while (fp < efp && *fp != '=' && *fp != '\n')
79 while (fp < efp && *fp != '\n')
83 *fp++ = '\0'; /* ok if we go off the end here */
85 if ((*cback)(name, value) == 0)