LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-05-2017, 02:25 PM   #1
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Rep: Reputation: 255Reputation: 255Reputation: 255
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?
 
Old 05-05-2017, 06:36 PM   #2
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
/sbin/fsck?
 
Old 05-05-2017, 11:41 PM   #3
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by Laserbeak View Post
/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
 
1 members found this post helpful.
Old 05-06-2017, 12:56 AM   #4
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,446
Blog Entries: 7

Rep: Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553
Cool

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$
 
Old 05-27-2017, 02:24 PM   #5
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by rkelsen View Post
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
 
Old 05-27-2017, 10:42 PM   #6
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,446
Blog Entries: 7

Rep: Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553
Quote:
Originally Posted by Xeratul View Post
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$
 
Old 05-28-2017, 12:54 AM   #7
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
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.
 
Old 05-28-2017, 04:17 AM   #8
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,446
Blog Entries: 7

Rep: Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553
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?
 
Old 05-28-2017, 07:52 AM   #9
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by rkelsen View Post
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'.
 
Old 05-28-2017, 08:43 AM   #10
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
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...
 
Old 05-29-2017, 05:16 AM   #11
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,446
Blog Entries: 7

Rep: Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553
Cool

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

I'd be happy to contribute wherever I can.
 
Old 05-29-2017, 10:45 AM   #12
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by rkelsen View Post
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/
 
Old 06-05-2017, 06:37 AM   #13
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by rkelsen View Post
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:
Attached Thumbnails
Click image for larger version

Name:	nc.png
Views:	14
Size:	40.4 KB
ID:	25184  
 
Old 06-05-2017, 08:59 AM   #14
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,487

Rep: Reputation: Disabled
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.
 
Old 06-05-2017, 09:25 AM   #15
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by fatmac View Post
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$$).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Shared Library Errors With Some Applications jefeyay Slackware 2 11-03-2016 01:16 PM
[SOLVED] No title bars in graphical applications on minimal debian install. mzsade Debian 13 08-09-2015 07:35 PM
Minimal KDE + choice set of applications = new MLED! kikinovak Slackware 33 09-21-2014 04:48 AM
Minimal LFS package selection, strip command, and more GiveMeSomeSlackware Linux From Scratch 2 11-12-2012 10:29 PM
Finding what applications need a library? littlebigman Linux - Software 2 04-13-2011 12:42 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration