Browse Source

sigint processing script

Rafael Arce Nazario 4 years ago
parent
commit
390f5e6fc4
5 changed files with 1761 additions and 12 deletions
  1. 1
    0
      .gitignore
  2. 0
    6
      caca
  3. 0
    6
      caca.c
  4. 41
    0
      screehw.c
  5. 1719
    0
      tmp

+ 1
- 0
.gitignore View File

@@ -1 +1,2 @@
1 1
 kilo
2
+a.out

+ 0
- 6
caca View File

@@ -1,6 +0,0 @@
1
-wow inserting wowo wow owi muchos cosas escribiendo hasta que se acabe la linea esto no se acaba es???
2
-this is kilo can I do cut past  
3
-inside
4
-outside
5
-dos
6
-tres

+ 0
- 6
caca.c View File

@@ -1,6 +0,0 @@
1
-int main() {
2
-  for(i = 0; i < 20; i++) {
3
-  |
4
-}
5
-coqui
6
-sapo

+ 41
- 0
screehw.c View File

@@ -0,0 +1,41 @@
1
+#include <sys/ioctl.h>
2
+#include <stdio.h>
3
+#include <unistd.h>
4
+#include <signal.h>
5
+#include <stdlib.h>
6
+
7
+
8
+void foo(int signum) {
9
+//   printf("wowo %d\n",signum);
10
+  //exit(signum);
11
+    int cols = 80;
12
+    int lines = 24;
13
+#ifdef TIOCGSIZE
14
+    struct ttysize ts;
15
+    ioctl(STDIN_FILENO, TIOCGSIZE, &ts);
16
+    cols = ts.ts_cols;
17
+    lines = ts.ts_lines;
18
+#elif defined(TIOCGWINSZ)
19
+    struct winsize ts;
20
+    ioctl(STDIN_FILENO, TIOCGWINSZ, &ts);
21
+    cols = ts.ws_col;
22
+    lines = ts.ws_row;
23
+#endif /* TIOCGSIZE */
24
+
25
+    printf("Terminal is %dx%d\n", cols, lines);
26
+
27
+}
28
+
29
+int main (void)
30
+{
31
+
32
+(void)signal(SIGWINCH,foo);
33
+
34
+
35
+
36
+
37
+   while(1) {
38
+   }
39
+}
40
+
41
+

+ 1719
- 0
tmp
File diff suppressed because it is too large
View File