mcsfile comes with better support of FONTCHARACTER names! Buy now.
This commit is contained in:
parent
24ffe2d0c3
commit
9a29b22a80
|
@ -10,6 +10,7 @@
|
|||
#include "main.h"
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
#define cry(S, ...) fprintf(stderr, (S), ##__VA_ARGS__)
|
||||
|
||||
/**
|
||||
|
@ -23,6 +24,9 @@
|
|||
|
||||
int main(int ac, char **av)
|
||||
{
|
||||
/* set the locale */
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
/* parse arguments */
|
||||
const char *path;
|
||||
if (parse_args(ac, av, &path))
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "main.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <libfontcharacter.h>
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Sort */
|
||||
|
@ -64,7 +65,7 @@ static void sort_files(g1m_t *handle)
|
|||
static void put_description(g1m_mcsfile_t *file)
|
||||
{
|
||||
if (!file->head.type)
|
||||
printf("unknown content (%" PRIuSIZE" octets)\n", file->head.size);
|
||||
printf("unknown content (%" PRIuSIZE " octets)\n", file->head.size);
|
||||
else if (file->head.type & g1m_mcstype_program) {
|
||||
printf("program (");
|
||||
if (g1m_has_password(file))
|
||||
|
@ -119,7 +120,7 @@ void put_files(g1m_t *handle)
|
|||
int max_size = 0;
|
||||
for (int i = 0; i < handle->count; i++) {
|
||||
g1m_mcsfile_t *file = handle->files[i];
|
||||
int sz = strlen(file->head.name);
|
||||
int sz = fc_mbstous(NULL, file->head.name, 0);
|
||||
if (file->head._dirname[0])
|
||||
sz += strlen((char*)file->head._dirname) + 1;
|
||||
if (sz > max_size) max_size = sz;
|
||||
|
@ -127,15 +128,17 @@ void put_files(g1m_t *handle)
|
|||
max_size++;
|
||||
|
||||
/* put the lines */
|
||||
char buf[max_size + 1];
|
||||
wchar_t buf[max_size + 1], endbuf[max_size + 2];
|
||||
for (int i = 0; i < handle->count; i++) if (handle->files[i]) {
|
||||
g1m_mcsfile_t *file = handle->files[i];
|
||||
buf[0] = 0;
|
||||
if (file->head._dirname[0])
|
||||
sprintf(buf, "%s/", (char*)file->head._dirname);
|
||||
sprintf(&buf[strlen(buf)], "%s:", file->head.name);
|
||||
swprintf(buf, max_size + 1, L"%s/", (char*)file->head._dirname);
|
||||
fc_mbstous(&buf[wcslen(buf)], file->head.name, 0);
|
||||
wcscpy(&buf[wcslen(buf)], L":");
|
||||
swprintf(endbuf, max_size + 2, L"%-*ls ", max_size, buf);
|
||||
|
||||
printf("%-*s ", max_size, buf);
|
||||
printf("%ls", endbuf);
|
||||
put_description(handle->files[i]);
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue