Hi,
this command is really very useful but where I can get the source code to see what is going on inside .
thanks .
Hi,
this command is really very useful but where I can get the source code to see what is going on inside .
thanks .
After doing a quick search, this is one of the first things I found.
Poke around the uclinux site. Since they distributed the software, they are required to make the source available one way or another.
Or, you could read man fseek
and guess at how it might be done.
NB-- See William's comments below, there are cases when you can't use seek.
The tail utility is part of the coreutils on linux.
I've always found FreeBSD to have far clearer source code than the gnu utilities. So here's tail.c in the FreeBSD project:
You might find it an interesting exercise to write your own. The vast majority of the Unix command-line tools are a page or so of fairly straightforward C code.
To just look at the code, the GNU CoreUtils sources are easily found on gnu.org or your favorite Linux mirror site.