Um touch para o ano 2000


[Home] [Dissertação] [Biba] [Linux] [Conjugue] [br.ispell] [axw3] [uplink]

/*

utouch: a touch able to go beyond 1999...

by Ricardo Ueda Karpischek

*/

#include <sys/types.h>
#include <time.h>
#include <utime.h>

int main(int argc,char *argv[])
{
    struct tm btime;
    struct utimbuf utb;
    
    btime.tm_sec = 1;
    btime.tm_min = 1;
    btime.tm_hour = 1;
    btime.tm_mday = 1;
    btime.tm_mon = 0;
    btime.tm_year = atoi(argv[1])-1900;
    btime.tm_isdst = -1;
    
    if ((utb.actime = utb.modtime = mktime(&btime)) > 0)
        utime(argv[2],&utb);
}