summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bc334f1)
raw | patch | inline | side by side (parent: bc334f1)
author | Jonas Fonseca <fonseca@diku.dk> | |
Sun, 10 Apr 2011 03:39:49 +0000 (23:39 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Sun, 10 Apr 2011 03:39:49 +0000 (23:39 -0400) |
tig.c | patch | blob | history |
index 7de7f8603f510cb4e487be33b1c09abbc92c3ff8..e60b717c90d0d4f9be73f76aee418c214fce4731 100644 (file)
--- a/tig.c
+++ b/tig.c
return text;
}
return text;
}
+static const char *
+mkmode(mode_t mode)
+{
+ if (S_ISDIR(mode))
+ return "drwxr-xr-x";
+ else if (S_ISLNK(mode))
+ return "lrwxrwxrwx";
+ else if (S_ISGITLINK(mode))
+ return "m---------";
+ else if (S_ISREG(mode) && mode & S_IXUSR)
+ return "-rwxr-xr-x";
+ else if (S_ISREG(mode))
+ return "-rw-r--r--";
+ else
+ return "----------";
+}
+
+
/*
* User requests
*/
/*
* User requests
*/
static bool
draw_mode(struct view *view, mode_t mode)
{
static bool
draw_mode(struct view *view, mode_t mode)
{
- const char *str;
-
- if (S_ISDIR(mode))
- str = "drwxr-xr-x";
- else if (S_ISLNK(mode))
- str = "lrwxrwxrwx";
- else if (S_ISGITLINK(mode))
- str = "m---------";
- else if (S_ISREG(mode) && mode & S_IXUSR)
- str = "-rwxr-xr-x";
- else if (S_ISREG(mode))
- str = "-rw-r--r--";
- else
- str = "----------";
+ const char *str = mkmode(mode);
return draw_field(view, LINE_MODE, str, STRING_SIZE("-rw-r--r-- "), FALSE);
}
return draw_field(view, LINE_MODE, str, STRING_SIZE("-rw-r--r-- "), FALSE);
}