[BusyBox] change in tftp

Jeff Studer jstuder at aquilagroup.com
Wed Feb 20 14:07:03 UTC 2002


The original tftp applet could do that if you set localfile to /dev/stdout or
/proc/self/fd/1: ie, "tftp -g -r FILENAME -l /proc/self/fd/1 IP" would achieve
the same results without any code change.  Of course, that requires having a
/proc filesystem.

Robert Parusel wrote:

> Hi folks,
> I made the following change to config.h and tftp.c
>
> config.h
>     375 // !!!!!!! new
>     376 // Allow tftpget to write to stdout
>     377 #define BB_FEATURE_TFTP_GET2STDOUT
>
> tftp.c
>     363 #ifdef BB_FEATURE_TFTP_GET2STDOUT
>     364     if ( localfile == NULL && cmd == tftp_cmd_get ) {
>     365         fd = 1;
>     366     } else {
>     367 #endif
>     368         fd = open(localfile, flags, 0644);
>     369         if (fd < 0) {
>     370             perror_msg_and_die("local file");
>     371         }
>     372 #ifdef BB_FEATURE_TFTP_GET2STDOUT
>     373     }
>     374 #endif
>
> With this busybox "tftp get" is able to write the file/s to stdout if you
> leave out  "-l filename". It is very usefull if someone want to use tarballs
> to update an embedded system on the fly for example.
> usage:
>         change to the directory were you want to install the files
> than with compressed tarballs
>         tftp -g HOSTNAME -r REMOTEFILE | gzip -d | tar x
> or
>         tftp -g HOSTNAME -r REMOTEFILE | tar x
> if it is not compressed.
>
> Regards
>         R.Parusel
>
> -------------------------------------------------------------
>
> Linus Torvalds: "We're back to the times where men were men,
>                  and wrote their own device drivers."
>
> =============================================================
> Infratec-Plus
> Gesellschaft für innovative Datentechnik mbH
> Werner-von-Siemens-Strasse 7
> 64625 Bensheim
>
> R.Parusel / Tel: 06251/8405-460 /   mailto:rp at infratec-plus.de
> =============================================================
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://busybox.net/mailman/listinfo/busybox

--
Jeff Studer
Software Engineer
Aquila Technologies Group

jstuder at aquilagroup.com
office:  505-796-3859






More information about the busybox mailing list