Results 1 to 7 of 7

Thread: 7.4.2 - Have you ever wanted a BS-free time format in mc?

Threaded View

  1. #1
    Member registered user
    Join Date
    Oct 2004
    Posts
    32

    7.4.2 - Have you ever wanted a BS-free time format in mc?

    Ever since 2008 when I started using Knoppix 5.3.1 (heavily remastered) I was stunned by the really obfuscating style of displaying access/modify/change time for files in mc.

    Simply looking at the whole column of time in a panel in mc is bound to get someone in a mental institution.

    I never understood the process of thinking on this aspect of the programmers who wrote this piece of software, otherwise very very useful.

    When it comes to representation of time, the only format that makes sense to me is "YYYY-mm-dd HH:MM".

    (Right, the year needs all 4 digits, anyone trying to tell me otherwise is missing some critical lamps. And the format having "day/month/year" is really retarded, especially when the year has only 2 digits and it's impossible to tell which is the month and which is the day and which is the year!! That is really really stupid, I'm sorry but there's just no other way of saying it.)

    Why "YYYY-mm-dd HH:MM"? Simply because it sorts itself out naturally timewise by means of regular alphabetical sorting if used in any indexing system.

    For instance I scan all my receipts from stores and save them in my data storage. And guess what the format of the file name is? "YYYY-mm-dd HH.MM Store_Name.tif"

    Simply displaying them in konqueror or any file manager they get sorted temporally by themselves.

    Quite a while ago I dug up the sources for mc-4.6.1 and started looking for a way to change the display format.
    I came up with a patch (see attachments to this message) which successfully gave me the time format displayed the way I wanted in mc.

    So now, since I started using Knoppix 7.4.2 it crossed my mind this would be the next nice trick to do in it.

    So here's what I did:
    (NOTE: everything described below is being done as root under the original Knoppix 7.4.2 DVD Live environment)

    Open a konsole window as root in an empty directory (for instance /home/knoppix/Downloads).
    Do the following:

    Code:
    sed -i -e "s/\.de\./.us./g" /etc/apt/sources.list
    rm -fv /var/cache/apt/*.bin
    rm -fv /var/lib/apt/lists/*debian*
    apt-get update
    Just for the record, I executed the code above on 2015 Jan 02. (It matters since at some point in the future the list of available package versions will change and the above code will have different consequences).

    Then I downloaded two packages from snapshot.debian.org:

    Code:
    wget http://snapshot.debian.org/archive/debian/20140317T222027Z/pool/main/libg/libgcrypt20/libgcrypt20-dev_1.6.1-2_i386.deb
    wget http://snapshot.debian.org/archive/debian/20140903T220917Z/pool/main/libs/libssh2/libssh2-1-dev_1.4.3-4_i386.deb
    Then I downloaded the sources for the version of mc in Knoppix 7.4.2:

    Code:
    wget http://snapshot.debian.org/archive/debian/20140402T100841Z/pool/main/m/mc/mc_4.8.12-1.debian.tar.xz
    wget http://snapshot.debian.org/archive/debian/20140402T100841Z/pool/main/m/mc/mc_4.8.12-1.dsc
    wget http://snapshot.debian.org/archive/debian/20140402T100841Z/pool/main/m/mc/mc_4.8.12.orig.tar.xz
    Then I made up a patch for the sources, that changes the time display format in mc's panels to what I described above.
    You can download it from the attachments to this message (mc-4.8.12-BS-free_time_format.patch.gz).

    Also you will need a script I prepared (update.sh) which looks like this:

    Code:
    #!/bin/sh
    
    #### RUN THIS AS ROOT !!!!! #####
    
    # src/setup.c lines 216 & 217 changed from:
    #define FMTYEAR _("%b %e  %Y")
    #define FMTTIME _("%b %e %H:%M")
    #                      to:
    #define FMTYEAR _("%Y-%m-%d %H:%M")
    #define FMTTIME _("%Y-%m-%d %H:%M")
    # (but it turns out it works without this, so it's not necessary)
    
    # lib/timefmt.c line 81 changed from:
    #    return i18n_timelength_cache
    #                to:
    #    return 16;
    
    # lib/timefmt.c line 114 changed from:
    #    return i18n_timelength_cache
    #                 to:
    #    return 16;
    
    # lib/timefmt.c line 139 changed from:
    #    FMT_LOCALTIME (timebuf, sizeof (timebuf), fmt, when);
    #                 to:
    #    FMT_LOCALTIME (timebuf, sizeof (timebuf), _("%Y-%m-%d %H:%M"), when);
    
    
    # Install dependencies required by the (re)building process.
    # At the time of running this script I had run "apt-get update" on 2015-Jan-02
    # after previously deleting /var/cache/apt/*.bin and /var/lib/apt/lists/*debian*
    echo -e "\n\n-------- removing libgnutls-dev ---------\n"
    apt-get -y remove libgnutls-dev
    echo -e "\n\n-------- removing libgcrypt11-dev ---------\n"
    apt-get -y remove libgcrypt11-dev
    echo -e "\n\n-------- installing libgcrypt20-dev ---------\n"
    dpkg -i libgcrypt20-dev_1.6.1-2_i386.deb
    echo -e "\n\n-------- installing libssh2-1-dev ---------\n"
    dpkg -i libssh2-1-dev_1.4.3-4_i386.deb
    echo -e "\n\n-------- installing a whole bunch ---------\n"
    apt-get -y install dh-autoreconf autopoint intltool bison check e2fslibs-dev libaspell-dev libgpm-dev libslang2-dev
    
    echo -e "\n\n-------- extracting mc-4.8.12 sources ---------\n"
    dpkg-source -x mc_4.8.12-1.dsc
    cd mc-4.8.12
    # now change src/setup.c and lib/timefmt.c as described above
    echo -e "\n\n-------- applying patch ---------\n"
    patch -p1 <../mc-4.8.12-BS-free_time_format.patch
    echo -e "\n\n-------- committing changes ---------\n"
    dpkg-source --commit
    echo -e "\n\n-------- rebuilding mc-4.8.12 debian packages ---------\n"
    dpkg-buildpackage -us -uc
    
    echo -e "\n\n-------- (re)installing mc-4.8.12 debian packages ---------\n"
    cd ..
    dpkg -i *.deb
    
    exit 0
    Copy/Paste the code above in kwrite and save it as "update.sh" in the same dir as the rest of the files.
    So at this point, your directory should look like this:

    Code:
    knoppix@Microknoppix:~/Downloads$ ls -1
    libgcrypt20-dev_1.6.1-2_i386.deb
    libssh2-1-dev_1.4.3-4_i386.deb
    mc_4.8.12-1.debian.tar.xz
    mc_4.8.12-1.dsc
    mc-4.8.12-BS-free_time_format.patch
    mc_4.8.12.orig.tar.xz
    update.sh
    Now simply type:

    Code:
    . update.sh
    or make the "update.sh" file executable and run it.

    It should run flawlessly until the end and when it's done, your directory should look like this:

    Code:
    knoppix@Microknoppix:~/Downloads$ ls -1
    libgcrypt20-dev_1.6.1-2_i386.deb
    libssh2-1-dev_1.4.3-4_i386.deb
    mc-4.8.12
    mc_4.8.12-1.debian.tar.xz
    mc_4.8.12-1.dsc
    mc_4.8.12-1_i386.changes
    mc_4.8.12-1_i386.deb
    mc-4.8.12-BS-free_time_format.patch
    mc_4.8.12.orig.tar.xz
    mc-data_4.8.12-1_all.deb
    mc-dbg_4.8.12-1_i386.deb
    update.sh
    Of course you can save the *.deb files somewhere and include them later in a Knoppix 7.4.2 remaster permanently.

    Now you can just type mc and you should see something like the snapshot attached to this message.

    Of course, first you need to go in mc's menu at "Left" or "Right" or both and change the "Listing mode" for panels to "User defined" (include "mtime" or "atime" or "ctime" somewhere in there) otherwise the time column won't be displayed.

    For instance this is what I had for "User defined" "Listing mode" when I took the snapshot:

    Code:
    half type name | size | mtime | perm | owner | group
    Attached Images Attached Images
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


🍎🖥️ Vintage Apple III Computer - Works Great Monitor, Hard Drive, Software 🍎 picture

🍎🖥️ Vintage Apple III Computer - Works Great Monitor, Hard Drive, Software 🍎

$2000.00



Vintage 1990 Apple Keyboard II M0487 picture

Vintage 1990 Apple Keyboard II M0487

$49.99



Vintage Apple Ethernet Twisted-Pair Transceiver Model M0437 picture

Vintage Apple Ethernet Twisted-Pair Transceiver Model M0437

$19.99



Vintage Apple Macintosh IIsi M0360 Computer For Parts or Repair w/Power Cord picture

Vintage Apple Macintosh IIsi M0360 Computer For Parts or Repair w/Power Cord

$69.99



Vintage Apple Macintosh SE Case - Empty Shell - Housing retro project picture

Vintage Apple Macintosh SE Case - Empty Shell - Housing retro project

$60.00



VINTAGE APPLE IMAC USB KEYBOARD - M2452  - 1999 - tested working picture

VINTAGE APPLE IMAC USB KEYBOARD - M2452 - 1999 - tested working

$39.99



Vintage Apple Macintosh Extended Keyboard II AEK M3501 + ADB Mouse M2706 TESTED picture

Vintage Apple Macintosh Extended Keyboard II AEK M3501 + ADB Mouse M2706 TESTED

$99.00



VINTAGE APPLE 1980’s COMPUTER LAPEL PIN BADGE picture

VINTAGE APPLE 1980’s COMPUTER LAPEL PIN BADGE

$14.99



MacEffects Gray ALPS Mechanical Keyboard for Vintage Apple IIe Computers picture

MacEffects Gray ALPS Mechanical Keyboard for Vintage Apple IIe Computers

$195.00



VINTAGE Apple Macintosh LC (FOR PARTS - DOES NOT BOOT) NO HDD #27 picture

VINTAGE Apple Macintosh LC (FOR PARTS - DOES NOT BOOT) NO HDD #27

$49.99