pike.git / lib / modules / Calendar.pmod / Timezone.pmod

version» Context lines:

pike.git/lib/modules/Calendar.pmod/Timezone.pmod:79: Inside #if 1
     #if 1    string s;       if ( (s=getenv("TZ")) )    {    tz=`[](s);    if (tz) return tz;    }    +  foreach(({ "/etc/TIMEZONE", // Solaris +  "/etc/sysconfig/clock", // Linux Gentoo +  "/etc/conf.d/clock", // Linux RedHat +  "/etc/localtime", // Linux & BSDs (binary) +  }), string fname) {    // Mapping from file name to variable name. -  foreach(([ "/etc/localtime":0, // Linux & BSDs -  "/etc/sysconfig/clock":"ZONE", // Linux RedHat -  "/etc/TIMEZONE":"TZ", // Solaris -  "/etc/conf.d/clock":"TIMEZONE", // Linux Gentoo -  ]); string fname; string var_name) { +  string var_name = +  ([ "/etc/TIMEZONE":"TZ", +  "/etc/sysconfig/clock":"ZONE", +  "/etc/conf.d/clock":"TIMEZONE", +  "/etc/localtime":0, +  ])[fname];    catch {    if (Stdio.is_file(fname) && (s = Stdio.read_bytes(fname))) {    if (!var_name) {    if (tz = tz_from_tzfile(s)) return tz;    } else {    foreach(s/"\n", string line) {    line = (line/"#")[0]; // Strip comments.    if (sscanf(s, "%*s" + var_name + "=%s", s) == 2) {    sscanf(s, "\"%s\"", s); // Strip quotes (if any).    if (tz = `[](s))