Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / cinelerra / timebomb.C
blob8fb6130eecb442232ff7e48f265f135943eabf0e
1 #include "timebomb.h"\r
2 #include <stdio.h>\r
3 #include <sys/stat.h>\r
4 #include <stdlib.h>\r
5 \r
6 #define LASTYEAR 2001\r
7 #define LASTDAY 1\r
8 #define LASTMONTH 10\r
9 #define EXCUSE \\r
10 "To reduce support liability this release had an expiration date.\n" \\r
11 "The expiration date of this release has expired.\n"\r
13 static char *files[] = \r
14 {\r
15         "/usr/lib/libcinelerra.so",\r
16         "/usr/bin/cinelerra"\r
17 };\r
19 TimeBomb::TimeBomb()\r
20 {\r
21         struct stat fileinfo;\r
22         time_t system_time;\r
23         int result;\r
25         result = stat("/etc", &fileinfo);\r
26         system_time = time(0);\r
28 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
29 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
30 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
31 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
32 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
33 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
34 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
35 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
36 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
37 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
38 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
39 printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
41         if(test_time(fileinfo.st_mtime) ||\r
42                 test_time(system_time))\r
43         {\r
44                 printf(EXCUSE);\r
45                 disable_system();\r
46                 exit(1);\r
47         }\r
48 }\r
51 int TimeBomb::test_time(time_t testtime)\r
52 {\r
53         struct tm *currenttime;\r
54         currenttime = localtime(&testtime);\r
56         if(currenttime->tm_year >= LASTYEAR - 1900 &&\r
57                 currenttime->tm_mday >= LASTDAY &&\r
58                 currenttime->tm_mon >= LASTMONTH - 1) return 1;\r
59         else return 0;\r
60 }\r
62 void TimeBomb::disable_system()\r
63 {\r
64 //printf("TimeBomb::disable_system %d\n", sizeof(files));\r
65         for(int i = 0; i < sizeof(files) / sizeof(char*); i++)\r
66         {\r
67                 remove((const char*)files[i]);\r
68         }\r
69 }\r
71 TimeBomb::~TimeBomb()\r
72 {\r
73 }\r
76 //      Local Variables:
77 //      mode: C++
78 //      c-file-style: "linux"
79 //      End: