Giter Club home page Giter Club logo

Comments (9)

psychon avatar psychon commented on July 2, 2024

Which system is this on? I'd guess this is Solaris 9 or worse because that's the only system that I know which is broken enough not to have getopt_long.
See http://en.znc.in/wiki/Portability

from znc.

octeron avatar octeron commented on July 2, 2024

hehe, irix actually

from znc.

psychon avatar psychon commented on July 2, 2024

Added Irix to the "broken" list in the wiki. getopt_long is a GNU extension, so... yeah. But I really like long options. :-(

I googled a getopt_long implementation and the file has 540 lines. That's a lot.

So plan B:
Grab a text editor and edit main.cpp. Remove the "g_LongOpts" array in lines 13 to 27. In line 117/119, change the calls to getopt_long(argc, argv, , g_LongOpts, &iOptIndex) into getopt(arc, argv, ).

If you got any problems with that, tell me which version of znc you are looking at and I'll patch main.cpp for you. (And yes, this will remove support for long options like --foreground and --debug from znc and make only the short forms like -f and -D work).

from znc.

octeron avatar octeron commented on July 2, 2024

fantastic!!
will give it a try right away!
and i couldn't care less about long options anyway :-)

i'll try 0.096 first but wouldn't mind any other version either

from znc.

octeron avatar octeron commented on July 2, 2024

okay, that worked like a charm but one more issue came up:

Csocket.cpp: In function 'void __Perror(const CString&, const char*, unsigned int)':
Csocket.cpp:495: error: 'strerror_r' was not declared in this scope

from znc.

psychon avatar psychon commented on July 2, 2024

http://predef.sourceforge.net/preos.html says that irix can be identified via #ifdef sgi, so could you change line 489 in Csocket.cpp from
#if defined(sun) || defined(_WIN32) || (defined(__NetBSD_Version) && NetBSD_Version < 4000000000)
into
#if defined(sgi) || defined(sun) || defined(_WIN32) || (defined(__NetBSD_Version) && NetBSD_Version < 4000000000)

from znc.

octeron avatar octeron commented on July 2, 2024

that worked just as well as the solution before!
had to replace install.sh with a real one and all was fine. now i'm the proud owner of a nice and current znc package for irix :-)

i have to say this was the best support i got in years. normally it's like that: "what? not linux? don't care." :-P

and for what it's worth the patch:

--- main.cpp_O Thu Mar 24 17:15:38 2011
+++ main.cpp Thu Mar 24 14:02:17 2011
@@ -10,21 +10,6 @@
#include <getopt.h>
#include <sys/wait.h>

-static const struct option g_LongOpts[] = {

  •   { "help",        no_argument,       0, 'h' },
    
  •   { "version",     no_argument,       0, 'v' },
    
  •   { "debug",       no_argument,       0, 'D' },
    
  •   { "foreground",  no_argument,       0, 'f' },
    
  •   { "no-color",    no_argument,       0, 'n' },
    
  •   { "allow-root",  no_argument,       0, 'r' },
    
  •   { "makeconf",    no_argument,       0, 'c' },
    
  •   { "makepass",    no_argument,       0, 's' },
    

    -#ifdef HAVE_LIBSSL

  •   { "makepem",     no_argument,       0, 'p' },
    

    -#endif /* HAVE_LIBSSL */

  •   { "datadir",     required_argument, 0, 'd' },
    
  •   { 0, 0, 0, 0 }
    

    -};

    static void GenerateHelp(const char *appname) {
    CUtils::PrintMessage("USAGE: " + CString(appname) + " [options]");
    @@ -114,9 +99,9 @@
    #ifdef HAVE_LIBSSL
    bool bMakePem = false;

  •   while ((iArg = getopt_long(argc, argv, "hvnrcspd:Df", g_LongOpts, &iOptIndex)) != -1) {
    
  •   while ((iArg = getopt(argc, argv, "hvnrcspd:Df")) != -1) {
    

    #else

  •   while ((iArg = getopt_long(argc, argv, "hvnrcsd:Df", g_LongOpts, &iOptIndex)) != -1) {
    
  •   while ((iArg = getopt(argc, argv, "hvnrcsd:Df")) != -1) {
    

    #endif /* HAVE_LIBSSL */
    switch (iArg) {
    case 'h':

--- Csocket.cpp_O Thu Mar 24 17:15:38 2011
+++ Csocket.cpp Thu Mar 24 17:00:39 2011
@@ -487,7 +487,7 @@

void *Perror( const CS_STRING & s, const char pszFile, unsigned int iLineNo )
{
-#if defined(__sun) || defined(_WIN32) || (defined(__NetBSD_Version
) && NetBSD_Version < 4000000000)
+#if defined(sgi) || defined(sun) || defined(_WIN32) || (defined(__NetBSD_Version) && NetBSD_Version < 4000000000)
std::cerr << s << "(" << pszFile << ":" << iLineNo << "): " << strerror( GetSockError() ) << endl;
#else
char buff[512];

from znc.

psychon avatar psychon commented on July 2, 2024

So you do know that irix is dead since almost 5 years? Good. :-)

For the getopt_long problem I did a proper patch which has the same effect as the one you got, but with the difference that we still use getopt_long() if it is available:
http://git.znc.in/?p=psychon/znc.git;a=commitdiff;h=2afe2a77629012b24d8d270437e94e98d1657ffc

I'll forward the change to Csocket.cpp the right person.

from znc.

octeron avatar octeron commented on July 2, 2024

hehe, i do, still love it tho (and the resp. machines).

thanks for all !!

from znc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.