LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Most library minimal Norton Command like applications? (https://www.linuxquestions.org/questions/programming-9/most-library-minimal-norton-command-like-applications-4175605332/)

Xeratul 05-05-2017 02:25 PM

Most library minimal Norton Command like applications?
 
Hello,

I am looking for a very portable, tiny, Norton Command like applications (opensource). I am just beginning C coding.

Of course, it is nice to have a file browser under the terminal/console.

Sometimes, there isn't ncurses devel, nor libtinfo.so.5, on the BSD/Linux/Solaris/... system. It may be useful, comfortable, to have an alternative the Midnight Commander, based on C, which could be easily compiled. Don't you think?

Laserbeak 05-05-2017 06:36 PM

/sbin/fsck?

Xeratul 05-05-2017 11:41 PM

Quote:

Originally Posted by Laserbeak (Post 5706814)
/sbin/fsck?

thank you.

work in progress. I will bring it on the tiniest, library really freeeee, as ever ... so that it can work even on a 1950's toaster ;) !!

tiny-mnc
development of mnc, tiny nc, most library minimal Norton Command like applications
https://github.com/spartrekus/tiny-mnc

rkelsen 05-06-2017 12:56 AM

I, for one, am REALLY looking forward to this.

For years (decades... :( ) mc has been my go-to tool for CLI file management... And I'm utterly disappointed that it is not stand-alone and that it is quite bulky for an application of it's type, and has too many dependencies.

This looks very promising, Xeratul. Colour me impressed.

Please keep up the good work!

P.S. It didn't compile for me under Slackware 14.2:
Code:

rob@slacktop:~/Downloads/mnc$ gcc -o mnc mnc.c
mnc.c: In function 'compare_fun':
mnc.c:7:9: warning: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
  cmp = strcmp( l, r );
        ^
mnc.c: In function 'main':
mnc.c:18:15: error: 'PATH_MAX' undeclared (first use in this function)
    char line[PATH_MAX];
              ^
mnc.c:18:15: note: each undeclared identifier is reported only once for each function it appears in
mnc.c:24:5: warning: implicit declaration of function 'strncpy' [-Wimplicit-function-declaration]
    strncpy( currentselection, "", PATH_MAX );
    ^
mnc.c:24:5: warning: incompatible implicit declaration of built-in function 'strncpy'
mnc.c:24:5: note: include '<string.h>' or provide a declaration of 'strncpy'
mnc.c:28:5: error: unknown type name 'DIR'
    DIR *dirp;
    ^
mnc.c: In function 'loaddir':
mnc.c:35:12: warning: implicit declaration of function 'opendir' [-Wimplicit-function-declaration]
    dirp = opendir( "." );
            ^
mnc.c:35:10: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
    dirp = opendir( "." );
          ^
mnc.c:36:19: warning: implicit declaration of function 'readdir' [-Wimplicit-function-declaration]
    while  ((dp = readdir( dirp )) != NULL  && 
                  ^
mnc.c:36:17: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
    while  ((dp = readdir( dirp )) != NULL  && 
                ^
mnc.c:38:28: error: dereferencing pointer to incomplete type 'struct dirent'
            if ( strcmp( dp->d_name , "." ) != 0 )
                            ^
mnc.c:46:5: warning: implicit declaration of function 'closedir' [-Wimplicit-function-declaration]
    closedir( dirp );
    ^
mnc.c:49:7: warning: implicit declaration of function 'qsort' [-Wimplicit-function-declaration]
      qsort( idata, n , sizeof idata[0], compare_fun );
      ^
mnc.c: In function 'drawit':
mnc.c:75:16: warning: implicit declaration of function 'fexist' [-Wimplicit-function-declaration]
          if ( fexist( idata[ n ] ) == 2 )
                ^
mnc.c: In function 'mncview':
mnc.c:107:51: warning: implicit declaration of function 'strrlf' [-Wimplicit-function-declaration]
      mvprintw( posy - mncview_scrolly , 0, "%s", strrlf( line ));
                                                  ^
mnc.c: In function 'main':
mnc.c:212:21: warning: implicit declaration of function 'chdir' [-Wimplicit-function-declaration]
                    chdir( getenv( "HOME" ) );
                    ^
mnc.c:212:28: warning: implicit declaration of function 'getenv' [-Wimplicit-function-declaration]
                    chdir( getenv( "HOME" ) );
                            ^
rob@slacktop:~/Downloads/mnc$


Xeratul 05-27-2017 02:24 PM

Quote:

Originally Posted by rkelsen (Post 5706885)
I, for one, am REALLY looking forward to this.

For years (decades... :( ) mc has been my go-to tool for CLI file management... And I'm utterly disappointed that it is not stand-alone and that it is quite bulky for an application of it's type, and has too many dependencies.

This looks very promising, Xeratul. Colour me impressed.

Please keep up the good work!

P.S. It didn't compile for me under Slackware 14.2:
Code:

rob@slacktop:~/Downloads/mnc$ gcc -o mnc mnc.c
mnc.c: In function 'compare_fun':
mnc.c:7:9: warning: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
  cmp = strcmp( l, r );
        ^
mnc.c: In function 'main':
mnc.c:18:15: error: 'PATH_MAX' undeclared (first use in this function)
    char line[PATH_MAX];
              ^
mnc.c:18:15: note: each undeclared identifier is reported only once for each function it appears in
mnc.c:24:5: warning: implicit declaration of function 'strncpy' [-Wimplicit-function-declaration]
    strncpy( currentselection, "", PATH_MAX );
    ^
mnc.c:24:5: warning: incompatible implicit declaration of built-in function 'strncpy'
mnc.c:24:5: note: include '<string.h>' or provide a declaration of 'strncpy'
mnc.c:28:5: error: unknown type name 'DIR'
    DIR *dirp;
    ^
mnc.c: In function 'loaddir':
mnc.c:35:12: warning: implicit declaration of function 'opendir' [-Wimplicit-function-declaration]
    dirp = opendir( "." );
            ^
mnc.c:35:10: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
    dirp = opendir( "." );
          ^
mnc.c:36:19: warning: implicit declaration of function 'readdir' [-Wimplicit-function-declaration]
    while  ((dp = readdir( dirp )) != NULL  && 
                  ^
mnc.c:36:17: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
    while  ((dp = readdir( dirp )) != NULL  && 
                ^
mnc.c:38:28: error: dereferencing pointer to incomplete type 'struct dirent'
            if ( strcmp( dp->d_name , "." ) != 0 )
                            ^
mnc.c:46:5: warning: implicit declaration of function 'closedir' [-Wimplicit-function-declaration]
    closedir( dirp );
    ^
mnc.c:49:7: warning: implicit declaration of function 'qsort' [-Wimplicit-function-declaration]
      qsort( idata, n , sizeof idata[0], compare_fun );
      ^
mnc.c: In function 'drawit':
mnc.c:75:16: warning: implicit declaration of function 'fexist' [-Wimplicit-function-declaration]
          if ( fexist( idata[ n ] ) == 2 )
                ^
mnc.c: In function 'mncview':
mnc.c:107:51: warning: implicit declaration of function 'strrlf' [-Wimplicit-function-declaration]
      mvprintw( posy - mncview_scrolly , 0, "%s", strrlf( line ));
                                                  ^
mnc.c: In function 'main':
mnc.c:212:21: warning: implicit declaration of function 'chdir' [-Wimplicit-function-declaration]
                    chdir( getenv( "HOME" ) );
                    ^
mnc.c:212:28: warning: implicit declaration of function 'getenv' [-Wimplicit-function-declaration]
                    chdir( getenv( "HOME" ) );
                            ^
rob@slacktop:~/Downloads/mnc$



I think that some libraries could be added before.
Code:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <dirent.h> //
// for fexist
#include <ctype.h>
#include <sys/stat.h>
#include <dirent.h>
#include <sys/types.h>
#include <unistd.h>
// time
#include <time.h>
#include <ncurses.h>

and fexist.
https://stackoverflow.com/questions/...le-exists-in-c
https://stackoverflow.com/questions/...andard-c-c11-c

rkelsen 05-27-2017 10:42 PM

Quote:

Originally Posted by Xeratul (Post 5715966)
I think that some libraries could be added before.
Code:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <dirent.h> //
// for fexist
#include <ctype.h>
#include <sys/stat.h>
#include <dirent.h>
#include <sys/types.h>
#include <unistd.h>
// time
#include <time.h>
#include <ncurses.h>

and fexist.
https://stackoverflow.com/questions/...le-exists-in-c
https://stackoverflow.com/questions/...andard-c-c11-c

That helped, but something else is missing as well:

Code:

rob@slacktop:~/Downloads/mnc/tiny-mnc-master$ gcc -o mnc mnc.c
mnc.c: In function 'mncview':
mnc.c:134:51: warning: implicit declaration of function 'strrlf' [-Wimplicit-function-declaration]
      mvprintw( posy - mncview_scrolly , 0, "%s", strrlf( line ));
                                                  ^
/tmp/cc8Ufqt6.o: In function `main':
mnc.c:(.text+0x1ef): undefined reference to `initscr'
mnc.c:(.text+0x1f9): undefined reference to `curs_set'
mnc.c:(.text+0x200): undefined reference to `stdscr'
mnc.c:(.text+0x20c): undefined reference to `stdscr'
mnc.c:(.text+0x228): undefined reference to `stdscr'
mnc.c:(.text+0x234): undefined reference to `stdscr'
mnc.c:(.text+0x2ae): undefined reference to `stdscr'
mnc.c:(.text+0x2c0): undefined reference to `wattr_on'
mnc.c:(.text+0x2e5): undefined reference to `stdscr'
mnc.c:(.text+0x2ef): undefined reference to `wmove'
mnc.c:(.text+0x2fb): undefined reference to `stdscr'
mnc.c:(.text+0x308): undefined reference to `waddch'
mnc.c:(.text+0x348): undefined reference to `stdscr'
mnc.c:(.text+0x355): undefined reference to `wmove'
mnc.c:(.text+0x361): undefined reference to `stdscr'
mnc.c:(.text+0x36e): undefined reference to `waddch'
mnc.c:(.text+0x3b1): undefined reference to `mvprintw'
mnc.c:(.text+0x3d0): undefined reference to `mvprintw'
mnc.c:(.text+0x3d7): undefined reference to `stdscr'
mnc.c:(.text+0x3e9): undefined reference to `wattr_off'
mnc.c:(.text+0x3f0): undefined reference to `stdscr'
mnc.c:(.text+0x3f8): undefined reference to `wrefresh'
mnc.c:(.text+0x3ff): undefined reference to `stdscr'
mnc.c:(.text+0x407): undefined reference to `wgetch'
mnc.c:(.text+0x4ca): undefined reference to `mvprintw'
mnc.c:(.text+0x4d1): undefined reference to `stdscr'
mnc.c:(.text+0x4d9): undefined reference to `wrefresh'
mnc.c:(.text+0x4e0): undefined reference to `stdscr'
mnc.c:(.text+0x4e8): undefined reference to `wgetch'
mnc.c:(.text+0x53b): undefined reference to `mvprintw'
mnc.c:(.text+0x542): undefined reference to `stdscr'
mnc.c:(.text+0x54a): undefined reference to `wrefresh'
mnc.c:(.text+0x551): undefined reference to `stdscr'
mnc.c:(.text+0x559): undefined reference to `wgetch'
mnc.c:(.text+0x659): undefined reference to `stdscr'
mnc.c:(.text+0x665): undefined reference to `stdscr'
mnc.c:(.text+0x681): undefined reference to `stdscr'
mnc.c:(.text+0x68d): undefined reference to `stdscr'
mnc.c:(.text+0x71a): undefined reference to `curs_set'
mnc.c:(.text+0x71f): undefined reference to `endwin'
/tmp/cc8Ufqt6.o: In function `drawit.5076':
mnc.c:(.text+0x73d): undefined reference to `stdscr'
mnc.c:(.text+0x74f): undefined reference to `wattr_off'
mnc.c:(.text+0x756): undefined reference to `stdscr'
mnc.c:(.text+0x75e): undefined reference to `werase'
mnc.c:(.text+0x7b6): undefined reference to `mvprintw'
mnc.c:(.text+0x7c9): undefined reference to `stdscr'
mnc.c:(.text+0x7db): undefined reference to `wattr_on'
mnc.c:(.text+0x872): undefined reference to `mvprintw'
mnc.c:(.text+0x8a9): undefined reference to `mvprintw'
mnc.c:(.text+0x8b4): undefined reference to `stdscr'
mnc.c:(.text+0x8c6): undefined reference to `wattr_off'
/tmp/cc8Ufqt6.o: In function `mncview.5083':
mnc.c:(.text+0x92e): undefined reference to `stdscr'
mnc.c:(.text+0x940): undefined reference to `wattr_off'
mnc.c:(.text+0x947): undefined reference to `stdscr'
mnc.c:(.text+0x94f): undefined reference to `werase'
mnc.c:(.text+0x9a3): undefined reference to `strrlf'
mnc.c:(.text+0x9c3): undefined reference to `mvprintw'
mnc.c:(.text+0x9f5): undefined reference to `stdscr'
mnc.c:(.text+0xa07): undefined reference to `wattr_on'
mnc.c:(.text+0xa23): undefined reference to `stdscr'
mnc.c:(.text+0xa2d): undefined reference to `wmove'
mnc.c:(.text+0xa39): undefined reference to `stdscr'
mnc.c:(.text+0xa46): undefined reference to `waddch'
mnc.c:(.text+0xa84): undefined reference to `mvprintw'
mnc.c:(.text+0xa8b): undefined reference to `stdscr'
mnc.c:(.text+0xa93): undefined reference to `wgetch'
mnc.c:(.text+0xae7): undefined reference to `stdscr'
mnc.c:(.text+0xaf9): undefined reference to `wattr_off'
collect2: error: ld returned 1 exit status
rob@slacktop:~/Downloads/mnc/tiny-mnc-master$


Xeratul 05-28-2017 12:54 AM

while compiling, you may add ncurses :

Code:

gcc name-of-source-file.c -o output-programme -lm -lncurses
with before:
Code:

apt-get install ncurses5-dev
here "-dev" means devel for compiling.

rkelsen 05-28-2017 04:17 AM

Getting closer:

Code:

rob@slacktop:~/Downloads/mnc/tiny-mnc-master$ gcc mnc.c -o mnc -lm -lncurses
mnc.c: In function 'mncview':
mnc.c:134:51: warning: implicit declaration of function 'strrlf' [-Wimplicit-function-declaration]
      mvprintw( posy - mncview_scrolly , 0, "%s", strrlf( line ));
                                                  ^
/tmp/cctrjoDg.o: In function `mncview.5083':
mnc.c:(.text+0x9a3): undefined reference to `strrlf'
collect2: error: ld returned 1 exit status
rob@slacktop:~/Downloads/mnc/tiny-mnc-master$

Quote:

Originally Posted by Xeratul
with before:
Code:

apt-get install ncurses5-dev
here "-dev" means devel for compiling.

I'm doing this on Slackware, which includes the dynamic libraries in every package.

Does mnc need the static library?

Xeratul 05-28-2017 07:52 AM

Quote:

Originally Posted by rkelsen (Post 5716128)
Getting closer:

Code:

rob@slacktop:~/Downloads/mnc/tiny-mnc-master$ gcc mnc.c -o mnc -lm -lncurses
mnc.c: In function 'mncview':
mnc.c:134:51: warning: implicit declaration of function 'strrlf' [-Wimplicit-function-declaration]
      mvprintw( posy - mncview_scrolly , 0, "%s", strrlf( line ));
                                                  ^
/tmp/cctrjoDg.o: In function `mncview.5083':
mnc.c:(.text+0x9a3): undefined reference to `strrlf'
collect2: error: ld returned 1 exit status
rob@slacktop:~/Downloads/mnc/tiny-mnc-master$


I'm doing this on Slackware, which includes the dynamic libraries in every package.

Does mnc need the static library?

it does not need libs, just ncurses-dev

strrlf is to remove the LF. You can just remove it into the src code if you want to make the code work'.

Xeratul 05-28-2017 08:43 AM

If it worked out, well, you may eventually make a GIT HUB project or branch, to allow other users to compile it on slackware box.

If you'd like...

rkelsen 05-29-2017 05:16 AM

It compiled without needing anything extra, apart from the tweaks above.

I'd be happy to contribute wherever I can. :)

Xeratul 05-29-2017 10:45 AM

Quote:

Originally Posted by rkelsen (Post 5716463)
It compiled without needing anything extra, apart from the tweaks above.

I'd be happy to contribute wherever I can. :)

you can make a project or fork of this tiny browser. it can greatly help people who have hands on a ssh, and that have nothing installed. This tiny broweser is great when no single libraries are installed, just gcc and fews.
this app is of great help when you have on a distant ssh new server.

herewith the link https://github.com/

Xeratul 06-05-2017 06:37 AM

1 Attachment(s)
Quote:

Originally Posted by rkelsen (Post 5716463)
It compiled without needing anything extra, apart from the tweaks above.

I'd be happy to contribute wherever I can. :)


Hi,

I am happy to give you the NIGHT COMMANDER. It is a all-mighty file manager.
https://github.com/spartrekus/nc

Let me know your impressions.
:Have Fun:

fatmac 06-05-2017 08:59 AM

Interesting project, looks like a cross between mc & vifm. :)

I used to have mc-light on one of my distros a while ago, but they stopped development of it.
File manager & editor combined with a compressed file extracter, basically, from memory.

Xeratul 06-05-2017 09:25 AM

Quote:

Originally Posted by fatmac (Post 5719192)
Interesting project, looks like a cross between mc & vifm. :)

I used to have mc-light on one of my distros a while ago, but they stopped development of it.
File manager & editor combined with a compressed file extracter, basically, from memory.

you can use "nc", it is much better ;) You can test it...
It's free (=0$$).


All times are GMT -5. The time now is 12:28 AM.