home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / gnuc / library / rcs / ix_get_vars2.c,v < prev    next >
Encoding:
Text File  |  1992-08-09  |  3.5 KB  |  179 lines

  1. head    1.4;
  2. access;
  3. symbols
  4.     version39-41:1.3;
  5. locks;
  6. comment    @ *  @;
  7.  
  8.  
  9. 1.4
  10. date    92.08.09.20.49.16;    author amiga;    state Exp;
  11. branches;
  12. next    1.3;
  13.  
  14. 1.3
  15. date    92.07.04.19.14.44;    author mwild;    state Exp;
  16. branches;
  17. next    1.2;
  18.  
  19. 1.2
  20. date    92.05.20.01.32.00;    author mwild;    state Exp;
  21. branches;
  22. next    1.1;
  23.  
  24. 1.1
  25. date    92.05.14.19.55.40;    author mwild;    state Exp;
  26. branches;
  27. next    ;
  28.  
  29.  
  30. desc
  31. @general initializer for program static variables (like stdio)
  32. @
  33.  
  34.  
  35. 1.4
  36. log
  37. @add cast
  38. @
  39. text
  40. @/*
  41.  *  This file is part of ixemul.library for the Amiga.
  42.  *  Copyright (C) 1991, 1992  Markus M. Wild
  43.  *
  44.  *  This library is free software; you can redistribute it and/or
  45.  *  modify it under the terms of the GNU Library General Public
  46.  *  License as published by the Free Software Foundation; either
  47.  *  version 2 of the License, or (at your option) any later version.
  48.  *
  49.  *  This library is distributed in the hope that it will be useful,
  50.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  51.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  52.  *  Library General Public License for more details.
  53.  *
  54.  *  You should have received a copy of the GNU Library General Public
  55.  *  License along with this library; if not, write to the Free
  56.  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  57.  *
  58.  *  $Id: ix_get_vars2.c,v 1.3 1992/07/04 19:14:44 mwild Exp $
  59.  *
  60.  *  $Log: ix_get_vars2.c,v $
  61.  *  Revision 1.3  1992/07/04  19:14:44  mwild
  62.  *  add new variable, environ-in, primarly support for fork-emulation in ksh
  63.  *
  64.  * Revision 1.2  1992/05/20  01:32:00  mwild
  65.  * do atexit(_cleanup) here, ix_open is the wrong place
  66.  *
  67.  * Revision 1.1  1992/05/14  19:55:40  mwild
  68.  * Initial revision
  69.  *
  70.  */
  71.  
  72. #define KERNEL
  73. #include "ixemul.h"
  74.  
  75. #include <stdio.h>
  76.  
  77. extern char _ctype_[];
  78. extern int sys_nerr;
  79. extern void _cleanup();
  80.  
  81. /* too bad this is necessary, but the old function didn't know how to tell
  82.  * how many values to fill out, making later extensions impossible without
  83.  * breaking old executables. This one uses an explicit counter for this.
  84.  */
  85.  
  86. void
  87. ix_get_vars2 (int argc, char **ctype, int *_sys_nerr, 
  88.           struct Library **SysBase, struct Library **DOSBase,
  89.           FILE ***fpp, char ***environ_out, char ***environ_in)
  90. {
  91.   switch (argc)
  92.     {
  93.     case 7:
  94.       /* a `bit' kludgy.. */
  95.       if (environ_in) *environ_in = *u.u_environ;
  96.  
  97.     case 6:
  98.       if (environ_out) u.u_environ = environ_out;
  99.  
  100.     case 5:
  101.       if (fpp)
  102.         {
  103.       __init_stdinouterr ();
  104.           *fpp = (FILE **) &u.u_sF[0];
  105.       /* make sure all stdio buffers are flushed on exit() */
  106.       atexit (_cleanup);
  107.         }
  108.  
  109.     case 4:
  110.       if (DOSBase) *DOSBase = (struct Library *) ix.ix_dos_base;
  111.       
  112.     case 3:
  113.       if (SysBase) *SysBase =  (struct Library *) *(struct ExecBase **)4;
  114.       
  115.     case 2:
  116.       if (_sys_nerr) *_sys_nerr = sys_nerr;
  117.       
  118.     case 1:
  119.       if (ctype) *ctype = _ctype_;
  120.  
  121.     default:
  122.       break;
  123.     }
  124.    
  125.   /* now that system start is over, free the tracer */
  126.   u.u_trace_flags = 0;
  127. }
  128. @
  129.  
  130.  
  131. 1.3
  132. log
  133. @add new variable, environ-in, primarly support for fork-emulation in ksh
  134. @
  135. text
  136. @d19 1
  137. a19 1
  138.  *  $Id: ix_get_vars2.c,v 1.2 1992/05/20 01:32:00 mwild Exp $
  139. d22 3
  140. d65 1
  141. a65 1
  142.           *fpp = &u.u_sF[0];
  143. @
  144.  
  145.  
  146. 1.2
  147. log
  148. @do atexit(_cleanup) here, ix_open is the wrong place
  149. @
  150. text
  151. @d19 1
  152. a19 1
  153.  *  $Id: ix_get_vars2.c,v 1.1 1992/05/14 19:55:40 mwild Exp $
  154. d22 3
  155. d47 1
  156. a47 1
  157.           FILE ***fpp, char ***environ)
  158. d51 4
  159. d56 1
  160. a56 1
  161.       if (environ) u.u_environ = environ;
  162. @
  163.  
  164.  
  165. 1.1
  166. log
  167. @Initial revision
  168. @
  169. text
  170. @d19 1
  171. a19 1
  172.  *  $Id$
  173. d21 4
  174. a24 1
  175.  *  $Log$
  176. d34 1
  177. d56 2
  178. @
  179.