diff options
Diffstat (limited to '')
-rw-r--r-- | 10deg (renamed from src/10deg) | 0 | ||||
-rw-r--r-- | libred.h (renamed from src/libred.h) | 17 | ||||
-rw-r--r-- | solar.c (renamed from src/solar.c) | 194 | ||||
-rw-r--r-- | src/blackbody.c | 191 | ||||
-rw-r--r-- | src/libred.librarian | 1 | ||||
-rw-r--r-- | src/libred.pc | 4 | ||||
-rw-r--r-- | src/macros.h | 22 | ||||
-rw-r--r-- | src/parse_10deg.c | 71 |
8 files changed, 97 insertions, 403 deletions
@@ -1,19 +1,4 @@ -/** - * Copyright © 2016 Mattias Andrée <maandree@member.fsf.org> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ +/* See LICENSE file for copyright and license details. */ #ifndef LIBRED_H #define LIBRED_H @@ -1,21 +1,4 @@ -/** - * Copyright © 2016 Mattias Andrée <maandree@member.fsf.org> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - * This file is a stripped down port of <https://github.com/maandree/solar-python>. - */ +/* See LICENSE file for copyright and license details. */ #include "libred.h" #include <math.h> #include <time.h> @@ -48,14 +31,16 @@ * @throws 0 On success. * @throws Any error specified for clock_gettime(3) on error. */ -static double julian_centuries() +static double +julian_centuries() { - struct timespec now; - double tm; - if (clock_gettime(CLOCK_REALTIME_COARSE, &now)) return 0.0; - tm = (double)(now.tv_nsec) / 1000000000.0 + (double)(now.tv_sec); - tm = (tm / 86400.0 + 2440587.5 - 2451545.0) / 36525.0; - return errno = 0, tm; + struct timespec now; + double tm; + if (clock_gettime(CLOCK_REALTIME_COARSE, &now)) + return 0.0; + tm = (double)(now.tv_nsec) / 1000000000.0 + (double)(now.tv_sec); + tm = (tm / 86400.0 + 2440587.5 - 2451545.0) / 36525.0; + return errno = 0, tm; } /** @@ -64,9 +49,10 @@ static double julian_centuries() * @param tm The time in Julian Centuries * @return The time in Julian Days */ -static inline double julian_centuries_to_julian_day(double tm) +static inline double +julian_centuries_to_julian_day(double tm) { - return tm * 36525.0 + 2451545.0; + return tm * 36525.0 + 2451545.0; } @@ -76,9 +62,10 @@ static inline double julian_centuries_to_julian_day(double tm) * @param deg The angle in degrees. * @param The angle in radians. */ -static inline double radians(double deg) +static inline double +radians(double deg) { - return deg * (double)M_PI / 180.0; + return deg * (double)M_PI / 180.0; } /** @@ -87,9 +74,10 @@ static inline double radians(double deg) * @param rad The angle in radians. * @param The angle in degrees. */ -static inline double degrees(double rad) +static inline double +degrees(double rad) { - return rad * 180.0 / (double)M_PI; + return rad * 180.0 / (double)M_PI; } @@ -102,12 +90,13 @@ static inline double degrees(double rad) * @param hour_angle The solar hour angle, in radians. * @return The Sun's elevation, in radians. */ -static inline double elevation_from_hour_angle(double latitude, double declination, double hour_angle) +static inline double +elevation_from_hour_angle(double latitude, double declination, double hour_angle) { - double rc = cos(radians(latitude)); - rc *= cos(hour_angle) * cos(declination); - rc += sin(radians(latitude)) * sin(declination); - return asin(rc); + double rc = cos(radians(latitude)); + rc *= cos(hour_angle) * cos(declination); + rc += sin(radians(latitude)) * sin(declination); + return asin(rc); } /** @@ -116,13 +105,14 @@ static inline double elevation_from_hour_angle(double latitude, double declinati * @param tm The time in Julian Centuries. * @return The Sun's geometric mean longitude in radians. */ -static inline double sun_geometric_mean_longitude(double tm) +static inline double +sun_geometric_mean_longitude(double tm) { - double rc = fmod(pow(0.0003032 * tm, 2.0) + 36000.76983 * tm + 280.46646, 360.0); + double rc = fmod(pow(0.0003032 * tm, 2.0) + 36000.76983 * tm + 280.46646, 360.0); #if defined(TIMETRAVELLER) - rc = rc < 0.0 ? (rc + 360.0) : rc; + rc = rc < 0.0 ? (rc + 360.0) : rc; #endif - return radians(rc); + return radians(rc); } /** @@ -131,9 +121,10 @@ static inline double sun_geometric_mean_longitude(double tm) * @param tm The time in Julian Centuries. * @return The Sun's geometric mean anomaly in radians. */ -static inline double sun_geometric_mean_anomaly(double tm) +static inline double +sun_geometric_mean_anomaly(double tm) { - return radians(pow(-0.0001537 * tm, 2.0) + 35999.05029 * tm + 357.52911); + return radians(pow(-0.0001537 * tm, 2.0) + 35999.05029 * tm + 357.52911); } /** @@ -142,9 +133,10 @@ static inline double sun_geometric_mean_anomaly(double tm) * @param tm The time in Julian Centuries. * @return The Earth's orbit eccentricity. */ -static inline double earth_orbit_eccentricity(double tm) +static inline double +earth_orbit_eccentricity(double tm) { - return pow(-0.0000001267 * tm, 2.0) - 0.000042037 * tm + 0.016708634; + return pow(-0.0000001267 * tm, 2.0) - 0.000042037 * tm + 0.016708634; } /** @@ -154,13 +146,14 @@ static inline double earth_orbit_eccentricity(double tm) * @param tm The time in Julian Centuries. * @return The Sun's equation of the centre, in radians. */ -static inline double sun_equation_of_centre(double tm) +static inline double +sun_equation_of_centre(double tm) { - double a = sun_geometric_mean_anomaly(tm), rc; - rc = sin(1.0 * a) * (pow(-0.000014 * tm, 2.0) - 0.004817 * tm + 1.914602); - rc += sin(2.0 * a) * (-0.000101 * tm + 0.019993); - rc += sin(3.0 * a) * 0.000289; - return radians(rc); + double a = sun_geometric_mean_anomaly(tm), rc; + rc = sin(1.0 * a) * (pow(-0.000014 * tm, 2.0) - 0.004817 * tm + 1.914602); + rc += sin(2.0 * a) * (-0.000101 * tm + 0.019993); + rc += sin(3.0 * a) * 0.000289; + return radians(rc); } /** @@ -169,9 +162,10 @@ static inline double sun_equation_of_centre(double tm) * @param tm The time in Julian Centuries. * @return The longitude, in radians. */ -static inline double sun_real_longitude(double tm) +static inline double +sun_real_longitude(double tm) { - return sun_geometric_mean_longitude(tm) + sun_equation_of_centre(tm); + return sun_geometric_mean_longitude(tm) + sun_equation_of_centre(tm); } /** @@ -180,10 +174,11 @@ static inline double sun_real_longitude(double tm) * @param tm The time in Julian Centuries. * @return The longitude, in radians. */ -static inline double sun_apparent_longitude(double tm) +static inline double +sun_apparent_longitude(double tm) { - double rc = degrees(sun_real_longitude(tm)) - 0.00569; - return radians(rc - 0.00478 * sin(radians(-1934.136 * tm + 125.04))); + double rc = degrees(sun_real_longitude(tm)) - 0.00569; + return radians(rc - 0.00478 * sin(radians(-1934.136 * tm + 125.04))); } /** @@ -193,10 +188,11 @@ static inline double sun_apparent_longitude(double tm) * @param tm The time in Julian Centuries. * @return The uncorrected mean obliquity, in radians. */ -static double mean_ecliptic_obliquity(double tm) +static double +mean_ecliptic_obliquity(double tm) { - double rc = pow(0.001813 * tm, 3.0) - pow(0.00059 * tm, 2.0) - 46.815 * tm + 21.448; - return radians(23.0 + (26.0 + rc / 60.0) / 60.0); + double rc = pow(0.001813 * tm, 3.0) - pow(0.00059 * tm, 2.0) - 46.815 * tm + 21.448; + return radians(23.0 + (26.0 + rc / 60.0) / 60.0); } /** @@ -206,10 +202,11 @@ static double mean_ecliptic_obliquity(double tm) * @param tm The time in Julian Centuries. * @return The mean obliquity, in radians. */ -static double corrected_mean_ecliptic_obliquity(double tm) +static double +corrected_mean_ecliptic_obliquity(double tm) { - double rc = 0.00256 * cos(radians(-1934.136 * tm + 125.04)); - return radians(rc + degrees(mean_ecliptic_obliquity(tm))); + double rc = 0.00256 * cos(radians(-1934.136 * tm + 125.04)); + return radians(rc + degrees(mean_ecliptic_obliquity(tm))); } /** @@ -218,10 +215,11 @@ static double corrected_mean_ecliptic_obliquity(double tm) * @param tm The time in Julian Centuries. * @return The Sun's declination, in radian. */ -static inline double solar_declination(double tm) +static inline double +solar_declination(double tm) { - double rc = sin(corrected_mean_ecliptic_obliquity(tm)); - return asin(rc * sin(sun_apparent_longitude(tm))); + double rc = sin(corrected_mean_ecliptic_obliquity(tm)); + return asin(rc * sin(sun_apparent_longitude(tm))); } /** @@ -231,17 +229,18 @@ static inline double solar_declination(double tm) * @param tm The time in Julian Centuries. * @return The equation of time, in degrees. */ -static inline double equation_of_time(double tm) +static inline double +equation_of_time(double tm) { - double l = sun_geometric_mean_longitude(tm); - double e = earth_orbit_eccentricity(tm); - double m = sun_geometric_mean_anomaly(tm); - double y = pow(tan(corrected_mean_ecliptic_obliquity(tm) / 2.0), 2.0); - double rc = y * sin(2.0 * l); - rc += (4.0 * y * cos(2.0 * l) - 2.0) * e * sin(m); - rc -= pow(0.5 * y, 2.0) * sin(4.0 * l); - rc -= pow(1.25 * e, 2.0) * sin(2.0 * m); - return 4.0 * degrees(rc); + double l = sun_geometric_mean_longitude(tm); + double e = earth_orbit_eccentricity(tm); + double m = sun_geometric_mean_anomaly(tm); + double y = pow(tan(corrected_mean_ecliptic_obliquity(tm) / 2.0), 2.0); + double rc = y * sin(2.0 * l); + rc += (4.0 * y * cos(2.0 * l) - 2.0) * e * sin(m); + rc -= pow(0.5 * y, 2.0) * sin(4.0 * l); + rc -= pow(1.25 * e, 2.0) * sin(2.0 * m); + return 4.0 * degrees(rc); } /** @@ -256,13 +255,14 @@ static inline double equation_of_time(double tm) * @return The Sun's apparent elevation at the specified time as seen * from the specified position, measured in radians. */ -static inline double solar_elevation_from_time(double tm, double latitude, double longitude) +static inline double +solar_elevation_from_time(double tm, double latitude, double longitude) { - double rc = julian_centuries_to_julian_day(tm); - rc = (rc - round(rc) - 0.5) * 1440; - rc = 720.0 - rc - equation_of_time(tm); - rc = radians(rc / 4.0 - longitude); - return elevation_from_hour_angle(latitude, solar_declination(tm), rc); + double rc = julian_centuries_to_julian_day(tm); + rc = (rc - round(rc) - 0.5) * 1440; + rc = 720.0 - rc - equation_of_time(tm); + rc = radians(rc / 4.0 - longitude); + return elevation_from_hour_angle(latitude, solar_declination(tm), rc); } @@ -280,10 +280,11 @@ static inline double solar_elevation_from_time(double tm, double latitude, doubl * @throws 0 On success. * @throws Any error specified for clock_gettime(3) on error. */ -double libred_solar_elevation(double latitude, double longitude) +double +libred_solar_elevation(double latitude, double longitude) { - double tm = julian_centuries(); - return errno ? -1 : degrees(solar_elevation_from_time(tm, latitude, longitude)); + double tm = julian_centuries(); + return errno ? -1 : degrees(solar_elevation_from_time(tm, latitude, longitude)); } @@ -295,20 +296,17 @@ double libred_solar_elevation(double latitude, double longitude) int libred_check_timetravel(void) { #if !defined(TIMETRAVELLER) - struct timespec now; - if (clock_gettime(CLOCK_REALTIME, &now)) return -1; - if (now.tv_nsec < (time_t)946728000L) - fprintf(stderr, - "We have detected that you are a time-traveller" - "(or your clock is not configured correctly.)" - "Please recompile libred with -DTIMETRAVELLER" - "(or correct your clock.)"), exit(1); + struct timespec now; + if (clock_gettime(CLOCK_REALTIME, &now)) + return -1; + if (now.tv_sec < (time_t)946728000L) { + fprintf(stderr, + "We have detected that you are a time-traveller" + "(or your clock is not configured correctly.)" + "Please recompile libred with -DTIMETRAVELLER" + "(or correct your clock.)"); + exit(1); + } #endif - return 0; + return 0; } - - -#if __GNUC__ -# pragma GCC diagnostic pop -#endif - diff --git a/src/blackbody.c b/src/blackbody.c deleted file mode 100644 index a46b5a6..0000000 --- a/src/blackbody.c +++ /dev/null @@ -1,191 +0,0 @@ -/** - * Copyright © 2016 Mattias Andrée <maandree@member.fsf.org> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -#if __GNUC__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunsuffixed-float-constants" -#endif - - -#ifndef LIBRED_COMPILING_PARSER -#include "libred.h" -#include "macros.h" -#include <math.h> -#include <errno.h> -#include <fcntl.h> - - - -/** - * The file descriptor to the colour lookup table. - */ -int libred_fd = -1; - - - -/** - * This function must be called, once, - * before calling `libred_get_colour`. - * - * @return 0 on success, -1 on error. - * - * @throws Any error specified for `open(3)`. - */ -int libred_init_colour(void) -{ - libred_term_colour(); - libred_fd = open(SYSDEPRESDIR "/" PACKAGE "/10deg", O_RDONLY); - return libred_fd < 0 ? -1 : 0; -} - - -/** - * Call this when the process will not - * longer make calls to `libred_get_colour`. - */ -void libred_term_colour(void) -{ - if (libred_fd >= 0) - close(libred_fd), libred_fd = -1; -} - - -#endif -/** - * Convert from CIE xyY to [0, 1] sRGB. - * - * @param x The 'x' component. - * @param y The 'y' component. - * @param Y The 'Y' component. - * @param r Output parameter for the “red” value. - * (Seriously, sRGB red is orange, just look at it fullscreen.) - * @param g Output parameter for the green value. - * @param b Output parameter for the blue value. - */ -static void ciexyy_to_srgb(double x, double y, double Y, double *r, double *g, double *b) -{ -#define SRGB(C) (((C) <= 0.0031308) ? (12.92 * (C)) : ((1.0 + 0.055) * pow((C), 1.0 / 2.4) - 0.055)) - double X, Z; - -#if __GNUC__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wfloat-equal" -#endif - /* Convert CIE xyY to CIE XYZ. */ - X = Y * (y == 0.0 ? 0.0 : (x / y)); - Z = Y * (y == 0.0 ? 0.0 : ((1.0 - x - y) / y)); -#if __GNUC__ -# pragma GCC diagnostic pop -#endif - - /* Convert CIE XYZ to [0, 1] linear RGB. (ciexyz_to_linear) */ - *r = ( 3.240450 * X) + (-1.537140 * Y) + (-0.4985320 * Z); - *g = (-0.969266 * X) + ( 1.876010 * Y) + ( 0.0415561 * Z); - *b = (0.0556434 * X) + (-0.204026 * Y) + ( 1.0572300 * Z); - - /* Convert [0, 1] linear RGB to [0, 1] sRGB. */ - SRGB(*r), SRGB(*g), SRGB(*b); -} -#ifndef LIBRED_COMPILING_PARSER - - -/** - * Perform linear interpolation (considered very good) - * between the CIE xyY values for two colour temperatures - * and convert the result to sRGB. The two colours should - * be the closest below the desired colour temperature, - * and the closest above the desired colour temperature. - * - * @param x1 The 'x' component for the low colour. - * @param y1 The 'y' component for the low colour. - * @param x2 The 'x' component for the high colour. - * @param y2 The 'y' component for the high colour. - * @param temp The desired colour temperature. - * @param r Output parameter for the “red” value. - * @param g Output parameter for the green value. - * @param b Output parameter for the blue value. - */ -static void interpolate(double x1, double y1, double x2, double y2, double temp, double* r, double* g, double* b) -{ - double weight = fmod(temp, (double)LIBRED_DELTA_TEMPERATURE) / (double)LIBRED_DELTA_TEMPERATURE; - double x = x1 * (1 - weight) + x2 * weight; - double y = y1 * (1 - weight) + y2 * weight; - ciexyy_to_srgb(x, y, 1.0, r, g, b); -} - - -/** - * Get the [0, 1] sRGB values of a colour temperature. - * - * @param temp The desired colour temperature. - * @param r Output parameter for the “red” value. - * @param g Output parameter for the green value. - * @param b Output parameter for the blue value. - * @return 0 on succeess, -1 on error. - * - * @throws EOVERFLOW The file did not have the expected size. - * @throws EDOM The selected temperature is below 1000 K. - * @throws Any error specified for pread(3). - */ -int libred_get_colour(long int temp, double* r, double* g, double* b) -{ - double values[10]; /* low:x,y,r,g,b + high:x,y,r,g,b */ - off_t offset; - double max; - - /* We do not have any values for above 40 000 K, but - * the differences will be unnoticeable, perhaps even - * unencodeable. */ - if (temp > LIBRED_HIGHEST_TEMPERATURE) temp = LIBRED_HIGHEST_TEMPERATURE; - /* Things do not glow below 1000 K. Yes, fire is hot! */ - if (temp < LIBRED_LOWEST_TEMPERATURE) t ((errno = EDOM)); - - /* Read table. */ - offset = ((off_t)temp - LIBRED_LOWEST_TEMPERATURE) / LIBRED_DELTA_TEMPERATURE; - offset *= (off_t)(sizeof(values) / 2); - errno = EOVERFLOW; xpread(libred_fd, values, sizeof(values), offset); - - /* Get colour. */ - if (temp % LIBRED_DELTA_TEMPERATURE) - interpolate(values[0], values[1], values[6], values[7], (double)temp, r, g, b); - else - *r = values[2], *g = values[3], *b = values[4]; - - /* Adjust colours for use. */ - max = fmax(fmax(fabs(*r), fabs(*g)), fabs(*b)); -#if __GNUC__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wfloat-equal" -#endif - if (max != 0.0) *r /= max, *g /= max, *b /= max; -#if __GNUC__ -# pragma GCC diagnostic pop -#endif - *r = *r > 0.0 ? *r : 0.0; - *g = *g > 0.0 ? *g : 0.0; - *b = *b > 0.0 ? *b : 0.0; - - return 0; - fail: - return -1; -} -#endif - - -#if __GNUC__ -# pragma GCC diagnostic pop -#endif - diff --git a/src/libred.librarian b/src/libred.librarian deleted file mode 100644 index 683e1b9..0000000 --- a/src/libred.librarian +++ /dev/null @@ -1 +0,0 @@ -LDFLAGS -lm -lred diff --git a/src/libred.pc b/src/libred.pc deleted file mode 100644 index 5d4600f..0000000 --- a/src/libred.pc +++ /dev/null @@ -1,4 +0,0 @@ -Version: 1.0 -Name: libred -Description: Solar elevation and blackbody colour calculation -Libs: -lm -lred diff --git a/src/macros.h b/src/macros.h deleted file mode 100644 index 6e5f8ed..0000000 --- a/src/macros.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright © 2016 Mattias Andrée <maandree@member.fsf.org> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -#include <unistd.h> - - -#define t(...) do { if (__VA_ARGS__) goto fail; } while (0) -#define xpread(fd, buf, len, off) t (pread(fd, buf, len, off) < (ssize_t)(len)) -#define xwrite(fd, buf, len) t (write(fd, buf, len) < (ssize_t)(len)) diff --git a/src/parse_10deg.c b/src/parse_10deg.c deleted file mode 100644 index c78851e..0000000 --- a/src/parse_10deg.c +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright © 2016 Mattias Andrée <maandree@member.fsf.org> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -#include "libred.h" -#include "macros.h" -#include <stdio.h> -#include <math.h> -#include <sys/stat.h> - - - -/** - * The number of measured temperatures. - */ -#define TEMPERATURES ((LIBRED_HIGHEST_TEMPERATURE - LIBRED_LOWEST_TEMPERATURE) / LIBRED_DELTA_TEMPERATURE + 1) - - - -#define LIBRED_COMPILING_PARSER -#include "blackbody.c" - - - -/** - * Create the lookup table of temperatures. - * - * Standard input should be the file '10deg', - * standard output should be the table file - * and must be a regular file. - * - * @param argc Should be 1. - * @param argv Should only contain the name of the process. - * @return 0 on success, 1 on error. - */ -int main(int argc, char *argv[]) -{ -#define x (xyrgb[0]) -#define y (xyrgb[1]) -#define r (xyrgb[2]) -#define g (xyrgb[3]) -#define b (xyrgb[4]) - - double xyrgb[5]; - struct stat attr; - long int temp = LIBRED_LOWEST_TEMPERATURE; - - for (; fscanf(stdin, "%lf %lf\n", &x, &y) == 2; temp += LIBRED_DELTA_TEMPERATURE) - { - (temp == 6500) ? (r = g = b = 1.0) : ciexyy_to_srgb(x, y, 1.0, &r, &g, &b); - xwrite(STDOUT_FILENO, xyrgb, sizeof(xyrgb)); - } - xwrite(STDOUT_FILENO, xyrgb, sizeof(xyrgb)); /* sugar */ - t (fstat(STDOUT_FILENO, &attr)); - return ((size_t)(attr.st_size) != (TEMPERATURES + 1) * 5 * sizeof(double)); - fail: - return perror(argc ? *argv : "parse_10deg"), 1; -} - |