Menu

ftpmod_request warning in ftp_util.c

BSzili
2013-09-02
2013-09-02
  • BSzili

    BSzili - 2013-09-02

    I'm trying to get ftp.module into shape, and I have a question about this warning:
    https://sourceforge.net/p/dopus5allamigas/code/544/tree/branches/branch_v1/Modules/ftp/ftp_util.c#l1321
    Did this vsprintf cause trouble on OS4 or MOS? It works on AROS, but I can replace it with RawDoFmt which is guaranteed to work on every platform, and we avoid the dubious cast from an array to va_list, like this:

    RawDoFmt((char *)fmttag->ti_Data, &array, DOPUS_RAWFMTFUNC, buffer);

     
  • kas1e

    kas1e - 2013-09-02

    @BSzili
    As far as i remember vsprintf cause problems on os3 (remember those DOSBASE/etc linking problems ?), but works ok on OS4 and MOS.

    But , i also remember that sucky "va_lists", so, not only good to not have vspintfs as it can cause problems for os3, but also good to not have them at all. So, i am fully ok with , if it all will works the same as it should works and will cause no problems.

     
  • BSzili

    BSzili - 2013-09-02

    I remember those, but the #ifdef __amigaos3__ was a little confusing, since it meant that vsprintf was only compiled in for os3. Anyway RawDoFmt uses an array instead of va_list, and it's an exec.library function so it should work everywhere.

     

    Last edit: BSzili 2013-09-02
  • xenic

    xenic - 2013-09-02

    @BSzili
    We temporarily replaced "vsnprintf" for OS3 in the debug file that was included with the library code that kas1e borrowed from codesets library. That debugging didn't work for us and the whole file was removed from the library compile.

    Other than that it appears that all the vsprintf are in the ftp module. I checked the gcc 2.95 includes and I see vsprintf there. My OS3 compile of the ftp module doesn't link for other reasons. I think vsprintf works with OS3, it was "vsnprintf" that doesn't exist in my OS3 Libnix.

    I suggest you take a look at the definition of "lsprintf" in the module_deps.h file in the ftp module directory. That definition was added by illia because I think MOS had a problems with varargs stuff (VARARGS68K va_list etc) used on other platforms. If you look at lsprintf.c in the init directory you will see the original lsprintf that worked for OS4 & OS3 and there an LSprintf function that might be doing the same as your direct RawDoFmt() suggestion.

    I haven't had time to look at the ftp code so I'm just mentioning some things that might have a bearing on the change you want to make. Since my OS3 compile of the ftp module doesn't link, I can't test any changes you make with OS3. You should probably get kas1e to test any changes you make to be sure it works with the OS3 version of the ftp module.

     

    Last edit: xenic 2013-09-02
  • xenic

    xenic - 2013-09-02

    @kas1e
    Did illia change the lsprintf() function to a #define and eliminate my original implementation in lsprintf.c because varargs stuff (va_list etc.) was causing problems or crashes in MOS?? If so, maybe he should take a look at all the va_list stuff in the ftp module.

    What version of GCC are you using to compile the ftp module. My OS3 compile doesn't link with GCC 2.95. For one thing, somebody changed "GetSysTime" to "gettimeofday" and the gettimeofday() function doesn't exist in GCC 2.95 Libnix. Was there a reason for that change?? I might also me missing some includes but I need to get rid of the "gettimeofday" issue before I can tell what else might be wrong.

     
  • kas1e

    kas1e - 2013-09-02

    @Xenic

    Since my OS3 compile of the ftp module doesn't link, I can't test any changes you make with OS3. You should probably get kas1e to test any changes you make to be sure it works with the OS3 version of the ftp module.

    In general os3 compile of ftp.module even never happens :) I.e. we build all the objects , but they dont links for os3 because of those "vsprintfs" , which ok for os4/mos/aros, but on os3 they leads to include libnix (but as our modules is libraries, it should be without). Because of that single function we have on os3 undefs to DOSBase, exit and some other. Once we comment them out in ftp.module (there about 4-5 places where we use them), no undefs. So, we think about replacing them on something more cross-compiler between all our oses.

    And even with such replace, you still will need our new "netincludes", which we still didn't upload to branches/files section (so its one of more archive which you will need dl, unpack to os3 sdk and add one more -I/path_to_new_netincludes). I didn't upload them because do not know how to change that os3 makefile for ftp.module so it will have "relative path" to netincludes. For example on crosscompiler i put them to /usr/local/amiga/m68k-amigaos/SDK/netinclude , and add
    -I/usr/local/amiga/m68k-amigaos/SDK/netinclude to the makefile, but its of course suck, because one want to build it on native maybe, so need something like -Ipath_to_netinclude_dir_which_will_works_everywhere.

    So, because of all of this, ftp.module now works only on os4 as it should. On aros it crashes at some other problems, on morphos it crashes just when i tried to spawn addressbook. Only os4 build works, give you ability to connect, list the files, just copy from ftp to local lister do not works. But maybe now it even works, after bszili replace that function which i comment out before via RawDoFMT.

    Version which we use its the same 2.95 as you have of course, its just your problems because of those vsnprinf functoins which want involve stuff from the library which we can't use when we do libraries.

    As for GetSysTime: Those dances with GetSysTime and gettimeofday it also was kind of test (bszili thinking about getting rid of timer.device related code, just to make it all cleaner), but in end we found that indeed, on os3 we didn't have "gettimeofday", so timer.device code should be back (for now its just commented uppear of those gettimeofday, so should be easy to revert them back, but i am sure BSzili can do it faster as he remember where all those places he change).

     

    Last edit: kas1e 2013-09-02
  • BSzili

    BSzili - 2013-09-02

    @xenic
    I took the RawDoFmt line from the definition of lsprintf. Replacing GetSysTime with gettimeofday was just an experiment, and I know it doesn't work on os3. The old code is still there commented out, I meant to change it back, but I was busy with other things.

     
  • xenic

    xenic - 2013-09-02

    @BSzili
    O.K, As soon as I get a chance, I'll change gettimeofday back and try my OS3 compile again.

     
  • kas1e

    kas1e - 2013-09-02

    @Xenic
    And you still will need fixed netincludes to be able to compile everything with right protos and so on (bszili send me something from aweb repo or so, with necessary fixes + we do one fix as well in them too).

     

Log in to post a comment.