~ubuntu-branches/ubuntu/vivid/parted/vivid

« back to all changes in this revision

Viewing changes to lib/localcharset.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-07-30 13:16:15 UTC
  • mfrom: (7.2.34 sid)
  • Revision ID: package-import@ubuntu.com-20140730131615-6uy87mosal6722s6
Tags: 3.2-1
* New upstream release.
* Drop currently-unused build-dependency on po4a (thanks, Johannes
  Schauer).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Determine a canonical name for the current locale's character encoding.
2
2
 
3
 
   Copyright (C) 2000-2006, 2008-2012 Free Software Foundation, Inc.
 
3
   Copyright (C) 2000-2006, 2008-2014 Free Software Foundation, Inc.
4
4
 
5
5
   This program is free software; you can redistribute it and/or modify
6
6
   it under the terms of the GNU General Public License as published by
29
29
#include <stdlib.h>
30
30
 
31
31
#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
32
 
# define DARWIN7 /* Darwin 7 or newer, i.e. MacOS X 10.3 or newer */
 
32
# define DARWIN7 /* Darwin 7 or newer, i.e. Mac OS X 10.3 or newer */
33
33
#endif
34
34
 
35
35
#if defined _WIN32 || defined __WIN32__
65
65
# include <os2.h>
66
66
#endif
67
67
 
 
68
/* For MB_CUR_MAX_L */
 
69
#if defined DARWIN7
 
70
# include <xlocale.h>
 
71
#endif
 
72
 
68
73
#if ENABLE_RELOCATABLE
69
74
# include "relocatable.h"
70
75
#else
542
547
  if (codeset[0] == '\0')
543
548
    codeset = "ASCII";
544
549
 
 
550
#ifdef DARWIN7
 
551
  /* Mac OS X sets MB_CUR_MAX to 1 when LC_ALL=C, and "UTF-8"
 
552
     (the default codeset) does not work when MB_CUR_MAX is 1.  */
 
553
  if (strcmp (codeset, "UTF-8") == 0 && MB_CUR_MAX_L (uselocale (NULL)) <= 1)
 
554
    codeset = "ASCII";
 
555
#endif
 
556
 
545
557
  return codeset;
546
558
}