diff --git a/README.rst b/README.rst index 10d42f1..e49bb02 100644 --- a/README.rst +++ b/README.rst @@ -156,12 +156,6 @@ Build DF-SHOW with make -Complie translations - -.. code-block:: bash - - make update-po - Install DF-SHOW .. code-block:: bash diff --git a/configure.ac b/configure.ac index e27cc32..f06d8bb 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([dfshow],[0.10.1],[https://github.com/roberthawdon/dfshow/issues]) +AC_INIT([dfshow],[0.10.2],[https://github.com/roberthawdon/dfshow/issues]) AM_INIT_AUTOMAKE([subdir-objects]) AC_PROG_CC AC_CONFIG_HEADERS([config.h:config.hin]) diff --git a/docs/source/conf.py b/docs/source/conf.py index 2b9d2e1..51726b5 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -20,13 +20,13 @@ # -- Project information ----------------------------------------------------- project = 'Directory File Show (DF-SHOW)' -copyright = '2023, Robert Ian Hawdon' +copyright = '2024, Robert Ian Hawdon' author = 'Robert Ian Hawdon' # The short X.Y version version = '0.10' # The full version, including alpha/beta/rc tags -release = '0.10.1-beta' +release = '0.10.2-beta' # -- General configuration --------------------------------------------------- diff --git a/docs/source/installation.rst b/docs/source/installation.rst index e2e3d3d..9abd28e 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -100,6 +100,9 @@ Ensure you have the following dependencies installed: * A C compiler (``gcc`` or ``clang``) * ``ncurses`` development packages * ``libconfig`` development packages +* ``libacl`` development packages +* ``selinux`` development packages (optional, for use with ``--with-selinux``) +* ``gettext`` for internationalization Download the project and prepare sources. diff --git a/docs/source/show.rst b/docs/source/show.rst index f4e7f7f..9ea256b 100644 --- a/docs/source/show.rst +++ b/docs/source/show.rst @@ -60,12 +60,12 @@ The following options are shared with ``ls``: Displays the file sizes in a human readable format. For example, 1024 Bytes will be represented as 1M. -``-i``, ``--inode`` - Prints the index number of each file - ``--si`` As above, but uses powers of 1000. (1000 = 1m) +``-i``, ``--inode`` + Prints the index number of each file + ``-n``, ``-numeric-uid-gid`` Show numeric values for user and group IDs. diff --git a/man/sf.1 b/man/sf.1 index ca97b61..bb6a6bf 100644 --- a/man/sf.1 +++ b/man/sf.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SF" "1" "Jun 01, 2023" "0.10" "Directory File Show (DF-SHOW)" +.TH "SF" "1" "Mar 10, 2024" "0.10" "Directory File Show (DF-SHOW)" .SH NAME sf \- An interactive file viewer written for Unix-like systems. .SH OVERVIEW @@ -191,6 +191,6 @@ Saves settings for future sessions. .SH AUTHOR Robert Ian Hawdon .SH COPYRIGHT -2023, Robert Ian Hawdon +2024, Robert Ian Hawdon .\" Generated by docutils manpage writer. . diff --git a/man/show.1 b/man/show.1 index 09309e4..7422643 100644 --- a/man/show.1 +++ b/man/show.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SHOW" "1" "Jun 01, 2023" "0.10" "Directory File Show (DF-SHOW)" +.TH "SHOW" "1" "Mar 10, 2024" "0.10" "Directory File Show (DF-SHOW)" .SH NAME show \- An interactive directory/file browser written for Unix-like systems. .SH OVERVIEW @@ -87,12 +87,12 @@ Omits the group of each object in the output. Displays the file sizes in a human readable format. For example, 1024 Bytes will be represented as 1M. .TP -.B \fB\-i\fP, \fB\-\-inode\fP -Prints the index number of each file -.TP .B \fB\-\-si\fP As above, but uses powers of 1000. (1000 = 1m) .TP +.B \fB\-i\fP, \fB\-\-inode\fP +Prints the index number of each file +.TP .B \fB\-n\fP, \fB\-numeric\-uid\-gid\fP Show numeric values for user and group IDs. .TP @@ -874,6 +874,6 @@ theme needs to be saved before this command can be used. .SH AUTHOR Robert Ian Hawdon .SH COPYRIGHT -2023, Robert Ian Hawdon +2024, Robert Ian Hawdon .\" Generated by docutils manpage writer. . diff --git a/src/colors.c b/src/colors.c index 5e75f59..0c92310 100644 --- a/src/colors.c +++ b/src/colors.c @@ -1,7 +1,7 @@ /* DF-SHOW: An interactive directory/file browser written for Unix-like systems. Based on the applications from the PC-DOS DF-EDIT suite by Larry Kroeker. - Copyright (C) 2018-2023 Robert Ian Hawdon + Copyright (C) 2018-2024 Robert Ian Hawdon This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -61,6 +61,8 @@ extern int * pc; extern char globalConfLocation[128]; extern char homeConfLocation[128]; +extern int viewMode; + menuDef *colorMenu; int colorMenuSize = 0; wchar_t *colorMenuLabel; @@ -771,6 +773,7 @@ void setCursorPos(int prev) void themeBuilder() { + viewMode = 2; clear(); if (bgToggle){ snprintf(fgbgLabel, 11, _("background")); diff --git a/src/common.c b/src/common.c index c48c03c..929fd02 100644 --- a/src/common.c +++ b/src/common.c @@ -1,7 +1,7 @@ /* DF-SHOW: An interactive directory/file browser written for Unix-like systems. Based on the applications from the PC-DOS DF-EDIT suite by Larry Kroeker. - Copyright (C) 2018-2023 Robert Ian Hawdon + Copyright (C) 2018-2024 Robert Ian Hawdon This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -68,15 +68,31 @@ int displaysize; char fileName[4096]; +int viewMode = 0; + +char *programName; + extern int * pc; extern int resized; +extern bool topMenu; +extern bool bottomMenu; +extern wchar_t *topMenuBuffer; +extern wchar_t *bottomMenuBuffer; + void refreshScreenShow(); void refreshScreenSf(); void refreshScreen(char *application) { + endwin(); + clear(); + cbreak(); + noecho(); + curs_set(FALSE); + keypad(stdscr, TRUE); + refresh(); #ifdef APPLICATION_SHOW if (!strcmp(application, "show")) { refreshScreenShow(); @@ -98,7 +114,9 @@ int getch10th (void) { do { if (resized) { resized = 0; - refreshScreen("show"); + refreshScreen(programName); + ch = -1; + break; } halfdelay (1); ch = getch(); @@ -329,7 +347,7 @@ char * objectFromPath(const char *myStr){ void printVersion(char* programName){ printf (("Directory File Show (DF-SHOW) - %s %s\n"), programName, VERSION); fputs (("\ -Copyright (C) 2023 Robert Ian Hawdon\n\ +Copyright (C) 2024 Robert Ian Hawdon\n\ License GPLv3+: GNU GPL version 3 or later .\n\ This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you\n\ are welcome to redistribute it under certain conditions.\n"), stdout); diff --git a/src/display.c b/src/display.c index 2db32cd..6a741e6 100644 --- a/src/display.c +++ b/src/display.c @@ -1,7 +1,7 @@ /* DF-SHOW: An interactive directory/file browser written for Unix-like systems. Based on the applications from the PC-DOS DF-EDIT suite by Larry Kroeker. - Copyright (C) 2018-2023 Robert Ian Hawdon + Copyright (C) 2018-2024 Robert Ian Hawdon This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/input.c b/src/input.c index 0caea87..a4b241c 100644 --- a/src/input.c +++ b/src/input.c @@ -1,7 +1,7 @@ /* DF-SHOW: An interactive directory/file browser written for Unix-like systems. Based on the applications from the PC-DOS DF-EDIT suite by Larry Kroeker. - Copyright (C) 2018-2023 Robert Ian Hawdon + Copyright (C) 2018-2024 Robert Ian Hawdon This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/menu.c b/src/menu.c index 2b9935f..6bc4941 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1,7 +1,7 @@ /* DF-SHOW: An interactive directory/file browser written for Unix-like systems. Based on the applications from the PC-DOS DF-EDIT suite by Larry Kroeker. - Copyright (C) 2018-2023 Robert Ian Hawdon + Copyright (C) 2018-2024 Robert Ian Hawdon This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,6 +29,11 @@ #include "menu.h" #include "banned.h" +bool topMenu = true; +bool bottomMenu = true; +wchar_t *topMenuBuffer; +wchar_t *bottomMenuBuffer; + int dynamicMenuLabel(wchar_t **label, const char *str) { int length = 0; @@ -220,6 +225,13 @@ int wPrintMenu(int line, int col, wchar_t *menustring) move(line, col); clrtoeol(); len = wcslen(menustring); + if ( line == 0 ){ + setDynamicWChar(&topMenuBuffer, L"%ls", menustring); + topMenu = true; + } else { + setDynamicWChar(&bottomMenuBuffer, L"%ls", menustring); + bottomMenu = true; + } setColors(COMMAND_PAIR); for (i = 0; i < len; i++) { diff --git a/src/settings.c b/src/settings.c index 691372f..d7a6160 100644 --- a/src/settings.c +++ b/src/settings.c @@ -1,7 +1,7 @@ /* DF-SHOW: An interactive directory/file browser written for Unix-like systems. Based on the applications from the PC-DOS DF-EDIT suite by Larry Kroeker. - Copyright (C) 2018-2023 Robert Ian Hawdon + Copyright (C) 2018-2024 Robert Ian Hawdon This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,6 +45,9 @@ extern int * pc; extern char globalConfLocation[4096]; extern char homeConfLocation[4096]; +extern int viewMode; + + void updateSetting(settingIndex **settings, int index, int type, int intSetting) { // To-Do, do a verification on the type @@ -392,6 +395,7 @@ int textValueLookup(t1CharValues **values, int *items, char *refLabel, char *val void settingsMenuView(wchar_t *settingsMenuLabel, int settingsMenuSize, menuDef *settingsMenu, settingIndex **settings, t1CharValues **charValues, t2BinValues **binValues, int totalCharItems, int totalBinItems, int totalItems, char *application) { + viewMode = 3; int count = 0; int x = 2; int y = 3; @@ -403,11 +407,6 @@ void settingsMenuView(wchar_t *settingsMenuLabel, int settingsMenuSize, menuDef clear(); wPrintMenu(0,0,settingsMenuLabel); - // TODO call the settings loader - settingsAction("read", application, NULL, NULL, NULL, NULL, 0, 0, 0, globalConfLocation); - settingsAction("read", application, NULL, NULL, NULL, NULL, 0, 0, 0, homeConfLocation); - settingsAction("generate", application, NULL, NULL, NULL, NULL, 0, 0, 0, NULL); - while(1) { for (count = 0; count < totalItems; count++){ diff --git a/src/sf.c b/src/sf.c index f7a24cb..d2a9f50 100644 --- a/src/sf.c +++ b/src/sf.c @@ -1,7 +1,7 @@ /* DF-SHOW: An interactive directory/file browser written for Unix-like systems. Based on the applications from the PC-DOS DF-EDIT suite by Larry Kroeker. - Copyright (C) 2018-2023 Robert Ian Hawdon + Copyright (C) 2018-2024 Robert Ian Hawdon This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,6 +47,9 @@ extern char regexinput[1024]; int colormode = 0; int messageBreak = 0; + +extern char *programName; + extern int displaysize; extern int topline; extern int leftcol; @@ -131,7 +134,9 @@ int main(int argc, char *argv[]) int c; initI18n(); - + + setDynamicChar(&programName, "%s", PROGRAM_NAME); + setConfLocations(); // Read the config @@ -245,3 +250,4 @@ int main(int argc, char *argv[]) exittoshell(); return 0; } + diff --git a/src/sffunctions.c b/src/sffunctions.c index 434d2ac..cdf5603 100644 --- a/src/sffunctions.c +++ b/src/sffunctions.c @@ -1,7 +1,7 @@ /* DF-SHOW: An interactive directory/file browser written for Unix-like systems. Based on the applications from the PC-DOS DF-EDIT suite by Larry Kroeker. - Copyright (C) 2018-2023 Robert Ian Hawdon + Copyright (C) 2018-2024 Robert Ian Hawdon This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,7 +47,6 @@ int leftcol = 1; int totallines = 0; int longestline = 0; int longestlongline = 0; -int viewmode = 0; int tabsize = 8; @@ -100,6 +99,13 @@ extern menuDef *settingsMenu; extern int settingsMenuSize; extern wchar_t *settingsMenuLabel; +extern bool topMenu; +extern bool bottomMenu; +extern wchar_t *topMenuBuffer; +extern wchar_t *bottomMenuBuffer; + +extern int viewMode; + void readSfConfig(const char * confFile) { config_t cfg; @@ -195,18 +201,33 @@ int generateSfSettingsVars() void refreshScreenSf() { - endwin(); - clear(); - refresh(); - displaysize = LINES - 2; + // endwin(); + // clear(); + // refresh(); + // displaysize = LINES - 2; unloadSfMenuLabels(); refreshSfMenuLabels(); - if (viewmode == 0){ - mvprintw(0,0,_("Show File - Enter pathname:")); - } else if (viewmode > 0){ - wPrintMenu(0, 0, sfFileMenuLabel); - loadFile(fileName); - } + // if (viewMode == 0){ + // mvprintw(0,0,_("Show File - Enter pathname:")); + // } else if (viewMode > 0){ + // wPrintMenu(0, 0, sfFileMenuLabel); + // loadFile(fileName); + // } + switch(viewMode) + { + case 3: // Settings View + wPrintMenu(0, 0, topMenuBuffer); + break; + case 4: // SF View + updateView(); + wPrintMenu(0, 0, topMenuBuffer); + wPrintMenu(LINES-1, 0, bottomMenuBuffer); + break; + default: // Fallback + wPrintMenu(0, 0, topMenuBuffer); + wPrintMenu(LINES-1, 0, bottomMenuBuffer); + break; + } } int calculateTab(int pos) @@ -334,7 +355,7 @@ void loadFile(const char * currentfile) len = 0; longestline = 0; longestlongline = 0; - viewmode = 1; + viewMode = 4; totallines = 0; filePos = malloc(sizeof(long int) + 1); // Initial size of lookup diff --git a/src/sfmenus.c b/src/sfmenus.c index 4759996..a14d889 100644 --- a/src/sfmenus.c +++ b/src/sfmenus.c @@ -1,7 +1,7 @@ /* DF-SHOW: An interactive directory/file browser written for Unix-like systems. Based on the applications from the PC-DOS DF-EDIT suite by Larry Kroeker. - Copyright (C) 2018-2023 Robert Ian Hawdon + Copyright (C) 2018-2024 Robert Ian Hawdon This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -70,7 +70,7 @@ extern char fileName[4096]; extern int displaysize; extern int totallines; extern int longestlongline; -extern int viewmode; +extern int viewMode; extern int wrap; extern int wrapmode; @@ -193,7 +193,7 @@ void show_file_position_input(int currentpos) int curPos = 0; // Fun fact, in DF-EDIT 2.3d, the following text input typoed "absolute" as "absolue", this typo also exists in the Windows version from 1997 (2.3d-76), however, the 1986 documentation correctly writes it as "absolute". setDynamicChar(&filePosText, _("Position relative (<+num> || <-num>) or absolute ():")); - viewmode = 2; + viewMode = 4; move(0,0); clrtoeol(); curPos = (printMenu(0,0,filePosText) + 1); @@ -225,6 +225,7 @@ void show_file_position_input(int currentpos) void show_file_inputs() { int e = 0; + viewMode = 4; wPrintMenu(0, 0, sfFileMenuLabel); while(1) { @@ -258,8 +259,9 @@ void show_file_inputs() settingsMenuView(sfSettingsMenuLabel, sfSettingsMenuSize, sfSettingsMenu, &settingIndexSf, &charValuesSf, &binValuesSf, totalCharItemsSf, totalBinItemsSf, generateSfSettingsVars(), "sf"); wPrintMenu(0, 0, sfFileMenuLabel); if(wrap){ - leftcol = 1; } + leftcol = 1; + viewMode = 4; refreshScreenSf(); // updateView(); } else if (*pc == menuHotkeyLookup(sfFileMenu, "f_quit", sfFileMenuSize)){ diff --git a/src/show.c b/src/show.c index e441ad5..0a4ec99 100644 --- a/src/show.c +++ b/src/show.c @@ -1,7 +1,7 @@ /* DF-SHOW: An interactive directory/file browser written for Unix-like systems. Based on the applications from the PC-DOS DF-EDIT suite by Larry Kroeker. - Copyright (C) 2018-2023 Robert Ian Hawdon + Copyright (C) 2018-2024 Robert Ian Hawdon This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,8 +30,10 @@ #include #include #include +#include "customtypes.h" #include "config.h" #include "showfunctions.h" +#include "sffunctions.h" #include "showmenus.h" #include "sfmenus.h" #include "colors.h" @@ -49,7 +51,6 @@ char * pagerPath; char currentpwd[4096]; -int viewMode = 0; int resized = 0; char sortmode[9] = "name"; @@ -118,6 +119,10 @@ t2BinValues *binValuesShow; int totalCharItemsShow; int totalBinItemsShow; +extern char *programName; + +extern int viewMode; + extern int skippable; extern int settingsPos; @@ -157,6 +162,13 @@ extern wchar_t *linkMenuLabel; extern xattrList *xa; extern int xattrPos; +extern bool topMenu; +extern bool bottomMenu; +extern wchar_t *topMenuBuffer; +extern wchar_t *bottomMenuBuffer; + +extern char fileName[4096]; + int setMarked(char* markedinput); int checkStyle(char* styleinput); @@ -810,44 +822,32 @@ int setBlockSize(const char * arg){ void refreshScreenShow() { - endwin(); - clear(); - cbreak(); - noecho(); - curs_set(FALSE); - keypad(stdscr, TRUE); - refresh(); unloadShowMenuLabels(); refreshShowMenuLabels(); switch(viewMode) { - case 0: + case 0: // Directory View resizeDisplayDir(ob); - wPrintMenu(0, 0, showFileMenuLabel); - wPrintMenu(LINES-1, 0, functionMenuLabel); + wPrintMenu(0, 0, topMenuBuffer); + wPrintMenu(LINES-1, 0, bottomMenuBuffer); break; - case 1: - resizeDisplayDir(ob); - wPrintMenu(0,0,globalMenuLabel); - wPrintMenu(LINES-1, 0, functionMenuLabel); + case 1: // Global Menu View + wPrintMenu(0, 0, topMenuBuffer); break; - case 2: - resizeDisplayDir(ob); - wPrintMenu(0, 0, modifyMenuLabel); - wPrintMenu(LINES-1, 0, functionMenuLabel); + case 2: // Colors View + themeBuilder(); break; - case 3: - resizeDisplayDir(ob); - wPrintMenu(0, 0, sortMenuLabel); - wPrintMenu(LINES-1, 0, functionMenuLabel); + case 3: // Settings View + wPrintMenu(0, 0, topMenuBuffer); break; - case 4: - wPrintMenu(0,0,globalMenuLabel); + case 4: // SF View + updateView(); + wPrintMenu(0, 0, topMenuBuffer); + wPrintMenu(LINES-1, 0, bottomMenuBuffer); break; - case 5: - resizeDisplayDir(ob); - wPrintMenu(0, 0, linkMenuLabel); - wPrintMenu(LINES-1, 0, functionMenuLabel); + default: // Fallback + wPrintMenu(0, 0, topMenuBuffer); + wPrintMenu(LINES-1, 0, bottomMenuBuffer); break; } } @@ -942,6 +942,8 @@ int main(int argc, char *argv[]) initI18n(); + setDynamicChar(&programName, "%s", PROGRAM_NAME); + #ifdef HAVE_ACL_TYPE_EXTENDED snprintf(options, 22, "%s", "@aABdfgGhilnrsStUZ1"); #else diff --git a/src/showfunctions.c b/src/showfunctions.c index f4a4dc7..551f151 100644 --- a/src/showfunctions.c +++ b/src/showfunctions.c @@ -1,7 +1,7 @@ /* DF-SHOW: An interactive directory/file browser written for Unix-like systems. Based on the applications from the PC-DOS DF-EDIT suite by Larry Kroeker. - Copyright (C) 2018-2023 Robert Ian Hawdon + Copyright (C) 2018-2024 Robert Ian Hawdon This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1608,6 +1608,7 @@ int SendToPager(char* object) snprintf(fileName, 4096, "%s", object); parentShow = true; file_view(fileName); + viewMode = 0; return(0); } diff --git a/src/showmenus.c b/src/showmenus.c index a85378c..7061a29 100644 --- a/src/showmenus.c +++ b/src/showmenus.c @@ -1,7 +1,7 @@ /* DF-SHOW: An interactive directory/file browser written for Unix-like systems. Based on the applications from the PC-DOS DF-EDIT suite by Larry Kroeker. - Copyright (C) 2018-2023 Robert Ian Hawdon + Copyright (C) 2018-2024 Robert Ian Hawdon This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1117,7 +1117,7 @@ void delete_multi_file_confirm_input(results* ob) void sort_view_inputs() { - viewMode = 3; + viewMode = 0; while(1) { wPrintMenu(0,0,sortMenuLabel); @@ -1438,7 +1438,7 @@ void linktext_input(char *file, int symbolic) void link_key_menu_inputs() { - viewMode = 5; + viewMode = 0; wPrintMenu(0,0,linkMenuLabel); memcpy(selfile, currentpwd, 4096); if (!check_last_char(selfile, "/")){ @@ -1570,7 +1570,7 @@ void modify_context_menu_inputs() void modify_key_menu_inputs() { - viewMode = 2; + viewMode = 0; wPrintMenu(0,0,modifyMenuLabel); while(1) { @@ -2044,9 +2044,9 @@ void global_menu_inputs() { wPrintMenu(0,0,globalMenuLabel); if (historyref == 0){ - viewMode = 4; - } else { viewMode = 1; + } else { + viewMode = 0; } while(1) {