~arivigo/schain

9ce5ec2b1b8538c476079464f385e5467ff6b9ac — Ariadna Vigo 2 months ago f386dd0
schain.c: -w now supports 'y' for yesterday's date
1 files changed, 7 insertions(+), 3 deletions(-)

M schain.c
M schain.c => schain.c +7 -3
@@ 156,10 156,14 @@ main(int argc, char *argv[])
	if (num < 0 || check_diff < 0)
		die("Error: not a positive number.");

	if (datearg != NULL)
		strlcpy(date, datearg, DATE_SIZE);
	else
	if (datearg != NULL) {
		if (strncmp(datearg, "y", DATE_SIZE) == 0)
			strlcpy(date, date_str(time(NULL) - 86400), DATE_SIZE);
		else
			strlcpy(date, datearg, DATE_SIZE);
	} else {
		strlcpy(date, date_str(time(NULL)), DATE_SIZE);
	}

	if (is_date(date) < 0)
		die("Error: not a valid YYYY-MM-DD date.");