aboutsummaryrefslogtreecommitdiff
path: root/sysutils/wmcube-gdk/files/patch-wmcube.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils/wmcube-gdk/files/patch-wmcube.c')
-rw-r--r--sysutils/wmcube-gdk/files/patch-wmcube.c121
1 files changed, 112 insertions, 9 deletions
diff --git a/sysutils/wmcube-gdk/files/patch-wmcube.c b/sysutils/wmcube-gdk/files/patch-wmcube.c
index b6026aaa448b..01f9db4427d8 100644
--- a/sysutils/wmcube-gdk/files/patch-wmcube.c
+++ b/sysutils/wmcube-gdk/files/patch-wmcube.c
@@ -1,6 +1,23 @@
---- wmcube.c.orig Tue Aug 28 12:08:13 2001
-+++ wmcube.c Tue Dec 18 14:37:25 2001
-@@ -778,7 +777,7 @@
+--- wmcube.c.orig 2009-02-25 09:56:08.000000000 -0300
++++ wmcube.c 2009-02-25 09:56:28.000000000 -0300
+@@ -174,6 +174,7 @@
+ #ifdef FREEBSD
+ static kvm_t *kd;
+ static struct nlist nlst[] = { {"_cp_time"}, {0} };
++static int cp_time_mib[2];
+ #endif
+
+ void prep_digits(void)
+@@ -226,7 +227,7 @@
+ XWMHints wmhints;
+ /* for mask */
+ GdkBitmap *mask;
+- unsigned char mask_data[8 * 64];
++ gchar mask_data[8 * 64];
+ int i;
+ GdkColor bright;
+ /* for that stupid shadow line */
+@@ -778,7 +779,7 @@
newx -= CHAR_WIDTH;
}
@@ -9,7 +26,17 @@
for (i = 0; (c = buf[i]); i++) {
if (c == '%')
copy_xpm_area(60, 0, 7, 9, newx, y);
-@@ -1250,7 +1249,7 @@
+@@ -899,7 +900,8 @@
+
+ while ((i > -1) && (temparr[i] > key)) {
+ temparr[i + 1] = temparr[i];
+- zorder[i + 1] = zorder[i--];
++ zorder[i + 1] = zorder[i];
++ i--;
+ }
+
+ zorder[i + 1] = k;
+@@ -1250,7 +1252,7 @@
exit(0);
}
@@ -18,7 +45,7 @@
if (strcmp(tmp, "WMCUBE_COORDINATES") != 0) {
printf
-@@ -1259,7 +1258,7 @@
+@@ -1259,7 +1261,7 @@
exit(0);
}
@@ -27,7 +54,7 @@
counter = atoi(tmp);
while ((strcmp(tmp, "WMCUBE_LINES") != 0)
-@@ -1280,7 +1279,7 @@
+@@ -1280,7 +1282,7 @@
fclose(fp);
exit(0);
}
@@ -36,7 +63,37 @@
if (feof(fp)) {
printf
-@@ -1398,7 +1397,7 @@
+@@ -1297,23 +1299,23 @@
+
+ planesORlines = 0;
+ while (1) {
+-
+ cline = (int *) realloc(cline, (i + 2) * sizeof(int));
+ mem_alloc_error(cline);
+- fscanf(fp, "%d %d", &cline[i++], &cline[i++]);
+- /* printf("\n%d %d",cline[i-2],cline[i-1]); */
++ fscanf(fp, "%d %d", &cline[i], &cline[i+1]);
++ /* printf("\n%d %d",cline[i],cline[i+1]); */
+ if (feof(fp))
+ break;
+
+- if (cline[i - 2] > nofcoords || cline[i - 1] > nofcoords) {
++ if (cline[i] > nofcoords || cline[i+1] > nofcoords) {
+ printf("\nError in objectfile (WMCUBE_LINES section):\n"
+ "coordinates %d or/and %d doesnt exist\n\n",
+- cline[i - 2], cline[i - 1]);
++ cline[i], cline[i+1]);
+ fclose(fp);
+ exit(0);
+ }
++ i = i + 2;
+ }
+- noflines = i - 2;
++ noflines = i;
+ } else if (strcmp(tmp, "WMCUBE_PLANES") == 0) {
+
+ planesORlines = 1;
+@@ -1398,7 +1400,7 @@
char cpuid[6];
char check_cpu[6];
@@ -45,7 +102,7 @@
if ((fp = fopen("/proc/stat", "rb")) == NULL) {
perror("/proc/stat required for this system");
-@@ -1409,7 +1408,7 @@
+@@ -1409,7 +1411,7 @@
return 0;
for (i = -2; i < which_cpu; i++) {
@@ -54,7 +111,7 @@
}
if (strcmp(check_cpu, cpuid) != 0) {
-@@ -1431,7 +1430,7 @@
+@@ -1431,7 +1433,7 @@
fp = fopen("/proc/stat", "rt");
for (i = -2; i < which_cpu; i++) {
@@ -63,3 +120,49 @@
}
fclose(fp);
+@@ -1582,18 +1584,23 @@
+ #include <nlist.h>
+ #include <fcntl.h>
+ #include <sys/dkstat.h>
++#include <sys/sysctl.h>
+
+ int init_calc_cpu()
+ {
++ size_t len = 2;
++ if (sysctlnametomib("kern.cp_time", cp_time_mib, &len) < 0) {
++ printf("\nWarning: unable to sysctl kern.cp_time\n\n");
+
+- if ((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open")) == NULL) {
+- printf("\nError: unable to open kvm\n\n");
+- exit(0);
+- }
+- kvm_nlist(kd, nlst);
+- if (nlst[0].n_type == 0) {
+- printf("\nError: unable to get nlist\n\n");
+- exit(1);
++ if ((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open")) == NULL) {
++ printf("\nError: unable to open kvm\n\n");
++ exit(0);
++ }
++ kvm_nlist(kd, nlst);
++ if (nlst[0].n_type == 0) {
++ printf("\nError: unable to get nlist\n\n");
++ exit(1);
++ }
+ }
+
+ /* drop setgid & setuid (hi GOBBLES, who the fuck are you? */
+@@ -1615,6 +1622,13 @@
+ int cpu, nice, system, idle;
+ unsigned long int cpu_time[CPUSTATES];
+
++ if (cp_time_mib[0] != 0) {
++ size_t cpu_time_len = sizeof (cpu_time);
++ if (sysctl(cp_time_mib, 2, cpu_time, &cpu_time_len, NULL, 0) < 0) {
++ printf("\nError sysctl\n\n");
++ exit(0);
++ }
++ } else
+ if (kvm_read(kd, nlst[0].n_value, &cpu_time, sizeof(cpu_time))
+ != sizeof(cpu_time)) {
+ printf("\nError reading kvm\n\n");