###-*- R -*-

.Library <- file.path(chartr("\\", "/", R.home()), "library")
invisible(.libPaths(unlist(strsplit(chartr("\\", "/", Sys.getenv("R_LIBS")),
                                    ";"))))

if(nchar(Sys.getenv("R_PAPERSIZE")) > 0) {
    options(papersize = as.vector(Sys.getenv("R_PAPERSIZE")))
} else {
    if(any(grep("united.states", Sys.getlocale("LC_MONETARY"), TRUE)) ||
       any(grep("canada", Sys.getlocale("LC_MONETARY"), TRUE)))
        options(papersize = "letter")
    else options(papersize = "a4")
}

options(pager = if(any(grep("--ess", commandArgs()))) "console" else "internal")
