Re: DOS program recording it's parameters and environment?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paul Crawford napsal(a):
> Dear Frantisek,
>> Excuse me for slightly OT question. Know anyone DOS program, which is
>> able record infos with what parameters was started and eventually
>> other informations about calling environment (e.g. environment
>> variables, available memory etc.)?
> 
> Attacked is a gzip'd tar file with a simple program to do this, but
> re-named .dat instead of .tgz as we use Google mail and it is too stupid
> to allow compressed executables to be emailed.
> 
> Save to a Linux box and then re-name, then the usual arcive manager or
> tar can extract the files.
> 
> It creates a file dosenv.txt in the working directory and prints out the
> calling arguments and the environment to that file. If you have a C
> compiler (I used Microsoft's C6.0 DOS compiler from around 1988) you
> could modify this program to do other things (e.g. date/time based file
> names if they fit the 8.3 limit of DOS, etc)
> 
> Regards,
> Paul

Hello Paul,

many thanks for Your help. I have not bigger piece of time for playing
with until yesterday. And I must say You program work well, is quite
tiny and when I have seen how it is simple, I was ashamed for being so
powerless for writing similar code.

I was trying slightly modify You code (nothing much, only write result
to not fixed name file, but to filename basename(argv[0]) and open it
for append and write there timestamp when program run). Because I have
not had any C compiler before, I was downloading and using OpenWatcom C
compiler v1.9 (http://www.openwatcom.org/) for DOS. And there I knock
to problem - it seems as this compiler not support construction:

int main(int argc, char *argv[], char *envp[])

in the concrete, pointer to environment vector perhaps isn't possible or
valid. Program compiles and links fine, run without problems, printed
args are OK, but instead of environment variables it output only several
weird characters. Thus, when I can still ask, know You or someone in
DOSEMU or FreeDOS forum:

- when is possible walk through environment values in Watcom C?
I think it may be possible with some undocumented functions, with some
included assembler code etc. Or there may be problem e.g. in incorrect
variable alignment in memory...? ;)

- or when there is other free DOS C compiler which would be possible use?

Thanks in advance, Franta Hanzlik
--
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Console]     [Linux Audio]     [Linux for Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Camping]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Samba]     [Linux Media]     [Fedora Users]

  Powered by Linux