home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / ibm / pc / digest / 155 < prev    next >
Encoding:
Internet Message Format  |  1992-08-16  |  43.7 KB

  1. Path: sparky!uunet!cis.ohio-state.edu!ucbvax!BRL.MIL!Info-IBMPC
  2. From: Info-IBMPC@BRL.MIL (Info-IBMPC Digest)
  3. Newsgroups: comp.sys.ibm.pc.digest
  4. Subject: Info-IBMPC Digest V92 #133
  5. Message-ID: <920810195223.V92N133@brl.mil>
  6. Date: 10 Aug 92 18:52:23 GMT
  7. Sender: daemon@ucbvax.BERKELEY.EDU
  8. Reply-To: Info-IBMPC@BRL.MIL
  9. Distribution: world
  10. Organization: The Internet
  11. Lines: 1168
  12. Approved: info-ibmpc@wsmr-simtel20.army.mil
  13.  
  14. Info-IBMPC Digest           Mon, 10 Aug 92       Volume 92 : Issue 133 
  15.  
  16. Today's Editor:
  17.          Gregory Hicks - Rota Spain <GHICKS@brl.mil>
  18.  
  19. Today's Topics:
  20.     AT&T vs. BSDI --> 4.3BSD-NET2 distribution requires AT&T license
  21.                          Borland mktime() bugs
  22.    Help: What is the difference between 386 assembly and the old 286
  23.                   Hmm.  Random numbers again (2 msgs)
  24.                  HOW CAN I SET PARENT ENV VARS WITH C ?
  25.  How easy is file I/O from device drivers in CONFIG.SYS at boot time ?
  26.                       moved my ibmdos.com (6 msgs)
  27.                        Polygon Question (2 msgs)
  28.                       problems with new hard disk
  29.                        Reboot from protected mode
  30.                 REQUEST FOR INFO: DISABLING ^C (3 msgs)
  31.  
  32. Send Replies or notes for publication to: <INFO-IBMPC@brl.mil>
  33.  
  34. Send requests of an administrative nature (addition to, deletion from
  35. the distribution list, et al) to: <INFO-IBMPC-REQUEST@brl.mil>
  36.  
  37. Addition and Deletion requests for UK readers should be sent to:
  38. <INFO-IBMPC-REQUEST@DARESBURY.AC.UK>
  39.  
  40. Archives of past issues of the Info-IBMPC Digest are available by FTP
  41. ONLY from WSMR-SIMTEL20.ARMY.MIL in directory PD2:<ARCHIVES.IBMPC>.
  42.  
  43. ----------------------------------------------------------------------
  44.  
  45. Date: 21 Jul 92 19:31:48 GMT
  46. From: merlin <merlin@neuro.usc.edu>
  47. Subject: AT&T vs. BSDI --> 4.3BSD-NET2 distribution requires AT&T license
  48. Keywords: AT&T 'Death Star' rises over BSDI's horizon [Tel. 1-800-800-4BSD
  49.  
  50. [For people in comp.unix.sysv386 -- two products were recently released
  51. in field test versions with a production version intended in the near
  52. future.  Berkeley Software Design, Inc [Tel. 1-800-800-4BSD] has
  53. offered full source code for a product called 'BSD/386' based on the
  54. publically available code made available via numerous archive sites
  55. from the UC Regents 4.3BSD-NET2 UNIX software distribution.  Willian
  56. and Lynne Jolitz have offered the full sources for an alternative
  57. product called '386BSD' which is also based on the publically available
  58. UC Regents 4.3BSD-NET2 UNIX software distribution.  'BSD/386' sells for
  59. $1,000 for the full source and $200 for a binary right to copy.
  60. '386BSD' is available from numerous public archive sites without any
  61. charge of any kind.]
  62.  
  63. [The UC Regents 4.3BSD-NET2 software was claimed not to contain any
  64. AT&T derived source code -- as a consequence it was believed by many
  65. people to be an appropriate base for development of extremely
  66. inexpensive versions of 'Berkeley UNIX' compatible operating systems.
  67. This claim is disputed by AT&T as described below.]
  68.  
  69. [This note is not an advertisement of any kind.  I am not connected
  70. with AT&T, ATTIS, USG, USDL, USL (or whatever AT&T would like to be
  71. called in the near future), Bell Laboratories, UC Regents, CSRG, BSDI,
  72. or the Jolitz Development Team.  This is simply an expression of
  73. concern about litigation which will have a dramatic effect on whether
  74. or not AT&T is allowed to have monopoly interest in operating systems
  75. derived from publically available source codes.  Frankly, I am curious
  76. about the ultimate judge's decision.]
  77.  
  78. Two days ago I told a colleague in Psychology that the world had
  79. changed -- we spent several hours talking about the possibilities for
  80. good which arose from the free or at least very low cost release of
  81. 386BSD & BSD/386.
  82.  
  83. However, AT&T [and it's massive army of high paid staff attorneys] have
  84. fired the first shot in a legal action which may doom such
  85. possibilities.
  86.  
  87. Tomorrow I'm going to have to tell him the forces of darkness and greed
  88. have decended to crush hope of using UNIX in extremely low cost
  89. systems.
  90.  
  91. The bottom line is that AT&T claims NET2 is contaminated with
  92. intellectual property misappropriated from AT&T -- perhaps not direct
  93. copies of source code -- but at least ways of doing things (trade
  94. secrets) -- and therefore any system derived from NET2 requires an AT&T
  95. source code license [it used to be about $10,000 to get an AT&T source
  96. license].  The threat is twofold
  97.  
  98. o  AT&T can sue anyone who has any assets or any prospect of assets for
  99. each and every copy of an operating system maintained or allowed to be
  100. copied by any individual without payment of the AT&T license fee
  101.  
  102. o  AT&T can withdraw it's contribution from any organization which
  103. would permit the maintenance or copying of systems derived from
  104. 4.3BSD-NET2
  105.  
  106. AT&T's complaint 92-1667 filed in US District Court--New Jersey claims:
  107.  
  108. o  AT&T authorized the UC Regents to distribute certain works derived
  109. from their UNIX software to third parties ... subject to restrictions
  110.  
  111.    o  Those restrictions include a requirement limiting such
  112. distribution to persons who have also acquired licenses from AT&T or
  113. USL
  114.  
  115. o  'Networking Release 2' contains software code that was copied from,
  116. based upon, or derived from, code licensed to the Regents by AT&T
  117.  
  118. o  Any operating system derived from 'Networking Release 2' requires a
  119. license from AT&T or its successor, USL
  120.  
  121. AT&T's entire complaint is contained in a false advertising and unfair
  122. competition claim based on BSDI's brochure which states BSDI sources
  123. are not derived from AT&T code --and-- do not require an AT&T source
  124. license.
  125.  
  126. AT&T's 1-MAY-92 interrogatory (a series of questions to an adversary)
  127. asks:
  128.  
  129. o  Whether anyone related to BSDI has ever had access to AT&T UNIX
  130. sources
  131.  
  132. o  How much employee time was spent to develop BSDI's source code
  133. product
  134.  
  135. BSDI's motion to dismiss and subsequent press releases argue that AT&T
  136. has not made out an adequate case of copyright infringement -- and --
  137. therefore cannot maintain their claim of false advertising or unfair
  138. competition until they prove what BSDI would like to say is a simple
  139. copyright claim.
  140.  
  141. However, the AT&T claim is not a copyright claim -- it is a claim that
  142. BSDI incorporated intellectual property belonging to AT&T into the BSDI
  143. product.  The intellectual property may be in the form of copyright,
  144. patent, or trade secret protected material.  While NET2 may not
  145. literally contain any direct copies of AT&T source code -- it is very
  146. possible it contains a translation or adaptation of copyrighted
  147. material -- or it may contain a patented means of performing some task
  148. -- or it may be based on knowledge of the original techniques [trade
  149. secrets] embodied in the AT&T source code.  Hence, AT&T only has to
  150. prove that someone involved in CSRG's NET2 release or in BSDI's BSD/386
  151. development had access to AT&T licensed materials at some time in
  152. his/her lifetime to trigger the spectre of contamination of BSDI's
  153. product.
  154.  
  155. BSDI's position is in stark contrast the Phoenix BIOS project where two
  156. teams of engineers worked in parallel -- one team developing a
  157. functional specification by studying the original IBM BIOS ROM chip
  158. codes -- and a second completely independent and compartmentalized team
  159. developing code.  There is no suggestion either CSRG or BSDI made any
  160. effort to institute similar means to prevent the incorporation of AT&T
  161. technology in BSD/386.
  162.  
  163. Further, AT&T's question about the time investment of BSDI in bringing
  164. out their product [compared with their own cost over many years] will
  165. likely go a long way toward supporting their unfair competition claim.
  166. If it took a small company like BSDI only a couple of years with a
  167. small team of people to produce BSD/386 vs the multi year investment of
  168. a corporate giant - then it is very possible AT&T may prevail on the
  169. unfair competition claim.
  170.  
  171. On a final note, BSDI's own press release states that:
  172.  
  173.   Although USL has not sued the University of California, we expect that
  174.   USL (or its parent, ATT) will threaten to review or withdraw research
  175.   grants made to any university or research institution using or
  176.   distributing software based on NET2 ...
  177.  
  178. All in all, this filing by a corporate giant with virtually unlimited
  179. funds for legal expenses would seem to spell the doom of 'free' UNIX
  180. projects as they are presently conceived.  There is simply too much
  181. risk someone with a prior exposure to AT&T source codes could manage to
  182. contaminate the product.
  183.  
  184. Sigh, AJ
  185.  
  186. Alexander-James Annala
  187. Principal Investigator
  188. Neuroscience Image Analysis Network
  189. HEDCO Neuroscience Building, Fifth Floor
  190. University of Southern California
  191. University Park
  192. Los Angeles, CA 90089-2520
  193.  
  194. [mod- as discussed here previously, UNIX does not have any patent
  195. protection. The only patent relating to it that I am aware of was the
  196. SUID patent which was donated to the public some time ago]
  197.  
  198. ------------------------------
  199.  
  200. Date: 19 Jul 92 02:08:00 GMT
  201. From: Vanzandt <jrv@truth.uucp>
  202. Subject: Borland mktime() bugs
  203.  
  204. Borland seems to have bugs in their implementations of mktime(), which
  205. converts a broken down time to a time_t (seconds since 0000 UCT 1 Jan
  206. 1900).  It is supposed to adjust invalid parameters (like 93 seconds or
  207. the 43rd day of the month) to be within their proper range.  However,
  208. Borland's mktime() sometimes increments or decrements the hour even if
  209. it's valid.  (It's not a one time adjustment, either -- if called again
  210. with the same structure, it keeps changing the hour.)
  211.  
  212. The version in the Turbo C++ 1.0 library shows the error for several
  213. days near each daylight savings time transition, for example:
  214.  mktime error 11 -> 10 on Apr 03 10:15:54 1989
  215.  mktime error 11 -> 10 on Apr 04 10:15:54 1989
  216.  mktime error 11 -> 10 on Apr 05 10:15:54 1989
  217.  mktime error 11 -> 10 on Oct 26 10:15:54 1989
  218.  mktime error 11 -> 10 on Oct 27 10:15:54 1989
  219.  mktime error 11 -> 10 on Oct 28 10:15:54 1989
  220.  mktime error 11 -> 10 on Oct 29 10:15:54 1989
  221.  mktime error 11 -> 10 on Apr 02 10:15:54 1990
  222.  mktime error 11 -> 10 on Apr 03 10:15:54 1990
  223.  mktime error 11 -> 10 on Apr 04 10:15:54 1990
  224.  mktime error 11 -> 12 on Oct 29 12:15:54 1990
  225.  mktime error 11 -> 12 on Oct 30 12:15:54 1990
  226.  mktime error 11 -> 12 on Oct 31 12:15:54 1990
  227. The version with Borland C++ 3.00 shows it only exactly on the day of the 
  228. transition, always incrementing in the spring and decrementing in the fall:
  229.  mktime error 10 -> 11 on Sun Apr 02 11:24 1989
  230.  mktime error 10 ->  9 on Sun Oct 29 09:24 1989
  231.  mktime error 10 -> 11 on Sun Apr 01 11:24 1990
  232.  mktime error 10 ->  9 on Sun Oct 28 09:24 1990
  233.  mktime error 10 -> 11 on Sun Apr 07 11:24 1991
  234.  mktime error 10 ->  9 on Sun Oct 27 09:24 1991
  235.  mktime error 10 -> 11 on Sun Apr 05 11:24 1992
  236.  mktime error 10 ->  9 on Sun Oct 25 09:24 1992
  237.  mktime error 10 -> 11 on Sun Apr 04 11:24 1993
  238.  mktime error 10 ->  9 on Sun Oct 31 09:24 1993
  239.  
  240. I believe the hour should be incremented only between 0200 and 0259 on
  241. the spring Sunday when daylight savings time starts, and that it should
  242. never be decremented.  A demo program follows.  Does the new Borland
  243. C++ 3.1 have bug?
  244.  
  245.                             - Jim Van Zandt <jrv@mbunix.mitre.org>
  246.  
  247. /*    demonstrate a bug in the Borland implementation of mktime() */
  248. #include <stdio.h>
  249. #include <time.h>    /* relevant declarations */
  250. main()
  251. {    char buf[200];
  252.     int yr, mo, da, hr = 10; /* NOT near 2:00 AM */
  253.     time_t now = time(0);
  254.     struct tm bdt = *localtime(&now); /* fill structure with legal values */
  255.     for (yr = 89; yr < 94; yr++)     /* test all days in a five year span */
  256.         for (mo = 0; mo < 12; mo++)
  257.             for (da = 1; da < 32; da++) {
  258.                 bdt.tm_year = yr;
  259.                 bdt.tm_mon = mo;
  260.                 bdt.tm_mday = da;
  261.                 bdt.tm_hour = hr;
  262.                 mktime(&bdt);
  263.                 if(bdt.tm_hour != hr) {
  264.                     strftime(buf, 199, "%a %b %d %H:%M %Y", &bdt);
  265.                     printf(" mktime error %2d -> %2d on %s\n", 
  266.                                             hr, bdt.tm_hour, buf);
  267.                 }
  268.             }
  269. }
  270.  
  271. ------------------------------
  272.  
  273. Date: 18 Jul 92 04:37:33 GMT
  274. From: Mark William Hopkins <markh@csd4.csd.uwm.edu>
  275. Subject: Help : What is the difference between 386 assembly and the old 286
  276.  
  277. 882028s@dragon.acadiau.ca (Ghazali Shafie) writes:
  278. >
  279. >I'm wondering what kind of differences between 386 assembly llang and 286
  280. >( I know there should be a difference since 386 is 32bit ) but what are
  281. >the differences and are any new instruction is used or introduced into
  282. >a 386 .
  283. >
  284. >Thanks in advance
  285. >.
  286.  
  287. 80386 EXTENSIONS
  288. Segment registers FS, GS
  289. Stack operations: pop FS, pop GS, push FS, push GS
  290.  
  291. 16-bit Registers now contained inside 32-bit registers:
  292.    EAX, EBX, ECX, EDX, ESI, EBI, ESP, EBP
  293.  
  294. Extra addressing modes for 32 bit operands.
  295.    Indirect addressing:     [I]
  296.    Scaled-index addressing: [I + S*B].
  297.    I: Any 32-bit register.
  298.    B: Any 32 bit register, except ESP.
  299.    S: The SCALE: 1, 2, 4, or 8.
  300.  
  301. Size Altering Prefixes to toggle between 16/32 bit addressing mode and
  302. 16/32 bit operand size.
  303.    opsiz:
  304.    adrsiz:
  305.  
  306. So most 16-bit operations can now be used on 32-bit objects, and
  307. operations involving indirect addressing can now used the extended
  308. 32-bit addressing modes.
  309.  
  310. Test and debug registers (CR0-CR7, DR0-DR7, TR0-TR7, not all defined).
  311. Test register operationd (Rd = 32-bit register).
  312.  
  313.    mov CRn, Rd
  314.    mov DRn, Rd
  315.    mov Rd, CRn
  316.    mov Rd, DRn
  317.    mov TRn, Rd
  318.    mov Rd, TRn
  319.  
  320. 16/32 bit offset jumps (Dv = 16/32 bit offset)
  321.    j* Dv
  322.  
  323. Set byte on condition (byte = condition? 1: 0), (Eb = byte operand).
  324.    set* Eb
  325.  
  326. Bit test operations (Ev = 16/32 bit effective address, Rv = 16/32 bit
  327. register, b = 8-bit constant).  First operand is the address, second
  328. operand is the bit index.
  329.  
  330. CF = bit(Dest, Index);
  331.    bt Ev, Rv
  332.    bt Ev, b
  333. CF = bit(Dest, Index); bit(Dest, Index) = 1;
  334.    bts Ev, Rv
  335.    bts Ev, b
  336. CF = bit(Dest, Index); bit(Dest, Index) = 0;
  337.    btr Ev, Rv
  338.    btr Ev, b
  339. CF = bit(Dest, Index); bit(Dest, Index) ^= 1;
  340.    btc Ev, Rv
  341.    btc Ev, b
  342.  
  343. Double shift left: shld D, S, C ...  D = D:S << max(C, 31);
  344.    shld Ev, Rv, b
  345.    shld Ev, Rv, CL
  346. Double shift right: shrd D, S, C ... D = D:S >> max(C, 31);
  347.    shrd Ev, Rv, b
  348.    shrd Ev, Rv, CL
  349.  
  350. Byte/Word to Word/Long conversions (Eb = 8 bit operand, Ew = 16 bit
  351. operand).  Move with Zero Extension
  352.  
  353.    movzx Rv, Eb
  354.    movzx Rv, Ew
  355. Move with Sign Extension
  356.    movsx Rv, Eb
  357.    movsx Rv, Ew
  358. Convert Double to Quad (EDX:EAX = sign-extend(EAX))
  359.    cdq
  360. Convert Word to Double Extended (EAX = sign-extend(AX))
  361.    cwde
  362.  
  363. Bit scan operations
  364. Bit Scan Forward
  365.    bsf Rv, Ev
  366. Bit Scan Reverse
  367.    bsr Rv, Ev
  368.  
  369. More stack operations
  370. Push 32-bit General Registers
  371.    pushad
  372. Pop All General Registers
  373.    popad
  374. Pop Stack into EFLAGS
  375.    popfd
  376. Push EFLAGS Register
  377.    pushfd
  378.  
  379. ------------------------------
  380.  
  381. Date: 18 Jul 92 21:19:48 GMT
  382. From: Philip Smolen <phil@cs.utexas.edu>
  383. Subject: Hmm.  Random numbers again.
  384. Keywords: random knuth
  385. Summary: Everything you ever wanted to know about random numbers
  386.  
  387. tck@netlink.cts.com (Kevin Marcus) writes:
  388. >Basically, what I need to do is get random numbers, without using the system 
  389. >clock, or, if it does use the clock, if I were to take two random numbers 
  390. >rigth next to each other (this is all in ASM!!!) that I would not get the 
  391. >same number.
  392.  
  393. You need to read _The Art of Computer Programming, volume 2:
  394. Semi-numerical Algorithms_ by Donald E. Knuth.  Half of this book
  395. discusses good algorithms for generating random numbers.  Knuth uses
  396. assembly to express his algorithms.  You'll probably also want volume
  397. one of this series, since it explains Knuth's unique way of expressing
  398. algorithms.
  399.  
  400. ------------------------------
  401.  
  402. Date: 20 Jul 92 14:26:46 GMT
  403. From: Alan Modra <amodra@ucs.adelaide.edu.au>
  404. Subject: Hmm.  Random numbers again.
  405.  
  406. >tck@netlink.cts.com (Kevin Marcus):
  407. > Basically, what I need to do is get random numbers, without using the system
  408. > clock, or, if it does use the clock, if I were to take two random numbers
  409. > rigth next to each other (this is all in ASM!!!) that I would not get the
  410. > same number.
  411.  
  412. Get the "improved random number generator" random.c from
  413. gatekeeper.dec.com in /.0/bsd-sources/src/lib/libc/gen (or from many
  414. other places in netland)
  415.  
  416. This files has LOTS of comments, and is fairly easy to understand, even
  417. if you're not a C programmer.  It will give you an idea how to create
  418. the most efficient assembly routines I know that return reasonably
  419. random (in a statistical sense) numbers.
  420.  
  421. For instance, a 32 bit RNG in TASM ideal mode for 386
  422.  
  423. proc Rand uses si
  424. public  Rand
  425. ; Nifty shift register feedback style of random number generator
  426. ; Think of it as 32 shift registers in parallel, with polymonial x^63 + x + 1
  427. ; There's also carries from one register to the next
  428. ; Period is approximately 63*(2^63-1)
  429.         cld
  430.         mov     si,[rptr]
  431.         lodsd
  432.         rol     eax,1
  433.         cmp     si,offset EndRandDat
  434.         jb      short Ok1
  435.         mov     si,offset StartRandDat
  436. Ok1:
  437.         add     [si],eax
  438.         mov     [rptr],si
  439.         ret
  440. endp
  441.  
  442. rptr is an index into an array of 63 dwords - the shift register.  See
  443. random.c for initial values to plug into the array.
  444.  
  445. The line 'rol eax,1' is a slight modification I made to the algorithm,
  446. an attempt to give bit 0 the same propagated carries that the other
  447. bits have.
  448.  
  449. It seems to work OK but I haven't done exhaustive tests, nor done any
  450. analysis of the resultant period (any pure mathematicians out there
  451. like a problem?).
  452.  
  453. ------------------------------
  454.  
  455. Date: 20 Jul 92 12:30:06 GMT
  456. From: hdtodd@eagle.wesleyan.edu
  457. Subject: HOW CAN I SET PARENT ENV VARS WITH C ?
  458.  
  459. rlmeyering@beckman.com writes:
  460. > I am writing an application in BORLAND C within which I need to be able
  461. > to SET environment variables that will remain once the program completes.
  462.  
  463.     I wrote two C programs that manipulate the parent (in fact, root)
  464. environment.  One trims environment variables (we use it on our Novell
  465. servers) and the other manipulates paths.  Either one would show how to
  466. manipulate the environment to add a new variable, for example.
  467.  
  468.     Here is the code for mp.c, which manipulates the path.  
  469.  
  470. /* mp.c
  471.    Program to modify the path environment for MS-DOS.
  472.    Written by H. D. Todd, Wesleyan University, 12/26/90 */
  473.  
  474. #include <stdio.h>
  475. #include <stdlib.h>
  476. #include <string.h>
  477. #include <dos.h>
  478. #define MAXSTRS 100        /* increase this if you have more env strings */
  479. #define MAXPATH 500        /* max size of path string */
  480. #define PATHSEP ";"        /* separates node names in path */
  481.  
  482. void main(int argc, char *argv[])
  483.  
  484. {
  485.   int i, num, envsize, len, nstrs=0, nextra, pathindex;
  486.   char dowhat, varstg[MAXPATH], tmpstr[MAXPATH],
  487.         *strptr[MAXSTRS], far *envp, far *envptr, *subloc;
  488.   unsigned far *p_psp, far *p_env;
  489.   struct {
  490.          char link;
  491.          unsigned int owner_psp;
  492.          unsigned int blk_len;
  493.          } far *envmcb;
  494.  
  495.   if (argc < 2) {
  496.     fprintf(stderr, "Usage: mp [ -{p|a} newnodename | -r oldnodename newnodename]*\n");
  497.     exit(1); }
  498.  
  499. /* Construct the PSP pointers */
  500.   p_psp = MK_FP(_psp,0x16);    /*pointer to parent's PSP*/
  501.   p_env = MK_FP(*p_psp,0x2c);  /*pointer to parent's environment ptr*/
  502.   envptr = MK_FP(*p_env,0x00); /*pointer to parent's environment */
  503.   envmcb = MK_FP(*p_env-1,0x00); /* pointer to parent env MCB */
  504.   envsize = (*envmcb).blk_len<<4;
  505.  
  506. /* copy strings from parent's environment (FAR) to local strings */
  507.    envp = envptr;
  508.    while (*envp) {      /* env strings terminated by second null */
  509.          int len;
  510.          char far *fp;
  511.          char *lp;
  512.          for (len=0, fp=envp; *fp; fp++) len++;
  513.          lp = strptr[nstrs++] = malloc(len+1);
  514.          for ( ; (*lp++=*envp++); );
  515.          }
  516.  
  517.  
  518. /*  find the PATH= string among the env vars */
  519.    for (pathindex=0; pathindex<nstrs; pathindex++) if (strnicmp(strptr[pathindex],"PATH=",5) ==0 ) break;
  520.    if (pathindex>=nstrs) {
  521.        fprintf(stderr, "MP: Can't find path var!\n");
  522.        exit(1);
  523.    }
  524.    strcpy(varstg,strptr[pathindex]);
  525.  
  526. /*  now do what the switches tell us to do */
  527.    while (--argc > 0 ) {
  528.     if ( ( (dowhat=(*++argv)[0])) != '-') {
  529.         fprintf(stderr, "MP: begin switches with '-', as in '-%c'\n", dowhat);
  530.              exit(1);
  531.     }
  532.     dowhat = tolower(*++argv[0]);
  533.     if (dowhat!='p' && dowhat!='a' && dowhat!='r') {
  534.        fprintf(stderr, "MP: invalid switch -%c\n", dowhat);
  535.        exit(1);
  536.     };
  537.     if (--argc <=0) {
  538.         fprintf(stderr, "MP: switch -%c missing node name\n", dowhat);
  539.         exit(1);
  540.     }
  541.     switch (dowhat) {
  542.         case 'a':    strcat(varstg,PATHSEP);
  543.                 strcat(varstg,*++argv);
  544.                 break;
  545.         case 'p':    strcpy(tmpstr,"PATH=");
  546.                 strcat(tmpstr,*++argv);
  547.                 strcat(tmpstr,PATHSEP);
  548.                 strcat(tmpstr,strpbrk(varstg,"=")+1);
  549.                 strcpy(varstg,tmpstr);
  550.                 break;
  551.         case 'r':    if ( (subloc=strstr(varstg,*++argv)) == NULL) {
  552.                     fprintf(stderr,"MP: pathnode %s not found in current path\n", *argv);
  553.                     fprintf(stderr,"    replacement ignored");
  554.                     while ( *(argv+1)[0] != '-') {
  555.                         ++argv;
  556.                         argc--;
  557.                     }
  558.                     break;
  559.                     };
  560.                 strcpy(tmpstr,subloc+strlen(*argv));
  561.                 if (*(argv+1)[0] != '-') {
  562.                     strcpy(subloc,*++argv);
  563.                     --argc;
  564.                     }
  565.                   else subloc = '\0';
  566.                 strcat(varstg,tmpstr);
  567.                 break;
  568.     };
  569.    }
  570.  
  571. /*  make sure we can copy it all back into the parent's env block */    
  572.     strptr[pathindex] = &varstg;
  573.     for (i=0, len=0; i<nstrs; i++) len += strlen(strptr[i]) + 1;
  574.     if (len+1>envsize)  {
  575.         fprintf(stderr,"MP: Env block too small to store updated PATH string\n");
  576.         exit(1);
  577.         }
  578.       else {
  579. /*  OK, do it */
  580.         for (i=0; i<nstrs; i++) {
  581.             for ( ; (*envptr++ = *strptr[i]++) ; ) ;
  582.             *envptr = '\0';
  583.         }
  584.       }
  585. }
  586.  
  587.  
  588. ------------------------------
  589.  
  590. Date: 22 Jul 92 08:22:08 GMT
  591. From: Len Chisholm <L.Chisholm@massey.ac.nz>
  592. Subject: How easy is file I/O from device drivers in CONFIG.SYS at boot time ?
  593. Keywords: CONFIG.SYS device drivers file I/O
  594. Summary: I want to do file I/O at boot time from a device driver in CONFIG.SYS
  595.  
  596. Hi there,
  597.  
  598. I am interested in doing file operations from a CONFIG.SYS loaded
  599. device driver at BOOT time to load configuration information.
  600.  
  601. It is obviously possible as QEMM'S LOADHI.SYS must read other device
  602. drivers and the OPTIMISE command causes LOADHI to write statistics to a
  603. file.
  604.  
  605. What contortions are required to do this safely , and what limitations
  606. are involved ( if any ) ?
  607.  
  608. Thanks in advance,
  609.  
  610. -------------------------------------------------------------------------
  611. |  LEN CHISHOLM , Systems programmer  | EMail: L.Chisholm@massey.ac.nz  |
  612. | Department of Production Technology | Phone: +64 6 3505262            |
  613. |         Massey University           | FAX:   +64 6 3505604            |
  614. |   Palmerston North, New Zealand     |                                 |
  615. -------------------------------------------------------------------------
  616.  
  617.  
  618. ------------------------------
  619.  
  620. Date: 20 Jul 92 09:29:08 GMT
  621. From: Volkmar Grote <vg@sup.stollmann.de>
  622. Subject: moved my ibmdos.com ....
  623.  
  624. jcmorris@mwunix.mitre.org (Joe Morris) writes:
  625.  
  626. >Several other posters have recommended the Norton Disk Doctor's "Make disk
  627. >bootable" function.  They're right, and I don't know of any other common
  628. >program to do this (other than the FORMAT command  ...  ah, THAT'S A JOKE!)
  629.  
  630. The other common program is DR DOS' "sys", which is much more sensible
  631. than the MS variant; when updating, the latter first destroys your
  632. system and then tells you, that there is not enough space ...  Volkmar
  633.  
  634. ------------------------------
  635.  
  636. Date: 19 Jul 92 03:32:40 GMT
  637. From: Jen Kilmer <jenk@microsoft.com>
  638. Subject: moved my ibmdos.com ....
  639.  
  640. Ralf.Brown@B.GP.CS.CMU.EDU writes:
  641. >parry@yoyo.cc.monash.edu.au (Tom J Parry) wrote:
  642. >}As of DOS 5.00, this problem no longer exists. Well it does but DOS 5.00
  643. >}can handle it. The SYS command of DOS 5.00 is able to install DOS on a
  644.  
  645. >For DOS 4.0+, only the first three sectors of IO.SYS have to be
  646. >contiguous.  
  647.  
  648. actually, for 3.30+, only the first three sectors of IO.SYS have to be
  649. contiguous. but 4.0+, SYS is able to move any file occupying those
  650. first three sectors elsewhere. SYS is also able to move any file(s) in
  651. the first two directory entries elsewhere.
  652.  
  653. >5.0, even the requirement that those three sectors be the first three on
  654. >the disk has been lifted by storing the actual starting location in the
  655. >boot sector.
  656.  
  657. also 5.0's SYS copies COMMAND.COM over as a matter of course...which
  658. for the majority of DOS users, makes a normal boot floppy.
  659.  
  660. >Internet: RALF+@CS.CMU.EDU   |The University would disclaim this if it knew...
  661. >FIDO: Ralf Brown 1:129/26.1  |"Wisdom is the quality that keeps you from
  662. >BIT: RALF%CS.CMU.EDU@CARNEGIE| getting into situations where you need it."
  663. >AT&Tnet: (412)268-3053 school|        -- Doug Larson
  664.  
  665. (gee, I'm correcting Ralf Brown...maybe one of these days I'll get to
  666. meet BillG. :-)
  667.  
  668. -jen
  669.  
  670. ------------------------------
  671.  
  672. Date: 19 Jul 92 16:20:10 GMT
  673. From: Leonard Erickson <leonard@qiclab.scn.rain.com>
  674. Subject: moved my ibmdos.com ....
  675.  
  676. jenk@microsoft.com (Jen Kilmer) writes:
  677.  
  678. >also 5.0's SYS copies COMMAND.COM over as a matter of course...which for
  679. >the majority of DOS users, makes a normal boot floppy.   
  680.  
  681. No it does *not*! 
  682.  
  683. As many users of 4dos (and other shels that take the place of
  684. COMMAND.COM could tell you, DOS 5.0's SYS takes *whatever* program is
  685. pointed to by the COMSPEC environment variable and copies it to the
  686. disk under the *name* COMMAND.COM!
  687.  
  688. Arguably, the copying could be considered the "correct" behavior, and
  689. in that case, to boot without a CONFIG.SYS the renaming is necessary.
  690. But as some of these shells require overlay files and the like, this is
  691. *not* a good idea.
  692.  
  693. I'd suggest that in the next version or revision, SYS should check and
  694. if the command processor *isn't* COMMAND.COM, it should prompt the user
  695. and ask if he wants <filename> copied to the disk. If not, then have it
  696. ask him for the path to COMMAND.COM and copy that.
  697.  
  698. Trust me, this *has* resulted in very puzzled users with non-bootable
  699. disks!
  700.  
  701. Leonard Erickson              leonard@qiclab.scn.rain.com
  702. CIS: [70465,203]             70465.203@compuserve.com
  703. FIDO:   1:105/56     Leonard.Erickson@f56.n105.z1.fidonet.org
  704. (The CIS address is checked daily. The others infrequently)
  705.  
  706. ------------------------------
  707.  
  708. Date: 19 Jul 92 18:17:42 GMT
  709. From: Ralf.Brown@b.gp.cs.cmu.edu
  710. Subject: moved my ibmdos.com ....
  711.  
  712. jenk@microsoft.com (Jen Kilmer) wrote:
  713. }Ralf.Brown@B.GP.CS.CMU.EDU writes:
  714. }>For DOS 4.0+, only the first three sectors of IO.SYS have to be
  715. }>contiguous.  
  716. }
  717. }actually, for 3.30+, only the first three sectors of IO.SYS have to be
  718. }contiguous. but 4.0+, SYS is able to move any file occupying those first 
  719. }three sectors elsewhere. SYS is also able to move any file(s) in the first 
  720. }two directory entries elsewhere.
  721.  
  722. I thought it was 3.3+, but was only sure for 4.0+.  I remember 3.3
  723. being able to deal with fragmented system files, but I wasn't sure
  724. whether that only applied to MSDOS.SYS or both IO.SYS and MSDOS.SYS.
  725.  
  726. }(gee, I'm correcting Ralf Brown...maybe one of these days I'll get to
  727. }meet BillG. :-)
  728.  
  729. I've never claimed to be perfect, only that I make fewer than average
  730. mistakes....
  731.  
  732. Internet: RALF+@CS.CMU.EDU   |The University would disclaim this if it knew...
  733. FIDO: Ralf Brown 1:129/26.1  |"Wisdom is the quality that keeps you from
  734. BIT: RALF%CS.CMU.EDU@CARNEGIE| getting into situations where you need it."
  735. AT&Tnet: (412)268-3053 school|        -- Doug Larson
  736.  
  737. ------------------------------
  738.  
  739. Date: 21 Jul 92 00:14:08 GMT
  740. From: Tom J Parry <parry@yoyo.cc.monash.edu.au>
  741. Subject: moved my ibmdos.com ....
  742.  
  743. vg@sup.stollmann.de (Volkmar Grote) writes:
  744. > jcmorris@mwunix.mitre.org (Joe Morris) writes:
  745. > >Several other posters have recommended the Norton Disk Doctor's "Make disk
  746. > >bootable" function.  They're right, and I don't know of any other common
  747. > >program to do this (other than the FORMAT command  ...  ah, THAT'S A JOKE!)
  748. > The other common program is DR DOS' "sys", which is much more sensible
  749. > than the MS variant; when updating, the latter first destroys your system and
  750. > then tells you, that there is not enough space ...
  751.  
  752. That's right! MSDOS sys just destroys your system and then gives an
  753. error message. Done that to me at least 57 times this morning already!
  754. Come on, let's not drop down to this level. Sure you prefer the DRDOS
  755. version of the program, sure you probably don't know that the DOS 5
  756. version will install the system on any disk where there is enough free
  757. space by moving things around if necessary. Sure MSDOS sys might have
  758. harmed you once (although I have never ever seen it do any harm myself)
  759. but this is no reason to announce that the program destorys every disk
  760. it is run on. IT DOES NOT, well not for me anyway.
  761.  
  762. BTW Somebody told me on the weekend that there is an undocumented
  763. argument to FDISK which will fix the boot record of a disk that is
  764. faulty. I have never tried it nor do I know what kind of disks it works
  765. on (presumably only hard disks) but the option is FDISK /MBR (for
  766. master boot record). Anyone come across this one?
  767.  
  768. Tom J Parry.
  769. Your reality is a figment of my imagination.
  770.  
  771. ------------------------------
  772.  
  773. Date: 26 Jul 92 03:21:34 GMT
  774. From: Jon Freivald <jaf@jaflrn.uucp>
  775. Subject: moved my ibmdos.com ....
  776.  
  777. parry@yoyo.cc.monash.edu.au (Tom J Parry) writes:
  778.  
  779. > BTW Somebody told me on the weekend that there is an undocumented
  780. > argument to FDISK which will fix the boot record of a disk that is
  781. > faulty. I have never tried it nor do I know what kind of disks it works
  782. > on (presumably only hard disks) but the option is FDISK /MBR
  783. > (for master boot record). Anyone come across this one?
  784.  
  785. Yes indeed - in fact, have used it many times...  It's new with DOS
  786. 5.0, but you can use it on any disk (assuming you booted 5.0 from a
  787. floppy) with any DOS version on it.
  788.  
  789. Why do I use it? - Instant erradication of BSI viruses!  It's been
  790. quite a handy tool for me - re-writing a clean Master Boot Record on an
  791. infected hard disk.  Of course, you have to be booting from a clean
  792. (preferably write protected - helps prevent accidents) floppy - also do
  793. a hard-boot, as you are then *SURE* that memory is virus free when you
  794. boot.
  795.  
  796. Jon
  797.            Jon Freivald ( jaflrn!jaf@uunet.UU.NET )
  798.  
  799. ------------------------------
  800.  
  801. Date: 21 Jul 92 22:10:38 GMT
  802. From: Glenn Clapp <gclapp@javelin.sim.es.com>
  803. Subject: Polygon Question...
  804.  
  805. morley@camins.camosun.bc.ca writes:
  806. >
  807. >Ok, this should be an easy one...  Given 3 X,Y points that form a triangle,
  808. >what is the simplest (fastest) way to determine if they are clock-wise or
  809. >counter-clock-wise?  I'm not interested in general polygons of N points,
  810. >just plain old triangles.  Yes, this is for use in a graphics app.
  811. >
  812.  
  813. Traverse the polygon, calculating 3 cross products (v1->v2 X v2->v3,
  814. v2->v3 X v3->v1), and (v3->v1 X v1->v2), and if the cross products are
  815. positive, the polygon is counterclockwise, otherwise they will be
  816. negetive.  Also, if you have a sign flip between the different cross
  817. products, then the polygon is not convex.
  818.  
  819. ------------------------------
  820.  
  821. Date: 25 Jul 92 22:37:19 GMT
  822. From: Larry Jones <scjones@thor.sdrc.com>
  823. Subject: Polygon Question...
  824.  
  825. gclapp@javelin.sim.es.com (Glenn Clapp) writes:
  826. > Traverse the polygon, calculating 3 cross products (v1->v2 X v2->v3,
  827. > v2->v3 X v3->v1), and (v3->v1 X v1->v2), and if the cross products are
  828. > positive, the polygon is counterclockwise, otherwise they will be negetive.
  829. > Also, if you have a sign flip between the different cross products, then
  830. > the polygon is not convex.
  831.  
  832. One is sufficient - a triangle is always convex.
  833.  
  834. Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
  835. Domain: lawrence.jones@sdrc.com               IBMMAIL: USSDR7DR at IBMMAIL
  836. I thought my life would seem more interesting with a musical
  837. score and a laugh track. -- Calvin
  838.  
  839. ------------------------------
  840.  
  841. Date: 18 Jul 92 07:06:54 GMT
  842. From: "Ira H. Nydick" <hinydick@curtiss.seas.ucla.edu>
  843. Subject: problems with new hard disk
  844.  
  845. Hi, I am new to this newsgroup and do not know if it is the appropriate
  846. one to post this question to.  I apologize in advance if it is not.
  847.  
  848. I recently acquired a Hyundai 386sx (it was free) which I am giving to
  849. my father.  I have my own computer, a 25 mhz 386 clone.  I took this as
  850. an oportunity to upgrade my hard drive to a larger unit, and purchased
  851. a Maxtor 7120 120 MB IDE drive and cheapo IDE card.  I installed my old
  852. drive, a 66 MB Toshiba w/RLL card in the Hyundai and the new Maxtor and
  853. IDE card in my computer.  The Hyundai works fine.  My computer,
  854. unfortunately, is not cooperating as nicely as its neighbor.  I
  855. partitioned the disk with MSDOS 4.01 FDISK to one partition, installed
  856. the MSDOS 4.01 os that came with the Hyundai (recall, the Hyundai has
  857. my old Toshiba drive which contains MSDOS 3.3 so no need to use the
  858. included DOS 4.01 on it, so why not on my new drive?), copied all
  859. directories and files from the old Toshiba with FASTBACK and restored
  860. them on the Maxtor, and, oh yeah, changed the CMOS settings in my AMI
  861. BIOS to reflect the new drive.  Everything seemed fine for a bit, until
  862. various problems startedoccuring.  These are the ones I have noticed so
  863. far:
  864.  
  865. Computer hangs when
  866. 1. I try to use FASTBACK to back up files on it
  867. 2. I try to save a worksheet in Lotus 123
  868. 3. I simply try to run Wordperfect 5.1 from the C prompt.  This is weird
  869.    because it initially ran WP fine, but now it locks up if I try.  ???
  870. 4. I try to save setup changes in my faxboard software.  This is the 
  871.    first problem I noticed.
  872. 5. Xtree gives a weird 'unknown disk error' message when first run but
  873. otherwise   seems to run ok.
  874.  
  875. Could it be any of the following reasons?
  876. a. My new IDE card is bad
  877.  
  878. b. my new Maxtor drive is bad
  879.  
  880. c. I hooked something up incorrectly (can't imagine what, installation
  881. was easy)d. drive is not configured properly in CMOS (store I bought
  882. the drive at said to   use user-defined drive type, 1024 cyl.,heads:14,
  883. sector: 17 and not worry about Write Pcomp and Landing zone. I put zero
  884. for them;don't know what they are)
  885.  
  886. e. operating system I installed is one that came with Hyundai (MSDOS
  887. 4.01).  Could it be a version specifically for Hyundai computers?  not
  888. likely, rt?
  889.  
  890. f. some sort of interrupt conflict (this area is fuzzy to me)
  891.  
  892. Note: the DOS 4.01 install program put some strange stuff in the
  893. config.sys and autoexec.bat files.  I tried rebooting with this stuff
  894. deleted and Xtree error message dissapeared but rest of problems still
  895. present.  I plan to upgrade to DOS 5.0 but want to figure out the
  896. reason for these problems first.
  897.  
  898. If anyone out there thinks he/she know what is wrong, I would REALLY
  899. REALLY appreciate hearing from you.  My computer ignorance is surely
  900. shining through but I am trying to learn as fast as I can.  If it is
  901. not a problem pleas email me; if it is, then post and I will try to
  902. check the group reasonably often.  Thanks, Thanks, Thanks in advance
  903.  
  904. Ira Nydick
  905. UCLA MANE Department
  906.  
  907. P.S. sorry for the length of the post, but I don't know what is
  908. important to include and what isn't so I may have gone overboard.
  909.  
  910.  
  911. ------------------------------
  912.  
  913. Date: 30 Jul 92 03:13:22 GMT
  914. From: bill parquet <billp@jupiter.cse.utoledo.edu>
  915. Subject: Reboot from protected mode
  916.  
  917. sankey@unixg.ubc.ca (Todd Sankey) writes:
  918. :  Does anyone have a description or code snippet or anything to
  919. : describe how to reboot the PC from protected mode?
  920.  
  921. Rebooting and kicking the computer out of protected mode are pretty similar.
  922.  
  923. To reboot just do:  mov   al,0feh
  924.             out   64h, al
  925.  
  926. (It seems to be 100% effective on my 286, but it sometimes causes my
  927. 486 to crash).  To get out of protected mode, there's a few outs to the
  928. CMOS before the big fe->64 to kind of give the bios a resume command.
  929. I don't know what they are off the top of my head.  (BTW  You might
  930. want to HLT, jump back to the halt after that... It seems like
  931. overkill, but the BIOS does it!)
  932.  
  933. ------------------------------
  934.  
  935. Date: 21 Jul 92 09:54:50 GMT
  936. From: Lee Hollingworth <s1110238@giaeb.cc.monash.edu.au>
  937. Subject: REQUEST FOR INFO: DISABLING ^C
  938.  
  939. fredc@ibmpcug.co.uk (Fred Curtis) writes:
  940.  
  941. >I want to disable the ^C interrupt.  I can trap it and ignore it
  942. >by reseting the DOS interrupt vector, but it still prints "^C" on
  943. >the screen.
  944.  
  945. Use the bios functions that use Interrupt 16h function 00h, if you are
  946. using MSC use _bios_keybrd(K_READ), if Borland TC++ or C++ use
  947. bioskey(0) to wait and read user input.
  948.  
  949. Or below is a simple asm listing which can be compiled and included in
  950. a C program...
  951.  
  952. Lee Hollingworth
  953. s1110238@giaeb.cc.monash.edu.au
  954.  
  955. # This is a shell archive.  Remove anything before this line,
  956. # then unpack it by saving it in a file and typing "sh file".
  957. #
  958. # Wrapped by Lee Hollingworth <s1110238@giaeb> on Tue Jul 21 20:07:03 1992
  959. #
  960. # This archive contains:
  961. #    biosibm.h    biosibm.asm    
  962. #
  963.  
  964. LANG=""; export LANG
  965. PATH=/bin:/usr/bin:$PATH; export PATH
  966.  
  967. echo x - biosibm.h
  968. cat >biosibm.h <<'@EOF'
  969. /****
  970.  * file:   biosibm.h
  971.  * purpose: defines for biosibm.asm
  972.  ****/
  973.  
  974. #ifndef BIOSKEYS
  975. #define BIOSKEYS
  976.  
  977. /* bioskeybrd services */
  978. #define K_READ      0x10
  979. #define K_READY     0x11
  980. #define K_STATUS    0x12
  981.  
  982. /* enhanced keyboard status bits */
  983. #define K_RSHIFT    0x0000         /* right shift is down   */
  984. #define K_LSHIFT    0x0002         /* left shift is down    */
  985. #define K_CTRL      0x0004         /* both Ctrl keys down   */
  986. #define K_ALT       0x0008         /* both Alt keys down    */
  987. #define K_SCROLL    0x0010         /* scroll lock toggle on */
  988. #define K_NUM       0x0020         /* num lock toggle on    */
  989. #define K_CAP       0x0040         /* cap lock toggle on    */
  990. #define K_INS       0x0080         /* insert toggle is on   */
  991. #define K_LCTRL     0x0100         /* left Ctrl key down    */
  992. #define K_LALT      0x0200         /* left Alt key down     */
  993. #define K_RCTRL     0x0400         /* right Ctrl key down   */
  994. #define K_RALT      0x0800         /* right Alt key down    */
  995. #define K_PSCROLL   0x1000         /* scroll key is down    */
  996. #define K_PNUM      0x2000         /* num key is down       */
  997. #define K_PCAP      0x4000         /* cap key is down       */
  998. #define K_SYSRQ     0x8000         /* sys rq key is down    */
  999.  
  1000. #endif
  1001.  
  1002. extern unsigned bioskeybrd(unsigned int service);
  1003. @EOF
  1004.  
  1005. chmod 600 biosibm.h
  1006.  
  1007. echo x - biosibm.asm
  1008. cat >biosibm.asm <<'@EOF'
  1009. ;
  1010. ; file:     biosibm.asm
  1011. ; purpose:  int 16h keyboard status functions
  1012. ; author:   Lee Hollingworth
  1013. ; header:   biosibm.h
  1014. ;
  1015.  
  1016. key_ready   equ     01h             ; function K_READY
  1017.  
  1018.             .model small
  1019.             .code
  1020. public      _bioskeybrd
  1021. ;----------------------- bioskeybrd
  1022. ;   call    unsigned int bioskeybrd(service);
  1023. ;           unsigned int service;
  1024. ;   services
  1025. ;           K_READ      read character and scan code, wait if none ready
  1026. ;           K_READY     check if a key is waiting to be read
  1027. ;           K_STATUS    get the current keyboard status
  1028. ;               refer to biosibm.h for defines
  1029. ;
  1030. _bioskeybrd proc
  1031.             push    bp
  1032.             mov     bp, sp              ; mov stack pointer to base pointer
  1033.             push    si
  1034.             push    di
  1035.  
  1036.             mov     ah, [bp+4]          ; get service argument
  1037.             cmp     ah, key_ready       ; special case for key_ready service
  1038.             jne     key_read_status     ; jump if not key_ready
  1039.             int     16h
  1040.             jnz     alldone             ; jmp if character waiting to be read
  1041.             xor     ax, ax              ; otherwise return 0
  1042.             jmp     alldone
  1043.  
  1044. key_read_status:
  1045.             int     16h                 ; simple call for read or status
  1046.  
  1047. alldone:
  1048.             pop     di
  1049.             pop     si
  1050.             pop     bp
  1051.             ret
  1052. _bioskeybrd endp
  1053.             end
  1054. @EOF
  1055.  
  1056. chmod 600 biosibm.asm
  1057.  
  1058. exit 0
  1059.  
  1060. ------------------------------
  1061.  
  1062. Date: 23 Jul 92 13:13:44 GMT
  1063. From: "Scott C. Sadow" <scott@mycro.uucp>
  1064. Subject: REQUEST FOR INFO: DISABLING ^C
  1065. Summary: How do you disable the ^C handling?
  1066.  
  1067. fredc@ibmpcug.co.uk (Fred Curtis) writes:
  1068. >I want to disable the ^C interrupt.  I can trap it and ignore it
  1069. >by reseting the DOS interrupt vector, but it still prints "^C" on
  1070. >the screen.
  1071.  
  1072. The best way I have found of doing this is to create a small interrupt
  1073. handler that just sets a flag. Then set interrupt vector 1BH to this
  1074. routine. (1BH is the BIOS ctrl-break handler) I also set interrupt
  1075. vector 23H to this same routine, or slightly different. (23H is the DOS
  1076. ctrl-c/ctrl-break handler)
  1077.  
  1078. Oh yes - make sure you save both vectors before changing them and
  1079. restore them before your programs ends.
  1080.  
  1081. (By the way, I have done this also for interrupt vector 5, which is
  1082. print screen. Then I can check the global variable and, if set, print
  1083. the graphics screen.)
  1084.  
  1085.    Scott C. Sadow
  1086.    scott@mycro.UUCP
  1087.    ...gatech!nanovx!mycro!scott
  1088.  
  1089. ------------------------------
  1090.  
  1091. Date: 26 Jul 92 05:55:41 GMT
  1092. From: mark jose <speednut@csource.oz.au>
  1093. Subject: REQUEST FOR INFO: DISABLING ^C
  1094.  
  1095. s110238@giaeb.cc.monash.edu.au (Lee Hollingworth)
  1096.  
  1097. > fredc@ibmpcug.co.uk (Fred Curtis) writes:
  1098. >
  1099. > >I want to disable the ^C interrupt.  I can trap it and ignore it
  1100. > >by reseting the DOS interrupt vector, but it still prints "^C" on
  1101. > >the screen.
  1102.  
  1103. Sorry for this late post, but I just read this group. Below is the code
  1104. I use to catch the ^C interrupt (directly).
  1105.  
  1106. The code below actually sets a flag "abortflag" to trigger other parts
  1107. of the program that it's time to quite. If you want to disable the
  1108. Ctrl-Break altogether then just make "FatalAbort()" do nothing.
  1109.  
  1110. Hope this helps.
  1111.  
  1112. /*---------------------------------------------------------------------------*/
  1113. /* Handles the capturing of Control-C and Control-Break to allow for normal  */
  1114. /* exitting during program execution.                                        */
  1115. /*                                                                           */
  1116. /* Donated to the Public Domain. USE IT AT ***YOUR*** PERIL!!!!!!!!!!!!!!!!  */
  1117. /*---------------------------------------------------------------------------*/
  1118. #include <dos.h>             /* Required for getvect/setvect  - Turbo C      */
  1119.  
  1120.  
  1121. #ifdefined MSOFT        /* Using a Microsoft C compiler (QUICK-C?) */
  1122.    #define  enable   _enable
  1123.    #define  disable  _disable
  1124.    #define  setvect  _dos_setvect
  1125.    #define  getvect  _dos_getvect
  1126. #endif
  1127.  
  1128. /*---------------------------------------------------------------------------*/
  1129. /* Local function prototypes and variables.                                  */
  1130. /*---------------------------------------------------------------------------*/
  1131. static void interrupt far FatalAbort(void);   /* The abort interrupt routine */
  1132. static void (interrupt far *OldBreak)(void);  /* The old abort interrupt     */
  1133.  
  1134. /*---------------------------------------------------------------------------*/
  1135. /* Global variables.                                                         */
  1136. /*---------------------------------------------------------------------------*/
  1137. int localabort;                           /* The abort flag.                 */
  1138.  
  1139. /*---------------------------------------------------------------------------*/
  1140. /* Set up the new interrupt routines for Ctrl-C and Ctrl-Break.              */
  1141. /*---------------------------------------------------------------------------*/
  1142. void cdecl SetBreakOut(void)
  1143.   {
  1144.    disable();                             /* Turn off interrupts (for now)   */
  1145.    localabort = 0;                        /* Set the abort flag.             */
  1146.    OldBreak = getvect(0x1B);              /* Save the old interrupt control. */
  1147.    setvect(0x1B, FatalAbort);             /* Set fatal abort vector (1)      */
  1148.    setvect(0x23, FatalAbort);             /* Set fatal abort vector (2)      */
  1149.    enable();                              /* Turn interrupts back on - flush!*/
  1150.   }
  1151.  
  1152. /*---------------------------------------------------------------------------*/
  1153. /* Restore the old interrupt back in its old vector.                         */
  1154. /*---------------------------------------------------------------------------*/
  1155. void cdecl RestoreBreak(void)
  1156.   {
  1157.    setvect(0x1B, OldBreak);              /* Restore old interrupt.           */
  1158.   }
  1159.  
  1160. /*---------------------------------------------------------------------------*/
  1161. /* Interrupt will trap Ctrl-C and Ctrl-Break. Just change abortflag to 1 &   */
  1162. /* the program will pick it up and deal with it.                             */
  1163. /*---------------------------------------------------------------------------*/
  1164. static void interrupt far FatalAbort(void)
  1165.    {
  1166.     localabort = 1;                      /* Just set the flag and that's it! */
  1167.    }
  1168.  
  1169. Above done in Turbo C 2.0
  1170.  
  1171. mark jose
  1172. speednut@csource.oz.au  Unique Computing Pty Ltd, Melbourne, Australia
  1173. The opinions expressed above are that of the author only.
  1174.  
  1175. ------------------------------
  1176.  
  1177. End of Info-IBMPC Digest V92 #133
  1178. *********************************
  1179. -------
  1180.