Introduction
Introduction Statistics Contact Development Disclaimer Help
Let the user configure the displayed menu items - sacc - sacc - sacc(omys), sim…
git clone git://git.codemadness.org/sacc
Log
Files
Refs
LICENSE
---
commit 80db85ac77a36eb3f591ea7f38816b6339607821
parent 0cb0ce0bb84aca55dd9d66d22fd6550ee0a58ada
Author: Quentin Rameau <[email protected]>
Date: Mon, 13 Aug 2018 11:08:36 +0200
Let the user configure the displayed menu items
Diffstat:
M common.h | 21 +++++++++++++++++++++
M config.def.h | 22 ++++++++++++++++++++++
M sacc.c | 37 +++++++++++++++--------------…
M ui_ti.c | 2 +-
M ui_txt.c | 2 +-
5 files changed, 63 insertions(+), 21 deletions(-)
---
diff --git a/common.h b/common.h
@@ -3,6 +3,27 @@
typedef struct item Item;
typedef struct dir Dir;
+enum {
+ TXT,
+ DIR,
+ CSO,
+ ERR,
+ MAC,
+ DOS,
+ UUE,
+ IND,
+ TLN,
+ BIN,
+ MIR,
+ IBM,
+ GIF,
+ IMG,
+ URL,
+ INF,
+ UNK,
+ BRK,
+};
+
struct item {
char type;
char redtype;
diff --git a/config.def.h b/config.def.h
@@ -25,3 +25,25 @@ static char *plumber = "xdg-open";
/* temporary directory template (must end with six 'X' characters) */
static char tmpdir[] = "/tmp/sacc-XXXXXX";
+
+/* menu items strings */
+static char *typestr[] = {
+ [TXT] = "Txt+",
+ [DIR] = "Dir+",
+ [CSO] = "CSO|",
+ [ERR] = "Err|",
+ [MAC] = "Mac+",
+ [DOS] = "DOS+",
+ [UUE] = "UUE+",
+ [IND] = "Ind+",
+ [TLN] = "Tln|",
+ [BIN] = "Bin+",
+ [MIR] = "Mir+",
+ [IBM] = "IBM|",
+ [GIF] = "GIF+",
+ [IMG] = "Img+",
+ [URL] = "URL+",
+ [INF] = " |",
+ [UNK] = " ? +",
+ [BRK] = "! |", /* malformed entry */
+};
diff --git a/sacc.c b/sacc.c
@@ -19,7 +19,6 @@
#include <sys/wait.h>
#include "common.h"
-
#include "config.h"
static char *mainurl;
@@ -223,43 +222,43 @@ typedisplay(char t)
{
switch (t) {
case '0':
- return "Text+";
+ return typestr[TXT];
case '1':
- return "Dir +";
+ return typestr[DIR];
case '2':
- return "CSO |";
+ return typestr[CSO];
case '3':
- return "Err |";
+ return typestr[ERR];
case '4':
- return "Macf+";
+ return typestr[MAC];
case '5':
- return "DOSf+";
+ return typestr[DOS];
case '6':
- return "UUEf+";
+ return typestr[UUE];
case '7':
- return "Find+";
+ return typestr[IND];
case '8':
- return "Tlnt+";
+ return typestr[TLN];
case '9':
- return "Binf+";
+ return typestr[BIN];
case '+':
- return "Mirr+";
+ return typestr[MIR];
case 'T':
- return "IBMt|";
+ return typestr[IBM];
case 'g':
- return "GIF +";
+ return typestr[GIF];
case 'I':
- return "Img +";
+ return typestr[IMG];
case 'h':
- return "HTML+";
+ return typestr[URL];
case 'i':
- return " |";
+ return typestr[INF];
default:
/* "Characters '0' through 'Z' are reserved." (ASCII) */
if (t >= '0' && t <= 'Z')
- return "! |";
+ return typestr[BRK];
else
- return "UNKN|";
+ return typestr[UNK];
}
}
diff --git a/ui_ti.c b/ui_ti.c
@@ -7,8 +7,8 @@
#include <unistd.h>
#include <sys/types.h>
-#include "config.h"
#include "common.h"
+#include "config.h"
#define C(c) #c
#define S(c) C(c)
diff --git a/ui_txt.c b/ui_txt.c
@@ -103,7 +103,7 @@ printstatus(Item *item, char c)
"%3lld%%%*c %s/%c%s [%c]: ";
if (snprintf(bufout, sizeof(bufout), fmt,
(printoff + lines-1 >= nitems) ? 100 :
- (printoff + lines) * 100 / nitems, ndigits(nitems)+2, '|',
+ (printoff + lines) * 100 / nitems, ndigits(nitems)+1, '|',
item->host, item->type, item->selector, c, item->port)
>= sizeof(bufout))
bufout[sizeof(bufout)-1] = '\0';
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.