Recent

Author Topic: A collection of daily *NIX commands, in Pascal  (Read 2791 times)

lebao3105

  • New Member
  • *
  • Posts: 18
A collection of daily *NIX commands, in Pascal
« on: February 23, 2026, 05:50:58 pm »
Hi all,
It's been a long while since I started working on this. While there is no stable release, it's something that might interest you:-P Also I'm looking for new contributors, I'm a *bit* alone.

The project's link is https://github.com/lebao3105/Commands-collection.
As the title says, it's a collection of daily *NIX commands.

You will see that C is used, mainly for function-like macros and...avoid runtime-modification for arrays (for what I mean, check this out: https://github.com/lebao3105/Commands-collection/blob/1dcffc17ea2342ff0388f95f716f28654b4fca57/include/custcustapp.pp)

Yes, all for parsing command-line arguments. Stupidly. It involves an implementation of <getopts.h>, requiring you to install a C compiler, and may cáue troubles if I forgot to free() something. Also the project is meant to use Pascal as its main language.
(The project still uses libc for obvious tasks like getting passwd entries)

That are the reasons I'm reverting it: https://github.com/lebao3105/Commands-collection/pull/5.
And this one (the pull request), I recommend you to try.  For the build instruction, consult the .github/workflows/nightly.yml file. Only some have adapted to the change, known by not having any C headers (.h extension) in their respective folder.
« Last Edit: February 23, 2026, 06:15:11 pm by lebao3105 »
My GitHub+GitLab username: lebao3105.

quirkyjelly

  • Newbie
  • Posts: 1
Re: A collection of daily *NIX commands, in Pascal
« Reply #1 on: February 23, 2026, 06:03:49 pm »
Just checked it out. Great work so far!
Such a misfortune that some deps are still written in C.
Let's see where this journey goes.

lebao3105

  • New Member
  • *
  • Posts: 18
Re: A collection of daily *NIX commands, in Pascal
« Reply #2 on: February 23, 2026, 06:13:28 pm »
Just checked it out. Great work so far!
Such a misfortune that some deps are still written in C.
Let's see where this journey goes.

Are you talking about the...mentioned pull request?
While functions made in C are gone, there're only few programs have adapted to that change.
Damn, I forgot to mention about that earlier!
My GitHub+GitLab username: lebao3105.

Roland57

  • Hero Member
  • *****
  • Posts: 604
    • msegui.net
Re: A collection of daily *NIX commands, in Pascal
« Reply #3 on: February 23, 2026, 07:19:05 pm »
As the title says, it's a collection of daily *NIX commands.

Thank you for sharing. It looks very interesting. But I didn't find how to build:

[roland@localhost cc (main)]$ LC_ALL=C xmake
cc1: fatal error: XMakefile: No such file or directory
[roland@localhost cc (main)]$ cd src/touch
[roland@localhost touch (main)]$ LC_ALL=C xmake
cc1: fatal error: XMakefile: No such file or directory


I tried also to use the --target_program=<program_name>, without success. (It's the first time I use xmake.)
« Last Edit: March 11, 2026, 06:26:45 pm by Roland57 »
My projects are on Codeberg.

lebao3105

  • New Member
  • *
  • Posts: 18
Re: A collection of daily *NIX commands, in Pascal
« Reply #4 on: February 24, 2026, 12:07:40 am »
As the title says, it's a collection of daily *NIX commands.

Thank you for sharing. It looks very interesting. But I idin't find how to build:

[roland@localhost cc (main)]$ LC_ALL=C xmake
cc1: fatal error: XMakefile: No such file or directory
[roland@localhost cc (main)]$ cd src/touch
[roland@localhost touch (main)]$ LC_ALL=C xmake
cc1: fatal error: XMakefile: No such file or directory


I tried also to use the --target_program=<program_name>, without success. (It's the first time I use xmake.)

The XMake is from https://xmake.io.
My GitHub+GitLab username: lebao3105.

Roland57

  • Hero Member
  • *****
  • Posts: 604
    • msegui.net
Re: A collection of daily *NIX commands, in Pascal
« Reply #5 on: February 24, 2026, 05:44:15 am »
The XMake is from https://xmake.io.

OK. I installed the latest version. Now I get this error:

$ LC_ALL=C xmake
[ 15%]: cache compiling.release src/custcustc.c
[ 31%]: linking.release libbridge.so
error: <command-line>: fatal error: ../src//config.h: No such file or directory
compilation terminated.
  > in src/custcustc.c
warning: ./xmake.lua:32: cannot match add_files("src//.pp") in target(selected)


P.-S. This command seems to work:

$ LC_ALL=C xmake f --target_program=touch
checking for platform ... linux
checking for architecture ... x86_64
checking for target_program ... touch


But I don't get a touch binary, only a libbridge.so.
« Last Edit: February 24, 2026, 05:52:08 am by Roland57 »
My projects are on Codeberg.

lebao3105

  • New Member
  • *
  • Posts: 18
Re: A collection of daily *NIX commands, in Pascal
« Reply #6 on: February 24, 2026, 06:02:24 am »
The XMake is from https://xmake.io.

OK. I installed the latest version. Now I get this error:

$ LC_ALL=C xmake
[ 15%]: cache compiling.release src/custcustc.c
[ 31%]: linking.release libbridge.so
error: <command-line>: fatal error: ../src//config.h: No such file or directory
compilation terminated.
  > in src/custcustc.c
warning: ./xmake.lua:32: cannot match add_files("src//.pp") in target(selected)


P.-S. This command seems to work:

$ LC_ALL=C xmake f --target_program=touch
checking for platform ... linux
checking for architecture ... x86_64
checking for target_program ... touch


But I don't get a touch binary, only a libbridge.so.

That's why I recommended the pull request: https://github.com/lebao3105/Commands-collection/pull/5

But since you're using the main branch, run xmake after the one with --target_program. In short, you used the wrong order.

You will have to use xmake f --target_program=<NAME HERE> for each program you want to compile. Check the wiki: https://github.com/lebao3105/Commands-collection/wiki/Building-and-running-CC

Note that rm and rmdir are not able to build yet. They have unresolved shared code in src/removethings.

Oh and by the way, set LD_LIBRARY_PATH environment variable to where libbridge.so is (do not include the library name itself) before running.
« Last Edit: February 24, 2026, 06:08:25 am by lebao3105 »
My GitHub+GitLab username: lebao3105.

Roland57

  • Hero Member
  • *****
  • Posts: 604
    • msegui.net
Re: A collection of daily *NIX commands, in Pascal
« Reply #7 on: February 24, 2026, 06:11:43 am »
OK, this works:

$ xmake f --target_program=touch
$ xmake
[ 15%]: linking.release libbridge.so
[ 15%]: cache compiling.release src/custcustc.c
[ 39%]: cache compiling.release src/logging.c
[ 39%]: cache compiling.release src/termcolor.c
[ 55%]: archiving.release touch/libcustcustc.a
[ 71%]: linking.release touch
create ok!
compile_commands.json updated!
[100%]: build ok, spent 1.16s

My projects are on Codeberg.

lebao3105

  • New Member
  • *
  • Posts: 18
Re: A collection of daily *NIX commands, in Pascal
« Reply #8 on: February 27, 2026, 06:24:53 pm »
News: CC is getting proper localizations! The only thing I need to implement is to read compiled files (for localizations of course).

RTL's GetOpts unit is being modified to suit CC needs (localization, callbacks, and maybe some small optimizations).

All available in the mentioned pull request.
My GitHub+GitLab username: lebao3105.

lebao3105

  • New Member
  • *
  • Posts: 18
Re: A collection of daily *NIX commands, in Pascal
« Reply #9 on: March 11, 2026, 05:21:48 pm »
OK, this works:

$ xmake f --target_program=touch
$ xmake
[ 15%]: linking.release libbridge.so
[ 15%]: cache compiling.release src/custcustc.c
[ 39%]: cache compiling.release src/logging.c
[ 39%]: cache compiling.release src/termcolor.c
[ 55%]: archiving.release touch/libcustcustc.a
[ 71%]: linking.release touch
create ok!
compile_commands.json updated!
[100%]: build ok, spent 1.16s


Quite a bit late for a question but did you have fun with the project? Anything that I should consider? Colors in dir was temporary removed though...
My GitHub+GitLab username: lebao3105.

Roland57

  • Hero Member
  • *****
  • Posts: 604
    • msegui.net
Re: A collection of daily *NIX commands, in Pascal
« Reply #10 on: March 11, 2026, 06:40:37 pm »
Quite a bit late for a question but did you have fun with the project? Anything that I should consider?

Until now, I haven't found the time to study this project further. And (to be honest), I am not sure to have understood what you said about the recommended pull request.

That's why I recommended the pull request: https://github.com/lebao3105/Commands-collection/pull/5

But since you're using the main branch...

I understood that the project was in a transitional state, and I said to myself that I would wait before I give it another look.  :)
« Last Edit: March 11, 2026, 08:15:19 pm by Roland57 »
My projects are on Codeberg.

lebao3105

  • New Member
  • *
  • Posts: 18
Re: A collection of daily *NIX commands, in Pascal
« Reply #11 on: April 04, 2026, 02:06:01 pm »
Quote
I understood that the project was in a transitional state, and I said to myself that I would wait before I give it another look.  :)

The transition is almost done:)

I just did a couple of fixes (console output, command line parse), finished the C -> Pascal transition.

The code is now hosted at GitLab, just use the same user and repository name (TLDR: replace github.com with gitlab.com), and I guess I'll main it? No idea.

Anyways, just found 2 known issues: one in compile time and one in runtime.
1. dir hangs when at least -l or -a get used.
2. FPC failed to write resource files. It that happends, append -v to the build command and send me, also downgrade xmake from 3.0.8 (latest) to 3.0.7 using xmake update 3.0.7. This happends on XMake 3.0.8.

You also can NOT combine short flags. For example -la is not accepted, while -l -a works. This is not a feature.

Happy testing!
My GitHub+GitLab username: lebao3105.

 

TinyPortal © 2005-2018