~ubuntu-branches/ubuntu/intrepid/plplot/intrepid

« back to all changes in this revision

Viewing changes to libltdl/ltdl.c

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2006-11-04 10:19:34 UTC
  • mfrom: (2.1.8 edgy)
  • Revision ID: james.westby@ubuntu.com-20061104101934-mlirvdg4gpwi6i5q
Tags: 5.6.1-10
* Orphaning the package
* debian/control: Changed the maintainer to the Debian QA Group

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* ltdl.c -- system independent dlopen wrapper
2
 
   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
 
2
   Copyright (C) 1998, 1999, 2000, 2004, 2005  Free Software Foundation, Inc.
3
3
   Originally by Thomas Tanner <tanner@ffii.org>
4
4
   This file is part of GNU Libtool.
5
5
 
20
20
 
21
21
You should have received a copy of the GNU Lesser General Public
22
22
License along with this library; if not, write to the Free Software
23
 
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24
 
02111-1307  USA
 
23
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
24
02110-1301  USA
25
25
 
26
26
*/
27
27
 
385
385
     const lt_ptr src;
386
386
     size_t size;
387
387
{
388
 
  size_t i = 0;
 
388
  const char *  s = src;
 
389
  char *        d = dest;
 
390
  size_t        i = 0;
389
391
 
390
392
  for (i = 0; i < size; ++i)
391
393
    {
392
 
      dest[i] = src[i];
 
394
      d[i] = s[i];
393
395
    }
394
396
 
395
397
  return dest;
409
411
     const lt_ptr src;
410
412
     size_t size;
411
413
{
412
 
  size_t i;
 
414
  const char *  s = src;
 
415
  char *        d = dest;
 
416
  size_t        i;
413
417
 
414
 
  if (dest < src)
 
418
  if (d < s)
415
419
    for (i = 0; i < size; ++i)
416
420
      {
417
 
        dest[i] = src[i];
 
421
        d[i] = s[i];
418
422
      }
419
 
  else if (dest > src)
420
 
    for (i = size -1; i >= 0; --i)
 
423
  else if (d > s && size > 0)
 
424
    for (i = size -1; ; --i)
421
425
      {
422
 
        dest[i] = src[i];
 
426
        d[i] = s[i];
 
427
        if (i == 0)
 
428
          break;
423
429
      }
424
430
 
425
431
  return dest;
451
457
  DIR *entry;
452
458
 
453
459
  assert(path != (char *) NULL);
454
 
  (void) strncpy(file_specification,path,LT_FILENAME_MAX-1);
 
460
  /* allow space for: path + '\\' '\\' '*' '.' '*' + '\0' */
 
461
  (void) strncpy (file_specification, path, LT_FILENAME_MAX-6);
 
462
  file_specification[LT_FILENAME_MAX-6] = LT_EOS_CHAR;
455
463
  (void) strcat(file_specification,"\\");
456
464
  entry = LT_DLMALLOC (DIR,sizeof(DIR));
457
465
  if (entry != (DIR *) 0)
492
500
  entry->firsttime = FALSE;
493
501
  (void) strncpy(entry->file_info.d_name,entry->Win32FindData.cFileName,
494
502
    LT_FILENAME_MAX-1);
 
503
  entry->file_info.d_name[LT_FILENAME_MAX - 1] = LT_EOS_CHAR;
495
504
  entry->file_info.d_namlen = strlen(entry->file_info.d_name);
496
505
  return(&entry->file_info);
497
506
}
616
625
  assert (pargz);
617
626
  assert (pargz_len);
618
627
 
619
 
  /* Make a copy of STR, but replacing each occurence of
 
628
  /* Make a copy of STR, but replacing each occurrence of
620
629
     DELIM with '\0'.  */
621
630
  argz_len = 1+ LT_STRLEN (str);
622
631
  if (argz_len)
1052
1061
#  include <sys/dl.h>
1053
1062
#endif
1054
1063
 
 
1064
#ifdef RTLD_GLOBAL
 
1065
#  define LT_GLOBAL             RTLD_GLOBAL
 
1066
#else
 
1067
#  ifdef DL_GLOBAL
 
1068
#    define LT_GLOBAL           DL_GLOBAL
 
1069
#  endif
 
1070
#endif /* !RTLD_GLOBAL */
 
1071
#ifndef LT_GLOBAL
 
1072
#  define LT_GLOBAL             0
 
1073
#endif /* !LT_GLOBAL */
 
1074
 
1055
1075
/* We may have to define LT_LAZY_OR_NOW in the command line if we
1056
1076
   find out it does not work in some platform. */
1057
1077
#ifndef LT_LAZY_OR_NOW
1087
1107
     lt_user_data loader_data;
1088
1108
     const char *filename;
1089
1109
{
1090
 
  lt_module   module   = dlopen (filename, LT_LAZY_OR_NOW);
 
1110
  lt_module   module   = dlopen (filename, LT_GLOBAL | LT_LAZY_OR_NOW);
1091
1111
 
1092
1112
  if (!module)
1093
1113
    {
1328
1348
  if (!searchname)
1329
1349
    return 0;
1330
1350
 
1331
 
#if __CYGWIN__
1332
1351
  {
1333
 
    char wpath[MAX_PATH];
1334
 
    cygwin_conv_to_full_win32_path(searchname, wpath);
1335
 
    module = LoadLibrary(wpath);
1336
 
  }
 
1352
    /* Silence dialog from LoadLibrary on some failures.
 
1353
       No way to get the error mode, but to set it,
 
1354
       so set it twice to preserve any previous flags. */
 
1355
    UINT errormode = SetErrorMode(SEM_FAILCRITICALERRORS);
 
1356
    SetErrorMode(errormode | SEM_FAILCRITICALERRORS);
 
1357
 
 
1358
#if defined(__CYGWIN__)
 
1359
    {
 
1360
      char wpath[MAX_PATH];
 
1361
      cygwin_conv_to_full_win32_path (searchname, wpath);
 
1362
      module = LoadLibrary (wpath);
 
1363
    }
1337
1364
#else
1338
 
  module = LoadLibrary (searchname);
 
1365
    module = LoadLibrary (searchname);
1339
1366
#endif
 
1367
 
 
1368
    /* Restore the error mode. */
 
1369
    SetErrorMode(errormode);
 
1370
  }
 
1371
 
1340
1372
  LT_DLFREE (searchname);
1341
1373
 
1342
1374
  /* libltdl expects this function to fail if it is unable
2521
2553
 
2522
2554
      /* maybe it was moved to another directory */
2523
2555
      {
2524
 
          if (tryall_dlopen_module (handle,
2525
 
                                    (const char *) 0, dir, dlname) == 0)
 
2556
          if (dir && (tryall_dlopen_module (handle,
 
2557
                                    (const char *) 0, dir, dlname) == 0))
2526
2558
            return 0;
2527
2559
      }
2528
2560
    }
2849
2881
        }
