#if 0
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define DATE_FORMAT "%Y-%m-%d"
int main( void )
{
FILE *stream;
char buf[1024] = {0};
char cmd[1024] = {0};
unsigned int day = 1;
snprintf( cmd , 1024 , "date -d \"%d day ago\" +%s" , day , DATE_FORMAT );
stream = popen( cmd , "r" );
fread( buf, sizeof(char), sizeof(buf), stream);
pclose( stream );
printf("%s" , buf);
return 0;
}
#endif
#include <stdio.h>
#include <time.h>
int main()
{
time_t stamp=time(NULL)-24*60*60;
struct tm *t=localtime(&stamp);
printf("%04d %02d %02d\n",1900+t->tm_year,t->tm_mon + 1,t->tm_mday);
return 0;
}