Hello to all of you!
Im in the process of recoding the tar command, (unix) and I ran into some problems/questions lately.
1.) What I do is, read a file, stat() on the file, create a header for my tar file, write into the tar file. And after I do the same for the rest. Is this more or less correct?
2.) Im having trouble with executables. I open an executable with emacs, you see very strange things. If I copy and paste this into a new file, it does not want to run no matter the encoding I put. Also reading the executable, the "read" command, doesnt read beyond the first 10 characters no matter what.
3.) If you open with emacs the executable or a tar file, you see ^@^@^@^@^@^@ and stuff like that all over the place. This is what a tar command (for example) does to make sure everything is in blocks of 512. How do I imitate this? I cant just write ^@^@ as it doesnt work. (im guessing ^@ is some binary code).
If you could help with those questions, I would be already very grateful. Im still in the thinking stage (as it is a big project), but those questions could really help me in doing the tar command.