| 138 | } |
| 139 | |
| 140 | static void load_cache_location(void) { |
| 141 | FILE *f = fopen(cache_file, "r"); |
| 142 | if (f) { |
| 143 | double new_lat, new_lon; |
| 144 | if (fscanf(f, "%lf %lf\n", &new_lat, &new_lon) == 2) { |
| 145 | publish_location(new_lat, new_lon, &loc_req); |
| 146 | DEBUG("%.2lf %.2lf loaded from cache file.\n", new_lat, new_lon); |
| 147 | } else { |
| 148 | WARN("Could not load cached location, wrong format.\n"); |
| 149 | } |
| 150 | fclose(f); |
| 151 | } else { |
| 152 | DEBUG("Could not find location cache file.\n"); |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | static void init_cache_file(void) { |
| 157 | if (getenv("XDG_CACHE_HOME")) { |
no test coverage detected