Changeset 367 for branches/samba-3.0


Ignore:
Timestamp:
Jan 13, 2010, 7:52:51 PM (16 years ago)
Author:
Herwig Bauernfeind
Message:

_divers os2_getExePath applied to BINDIR, SBINDIR and SWATDIR in 3.0.x

Location:
branches/samba-3.0/source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/dynconfig.c

    r366 r367  
    4141 **/
    4242
    43 char const *dyn_SBINDIR = SBINDIR,
    44         *dyn_BINDIR = BINDIR,
    45         *dyn_SWATDIR = SWATDIR;
    4643
    4744#ifdef __OS2__
     45
     46/* Directory the binary was called from, same as getbindir() */
     47const char * getsbindir()
     48{
     49        static pstring buffer = "";
     50        if (!*buffer)
     51        {
     52                pstring exedir = "";
     53                if (os2_GetExePath(exedir) != 0)
     54                {
     55                        snprintf(buffer, 260, "%s", SBINDIR);
     56                } else {
     57                        snprintf(buffer, 260, "%s", exedir);
     58                }
     59        }
     60        return buffer;
     61}
     62
     63/* Directory the binary was called from, same as getsbindir() */
     64const char * getbindir()
     65{
     66        static pstring buffer = "";
     67        if (!*buffer)
     68        {
     69                pstring exedir = "";
     70                if (os2_GetExePath(exedir) != 0)
     71                {
     72                        snprintf(buffer, 260, "%s", BINDIR);
     73                } else {
     74                        snprintf(buffer, 260, "%s", exedir);
     75                }
     76        }
     77        return buffer;
     78}
     79
     80/* Directory holding the SWAT files */
     81const char * getswatdir()
     82{
     83        static pstring buffer = "";
     84        if (!*buffer)
     85        {
     86                pstring exedir = "";
     87                if (os2_GetExePath(exedir) != 0)
     88                {
     89                        snprintf(buffer, 260, "%s", SWATDIR);
     90                } else {
     91                        snprintf(buffer, 260, "%s/%s", exedir,"swat");
     92                }
     93        }
     94        return buffer;
     95}
     96
     97/* Location of smb.conf file. */
    4898const char * getconfigfile()
    4999{
     
    74124}
    75125
     126/* Log file directory */
    76127const char * getlogbase()
    77128{
     
    84135}
    85136
     137/* Directory holding lock files */
    86138const char * getlockdir()
    87139{
     
    94146}
    95147
     148/* Directory holding the pid files */
    96149const char * getpiddir()
    97150{
     
    104157}
    105158
     159/* Directory holding the private files */
    106160const char * getprivatedir()
    107161{
     
    114168}
    115169
     170/* Location of smbpasswd */
    116171const char * getsmbpasswd()
    117172{
     
    124179}
    125180
     181/* Statically configured LanMan hosts */
    126182const char * getlmhosts()
    127183{
     
    139195 * @sa lib_path() to get the path to a file inside the LIBDIR.
    140196 **/
    141 // we try to set the libdir based on the current running process
     197// SCS we try to set the libdir based on the current running process
    142198const char * getlibdir()
    143199{
     
    158214fstring dyn_SHLIBEXT = SHLIBEXT;
    159215
    160 
    161216#else
    162217
    163 pstring dyn_CONFIGFILE = CONFIGFILE; /**< Location of smb.conf file. **/
     218char const *dyn_SBINDIR = SBINDIR,
     219        *dyn_BINDIR = BINDIR,
     220        *dyn_SWATDIR = SWATDIR;
     221
     222/**< Location of smb.conf file. **/
     223pstring dyn_CONFIGFILE = CONFIGFILE;
    164224
    165225/** Log file directory. **/
  • branches/samba-3.0/source/include/dynconfig.h

    r363 r367  
    2525 **/
    2626
    27 extern char const *dyn_SBINDIR,
    28         *dyn_BINDIR,
    29         *dyn_SWATDIR;
    30 
    3127#ifdef __OS2__
     28#define dyn_SBINDIR (getsbindir())
     29#define dyn_BINDIR (getbindir())
     30#define dyn_SWATDIR (getswatdir())
    3231#define dyn_CONFIGFILE (getconfigfile())
    3332#define dyn_LOGFILEBASE (getlogbase())
     
    3938#define dyn_LIBDIR (getlibdir())
    4039#else
     40extern char const *dyn_SBINDIR,
     41        *dyn_BINDIR,
     42        *dyn_SWATDIR;
    4143extern pstring dyn_CONFIGFILE;
    4244extern pstring dyn_LOGFILEBASE, dyn_LMHOSTSFILE;
  • branches/samba-3.0/source/lib/os2path.c

    r366 r367  
    1111#include <string.h>
    1212
    13 // samba DEBUG() needs the following includes and defines
     13// Samba DEBUG() needs the following includes and defines
    1414#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
    1515#include "pstring.h"
     
    2121int os2_GetExePath(char *buff)
    2222{
    23         APIRET rc = NO_ERROR;
    24         PPIB ppib = NULL;
    25         char sExePath [_MAX_PATH];
    26         char sDrive [_MAX_PATH], sDir [_MAX_DIR];
     23        APIRET rc = NO_ERROR;
     24        PPIB ppib = NULL;
     25        char sExePath [_MAX_PATH];
     26        char sDrive [_MAX_PATH], sDir [_MAX_DIR];
    2727
    2828        // we search for the infoblock to get the module name
    29         rc = DosGetInfoBlocks(NULL, &ppib);
     29        rc = DosGetInfoBlocks(NULL, &ppib);
    3030        if (rc != NO_ERROR)
    3131        {
     
    3333        }
    3434
    35         // wit the module name we get the path (including the exe name)
    36         rc = DosQueryModuleName(ppib->pib_hmte, sizeof(sExePath), sExePath);
    37         if (rc != NO_ERROR)
    38         {
    39                 return -1;
    40         }
     35        // with the module name we get the path (including the exe name)
     36        rc = DosQueryModuleName(ppib->pib_hmte, sizeof(sExePath), sExePath);
     37        if (rc != NO_ERROR)
     38        {
     39                return -1;
     40        }
    4141
    42         // we spitt to the different values
    43         _splitpath(sExePath, sDrive, sDir, NULL, NULL);
    44         // strcat(sDrive, sDir);
    45         strncat(sDrive, sDir, strlen(sDir) -1);
    46         strcpy(buff, sDrive);
     42        // we split to the different values
     43        _splitpath(sExePath, sDrive, sDir, NULL, NULL);
     44        // strcat(sDrive, sDir);
     45        strncat(sDrive, sDir, strlen(sDir) -1);
     46        strcpy(buff, sDrive);
    4747
    4848        return 0;
  • branches/samba-3.0/source/lib/popt_common.c

    r1 r367  
    186186        case DYN_SBINDIR:
    187187                if (arg) {
     188#ifdef __OS2__
     189                        pstrcpy(dyn_SBINDIR, arg);
     190#else
    188191                        dyn_SBINDIR = SMB_STRDUP(arg);
     192#endif
    189193                }
    190194                break;
     
    192196        case DYN_BINDIR:
    193197                if (arg) {
     198#ifdef __OS2__
     199                        pstrcpy(dyn_BINDIR, arg);
     200#else
    194201                        dyn_BINDIR = SMB_STRDUP(arg);
     202#endif
    195203                }
    196204                break;
     
    198206        case DYN_SWATDIR:
    199207                if (arg) {
     208#ifdef __OS2__
     209                        pstrcpy(dyn_SWATDIR, arg);
     210#else
    200211                        dyn_SWATDIR = SMB_STRDUP(arg);
     212#endif
    201213                }
    202214                break;
Note: See TracChangeset for help on using the changeset viewer.