File: envTermMissing.cpp

package info (click to toggle)
rang 3.2.0-1
  • links: PTS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 148 kB
  • sloc: cpp: 849; python: 33; makefile: 3
file content (24 lines) | stat: -rw-r--r-- 530 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "rang.hpp"
#include <cstdlib>

using std::cout;
using std::endl;
using std::getenv;

int main()
{
#if defined(WIN32) || defined(_WIN32) || defined(_WIN64)
    return 0;
#else
    const auto TERM = getenv("TERM");
    if (TERM != nullptr) {
        cout << "Unsetting $PATH: " << TERM << '\n';
        unsetenv("TERM");
    }
    cout << rang::fg::green << "===NO COLORS AS FALLBACK===" << endl;
    if (TERM != nullptr) {
        cout << "Setting $PATH: " << TERM << '\n';
        setenv("TERM", TERM, 1);
    }
#endif
}