billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=2a397f35cdc2e781ce4fe26cc1b6476fbfb8a8d9

commit 2a397f35cdc2e781ce4fe26cc1b6476fbfb8a8d9
Author: broggi_t <brogg...@epitech.eu>
Date:   Wed Feb 4 05:57:21 2015 +0100

    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)
---
 AUTHORS           |  1 +
 src/bin/about.c   |  3 ++-
 src/bin/tyalpha.c |  5 +----
 src/bin/tybg.c    |  5 +----
 src/bin/tyls.c    | 25 +++++++++----------------
 src/bin/typop.c   |  5 +----
 src/bin/tyq.c     |  5 +----
 7 files changed, 16 insertions(+), 33 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index ff8cd21..69a8e85 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -45,3 +45,4 @@ Nicholas Hughart <mek...@mekius.net>
 Rafael Antognolli <antogno...@gmail.com>
 Rui Seabra <r...@1407.org>
 Vincent Torri <vincent.to...@gmail.com>
+Thibaut Broggi <brogg...@epitech.eu>
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,
               "Nicholas Hughart<br>"
               "Rafael Antognolli<br>"
               "Rui Seabra<br>"
-              "Vincent Torri<br>",
+              "Vincent Torri<br>"
+              "Thibaut Broggi<br>",
               "All rights reserved.<br>"
               "<br>"
               "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)
           snprintf(tbuf, sizeof(tbuf), "%c}ap%s", 0x1b, argv[i]);
         else
           snprintf(tbuf, sizeof(tbuf), "%c}at%s", 0x1b, argv[i]);
-        if (write(0, tbuf, strlen(tbuf)) < 1) perror("write");
-        tbuf[0] = 0;
-        if (write(0, tbuf, 1) < 1) perror("write");
+        if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) 
perror("write");
      }
-   exit(0);
    return 0;
 }
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)
           snprintf(tbuf, sizeof(tbuf), "%c}bp%s", 0x1b, path);
         else
           snprintf(tbuf, sizeof(tbuf), "%c}bt%s", 0x1b, path);
-        if (write(0, tbuf, strlen(tbuf)) < 1) perror("write");
-        tbuf[0] = 0;
-        if (write(0, tbuf, 1) < 1) perror("write");
+        if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) 
perror("write");
      }
-   exit(0);
    return 0;
 }
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)
         for (i = 1; i < argc; i++)
           {
              char *path;
+             char *cmp[] = {"-c", "-m", "-l"};
+             int j;
 
-             if (!strcmp(argv[i], "-c"))
+             for (j = 0; j < 3; j++)
                {
-                  mode = SMALL;
-                  i++;
-                  if (i >= argc) break;
-               }
-             else if (!strcmp(argv[i], "-m"))
-               {
-                  mode = MEDIUM;
-                  i++;
-                  if (i >= argc) break;
-               }
-             else if (!strcmp(argv[i], "-l"))
-               {
-                  mode = LARGE;
-                  i++;
-                  if (i >= argc) break;
+                 if (!strcmp(argv[i], cmp[j]))
+                   {
+                     mode = j;
+                     if (++i >= argc) break;
+                   }
                }
+             if (i >= argc) break;
              path = argv[i];
              rp = ecore_file_realpath(path);
              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)
         path = argv[i];
         if (realpath(path, buf)) path = buf;
         snprintf(tbuf, sizeof(tbuf), "%c}pn%s", 0x1b, path);
-        if (write(0, tbuf, strlen(tbuf)) < 1) perror("write");
-        tbuf[0] = 0;
-        if (write(0, tbuf, 1) < 1) perror("write");
+        if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) 
perror("write");
      }
-   exit(0);
    return 0;
 }
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)
         path = argv[i];
         if (realpath(path, buf)) path = buf;
         snprintf(tbuf, sizeof(tbuf), "%c}pq%s", 0x1b, path);
-        if (write(0, tbuf, strlen(tbuf)) < 1) perror("write");
-        tbuf[0] = 0;
-        if (write(0, tbuf, 1) < 1) perror("write");
+        if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) 
perror("write");
      }
-   exit(0);
    return 0;
 }

-- 


Reply via email to