# Retrieving files from tftpd



## balanga (Apr 25, 2021)

I'm trying to follow a Clonezilla script for retrieving files from a tftp server, but this does not seem to work on FreeBSD...

The example is `tftp -g -r custom-ocs-2 -l /tmp/custom-ocs-2 192.168.120.254` but on FreeBSD I just get:-

```
usage: tftp [host [port]]
tftp>
```

Is this to be expected?


----------



## SirDice (Apr 25, 2021)

If you look at tftp(1) you'll notice FreeBSD's tftp(1) client doesn't support all those options.


----------



## balanga (Apr 25, 2021)

Yes I did notice the man page, but thought there might be some undocumented options... I kind of thought that such universal programs as tftpd, which have been around for ever, would have similar options..

I have actually found that something like this  works:-

`echo 'get ldlinux.c32' | tftp 192.168.1.1`


----------



## honk (Apr 29, 2021)

balanga said:


> I kind of thought that such universal programs as tftpd, which have been around for ever, would have similar options



Is there an authority responsible to ensure that command line tools behave exactly the same across _different _operating systems?


----------



## SirDice (Apr 29, 2021)

balanga said:


> I kind of thought that such universal programs as tftpd, which have been around for ever, would have similar options..


Different implementations of the programs will have different options. Just because the protocol is the same and the tools are named the same that doesn't mean they all have the same options or usage.


----------



## mark_j (Apr 29, 2021)

honk said:


> Is there an authority responsible to ensure that command line tools behave exactly the same across _different _operating systems?


Yes, POSIX. It's optional to comply.


----------



## honk (Apr 29, 2021)

mark_j said:


> Yes, POSIX. It's optional to comply.



Optional to comply and mandatory to pay to read the specs?! Do you know whether the user interface of a tftp-client (e.g. command line options) is defined in POSIX?


----------



## mark_j (Apr 29, 2021)

That's a different question. 
I was splitting hairs. 
POSIX defines the applications API if you will, but not how you implement it for your own OS. So while tftp might use the POSIX library calls across different POSIX systems, it is totally up to the designers/implementers whether they follow the RFC and restrict or extend its capability.
See: RFC1350 and its extension RFC2347

So, ultimately, no, there is no standard. Some, for example, extended the functionality of grep into egrep. Still, I would guess the GNU version of grep is not exactly the same as the OpenBSD (now FreeBSD) version of grep?

Generally people get around this with tests in shell scripts to detect the OS and implement accordingly. It makes portability a pain, but that's life, I guess.


----------

