summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbroggi_t <broggi_t@epitech.eu>2015-02-04 05:57:21 +0100
committerBoris Faure <billiob@gmail.com>2015-02-07 12:02:19 +0100
commit2a397f35cdc2e781ce4fe26cc1b6476fbfb8a8d9 (patch)
treed35e1001cc14c21e8518650e701acb850673f419 /src
parent9814b10ad2f2d6ee4371bbf25d41ff178505624d (diff)
fix some possible bug in tyalpha, tybg, typop, tyq commands
make the code prettier in tyls remove useless exit(0) at the end of the main (just before some return 0)
Diffstat (limited to 'src')
-rw-r--r--src/bin/about.c3
-rw-r--r--src/bin/tyalpha.c5
-rw-r--r--src/bin/tybg.c5
-rw-r--r--src/bin/tyls.c25
-rw-r--r--src/bin/typop.c5
-rw-r--r--src/bin/tyq.c5
6 files changed, 15 insertions, 33 deletions
diff --git a/src/bin/about.c b/src/bin/about.c
index 6366ec2..65e019a 100644
--- a/src/bin/about.c
+++ b/src/bin/about.c
@@ -116,7 +116,8 @@ about_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term,
116 "Nicholas Hughart<br>" 116 "Nicholas Hughart<br>"
117 "Rafael Antognolli<br>" 117 "Rafael Antognolli<br>"
118 "Rui Seabra<br>" 118 "Rui Seabra<br>"
119 "Vincent Torri<br>", 119 "Vincent Torri<br>"
120 "Thibaut Broggi<br>",
120 "All rights reserved.<br>" 121 "All rights reserved.<br>"
121 "<br>" 122 "<br>"
122 "Redistribution and use in source and binary forms, with or " 123 "Redistribution and use in source and binary forms, with or "
diff --git a/src/bin/tyalpha.c b/src/bin/tyalpha.c
index fe314bb..ac189d7 100644
--- a/src/bin/tyalpha.c
+++ b/src/bin/tyalpha.c
@@ -33,10 +33,7 @@ main(int argc, char **argv)
33 snprintf(tbuf, sizeof(tbuf), "%c}ap%s", 0x1b, argv[i]); 33 snprintf(tbuf, sizeof(tbuf), "%c}ap%s", 0x1b, argv[i]);
34 else 34 else
35 snprintf(tbuf, sizeof(tbuf), "%c}at%s", 0x1b, argv[i]); 35 snprintf(tbuf, sizeof(tbuf), "%c}at%s", 0x1b, argv[i]);
36 if (write(0, tbuf, strlen(tbuf)) < 1) perror("write"); 36 if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
37 tbuf[0] = 0;
38 if (write(0, tbuf, 1) < 1) perror("write");
39 } 37 }
40 exit(0);
41 return 0; 38 return 0;
42} 39}
diff --git a/src/bin/tybg.c b/src/bin/tybg.c
index 9fd74b1..ea12c6e 100644
--- a/src/bin/tybg.c
+++ b/src/bin/tybg.c
@@ -35,10 +35,7 @@ main(int argc, char **argv)
35 snprintf(tbuf, sizeof(tbuf), "%c}bp%s", 0x1b, path); 35 snprintf(tbuf, sizeof(tbuf), "%c}bp%s", 0x1b, path);
36 else 36 else
37 snprintf(tbuf, sizeof(tbuf), "%c}bt%s", 0x1b, path); 37 snprintf(tbuf, sizeof(tbuf), "%c}bt%s", 0x1b, path);
38 if (write(0, tbuf, strlen(tbuf)) < 1) perror("write"); 38 if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
39 tbuf[0] = 0;
40 if (write(0, tbuf, 1) < 1) perror("write");
41 } 39 }
42 exit(0);
43 return 0; 40 return 0;
44} 41}
diff --git a/src/bin/tyls.c b/src/bin/tyls.c
index c8067c7..12975ce 100644
--- a/src/bin/tyls.c
+++ b/src/bin/tyls.c
@@ -789,25 +789,18 @@ main(int argc, char **argv)
789 for (i = 1; i < argc; i++) 789 for (i = 1; i < argc; i++)
790 { 790 {
791 char *path; 791 char *path;
792 char *cmp[] = {"-c", "-m", "-l"};
793 int j;
792 794
793 if (!strcmp(argv[i], "-c")) 795 for (j = 0; j < 3; j++)
794 { 796 {
795 mode = SMALL; 797 if (!strcmp(argv[i], cmp[j]))
796 i++; 798 {
797 if (i >= argc) break; 799 mode = j;
798 } 800 if (++i >= argc) break;
799 else if (!strcmp(argv[i], "-m")) 801 }
800 {
801 mode = MEDIUM;
802 i++;
803 if (i >= argc) break;
804 }
805 else if (!strcmp(argv[i], "-l"))
806 {
807 mode = LARGE;
808 i++;
809 if (i >= argc) break;
810 } 802 }
803 if (i >= argc) break;
811 path = argv[i]; 804 path = argv[i];
812 rp = ecore_file_realpath(path); 805 rp = ecore_file_realpath(path);
813 if (rp) 806 if (rp)
diff --git a/src/bin/typop.c b/src/bin/typop.c
index 2686ed9..d777d3a 100644
--- a/src/bin/typop.c
+++ b/src/bin/typop.c
@@ -25,10 +25,7 @@ main(int argc, char **argv)
25 path = argv[i]; 25 path = argv[i];
26 if (realpath(path, buf)) path = buf; 26 if (realpath(path, buf)) path = buf;
27 snprintf(tbuf, sizeof(tbuf), "%c}pn%s", 0x1b, path); 27 snprintf(tbuf, sizeof(tbuf), "%c}pn%s", 0x1b, path);
28 if (write(0, tbuf, strlen(tbuf)) < 1) perror("write"); 28 if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
29 tbuf[0] = 0;
30 if (write(0, tbuf, 1) < 1) perror("write");
31 } 29 }
32 exit(0);
33 return 0; 30 return 0;
34} 31}
diff --git a/src/bin/tyq.c b/src/bin/tyq.c
index 7e45d78..1a73c4e 100644
--- a/src/bin/tyq.c
+++ b/src/bin/tyq.c
@@ -25,10 +25,7 @@ main(int argc, char **argv)
25 path = argv[i]; 25 path = argv[i];
26 if (realpath(path, buf)) path = buf; 26 if (realpath(path, buf)) path = buf;
27 snprintf(tbuf, sizeof(tbuf), "%c}pq%s", 0x1b, path); 27 snprintf(tbuf, sizeof(tbuf), "%c}pq%s", 0x1b, path);
28 if (write(0, tbuf, strlen(tbuf)) < 1) perror("write"); 28 if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
29 tbuf[0] = 0;
30 if (write(0, tbuf, 1) < 1) perror("write");
31 } 29 }
32 exit(0);
33 return 0; 30 return 0;
34} 31}