Merge CV, ver=5.1; ops/methods from HV, and interface from CV where possible
[goodguy/history.git] / cinelerra-5.1 / cinelerra / timebomb.C
diff --git a/cinelerra-5.1/cinelerra/timebomb.C b/cinelerra-5.1/cinelerra/timebomb.C
new file mode 100644 (file)
index 0000000..75a147b
--- /dev/null
@@ -0,0 +1,95 @@
+
+/*
+ * CINELERRA
+ * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
+ * 
+ * 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 2 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * 
+ */
+
+#include "timebomb.h"\r
+#include <stdio.h>\r
+#include <sys/stat.h>\r
+#include <stdlib.h>\r
+\r
+#define LASTYEAR 2001\r
+#define LASTDAY 1\r
+#define LASTMONTH 10\r
+#define EXCUSE \\r
+"To reduce support liability this release had an expiration date.\n" \\r
+"The expiration date of this release has expired.\n"\r
+\r
+static char *files[] = \r
+{\r
+       "/usr/lib/libcinelerra.so",\r
+       "/usr/bin/cinelerra"\r
+};\r
+\r
+TimeBomb::TimeBomb()\r
+{\r
+       struct stat fileinfo;\r
+       time_t system_time;\r
+       int result;\r
+\r
+       result = stat("/etc", &fileinfo);\r
+       system_time = time(0);\r
+\r
+printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
+printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
+printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
+printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
+printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
+printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
+printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
+printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
+printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
+printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
+printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
+printf("This release expires %d/%d/%d\n", LASTMONTH, LASTDAY, LASTYEAR);\r
+\r
+       if(test_time(fileinfo.st_mtime) ||\r
+               test_time(system_time))\r
+       {\r
+               printf(EXCUSE);\r
+               disable_system();\r
+               exit(1);\r
+       }\r
+}\r
+\r
+\r
+int TimeBomb::test_time(time_t testtime)\r
+{\r
+       struct tm *currenttime;\r
+       currenttime = localtime(&testtime);\r
+\r
+       if(currenttime->tm_year >= LASTYEAR - 1900 &&\r
+               currenttime->tm_mday >= LASTDAY &&\r
+               currenttime->tm_mon >= LASTMONTH - 1) return 1;\r
+       else return 0;\r
+}\r
+\r
+void TimeBomb::disable_system()\r
+{\r
+//printf("TimeBomb::disable_system %d\n", sizeof(files));\r
+       for(int i = 0; i < sizeof(files) / sizeof(char*); i++)\r
+       {\r
+               remove((const char*)files[i]);\r
+       }\r
+}\r
+\r
+TimeBomb::~TimeBomb()\r
+{\r
+}\r
+\r