home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / MISC / GNU / SWALIBAS.ZIP / SWAPLIB.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-09-09  |  3.8 KB  |  119 lines

  1. /* swaplib.h - public declarations for swaplib
  2.    Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
  3.  
  4.    This file is part of SWAPLIB (the library), a library for efficient
  5.    execution of child processes under MS-DOS.
  6.  
  7.    The library is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation; either version 1, or (at your option)
  10.    any later version.
  11.  
  12.    The library is distributed in the hope that it will be useful,
  13.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.    GNU General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU General Public License
  18.    along with the library; if not, write to the Free Software
  19.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21.    $Header: e:/gnu/swaplib/RCS/swaplib.h'v 0.9 90/09/09 21:44:27 tho Stable $
  22.  */
  23.  
  24. #ifndef _FILE_DEFINED
  25. #include <stdio.h>
  26. #endif
  27.  
  28. /* The main entry points, working just like spawn[lv]p?e? () from
  29.    the standard MSC library.  */
  30.  
  31. extern int swap_spawnl (char *cmd, char *argv0, ...);
  32. extern int swap_spawnle (char *cmd, char *argv0, ...);
  33. extern int swap_spawnlp (char *cmd, char *argv0, ...);
  34. extern int swap_spawnlpe (char *cmd, char *argv0, ...);
  35.  
  36. extern int swap_spawnv (char *cmd, char **argv);
  37. extern int swap_spawnve (char *cmd, char **argv, char **envv);
  38. extern int swap_spawnvp (char *cmd, char **argv);
  39. extern int swap_spawnvpe (char *cmd, char **argv, char **envv);
  40.  
  41. extern int swap_system (char *command);
  42. extern FILE *swap_popen (char *command, char *mode);
  43. extern int swap_pclose (FILE *pipe);
  44.  
  45.  
  46. /* Where to swap to. */
  47.  
  48. enum swap_swapping_mode
  49. {
  50.   none, disk, ems, xms
  51. };
  52.  
  53. /* Be smart about passing arguments.  */
  54.  
  55. struct swap_respondfile_action
  56. {
  57.   char *prog;                    /* The name we recognize */
  58.   int (*action) (char **argv, char **envv);    /* The action we take.  */
  59. };
  60.  
  61. /* You don't want to call this... */
  62.  
  63. int _swap_spawn_child (enum swap_swapping_mode mode, char *path,
  64.                char *cmdline, char *env, int len, char *swap_file);
  65.  
  66.  
  67. /* Functions you might want to override.  */
  68.  
  69. extern enum swap_swapping_mode swap_set_swapping_mode (char *cmd, char **argv);
  70. extern int swap_smart_p (char *name);
  71. extern struct swap_respondfile_action *swap_set_respondfile_actions (void);
  72. extern char *swap_invoke_shell (char *cmd, char ***argvp);
  73.  
  74. /* Dedicated handlers for specific commands.  */
  75.  
  76. extern int _swap_build_cl_environment (char **argv, char **envv);
  77. extern int _swap_build_fl_environment (char **argv, char **envv);
  78. extern int _swap_build_masm_environment (char **argv, char **envv);
  79. extern int _swap_build_link_respond_file (char **argv, char **envv);
  80. extern int _swap_build_lib_respond_file (char **argv, char **envv);
  81. extern int _swap_build_zip_respond_file (char **argv, char **envv);
  82.  
  83. /* Generic handlers.  */
  84.  
  85. extern int _swap_format_msdos_environment (char **argv, char **envv, ...);
  86. extern int _swap_build_msc_environment (char *prefix, char **argv,
  87.                     char **envv);
  88.  
  89. extern int _swap_build_cmdline (char **argv);
  90.  
  91.  
  92. /* Path expansion, etc.  */
  93.  
  94. extern char *swap_expand_path (char *name, char *env,
  95.                    char *(*select) (char *));
  96. extern char *swap_executable_p (char *path);
  97. extern char *swap_basename (char *path);
  98. extern char *swap_back_slashify (char *path);
  99. extern char *swap_mktmpname (char *prefix);
  100.  
  101.  
  102. /* Should we really make these public?  */
  103.  
  104. extern char _swap_cmdline_buf[];
  105. extern char *_swap_environ_buf;
  106. extern char *_swap_respond_file_name;
  107.  
  108. #define PROGRAM "spawn"
  109. #define CMDLINE_TOO_LONG "<" PROGRAM ":commandline-too-long>"
  110.  
  111.  
  112. /* 
  113.  * Local Variables:
  114.  * mode:C
  115.  * ChangeLog:ChangeLog
  116.  * compile-command:make
  117.  * End:
  118.  */
  119.