Back to index

texmacs  1.0.7.15
Functions | Variables
sys_utils.cpp File Reference
#include "sys_utils.hpp"
#include "file.hpp"
#include "tree.hpp"
#include "Unix/unix_sys_utils.hpp"

Go to the source code of this file.

Functions

static int system (string s, string &result)
int system (string s)
string eval_system (string s)
string var_eval_system (string s)
string get_env (string var)
void set_env (string var, string with)

Variables

int script_status = 1

Function Documentation

Definition at line 61 of file sys_utils.cpp.

                       {
  string result;
  (void) system (s, result);
  return result;
}

Here is the call graph for this function:

string get_env ( string  var)

Definition at line 75 of file sys_utils.cpp.

                     {
  char* _var= as_charp (var);
  char* _ret= getenv (_var);
  tm_delete_array (_var);
  if (_ret==NULL) {
    if (var == "PWD") return get_env ("HOME");
    return "";
  }
  string ret (_ret);
  return ret;
  // do not delete _ret !
}

Here is the call graph for this function:

Here is the caller graph for this function:

void set_env ( string  var,
string  with 
)

Definition at line 89 of file sys_utils.cpp.

                                  {
#if defined(STD_SETENV) && !defined(__MINGW32__)
  char* _var = as_charp (var);
  char* _with= as_charp (with);
  setenv (_var, _with, 1);
  tm_delete_array(_var);
  tm_delete_array(_with);
#else
  char* _varw= as_charp (var * "=" * with);
  (void) putenv (_varw);
  // do not delete _varw !!!
  // -> known memory leak, but solution more complex than it is worth
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int system ( string  s,
string result 
) [static]

Definition at line 32 of file sys_utils.cpp.

                                  {
#if defined (QTTEXMACS) && (defined (__MINGW__) || defined (__MINGW32__))
  int r= qt_system (s, result);
#else
  int r= unix_system (s, result);
#endif  
  return r;
}

Here is the call graph for this function:

int system ( string  s)

Definition at line 42 of file sys_utils.cpp.

                  {
  if (DEBUG_STD) cerr << "TeXmacs] System: " << s << "\n";
  if (DEBUG_VERBOSE) {
    string result;
    int r= system (s, result);
    cerr << result;
    return r;
  }
  else {
#if defined (QTTEXMACS) && (defined (__MINGW__) || defined (__MINGW32__))
    // if (starts (s, "convert ")) return 1;
    return qt_system (s);
#else
    return unix_system (s);
#endif
  }
}

Here is the call graph for this function:

Definition at line 68 of file sys_utils.cpp.

                           {
  string r= eval_system (s);
  while ((N(r)>0) && (r[N(r)-1]=='\n')) r= r (0,N(r)-1);
  return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

int script_status = 1

Definition at line 25 of file sys_utils.cpp.