apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfcl...@apache.org
Subject cvs commit: apr/build jlibtool.c
Date Tue, 29 Jun 2004 15:25:56 GMT
jfclere     2004/06/29 08:25:56

  Modified:    build    jlibtool.c
  Log:
  Add support for BS2000 (_OSD_POSIX).
  
  Revision  Changes    Path
  1.3       +56 -0     apr/build/jlibtool.c
  
  Index: jlibtool.c
  ===================================================================
  RCS file: /home/cvs/apr/build/jlibtool.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- jlibtool.c	29 Jun 2004 13:44:29 -0000	1.2
  +++ jlibtool.c	29 Jun 2004 15:25:56 -0000	1.3
  @@ -53,6 +53,9 @@
    */
   
   #include <stdio.h>
  +#if defined(_OSD_POSIX)
  +#include <stdarg.h>
  +#endif
   #include <string.h>
   #include <stdlib.h>
   #include <sys/stat.h>
  @@ -123,6 +126,18 @@
   #  define LINKER_FLAG_PREFIX "-Wl,"
   #endif
   
  +#if defined(_OSD_POSIX)
  +#  define SHELL_CMD  "/usr/bin/sh"
  +#  define DYNAMIC_LIB_EXT "so"
  +#  define MODULE_LIB_EXT  "so"
  +#  define STATIC_LIB_EXT "a"
  +#  define OBJECT_EXT     "o"
  +#  define LIBRARIAN      "ar"
  +#  define LIBRARIAN_OPTS "cr"
  +#  define DYNAMIC_LINK_OPTS "-G"
  +#  define LINKER_FLAG_PREFIX "-Wl,"
  +#endif
  +
   #ifndef SHELL_CMD
   #error Unsupported platform: Please add defines for SHELL_CMD etc. for your platform.
   #endif
  @@ -217,6 +232,44 @@
       const char *version_info;
   } command_t;
   
  +#if defined(_OSD_POSIX)
  +/* Write at most n characters to the buffer in str, return the
  + * number of chars written or -1 if the buffer would have been
  + * overflowed.
  + *
  + * This is portable to any POSIX-compliant system has /dev/null
  + */
  +static FILE *f=NULL;
  +static int vsnprintf( char *str, size_t n, const char *fmt, va_list ap )
  +{
  +       int res;
  +
  +       if (f == NULL)
  +               f = fopen("/dev/null","w");
  +       if (f == NULL)
  +               return -1;
  +
  +       setvbuf( f, str, _IOFBF, n );
  +
  +       res = vfprintf( f, fmt, ap );
  +
  +       if ( res > 0 && res < n ) {
  +               res = vsprintf( str, fmt, ap );
  +       }
  +       return res;
  +}
  +static int snprintf( char *str, size_t n, const char *fmt, ... )
  +{
  +        va_list ap;
  +        int res;
  + 
  +        va_start( ap, fmt );
  +        res = vsnprintf( str, n, fmt, ap );
  +        va_end( ap );
  +        return res;
  +}
  +#endif
  +
   void init_count_chars(count_chars *cc)
   {
       cc->vals = (const char**)malloc(PATH_MAX);
  @@ -859,6 +912,9 @@
       if (!ext) {
           cmd_data->basename = arg;
           cmd_data->output = otProgram;
  +#if defined(_OSD_POSIX)
  +        cmd_data->options.pic_mode = AVOID;
  +#endif
           newarg = (char *)malloc(strlen(arg) + 5);
           strcpy(newarg, arg);
   #ifdef EXE_EXT
  
  
  

Mime
View raw message