2850
2882
    }
2851
2883
 
2852
 
  /* restore the old search path */
2853
 
  LT_DLFREE (user_search_path);
2854
 
  user_search_path = save_search_path;
2855
 
 
2856
 
  LT_DLMUTEX_UNLOCK ();
2857
 
 
2858
2884
  if (!depcount)
2859
2885
    {
2860
2886
      errors = 0;
2941
2967
 
2942
2968
 cleanup:
2943
2969
  LT_DLFREE (names);
 
2970
  /* restore the old search path */
 
2971
  if (user_search_path) {
 
2972
    LT_DLFREE (user_search_path);
 
2973
    user_search_path = save_search_path;
 
2974
  }
 
2975
  LT_DLMUTEX_UNLOCK ();
 
2976
 
2944
2977
#endif
2945
2978
 
2946
2979
  return errors;
2980
3013
 
2981
3014
  LT_DLFREE (*dest);
2982
3015
 
 
3016
  if (!end)
 
3017
    return 1;
 
3018
 
2983
3019
  if (len > 3 && str[0] == '\'')
2984
3020
    {
2985
3021
      tmp = LT_EMALLOC (char, end - str);
3084
3120
      ++base_name;
3085
3121
    }
3086
3122
  else
3087
 
    LT_DLMEM_REASSIGN (base_name, canonical);
 
3123
    base_name = canonical;
3088
3124
 
3089
3125
  assert (base_name && *base_name);
3090
3126
 
3517
3553
{
3518
3554
  error_t error;
3519
3555
 
3520
 
  if ((error = argz_insert (pargz, pargz_len, before, entry)))
 
3556
  /* Prior to Sep 8, 2005, newlib had a bug where argz_insert(pargz,
 
3557
     pargz_len, NULL, entry) failed with EINVAL.  */
 
3558
  if (before)
 
3559
    error = argz_insert (pargz, pargz_len, before, entry);
 
3560
  else
 
3561
    error = argz_append (pargz, pargz_len, entry, 1 + LT_STRLEN (entry));
 
3562
 
 
3563
  if (error)
3521
3564
    {
3522
3565
      switch (error)
3523
3566
        {