1 /* gcc -Wall -O2 scrsav.c -o scrsav
2 * while : ; do ./scrsav /dev/vcc/a2 /dev/vcc/a3 ; sleep 5 ; done
4 * --- T2-COPYRIGHT-NOTE-BEGIN ---
5 * This copyright note is auto-generated by ./scripts/Create-CopyPatch.
7 * T2 SDE: misc/archive/scrsav.c
8 * Copyright (C) 2004 - 2005 The T2 SDE Project
9 * Copyright (C) 1998 - 2003 ROCK Linux Project
11 * More information can be found in the files COPYING and README.
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; version 2 of the License. A copy of the
16 * GNU General Public License can be found in the file COPYING.
17 * --- T2-COPYRIGHT-NOTE-END ---
21 #include <sys/types.h>
37 #define BUFSIZE (LINES*CHARS*2)
38 #define LINESIZE (CHARS*2)
40 int main(int argc
, char ** argv
) {
46 fprintf(stderr
, "Usage: %s <src-vcs> <trg-vcs>\n", argv
[0]);
47 fprintf(stderr
, "E.g.: %s /dev/vcc/a2 /dev/vcc/a3\n", argv
[0]);
51 fd
=open(argv
[1], O_RDONLY
);
52 if (fd
< 0) { perror(argv
[1]); return 1; }
53 read(fd
, miscdata
, 4);
54 read(fd
, buffer
, BUFSIZE
);
57 srandom( time(NULL
) + getpid() );
59 for (c
=0; c
<BUFSIZE
-1; c
+=2) {
60 #if __BYTE_ORDER == __LITTLE_ENDIAN
65 buffer
[i
] ^= buffer
[j
] ^ c
^ random() ;
66 if ( c
/LINESIZE
+1 != time(NULL
) % LINES
)
70 fd
=open(argv
[2], O_WRONLY
);
71 if (fd
< 0) { perror(argv
[2]); return 1; }
72 write(fd
, miscdata
, 4);
73 write(fd
, buffer
, BUFSIZE
);