HDTenEightyP/NetNews huggingface dataset:
From: dmh@superb (Daniel Hermans)
Newsgroups: comp.os.msdos.programmer
Subject: How can you set an environment variable in a program?
Summary: can you set an env variable?
Keywords: variable, C
Date: 22 Aug 92 03:07:06 GMT
X-Newsreader: Tin 1.1 PL4

hi,
i am using turbo c v2.0 to generate a temporary file name,
place some data in the temporary file and then close the file. the temp
file is then to be used on the command line of another program. both
programs are called within a batch file something like:

@echo off

program1
program2 < %tempfile%

i need a way to tell the batch file the name of the tempfile that has been
created, so that it can be used by the second program on it's command line.

the only way i can see to do this would be to set an environment variable
to the temp file name within program 1 for use by program 2:
program1:
   generate temp file
   write to temp file
   close temp file
   system("set tempfile=tmpx.$$$");

program2:
   use tmpx.$$$ for whatever.

the name also needs to be unique so that multiple network users can create
their own temp files when they all start in the same directory. i am
using mktemp to generate the temp file name.

i tried using system(command) as above but the variable is not set when the
program exits probably because system starts a new command.com shell each
time

any ideas ?

--
Daniel Hermans (dmh@superb.mel.cocam.oz.au)
Co-Cam Computer Group, Melbourne, OZ (Phone : (613) 412-3341)
Newsgroups: comp.os.msdos.programmer
From: bx304@cleveland.Freenet.Edu (Jeff Epler)
Subject: Re: A batch programming contest for you
Reply-To: bx304@cleveland.Freenet.Edu (Jeff Epler)
Organization: Case Western Reserve University, Cleveland, Ohio, (USA)
Date: Tue, 18 Aug 92 16:26:57 GMT


In a previous article, ts@uwasa.fi (Timo Salmi) says:

>I have a puzzle for you gentle fellow programmers who are interested
>in batch programming. The task is the following.  With the standard
>batch commands write a batch that returns the extension of the
>(file) name given to the batch as the parameter (%1). No external
>commands or programs are allowed to perform the task.
>
>Please post your potential suggestions and solutions in here for
>everyone to see. 

Let me start off by saying that I have no idea how to do that.

But *why* would you want to put yourself through the pain and agony of
doing such a thing, when if you but 4DOS you can just say %@ext[%1] and
be done with it...

Thirdly, I'd still love to see how it's done...

