~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to lib/xstrtol.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* A more useful interface to strtol.
2
2
 
3
 
   Copyright (C) 1995-1996, 1998-2001, 2003-2007, 2009-2011 Free Software
 
3
   Copyright (C) 1995-1996, 1998-2001, 2003-2007, 2009-2012 Free Software
4
4
   Foundation, Inc.
5
5
 
6
6
   This program is free software: you can redistribute it and/or modify
43
43
 
44
44
#include "intprops.h"
45
45
 
 
46
/* xstrtoll.c and xstrtoull.c, which include this file, require that
 
47
   ULLONG_MAX, LLONG_MAX, LLONG_MIN are defined, but <limits.h> does not
 
48
   define them on all platforms.  */
 
49
#ifndef ULLONG_MAX
 
50
# define ULLONG_MAX TYPE_MAXIMUM (unsigned long long)
 
51
#endif
 
52
#ifndef LLONG_MAX
 
53
# define LLONG_MAX TYPE_MAXIMUM (long long int)
 
54
#endif
 
55
#ifndef LLONG_MIN
 
56
# define LLONG_MIN TYPE_MINIMUM (long long int)
 
57
#endif
 
58
 
46
59
static strtol_error
47
60
bkm_scale (__strtol_t *x, int scale_factor)
48
61
{
113
126
      err = LONGINT_OVERFLOW;
114
127
    }
115
128
 
116
 
  /* Let valid_suffixes == NULL mean `allow any suffix'.  */
 
129
  /* Let valid_suffixes == NULL mean "allow any suffix".  */
117
130
  /* FIXME: update all callers except the ones that allow suffixes
118
 
     after the number, changing last parameter NULL to `""'.  */
 
131
     after the number, changing last parameter NULL to "".  */
119
132
  if (!valid_suffixes)
120
133
    {
121
134
      *val = tmp;
136
149
 
137
150
      if (strchr (valid_suffixes, '0'))
138
151
        {
139
 
          /* The ``valid suffix'' '0' is a special flag meaning that
 
152
          /* The "valid suffix" '0' is a special flag meaning that
140
153
             an optional second suffix is allowed, which can change
141
154
             the base.  A suffix "B" (e.g. "100MB") stands for a power
142
155
             of 1000, whereas a suffix "iB" (e.g. "100MiB") stands for