RInside Version 0.2.16
RInsideEnvVars.r
Go to the documentation of this file.
1 #!/usr/bin/r -q
2 #
3 # This owes a lot to littler.R in the littler sources
4 
5 ExcludeVars <- c("R_SESSION_TMPDIR", "R_HISTFILE", "R_LIBRARY_DIR", "R_LIBS",
6  "R_PACKAGE_DIR", "R_SESSION_INITIALIZED")
7 IncludeVars <- Sys.getenv()
8 IncludeVars <- IncludeVars[grep("^R_",names(IncludeVars),perl=TRUE)]
9 if (.Platform$OS.type == "windows") {
10  IncludeVars <- gsub("\\\\", "/", IncludeVars, perl=TRUE)
11  IncludeVars <- gsub("\r", "", IncludeVars, fixed = TRUE)
12 }
13 cat(" const char *R_VARS[] = {\n")
14 for (i in 1:length(IncludeVars)){
15  if (names(IncludeVars)[i] %in% ExcludeVars)
16  next
17  cat(' "',names(IncludeVars)[i],'","',IncludeVars[i],'",\n',sep='')
18 }
19 cat(" NULL\n };\n")