-- 
|Jeff Epler               Additions Welcome           c(-8 ;-) >{8-) |
| :) (=( =-] (-= Celebrating the variety of faces =-> :^) {-= |-) (: |
|                                                   Lincoln, Nebraska|
Xref: sparky comp.os.msdos.programmer:8671 comp.lang.pascal:4935
Newsgroups: comp.os.msdos.programmer,comp.lang.pascal
Subject: Re: How can I redirect STDERR into a file ?
From: phys169@csc.canterbury.ac.nz
Date: 21 Aug 92 11:38:44 +1200
Organization: University of Canterbury, Christchurch, New Zealand

In article <4117@bimacs.BITNET>, tamari@bimacs.BITNET (tamari zvi) writes:
>   I wrote a program in Turbo Pascal that executes dos command and redirect it's
>   output into a file.
>   However, when an error accours the error message appear on the screen rather
>   than find it's way into the output file.
> 
>   So, the question is how can I redirect these error messages into a file ?
>   (it does'nt have to be the output file.

You can redirect any of the standard handles by duplicating the file handle,
closing the original file, openning it again using a different file, and
putting things back the way they were after executing the DOS commands.

There does seem to a be problem in Turbo Pascal, though, if you redirect a
standard handle then exit the program... Turbo's wrap-up code seems to restore
things automatically, undoing the redirection.

Here's a bit of Turbo Pascal to do something like what you ask...

program TryRedirect; {redirect StdErr during execution of a command}
uses DOS;
const
  StandardInputHandle = 0;
  StandardOutputHandle= 1;
  StandardErrorHandle = 2;
  StandardPrinterHandle=4;
  StandardAuxHandle   = 3;

var RedirectionFile : text;
    OldHandle       : word;
    reg             : registers;
    st,
    param1,
    param2          : string;

procedure WriteToStandardFile(Handle : word; st : string);
begin
with reg do begin
            AH:=$40; BX:=handle; CX:=length(st);
            DS:=seg(st); DX:=ofs(st[1]);
            MsDos(reg);
            if odd(Flags) then DosError:=AX else DosError:=0;
            end;
end;


function RedirectHandle(HandleToRedirect,NewFileHandle : word) : word;
begin
with reg do
     begin
     AH:=$45;
     BX:=HandleToRedirect;
     MsDos(reg);   {Duplicate a file handle}
     RedirectHandle:=AX; {Return the temporary copy of the original handle}
     AH:=$46;
     CX:=HandleToRedirect;
     BX:=NewFileHandle;
     if BX<>CX then MsDos(reg); {MSDOS might hang if BX=CX!}
     end;
end;

procedure UnRedirect(HandleToRedirect,OldFileHandle : word);
begin
with reg do
     begin
     AH:=$46;  {force duplicate handle}
     CX:=HandleToRedirect;
     BX:=OldFileHandle;
     if BX<>CX then MsDos(reg); {MSDOS might hang if BX=CX!}
     AH:=$3E;  {close a handle}
     BX:=OldFileHandle;
     MsDos(reg);
     end;
end;


begin
writeln('Redirection of stderr to a file (LPT1 in this demo)');
writeToStandardFile(StandardErrorHandle,' This was teh StdErr file...'^M^J);
assign(RedirectionFile,'LPT1');
rewrite(RedirectionFile);
writeln(RedirectionFile,'This is the file to get the redirected output...');
OldHandle:=Redirect(StandardErrorHandle,TextRec(RedirectionFile).handle);
close(RedirectionFile);
WriteToStandardFile(StandardErrorHandle,'This goes to the standard error file');
exec('c:\COMMAND.COM','/C something');
UnRedirect(StandardErrorHandle,OldHandle);
end.

Hope this helps,
Mark Aitchison, University of Canterbury, New Zealand.
From: billp@jupiter.cse.utoledo.edu (Bill Parquet)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Turbo C++ 3.1 -- does it exist ?
Date: 20 Aug 92 23:15:14 GMT

kestes@nswc-wo.navy.mil (Kent Estes) writes:
: I've heard that Turbo C++ 3.1 is out.  Is this true ?  If so
: can anyone tell me what has changed/improved ?

Not to much (I think) They implemented the C++ standard version 2.1 and
support for windows 3.1.
From: lubkt@synergy.CC.Lehigh.EDU (Binod Taterway)
Newsgroups: comp.os.msdos.programmer
Subject: How to detect base address of COMx ports?
Date: 17 Aug 92 18:28:54 GMT
Distribution: comp.os.msdos.programmer
Organization: Lehigh University, Bethlehem, PA


I am writing a software that dials various computers using a comm
package. In order to dial thru a particular, I need to know the base
address of the serial port. For COM1 and COM2, base addresses are set
to 0x3F8 and 0x2F8, respectively. For the rest of the ports, their
addresses are highly dependent on the vendor. So right now, I ask my
users to specify this address and the interrupt level if they are
using ports such as COM3 and COM4. Many of these users are too naive
to understand what these two terms and have hard time looking up the
manual. Is there any way, via some interrupt routine or the like, to
determine how many ports are available and their base addresses and
interrupt levels. Is it stored anywhere on the system?

Thanks in advance for your replies.
--

- Binod Taterway                     
  Sr. User Consultant (LUCC)
  E-mail: bt00@Lehigh.EDU
Newsgroups: comp.os.msdos.programmer
From: yogi@cs.ubc.ca (Yossi Gil)
Subject: Re: A batch programming contest for you
Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
Date: Wed, 19 Aug 92 06:51:19 GMT

ts@uwasa.fi (Timo Salmi) writes:

>As you might know I have a large collection of batch files and
>tricks garbo.uwasa.fi:/pc/ts/tsbat36.zip. I am always looking for
>useful new information for it.

Well, I have this other discovery that I try to offer every year
or so, but it still remains unnoticed. I hope that you will add
this to your tips&tricks so that I will not have to pound on this
again in a year from now. 

How to prevent ctrl-breaks during execution of autoexec.bat? 
------------------------------------------------------------
The "ctty nul" command is a well known trick, but it doesn't hold
if the user types in ^C quickly. One usually puts "@echo off" at the
beginning of the batch file. These leavs even more time to the
intruding user to break. 

My trick is to create
	shell=command.com /p nul line in my config.sys file. This will
make command.com start with the nul device as its standard
input/output. It is undocumented, but worked in all of the many dos
versions I have tried it on.

And yet another relatively unknwon features of COMMAND.COM. Did you
know that the following would work? Can you figure out what it will
do?

	<NUL> con ver 

as well as

	<CON> nul vol 

not mentioning

	if not if == not shift else ; endif 

These may prove useful to encrypt your batch files. 
--
Joseph (Yossi) Gil                 {alberta,uw-beaver,uunet}!ubc-cs!yogi
Dept. of Computer Science          yogi@cs.ubc.ca (cs.ubc.ca=137.82.8.5)
6356 Agricultural Road., Univ. of B.C.,             Tel: +1-604-822-8175
Vancouver, British Columbia, V6T 1Z2, Canada.       Fax: +1-604-822-5485
Newsgroups: comp.os.msdos.programmer
From: gchunt@rio.dixie.edu (Galen C. Hunt)
Subject: Anyone have a suggestion for a good 286 DOS Extender?
Organization: The Ohio State University Department of Computer and Information Science
Date: Wed, 19 Aug 1992 15:20:47 GMT

The software project that I'm currently working on needs to run on 286 machines,
but I would like to use a DOS extender because my program is extremely cramped
in 640K.  I would appreciate any helpful hints, suggestions or opinions from
anyone using a 286 DOS extender.  Important questions I have are the following:
	1) How much does it cost?
	2) Is there are runtime royalty?
	3) Will it work with Microsoft C (either 6.0 or 7.0)?
	4) Will it work with CodeView?
	5) Does it support automatic paging or swapping to disk?
