public inbox for linux-msdos@vger.kernel.org
 help / color / mirror / Atom feed
From: Frantisek Hanzlik <franta@hanzlici.cz>
To: Paul Crawford <psc@sat.dundee.ac.uk>
Cc: DOSEMU/FreeDOS <linux-msdos@vger.kernel.org>,
	Freedos user list <freedos-user@lists.sourceforge.net>
Subject: Re: DOS program recording it's parameters and environment?
Date: Thu, 16 Feb 2012 19:54:07 +0100	[thread overview]
Message-ID: <4F3D50CF.4000004@hanzlici.cz> (raw)
In-Reply-To: <4F229215.1040801@sat.dundee.ac.uk>

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

  reply	other threads:[~2012-02-16 18:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-18  5:20 DOS program recording it's parameters and environment? Frantisek Hanzlik
     [not found] ` <4F16E21B.9030804@gmail.com>
2012-01-18 17:46   ` Frantisek Hanzlik
2012-01-18 17:55     ` Frank Cox
2012-01-18 18:36       ` Frantisek Hanzlik
2012-01-18 19:17         ` Scott
2012-01-27 12:01 ` Paul Crawford
2012-02-16 18:54   ` Frantisek Hanzlik [this message]
2012-02-16 21:01     ` Paul Crawford
2012-02-16 21:34       ` Frantisek Hanzlik
2012-02-17  1:57       ` Samuel Bronson
2012-02-17 22:29         ` Scott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F3D50CF.4000004@hanzlici.cz \
    --to=franta@hanzlici.cz \
    --cc=freedos-user@lists.sourceforge.net \
    --cc=linux-msdos@vger.kernel.org \
    --cc=psc@sat.dundee.ac.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox