• libwy v0.68.3 is reased.

    From wij@21:1/5 to All on Mon Aug 7 13:48:13 2023
    libwy https://sourceforge.net/projects/cscall/files/latest/download
    is based on GNU-Clib/syscall (mostly POSIX calls, on Linux machines), provides basic 'system objects' for C++ aprogramers to program in Object-Oriented way.

    This is lastly added example a_sysinfo.cpp (collect and dump system information)

    #include <Wy.stdio.h>
    #include <Wy.unistd.h>
    #include <Wy.time.h>
    #include <sys/utsname.h>

    using namespace Wy;

    String getfile(const char* fname)
    {
    Errno r;
    String str;

    cout << "---------------- Dump file: " << fname << " -----------------" WY_ENDL;
    if((r=Wy::access(fname,F_OK))!=Ok) { // showcase, this check is not necessary return "File (" + String(fname) + ") reading error: " + wrd(r) + WY_ENDL;
    }

    RegFile regf(fname,O_RDONLY); // may be virtual files (file size=0),
    RdBuf strm(regf); // get_whole_regfile(..) won't work for(;strm.is_eof()==false;) {
    if((r=strm.append_read(str))!=Ok) {
    WY_THROW(r);
    }
    if(str.size()>1000000) {
    WY_THROW( Errno(EFBIG) ); // file size > 1-mega bytes
    }
    }
    return str;
    };

    void dump_sysinfo() {
    Errno r;
    String str;

    cout << "hostname: " << Wy::gethostname() << WY_ENDL;
    {
    struct utsname buf;
    if(::uname(&buf)!=0) {
    WY_THROW( Errno(errno) );
    }
    cout << WY_ENDL;
    cout << "---------------- Dump struct utsname -----------------" WY_ENDL;
    cout << "sysname : " << buf.sysname << WY_ENDL;
    cout << "nodename: " << buf.nodename << WY_ENDL;
    cout << "release : " << buf.release << WY_ENDL;
    cout << "version : " << buf.version << WY_ENDL;
    cout << "machine : " << buf.machine << WY_ENDL;
    }

    cout << WY_ENDL;
    cout << "ttyname(cerr): " << ttyname(cerr) << WY_ENDL;
    cout << "ttyname(cin): " << ttyname(cin) << WY_ENDL;
    cout << "ttyname(cout): " << ttyname(cout) << WY_ENDL;
    cout << "ctermid(): " << ctermid() << WY_ENDL;
    cout << WY_ENDL;
    cout << "timezone: " << local_tzname() << WY_ENDL;
    cout << WY_ENDL;
    cout << "current working directory: " << getcwd() << WY_ENDL;

    cout << WY_ENDL;
    cout << getfile("/etc/os-release");
    cout << WY_ENDL;
    cout << getfile("/proc/cpuinfo");
    cout << WY_ENDL;
    cout << getfile("/proc/version");
    cout << WY_ENDL;
    cout << getfile("/proc/meminfo");
    cout << WY_ENDL;
    };

    int main(int argc, const char* argv[])
    try {
    dump_sysinfo();
    return 0;
    }
    catch(const Errno& e) {
    cerr << wrd(e) << WY_ENDL;
    return e.c_errno();
    }
    catch(...) {
    cerr << "main() caught(...)" WY_ENDL;
    throw;
    };

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [email protected]@21:1/5 to wij on Tue Aug 8 07:18:18 2023
    On Mon, 7 Aug 2023 13:48:13 -0700 (PDT)
    wij <[email protected]> wrote:
    libwy https://sourceforge.net/projects/cscall/files/latest/download
    is based on GNU-Clib/syscall (mostly POSIX calls, on Linux machines), provides >basic 'system objects' for C++ aprogramers to program in Object-Oriented way.

    You might want to look into the concept known as indentation. It makes code
    a lot more readable.

    Also any half decent C++ dev can wrap posix calls in classes and many do in their day jobs so you're hardly breaking knew ground here despite what you
    seem to think.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to [email protected] on Tue Aug 8 09:48:34 2023
    In article <uasq7q$39np6$[email protected]>, <[email protected]> wrote: >On Mon, 7 Aug 2023 13:48:13 -0700 (PDT)
    wij <[email protected]> wrote:
    libwy https://sourceforge.net/projects/cscall/files/latest/download
    is based on GNU-Clib/syscall (mostly POSIX calls, on Linux machines), >>provides basic 'system objects' for C++ aprogramers to program in >>Object-Oriented way.

    You might want to look into the concept known as indentation. It makes code
    a lot more readable.

    Also any half decent C++ dev can wrap posix calls in classes and many do in >their day jobs so you're hardly breaking knew ground here despite what you >seem to think.

    i.e., in the fine Usenet tradition:

    If you don't have anything nice to say, come sit by me and post it to Usenet.

    (Dorothy Parker, updated)

    --
    Indeed, most .NET developers couldn't pass CS101 at a third-rate
    community college.
    - F. Russell -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From wij@21:1/5 to [email protected] on Tue Aug 8 05:43:33 2023
    On Tuesday, August 8, 2023 at 3:18:24 PM UTC+8, [email protected] wrote:
    On Mon, 7 Aug 2023 13:48:13 -0700 (PDT)
    wij <[email protected]> wrote:
    libwy https://sourceforge.net/projects/cscall/files/latest/download
    is based on GNU-Clib/syscall (mostly POSIX calls, on Linux machines), provides
    basic 'system objects' for C++ aprogramers to program in Object-Oriented way.
    You might want to look into the concept known as indentation. It makes code a lot more readable.

    Show us an example!

    If you mean the kind of indentation of Python, LOL.

    Also any half decent C++ dev can wrap posix calls in classes and many do in their day jobs so you're hardly breaking knew ground here despite what you seem to think.

    Name some, so I can understand better what you said. (there were some, but
    none survived, IIRC).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [email protected]@21:1/5 to wij on Tue Aug 8 15:51:41 2023
    On Tue, 8 Aug 2023 05:43:33 -0700 (PDT)
    wij <[email protected]> wrote:
    On Tuesday, August 8, 2023 at 3:18:24=E2=80=AFPM UTC+8, Mut...@dastardlyhq.= >com wrote:
    On Mon, 7 Aug 2023 13:48:13 -0700 (PDT)=20
    wij <[email protected]> wrote:=20
    libwy https://sourceforge.net/projects/cscall/files/latest/download=20
    is based on GNU-Clib/syscall (mostly POSIX calls, on Linux machines), pr= >ovides=20
    basic 'system objects' for C++ aprogramers to program in Object-Oriented=
    way.
    You might want to look into the concept known as indentation. It makes co= >de=20
    a lot more readable.
    =20
    Show us an example!

    If you don't understand indentation there's little point showing you. A 3
    year old could grasp the concept.

    If you mean the kind of indentation of Python, LOL.

    You do realise in C++ that whitespace doesn't have syntatic significance** unlike Python?

    Also any half decent C++ dev can wrap posix calls in classes and many do = >in=20
    their day jobs so you're hardly breaking knew ground here despite what yo= >u=20
    seem to think.

    Name some, so I can understand better what you said. (there were some, but >none survived, IIRC).

    Wtf are you talking? People often wrap posix calls in classes, how would I know what they call them? If you want a public example Google the ACE networking library.

    ** yes ok, older compilers required > > instead of >> for templates.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to wij on Tue Aug 8 16:13:49 2023
    On 2023-08-08, wij <[email protected]> wrote:
    On Tuesday, August 8, 2023 at 3:18:24 PM UTC+8, [email protected] wrote:
    On Mon, 7 Aug 2023 13:48:13 -0700 (PDT)
    wij <[email protected]> wrote:
    libwy https://sourceforge.net/projects/cscall/files/latest/download
    is based on GNU-Clib/syscall (mostly POSIX calls, on Linux machines), provides
    basic 'system objects' for C++ aprogramers to program in Object-Oriented way.
    You might want to look into the concept known as indentation. It makes code >> a lot more readable.

    Show us an example!

    https://sourceforge.net/projects/cscall/files/libwy/

    Scroll to bottom:

    +--------+
    | Goal |
    +--------+
    This library is intended a widely reusable C++ library.

    ^^^^ this is indentation

    Reusableness means:

    [...]

    3. Strict(precise) definition and necessity. (systemize problems in
    the way)

    ^^^ this is more indentation, a variety of "hanging indentation".

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [email protected]@21:1/5 to Kenny McCormack on Tue Aug 8 15:54:34 2023
    On Tue, 8 Aug 2023 09:48:34 -0000 (UTC)
    [email protected] (Kenny McCormack) wrote:
    In article <uasq7q$39np6$[email protected]>, <[email protected]> wrote: >>On Mon, 7 Aug 2023 13:48:13 -0700 (PDT)
    wij <[email protected]> wrote:
    libwy https://sourceforge.net/projects/cscall/files/latest/download
    is based on GNU-Clib/syscall (mostly POSIX calls, on Linux machines), >>>provides basic 'system objects' for C++ aprogramers to program in >>>Object-Oriented way.

    You might want to look into the concept known as indentation. It makes code >>a lot more readable.

    Also any half decent C++ dev can wrap posix calls in classes and many do in >>their day jobs so you're hardly breaking knew ground here despite what you >>seem to think.

    i.e., in the fine Usenet tradition:

    If you don't have anything nice to say, come sit by me and post it to
    Usenet.

    So no criticism allowed? Only say nicey wicey things to each other, perhaps while hugging bunny wunnies and singing kumbaya?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to wij on Tue Aug 8 16:33:06 2023
    On 2023-08-07, wij <[email protected]> wrote:
    if((r=Wy::access(fname,F_OK))!=Ok) { // showcase, this check is not necessary

    Note that the access function behaves in a special way in setuid
    programs, and is intended for that.

    It answers the question, "would the original, non-privileged user
    (the real user ID) be able to perform this access?"

    There is no reason to ever use the access function, in a program not
    intended for setuid operation.

    Normally, you just try an operation and check for failure (such as permissions).

    The problem that it helps solve is that a setuid root process can just
    blast through permission checks; e.g. overwrite your write-protected
    file. Or show user A a file of user B they are not supposed to see.

    Even the F_OK existence check is intended for this. It's not for
    checking whether the file actually exists or not, but whether the
    real user ID is allowed to know the existence of the file.

    To a setuid root program, the file "/root/.dead.letter" exists.
    But, I think, according to access("/root/.dead.letter", F_OK),
    it doesn't. The real user ID has no read access to the /root
    directory and so has no way of knowing whether such a file exists;
    F_OK should follow that.

    To answer the question "do I have this kind of access to this file,
    using my effective privileges", you need to write your own function.
    access will work if the real and effective user IDs happen to be
    the same.

    Also note that using the access function encourages TOCtoTOU bugs,
    and POSIX itself says that:

    "Use of these functions [access, faccessat] is discouraged since by the
    time the returned information is acted upon, it is out-of-date."

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to [email protected] on Tue Aug 8 17:18:45 2023
    On 2023-08-08, [email protected] <[email protected]> wrote:
    On Tue, 8 Aug 2023 05:43:33 -0700 (PDT)
    wij <[email protected]> wrote:
    On Tuesday, August 8, 2023 at 3:18:24=E2=80=AFPM UTC+8, Mut...@dastardlyhq.= >>com wrote:
    On Mon, 7 Aug 2023 13:48:13 -0700 (PDT)=20
    wij <[email protected]> wrote:=20
    libwy https://sourceforge.net/projects/cscall/files/latest/download=20
    is based on GNU-Clib/syscall (mostly POSIX calls, on Linux machines), pr= >>ovides=20
    basic 'system objects' for C++ aprogramers to program in Object-Oriented= >> way.
    You might want to look into the concept known as indentation. It makes co= >>de=20
    a lot more readable.
    =20
    Show us an example!

    If you don't understand indentation there's little point showing you. A 3 year old could grasp the concept.

    The code in libwy is indented. He has documentation in the form of
    numerous man pages, and there are test cases.

    It doesn't compile for me; the ./configure script runs, but then
    when running make, there are C++ errors.

    The LGPL license of this library is a problem because some modules
    consist of C++ inline functions. If anyone uses these inline functions,
    their own license must be GPL-compatible and their program as a whole
    has to be released under the GPL or LGPL.

    In my experience with this sort of thing is that it's easier to roll
    what you need than figuring out something like this.

    It saves you a bit of typing that it's already written, but
    you're going to have to own the code all the same: debug it yourself,
    maintain it yourself.

    There has to be a compelling reason, like the thing is the best of its
    kind, widely used. Nobody is going to switch to a random, obscure C++
    library you've never heard of, let alone one with licensing issues.

    E.g. if I want an epoll wrapper or semaphore wrapper in C++, I can just
    spend one hour making it myself, and not deal with this third party
    stuff that I would have to maintain as if it were my own anyway--but
    have to deal with its naming conventions, formatting, and other
    stylistic and design decisions that are not mine.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @[email protected]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From wij@21:1/5 to Kaz Kylheku on Tue Aug 8 18:15:06 2023
    On Wednesday, August 9, 2023 at 1:18:50 AM UTC+8, Kaz Kylheku wrote:
    On 2023-08-08, [email protected] <[email protected]> wrote:
    On Tue, 8 Aug 2023 05:43:33 -0700 (PDT)
    wij <[email protected]> wrote:
    On Tuesday, August 8, 2023 at 3:18:24=E2=80=AFPM UTC+8, Mut...@dastardlyhq.=
    com wrote:
    On Mon, 7 Aug 2023 13:48:13 -0700 (PDT)=20
    wij <[email protected]> wrote:=20
    libwy https://sourceforge.net/projects/cscall/files/latest/download=20 >>> >is based on GNU-Clib/syscall (mostly POSIX calls, on Linux machines), pr=
    ovides=20
    basic 'system objects' for C++ aprogramers to program in Object-Oriented=
    way.
    You might want to look into the concept known as indentation. It makes co=
    de=20
    a lot more readable.
    =20
    Show us an example!

    If you don't understand indentation there's little point showing you. A 3 year old could grasp the concept.
    The code in libwy is indented. He has documentation in the form of
    numerous man pages, and there are test cases.

    It doesn't compile for me; the ./configure script runs, but then
    when running make, there are C++ errors.

    What kind of compiling errors?
    The current libwy just tested on my machine. I am tire to test more in current stage of development.

    The LGPL license of this library is a problem because some modules
    consist of C++ inline functions. If anyone uses these inline functions, their own license must be GPL-compatible and their program as a whole
    has to be released under the GPL or LGPL.

    I don't think inline functions are an issue, very weak in the court.
    Anyway, I was intended copyright libwy Public Domain, but not sure it will do.

    In my experience with this sort of thing is that it's easier to roll
    what you need than figuring out something like this.

    If you mean std::string,vector,list,unique_ptr,.... I can't agree more, they are trivial to me.

    It saves you a bit of typing that it's already written, but
    you're going to have to own the code all the same: debug it yourself, maintain it yourself.

    There has to be a compelling reason, like the thing is the best of its
    kind, widely used. Nobody is going to switch to a random, obscure C++ library you've never heard of, let alone one with licensing issues.

    E.g. if I want an epoll wrapper or semaphore wrapper in C++, I can just spend one hour making it myself, and not deal with this third party
    stuff that I would have to maintain as if it were my own anyway--but
    have to deal with its naming conventions, formatting, and other
    stylistic and design decisions that are not mine.

    Can C++ programmers spend several months or several years for such libraries?
    I would say not likely. I've considered the same for the 20 years about the 'too easy' sort of things of the seemingly trivial 'wrapper' design. But the true thing is far from so.
    For a rough and simple summary, the API being looking like a thin wrapper is DELIBERATE, so little burden is added for users (as you can know it and use it just by a look). There are 'concept' in Unix-like OS and the POSIX API that is invisible (many things need experience to understand) and no good to hide as would be done in normal 'advanced' libraries, see ClassGuidelines.txt in /doc directory for more details (REAME.TXT is the 20 years old original document,
    I tried as possible not to modify it so I can evaluate the whole thing of the project).

    Yes, in some cases, serious applications will always want to implement their own class
    or function. This is explicitly allowed and should be simple as doc'd in libwy library guidelines.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @[email protected]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to wij on Wed Aug 9 01:33:16 2023
    On 2023-08-09, wij <[email protected]> wrote:
    On Wednesday, August 9, 2023 at 1:18:50 AM UTC+8, Kaz Kylheku wrote:
    On 2023-08-08, [email protected] <[email protected]> wrote:
    On Tue, 8 Aug 2023 05:43:33 -0700 (PDT)
    wij <[email protected]> wrote:
    On Tuesday, August 8, 2023 at 3:18:24=E2=80=AFPM UTC+8, Mut...@dastardlyhq.=
    com wrote:
    On Mon, 7 Aug 2023 13:48:13 -0700 (PDT)=20
    wij <[email protected]> wrote:=20
    libwy https://sourceforge.net/projects/cscall/files/latest/download=20 >> >>> >is based on GNU-Clib/syscall (mostly POSIX calls, on Linux machines), pr=
    ovides=20
    basic 'system objects' for C++ aprogramers to program in Object-Oriented=
    way.
    You might want to look into the concept known as indentation. It makes co=
    de=20
    a lot more readable.
    =20
    Show us an example!

    If you don't understand indentation there's little point showing you. A 3 >> > year old could grasp the concept.
    The code in libwy is indented. He has documentation in the form of
    numerous man pages, and there are test cases.

    It doesn't compile for me; the ./configure script runs, but then
    when running make, there are C++ errors.

    What kind of compiling errors?

    C++ compiling errors on g++ 7.5.0 on a Ubuntu 18 box. Like
    ambigous overload resolution and such.

    Maybe you are relying on newer g++. That's probably a bad idea; if
    you are not doing anything "earth shattering", stick to old C++.

    Or, possibly, you only compiled your code 64 bit? Changes in the
    integer types from one platform to another could cause plausibly those
    kinds of errors.

    I tried compiling for 32 bit x86, which is losing popularity; but there
    are lots of embedded 32 bit systems, like ARM. Most of the audience for
    your kind of library is doing embedded programming for 32 bit targets.

    I don't think inline functions are an issue, very weak in the court.

    So you're preparing to go to court over someone the LGPL violation of
    someone using your inline functions? But promise to to defend them
    only weakly? :)

    Anyway, I was intended copyright libwy Public Domain, but not sure it will do.

    Slapping a LGPL on something is a bad way of showing the intent to
    go to Public Domain, ha!

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @[email protected]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Keith Thompson@21:1/5 to wij on Tue Aug 8 19:04:51 2023
    wij <[email protected]> writes:
    [...]
    I don't think inline functions are an issue, very weak in the court.
    Anyway, I was intended copyright libwy Public Domain, but not sure it will do.
    [...]

    If you're considering releasing it to the public domain, you should do
    some research first. In particular, public domain means specifically
    that there is no copyright. Some jurisdictions might not recognize it.

    SQLite3 is public domain. Take a look at how they do it.

    --
    Keith Thompson (The_Other_Keith) [email protected]
    Will write code for food.
    void Void(void) { Void(); } /* The recursive call of the void */

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)