File: timers.c.patch

package info (click to toggle)
electricsheep 2.1-5.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,848 kB
  • ctags: 1,251
  • sloc: ansic: 22,199; sh: 1,929; makefile: 148
file content (57 lines) | stat: -rw-r--r-- 1,334 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
21d20
< #include <sys/stat.h>
509,536d507
< int
< electricsheep_vote(int vote) {
<     char ffn[5000];
<     FILE *ff;
<     char *hom = getenv("HOME");
<     struct stat sbuf;
<     if (!hom) {
< 	fprintf(real_stderr, "HOME envar not defined\n");
< 	return 1;
<     }
<     sprintf(ffn, "%s/.sheep/vote-fifo", hom);
< 
<     if (-1 == stat(ffn, &sbuf)) {
< 	fprintf(real_stderr, "vote failed stat %s\n", ffn);
< 	return 1;
<     }
< 
<     ff = fopen(ffn, "w");
<     if (NULL == ff) {
< 	fprintf(real_stderr, "vote failed fopen %s\n, ffn");
< 	return 1;
<     }
<     fprintf(ff, "%d\n", vote);
<     fclose(ff);
<     return 0;
< }
< 
< 
740,742c711,712
< 	    else {
< 	      /* If we're not demoing, then any activity causes deactivation,
< 		 except pressing up or down arrow.
---
> 	    else
> 	      /* If we're not demoing, then any activity causes deactivation.
744,759c714
< 		if ((event.xany.type == KeyRelease) || (event.xany.type == KeyPress)) {
< 		    switch (event.xkey.keycode) {
< 		    case 98:
< 			if ((event.xany.type == KeyPress) && electricsheep_vote(1))
< 			    goto DONE;
< 			break;
< 		    case 104:
< 			if ((event.xany.type == KeyPress) && electricsheep_vote(-1))
< 			    goto DONE;
< 			break;
< 		    default:
< 			goto DONE;
< 		    }
< 		} else
< 		    goto DONE;
< 	    }
---
> 	      goto DONE;