Thanks for you time!

galen
Newsgroups: comp.os.msdos.programmer
From: Petri.Virkkula@hut.fi (Petri Virkkula)
Subject: Re: Summary: P.D. MAKE for msdos
Organization: Helsinki University of Technology, Finland
Date: 15 Aug 92 08:22:27

On Tue, 11 Aug 1992 06:02:05 GMT, glauber@vpnet.chi.il.us (Glauber Ribeiro) said:

Glauber> (1) My personal choice: GNUISH MAKE

Glauber>      This is a port done by the legendary Thorsten Ohl, of GNU 
Glauber> make 3.58 (beta version). It is public domain, fully unix- 


	Once again, allthough GNUISH make is free it isn't PD.
	It is distributed under GNU General Public License.


Glauber> -- 
Glauber> Glauber Ribeiro - Wheaton College, IL (USA)
Glauber>   email: glauber@vpnet.chi.il.us
Glauber>   big files and uuencoded stuff: gmribeir@david.wheaton.edu


	Petri
--
   -----------------------------------------------------------------------
       Petri Virkkula             |    email : Petri.Virkkula@hut.fi
       J{mer{ntaival 11 H 168     |            pvirkkul@niksula.cs.hut.fi
       02150 Espoo                |            pvirkkul@nic.funet.fi
       FINLAND                    |    Phone : +358 0 455 1277
   -----------------------------------------------------------------------
From: af458@yfn.ysu.edu (Jon K. Salmon)
Subject: Re: Summary: How to flush keyboard buffer
Organization: Youngstown State University/Youngstown Free-Net
Date: Fri, 14 Aug 1992 01:43:04 GMT


brown@NCoast.ORG (Stan Brown) writes:

>> while (kbhit()) getch();
>> while (bioskey(1)) bioskey(0);

> These two are very likely the same thing.  If they are implemented in
> the obvious way, however, they will miss keystrokes like F12.

The kbhit/getch version uses DOS calls (Int 21h, func. 0Bh and 07h,
respectively).  Note that the getch routine also contains support for
the ungetch function.

The bioskey routine calls BIOS (Int 16h, func. 01h and 00h).

True, an F12 keypress will not be detected by these calls; the BIOS
functions (0 and 1) will "automatically" ignore such keypresses.  Note
that Int 16h, functions 10h and 11h, on the other hand WILL grab such
keys.  However, since the goal is to flush the buffer, the bioskey
functions work just fine.  Note, furthermore, that Borland has NOT
implemented the 10h and 11h calls; i.e. you cannot simply call
bioskey(10h) to read an F12 keypress.

-- Jon
--
Newsgroups: comp.os.msdos.programmer
Subject: Help : Compression Algorithms
From: ebolog@elaine.ee.und.ac.za (EDWIN BOLOGNA : THIRD)
Date: 20 Aug 92 13:20:18 +0200
Organization: Electronic Eng., Univ. Natal, Durban, South Africa


Does anyone out there happen to have PAS, C, or ASM source code to decode
and code LZH, or other good compression formats.

Any information at all on any of these formats will be greatly appreciated.

        Desperate fellow programmer (And very Greatful for any information)

                E.B. (EBOLOG@ELAINE.EE.UND.AC.ZA)

PS : Please be kind hearted and Assist !
Newsgroups: comp.os.msdos.programmer
From: yogi@cs.ubc.ca (Yossi Gil)
Subject: Re: 4DOS diversion (Was Re: A batch programming contest for you)
Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
Date: Wed, 19 Aug 92 05:12:08 GMT

ts@uwasa.fi (Timo Salmi) writes:

>The funny side of it is that it is almost predestined that when an
>MsDos problem is posed some dedicated soul suggests using 4DOS. 
^^^^^^^^^^^^^^

Taking your words slightly out of context, but maintaining the playful
tone:

	Isn't MS-DOS a problem by definition?

	 
--
Joseph (Yossi) Gil                 {alberta,uw-beaver,uunet}!ubc-cs!yogi
Dept. of Computer Science          yogi@cs.ubc.ca (cs.ubc.ca=137.82.8.5)
6356 Agricultural Road., Univ. of B.C.,             Tel: +1-604-822-8175
Vancouver, British Columbia, V6T 1Z2, Canada.       Fax: +1-604-822-5485
From: libh@Jane.UH.EDU
Newsgroups: comp.os.msdos.programmer
Subject: Sorting/Printing
Date: 20 Aug 92 02:22:02 GMT
Article-I.D.: menudo.1992Aug20.022202.2349
Reply-To: libh@Jane.UH.EDU
Organization: University of Houston


  I am working on a project for a friend that requires me to sort a large file
of records (2000+ entries generally) that will change from month to month as he
gets updates so I can never be certain of the number of records.  I would
appreciate any suggestions on sorting the file.  Right now I am debating on how
to treat it as a large array on disk and sort it as if it were in memory, but I
also realize that it would be VERY slow.  Any suggestions would be greatly
appreciated.
  Also, can someone tell me how to send escape codes to the printer.  I haven't
had a reason until now but he wants the sorted file printed out in condensed
print.  How do I send the 'chr(27) + ??' (the basic version) to the printer.  I
tried sending the character 27 + value but it just gave me the ascii equivalent
letter rather than changing the printer setup.  Thanks alot in advance for any
help on either question....

********************************************************************************
*                       | What do I see?                                       *
*                       | I see time as it affects all things . . .            *
*   John White          | Human flesh withers and dies before my eyes. .       *
*                       | Flowers bloom only to fade . . .                     *
*   Libh@Jetson.uh.edu  | Trees drop green leaves, never to regain them        *
*                       | In my sight. . .it is always winter. . .always night *
*                       |                                     -- Raistlin --   *
********************************************************************************
Newsgroups: comp.os.msdos.programmer
From: Ross Ridge <ross@zooid.guild.org>
Subject: Re: A batch programming contest for you
Organization: ZOOiD BBS
Date: Thu, 20 Aug 1992 02:23:38 GMT

yogi@cs.ubc.ca (Yossi Gil) writes:
>My trick is to create
>	shell=command.com /p nul line in my config.sys file. This will
>make command.com start with the nul device as its standard
>input/output. It is undocumented, but worked in all of the many dos
>versions I have tried it on.

It's documented in the MS-DOS 5.0 manual.

>	<NUL> con ver 

>not mentioning
>
>	if not if == not shift else ; endif 
>
>These may prove useful to encrypt your batch files. 

Encrypt?  Try lightly obfuscated, you're not going to fool many
people with above tricks, not for long at least.

							Ross Ridge

-- 
Ross Ridge - The Great HTMU					     l/	 //
								    [OO][oo]
ross@zooid.guild.org						    /()\/()/
uunet.ca!zooid!ross						     db	 //
From: aeldridge@p473.f150.n3603.z1.FIDONET.ORG (Alan Eldridge)
Newsgroups: comp.os.msdos.programmer
Subject: Turbo Vision .EXE size
Date: Thu, 20 Aug 92 23:32:50 EDT
Organization: FidoNet node 1:3603/150.473 - Carrie's Living Roo, Largo FL

To: tom@fokus.gmd.de

Hello Tom!

20 Aug 92, Tom Pfeifer writes to All:

 TP> I've seen some complaints about the size of Turbo Vision programs.
 TP>
 TP> Don't forget to get rid of the debug information in your .EXE file.
 TP> The easiest way (instead of switching off in the IDE) is to run
 TP> TDSTRIP filename. My last application shrunk from 900K with to 200K
 TP> without the debug info.

You will save still more room if you link w/o the /v option.... if you use tdstrip, the static (BSS) areas in your program are still included in the .exe, because of debugger requirements. If you don't tell tlink to gen debug info, it will not create space for these until the app is actually loaded into memory.

Alan

--  
Internet: aeldridge@p473.f150.n3603.z1.FIDONET.ORG
UUCP: ...!myrddin!tct!psycho!150.473!aeldridge
Note:psycho is a free gateway between Usenet & Fidonet. For info write to
     root@psycho.fidonet.org.
Xref: sparky comp.os.msdos.programmer:8544 comp.os.ms-windows.programmer.misc:1333
From: pshuang@zurich.ai.mit.edu (Ping Huang)
Newsgroups: comp.os.msdos.programmer,comp.os.ms-windows.programmer.misc
Subject: Virtual Memory Manager (MSC 7.0)
Date: 14 Aug 92 21:11:30 GMT
Followup-To: comp.os.msdos.programmer
Distribution: comp
Organization: M.I.T. Artificial Intelligence Lab.

I was flipping through the "Programing Techniques" manual that comes
with MSC 7.0 and noticed section 4.7, "Using the Virtual Memory
Manager", covering new routines dealing with memory handles that permit
transparent use of EMS/XMS/disk space. This seems to be a new addition
to the run-time libraries. Has anybody else tried using it under DOS?
Better yet, has anybody tried using it in code shared with Windows?
(Using these new routines along with the Mewel Windows API library would
be a nice boon to us grunt programmers.)

If you think your answer is very specific to only one of the two
newsgroups that I have sent this posting to, please set follow-up.

--
| Ping Huang (INTERNET: pshuang@martigny.ai.mit.edu) speaking for himself.
| "One Thing to name them all, One Thing to define them,
|  One Thing to place them in environments and bind them..."
Newsgroups: comp.os.msdos.programmer
From: Frank Hoffmann <fh.pad@sni.de>
Subject: Re: BIOS/DOS interrupt list
Organization: Siemens Nixdorf Info.Sys. AG, Paderborn, Germany
Date: Tue, 18 Aug 1992 14:52:20 GMT

<ISSLKA@BYUVM.BITNET> writes:

>Can somebody please let me know where I can find a good list of DOS and BIOS
>interrupts, with descriptions and necassary parameter values?  I'm a student
>programmer and would like to be able to do some of the stuff that the big
>boys do.


288981 Jul 12 09:40 garbo.uwasa.fi:/pc/programming/inter31a.zip
276636 Jul 12 09:36 garbo.uwasa.fi:/pc/programming/inter31b.zip
164568 Jul 12 09:39 garbo.uwasa.fi:/pc/programming/inter31c.zip

284028 Apr 15  1991 garbo.uwasa.fi:/pc/programming/helppc21.zip

The above information was copied from : comp.os.msdos.programmer

Thanks to Timo Salmi at garbo.uwasa.fi anonymous FTP archives 128.214.87.1

frank
-------------------------------------------------------------------------------
    __________                  Frank Hoffmann
     /             /    Siemens-Nixdorf Info. Systems Voice: [+49] 5251 812 209
    /__           /      Dept: AP 52 / SW-Production    Fax: [+49] 5251 811 599
   /' _  _   __  //            Fuerstenallee 7          USA: fh.pad@sni-usa.com
__/__/__(_(_/ /_/^\__    W-4790 Paderborn / Germany    !USA: fh.pad@sni.de
-------------------------------------------------------------------------------
( * )  <--- The green dot.  This mail is reusable. Copy to /dev/null instantly.
-------------------------------------------------------------------------------
From: kestes@nswc-wo.navy.mil (Kent Estes)
Newsgroups: comp.os.msdos.programmer
Subject: What is the latest greatest Turbo C++ ?
Date: 20 Aug 92 17:01:16 GMT
Organization: Naval Surface Warfare Center - White Oak

I've heard that version 3.1 of Borland's Turbo C++ is out.  Can anyone tell
me :

  1.  if this is true ?
  2.  what's changed ?
  3.  is "that company" offering an upgrade ?

  tnx.
Newsgroups: comp.os.msdos.programmer
From: tobrien@gandalf.ca (Tony Obrien)
Subject: Re: Why can't I hook INT 21h???
Organization: Gandalf Data Ltd.
Date: Tue, 18 Aug 1992 12:38:00 GMT

In <eoq.25.0@vthnw.cvm.msu.edu> eoq@vthnw.cvm.msu.edu (Edward Quillen) writes:

>In article <14339@mindlink.bc.ca> Charlie_Hutchins@mindlink.bc.ca (Charlie Hutchins) writes:
>>From: Charlie_Hutchins@mindlink.bc.ca (Charlie Hutchins)
>>Subject: Why can't I hook INT 21h???
>>Date: 17 Aug 92 17:41:03 GMT
>>Okay, maybe someone could help me here.  I am trying to write a TSR
>>that hooks interrupt 21h but whenever I try and hook that vector I
>>get an invalid command.com error and my system crashes.  I am using
>>TC++ 3.0 and I have tryed both using their set vect routine as
>>well as manually changing the interrupt vector table but in both
>>cases the same thing happens...crash!  Even if I write an ISR for
>>INT 21h that simply returns control to the original ISR the system
>>crahes.  For example, even this crashes my system:
>>
>>#include <dos.h>
>>#include <stdio.h>
>>
>>void interrupt new21handler(void);
>>void interrupt (*old21handler)();
>>
>>void main(void)
>>{
>>        disable();
>>        old21handler=getvect(0x21);
>>        setvect(0x21, new21handler);
>>        enable();
>>        keep(0, 4000);
>>}
>>
>>void interrupt new21handler(void)
>>{
>>        (old21handler)();
>>}
>>
>>Anyone know what's wrong here??? As far as I can see this program should
>>basically do nothing but take up memory but instead, it crahes the system when
>>run.  Any info would be greatly appreciated.
>>
>>...Charlie Hutchins

>Please post replies to this ? because I've always wanted to hook INT 21h
>but have never been able to. Thanks!!!

>+++++++++++++++++++++++++++++++++++++++++++++++++
>+++ ED (Edward Quillen)   (517) 336-1293      +++
>+++ Vet Teaching Hosp.    System Admin.       +++
>+++ Email: quillen@cps.msu.edu                +++



Two things to consider:
1.  Beware of the "version" of your compiler...for example Microsoft 6.0 
exhibits an improper coding of the "GETVECT" routine and returns the correct
offset but the RONG segment!!!! (By the bye...MS6.AX revision seems to do 
this OK.

2. You might also try using "_far" in front of the routine prototypea and 
instances.

Luck,
tob

>+++++++++++++++++++++++++++++++++++++++++++++++++