summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ChangeLog-20072
-rw-r--r--lib/acl-errno-valid.c2
-rw-r--r--lib/acl-internal.c500
-rw-r--r--lib/acl-internal.h71
-rw-r--r--lib/acl.h2
-rw-r--r--lib/acl_entries.c2
-rw-r--r--lib/alignof.h2
-rw-r--r--lib/alloca.in.h2
-rw-r--r--lib/allocator.h2
-rw-r--r--lib/anytostr.c2
-rw-r--r--lib/areadlink-with-size.c2
-rw-r--r--lib/areadlink.c2
-rw-r--r--lib/areadlink.h2
-rw-r--r--lib/areadlinkat.c2
-rw-r--r--lib/argmatch.c2
-rw-r--r--lib/argmatch.h2
-rw-r--r--lib/argv-iter.c2
-rw-r--r--lib/argv-iter.h2
-rw-r--r--lib/arpa_inet.in.h2
-rw-r--r--lib/asnprintf.c2
-rw-r--r--lib/asprintf.c2
-rw-r--r--lib/assure.h37
-rw-r--r--lib/at-func.c2
-rw-r--r--lib/at-func2.c2
-rw-r--r--lib/backupfile.c2
-rw-r--r--lib/backupfile.h2
-rw-r--r--lib/base64.c2
-rw-r--r--lib/base64.h2
-rw-r--r--lib/basename-lgpl.c2
-rw-r--r--lib/basename.c2
-rw-r--r--lib/bitrotate.h2
-rw-r--r--lib/btowc.c2
-rw-r--r--lib/buffer-lcm.c2
-rw-r--r--lib/c-ctype.c2
-rw-r--r--lib/c-ctype.h2
-rw-r--r--lib/c-strcase.h2
-rw-r--r--lib/c-strcasecmp.c2
-rw-r--r--lib/c-strcaseeq.h2
-rw-r--r--lib/c-strncasecmp.c2
-rw-r--r--lib/c-strtod.c2
-rw-r--r--lib/c-strtod.h2
-rw-r--r--lib/calloc.c2
-rw-r--r--lib/canon-host.c2
-rw-r--r--lib/canon-host.h2
-rw-r--r--lib/canonicalize.c2
-rw-r--r--lib/canonicalize.h2
-rw-r--r--lib/careadlinkat.c2
-rw-r--r--lib/careadlinkat.h2
-rw-r--r--lib/chdir-long.c17
-rw-r--r--lib/chdir-long.h2
-rw-r--r--lib/chown.c2
-rw-r--r--lib/cloexec.c2
-rw-r--r--lib/cloexec.h2
-rw-r--r--lib/close-stream.c2
-rw-r--r--lib/close.c2
-rw-r--r--lib/closedir.c2
-rw-r--r--lib/closein.c2
-rw-r--r--lib/closein.h2
-rw-r--r--lib/closeout.c2
-rw-r--r--lib/closeout.h2
-rw-r--r--lib/config.charset6
-rw-r--r--lib/config.hin80
-rw-r--r--lib/copy-acl.c2
-rw-r--r--lib/creat-safer.c2
-rw-r--r--lib/ctype.in.h2
-rw-r--r--lib/cycle-check.c10
-rw-r--r--lib/cycle-check.h2
-rw-r--r--lib/di-set.c2
-rw-r--r--lib/diacrit.c2
-rw-r--r--lib/diacrit.h2
-rw-r--r--lib/dirchownmod.c2
-rw-r--r--lib/dirent--.h3
-rw-r--r--lib/dirent-private.h2
-rw-r--r--lib/dirent-safer.h2
-rw-r--r--lib/dirent.in.h4
-rw-r--r--lib/dirfd.c2
-rw-r--r--lib/dirname-lgpl.c2
-rw-r--r--lib/dirname.c2
-rw-r--r--lib/dirname.h10
-rw-r--r--lib/dosname.h2
-rw-r--r--lib/dtotimespec.c2
-rw-r--r--lib/dup-safer-flag.c2
-rw-r--r--lib/dup-safer.c2
-rw-r--r--lib/dup.c2
-rw-r--r--lib/dup2.c2
-rw-r--r--lib/errno.in.h2
-rw-r--r--lib/error.c8
-rw-r--r--lib/error.h16
-rw-r--r--lib/euidaccess.c2
-rw-r--r--lib/exclude.c4
-rw-r--r--lib/exclude.h2
-rw-r--r--lib/exitfail.c2
-rw-r--r--lib/exitfail.h2
-rw-r--r--lib/faccessat.c2
-rw-r--r--lib/fadvise.c2
-rw-r--r--lib/fadvise.h2
-rw-r--r--lib/fchdir.c8
-rw-r--r--lib/fchmodat.c2
-rw-r--r--lib/fchownat.c2
-rw-r--r--lib/fclose.c2
-rw-r--r--lib/fcntl--.h2
-rw-r--r--lib/fcntl-safer.h2
-rw-r--r--lib/fcntl.c24
-rw-r--r--lib/fcntl.in.h6
-rw-r--r--lib/fd-hook.c2
-rw-r--r--lib/fd-hook.h2
-rw-r--r--lib/fd-reopen.c2
-rw-r--r--lib/fd-reopen.h2
-rw-r--r--lib/fd-safer-flag.c2
-rw-r--r--lib/fd-safer.c2
-rw-r--r--lib/fdatasync.c2
-rw-r--r--lib/fdopen.c2
-rw-r--r--lib/fdopendir.c15
-rw-r--r--lib/fdutimensat.c2
-rw-r--r--lib/fflush.c14
-rw-r--r--lib/file-has-acl.c476
-rw-r--r--lib/file-set.c2
-rw-r--r--lib/file-type.c2
-rw-r--r--lib/file-type.h2
-rw-r--r--lib/fileblocks.c2
-rw-r--r--lib/filemode.c2
-rw-r--r--lib/filemode.h2
-rw-r--r--lib/filename.h2
-rw-r--r--lib/filenamecat-lgpl.c2
-rw-r--r--lib/filenamecat.c2
-rw-r--r--lib/filenamecat.h2
-rw-r--r--lib/filevercmp.c2
-rw-r--r--lib/filevercmp.h4
-rw-r--r--lib/float+.h2
-rw-r--r--lib/float.c2
-rw-r--r--lib/float.in.h2
-rw-r--r--lib/fnmatch.c2
-rw-r--r--lib/fnmatch.in.h2
-rw-r--r--lib/fnmatch_loop.c2
-rw-r--r--lib/fopen-safer.c2
-rw-r--r--lib/fopen.c2
-rw-r--r--lib/fpending.c2
-rw-r--r--lib/fpending.h2
-rw-r--r--lib/fprintftime.h2
-rw-r--r--lib/fpucw.h2
-rw-r--r--lib/fpurge.c8
-rw-r--r--lib/freadahead.c5
-rw-r--r--lib/freadahead.h2
-rw-r--r--lib/freading.c5
-rw-r--r--lib/freading.h2
-rw-r--r--lib/freadptr.c5
-rw-r--r--lib/freadptr.h2
-rw-r--r--lib/freadseek.c5
-rw-r--r--lib/freadseek.h2
-rw-r--r--lib/freopen-safer.c2
-rw-r--r--lib/freopen.c20
-rw-r--r--lib/frexp.c2
-rw-r--r--lib/frexpl.c2
-rw-r--r--lib/fseek.c2
-rw-r--r--lib/fseeko.c13
-rw-r--r--lib/fseterr.c5
-rw-r--r--lib/fseterr.h2
-rw-r--r--lib/fstat.c2
-rw-r--r--lib/fstatat.c2
-rw-r--r--lib/fsusage.c2
-rw-r--r--lib/fsusage.h2
-rw-r--r--lib/fsync.c2
-rw-r--r--lib/ftell.c2
-rw-r--r--lib/ftello.c2
-rw-r--r--lib/ftoastr.c2
-rw-r--r--lib/ftoastr.h2
-rw-r--r--lib/ftruncate.c2
-rw-r--r--lib/fts-cycle.c2
-rw-r--r--lib/fts.c32
-rw-r--r--lib/fts_.h10
-rw-r--r--lib/full-read.c2
-rw-r--r--lib/full-read.h3
-rw-r--r--lib/full-write.c2
-rw-r--r--lib/full-write.h2
-rw-r--r--lib/futimens.c2
-rw-r--r--lib/gai_strerror.c2
-rw-r--r--lib/get-permissions.c285
-rw-r--r--lib/getaddrinfo.c2
-rw-r--r--lib/getcwd-lgpl.c2
-rw-r--r--lib/getcwd.c10
-rw-r--r--lib/getdelim.c2
-rw-r--r--lib/getdtablesize.c40
-rw-r--r--lib/getfilecon.c3
-rw-r--r--lib/getgroups.c2
-rw-r--r--lib/gethostname.c2
-rw-r--r--lib/gethrxtime.c2
-rw-r--r--lib/gethrxtime.h2
-rw-r--r--lib/getline.c2
-rw-r--r--lib/getloadavg.c2
-rw-r--r--lib/getlogin.c2
-rw-r--r--lib/getndelim2.c2
-rw-r--r--lib/getndelim2.h2
-rw-r--r--lib/getopt.c54
-rw-r--r--lib/getopt.in.h2
-rw-r--r--lib/getopt1.c2
-rw-r--r--lib/getopt_int.h2
-rw-r--r--lib/getpagesize.c2
-rw-r--r--lib/getpass.c4
-rw-r--r--lib/getpass.h2
-rw-r--r--lib/gettext.h2
-rw-r--r--lib/gettime.c2
-rw-r--r--lib/gettimeofday.c2
-rw-r--r--lib/getugroups.c9
-rw-r--r--lib/getugroups.h2
-rw-r--r--lib/getusershell.c2
-rw-r--r--lib/gl_anylinked_list1.h48
-rw-r--r--lib/gl_anylinked_list2.h1195
-rw-r--r--lib/gl_linked_list.c64
-rw-r--r--lib/gl_linked_list.h34
-rw-r--r--lib/gl_list.c3
-rw-r--r--lib/gl_list.h841
-rw-r--r--lib/gl_openssl.h2
-rw-r--r--lib/gl_xlist.c3
-rw-r--r--lib/gl_xlist.h177
-rw-r--r--lib/glthread/lock.c2
-rw-r--r--lib/glthread/lock.h2
-rw-r--r--lib/glthread/threadlib.c2
-rw-r--r--lib/glthread/tls.c2
-rw-r--r--lib/glthread/tls.h2
-rw-r--r--lib/gnulib.mk80
-rw-r--r--lib/group-member.c2
-rw-r--r--lib/hard-locale.c2
-rw-r--r--lib/hard-locale.h2
-rw-r--r--lib/hash-pjw.c2
-rw-r--r--lib/hash-pjw.h2
-rw-r--r--lib/hash-triple.c2
-rw-r--r--lib/hash.c10
-rw-r--r--lib/hash.h6
-rw-r--r--lib/heap.c2
-rw-r--r--lib/heap.h2
-rw-r--r--lib/human.c2
-rw-r--r--lib/human.h2
-rw-r--r--lib/i-ring.c2
-rw-r--r--lib/i-ring.h2
-rw-r--r--lib/iconv.c2
-rw-r--r--lib/iconv.in.h2
-rw-r--r--lib/iconv_close.c2
-rw-r--r--lib/iconv_open.c2
-rw-r--r--lib/idcache.c2
-rw-r--r--lib/ignore-value.h2
-rw-r--r--lib/inet_ntop.c2
-rw-r--r--lib/ino-map.c2
-rw-r--r--lib/intprops.h2
-rw-r--r--lib/inttostr.h2
-rw-r--r--lib/inttypes.in.h6
-rw-r--r--lib/isapipe.c2
-rw-r--r--lib/isatty.c2
-rw-r--r--lib/isblank.c2
-rw-r--r--lib/isnan.c2
-rw-r--r--lib/isnand-nolibm.h2
-rw-r--r--lib/isnand.c2
-rw-r--r--lib/isnanf-nolibm.h2
-rw-r--r--lib/isnanf.c2
-rw-r--r--lib/isnanl-nolibm.h2
-rw-r--r--lib/isnanl.c2
-rw-r--r--lib/iswblank.c2
-rw-r--r--lib/itold.c2
-rw-r--r--lib/langinfo.in.h2
-rw-r--r--lib/lchown.c2
-rw-r--r--lib/linebuffer.c2
-rw-r--r--lib/linebuffer.h2
-rw-r--r--lib/link.c2
-rw-r--r--lib/linkat.c20
-rw-r--r--lib/localcharset.c81
-rw-r--r--lib/localcharset.h2
-rw-r--r--lib/locale.in.h2
-rw-r--r--lib/localeconv.c2
-rw-r--r--lib/long-options.c2
-rw-r--r--lib/long-options.h2
-rw-r--r--lib/lseek.c2
-rw-r--r--lib/lstat.c2
-rw-r--r--lib/malloc.c2
-rw-r--r--lib/malloca.c2
-rw-r--r--lib/malloca.h2
-rw-r--r--lib/math.in.h2
-rw-r--r--lib/mbchar.c2
-rw-r--r--lib/mbchar.h2
-rw-r--r--lib/mbiter.h2
-rw-r--r--lib/mbrlen.c2
-rw-r--r--lib/mbrtowc.c2
-rw-r--r--lib/mbsalign.c2
-rw-r--r--lib/mbsalign.h2
-rw-r--r--lib/mbscasecmp.c2
-rw-r--r--lib/mbsinit.c2
-rw-r--r--lib/mbslen.c2
-rw-r--r--lib/mbsrtowcs-impl.h2
-rw-r--r--lib/mbsrtowcs-state.c2
-rw-r--r--lib/mbsrtowcs.c2
-rw-r--r--lib/mbsstr.c2
-rw-r--r--lib/mbswidth.c2
-rw-r--r--lib/mbswidth.h2
-rw-r--r--lib/mbtowc-impl.h2
-rw-r--r--lib/mbtowc.c2
-rw-r--r--lib/mbuiter.h2
-rw-r--r--lib/md5.c2
-rw-r--r--lib/md5.h2
-rw-r--r--lib/memcasecmp.c2
-rw-r--r--lib/memcasecmp.h2
-rw-r--r--lib/memchr.c2
-rw-r--r--lib/memchr2.c2
-rw-r--r--lib/memchr2.h2
-rw-r--r--lib/memcmp2.c2
-rw-r--r--lib/memcmp2.h2
-rw-r--r--lib/memcoll.c2
-rw-r--r--lib/memcoll.h2
-rw-r--r--lib/mempcpy.c2
-rw-r--r--lib/memrchr.c2
-rw-r--r--lib/mgetgroups.c8
-rw-r--r--lib/mgetgroups.h2
-rw-r--r--lib/mkancesdirs.c2
-rw-r--r--lib/mkdir-p.c2
-rw-r--r--lib/mkdir-p.h2
-rw-r--r--lib/mkdir.c2
-rw-r--r--lib/mkfifo.c2
-rw-r--r--lib/mknod.c2
-rw-r--r--lib/mkstemp-safer.c2
-rw-r--r--lib/mkstemp.c2
-rw-r--r--lib/mktime.c2
-rw-r--r--lib/modechange.c2
-rw-r--r--lib/modechange.h2
-rw-r--r--lib/mountlist.c187
-rw-r--r--lib/mountlist.h2
-rw-r--r--lib/mpsort.c2
-rw-r--r--lib/msvc-inval.c2
-rw-r--r--lib/msvc-inval.h2
-rw-r--r--lib/msvc-nothrow.c2
-rw-r--r--lib/msvc-nothrow.h2
-rw-r--r--lib/nanosleep.c2
-rw-r--r--lib/netdb.in.h2
-rw-r--r--lib/netinet_in.in.h2
-rw-r--r--lib/nl_langinfo.c2
-rw-r--r--lib/nproc.c2
-rw-r--r--lib/nproc.h2
-rw-r--r--lib/obstack.c324
-rw-r--r--lib/obstack.h250
-rw-r--r--lib/open-safer.c2
-rw-r--r--lib/open.c2
-rw-r--r--lib/openat-die.c6
-rw-r--r--lib/openat-priv.h2
-rw-r--r--lib/openat-proc.c2
-rw-r--r--lib/openat-safer.c2
-rw-r--r--lib/openat.c2
-rw-r--r--lib/openat.h2
-rw-r--r--lib/opendir-safer.c2
-rw-r--r--lib/opendir.c2
-rw-r--r--lib/parse-datetime.c1348
-rw-r--r--lib/parse-datetime.h2
-rw-r--r--lib/parse-datetime.y6
-rw-r--r--lib/pathmax.h2
-rw-r--r--lib/physmem.c2
-rw-r--r--lib/physmem.h2
-rw-r--r--lib/pipe-safer.c2
-rw-r--r--lib/pipe.c2
-rw-r--r--lib/posixtm.c73
-rw-r--r--lib/posixtm.h2
-rw-r--r--lib/posixver.c2
-rw-r--r--lib/printf-args.c2
-rw-r--r--lib/printf-args.h2
-rw-r--r--lib/printf-frexp.c2
-rw-r--r--lib/printf-frexp.h2
-rw-r--r--lib/printf-frexpl.c2
-rw-r--r--lib/printf-frexpl.h2
-rw-r--r--lib/printf-parse.c2
-rw-r--r--lib/printf-parse.h2
-rw-r--r--lib/priv-set.c2
-rw-r--r--lib/priv-set.h2
-rw-r--r--lib/progname.c2
-rw-r--r--lib/progname.h2
-rw-r--r--lib/propername.c2
-rw-r--r--lib/propername.h12
-rw-r--r--lib/pthread.in.h2
-rw-r--r--lib/putenv.c2
-rw-r--r--lib/qcopy-acl.c544
-rw-r--r--lib/qset-acl.c641
-rw-r--r--lib/quote.h2
-rw-r--r--lib/quotearg.c2
-rw-r--r--lib/quotearg.h2
-rw-r--r--lib/raise.c2
-rw-r--r--lib/rand-isaac.c18
-rw-r--r--lib/rand-isaac.h2
-rw-r--r--lib/randint.c2
-rw-r--r--lib/randint.h2
-rw-r--r--lib/randperm.c2
-rw-r--r--lib/randread.c4
-rw-r--r--lib/randread.h2
-rw-r--r--lib/read-file.c2
-rw-r--r--lib/read-file.h2
-rw-r--r--lib/read.c2
-rw-r--r--lib/readdir.c2
-rw-r--r--lib/readlink.c2
-rw-r--r--lib/readlinkat.c56
-rw-r--r--lib/readtokens.c2
-rw-r--r--lib/readtokens.h2
-rw-r--r--lib/readtokens0.c2
-rw-r--r--lib/readtokens0.h2
-rw-r--r--lib/readutmp.c4
-rw-r--r--lib/readutmp.h4
-rw-r--r--lib/realloc.c2
-rw-r--r--lib/ref-add.sin2
-rw-r--r--lib/ref-del.sin2
-rw-r--r--lib/regcomp.c2
-rw-r--r--lib/regex.c2
-rw-r--r--lib/regex.h2
-rw-r--r--lib/regex_internal.c6
-rw-r--r--lib/regex_internal.h2
-rw-r--r--lib/regexec.c2
-rw-r--r--lib/remove.c2
-rw-r--r--lib/rename.c2
-rw-r--r--lib/rewinddir.c2
-rw-r--r--lib/rmdir.c2
-rw-r--r--lib/root-dev-ino.c2
-rw-r--r--lib/root-dev-ino.h2
-rw-r--r--lib/root-uid.h2
-rw-r--r--lib/rpmatch.c2
-rw-r--r--lib/safe-read.c2
-rw-r--r--lib/safe-read.h2
-rw-r--r--lib/safe-write.c2
-rw-r--r--lib/safe-write.h2
-rw-r--r--lib/same-inode.h2
-rw-r--r--lib/same.c2
-rw-r--r--lib/same.h2
-rw-r--r--lib/save-cwd.c2
-rw-r--r--lib/save-cwd.h2
-rw-r--r--lib/savedir.c5
-rw-r--r--lib/savedir.h2
-rw-r--r--lib/savewd.c18
-rw-r--r--lib/savewd.h4
-rw-r--r--lib/sched.in.h9
-rw-r--r--lib/se-selinux.in.h2
-rw-r--r--lib/secure_getenv.c2
-rw-r--r--lib/select.c2
-rw-r--r--lib/selinux-at.c2
-rw-r--r--lib/selinux-at.h2
-rw-r--r--lib/set-acl.c2
-rw-r--r--lib/set-permissions.c833
-rw-r--r--lib/setenv.c2
-rw-r--r--lib/settime.c2
-rw-r--r--lib/sha1.c2
-rw-r--r--lib/sha1.h2
-rw-r--r--lib/sha256.c2
-rw-r--r--lib/sha256.h2
-rw-r--r--lib/sha512.c2
-rw-r--r--lib/sha512.h2
-rw-r--r--lib/sig-handler.h4
-rw-r--r--lib/sig2str.c2
-rw-r--r--lib/sig2str.h2
-rw-r--r--lib/sigaction.c2
-rw-r--r--lib/siglist.h2
-rw-r--r--lib/signal.in.h10
-rw-r--r--lib/signbitd.c2
-rw-r--r--lib/signbitf.c2
-rw-r--r--lib/signbitl.c2
-rw-r--r--lib/sigprocmask.c2
-rw-r--r--lib/size_max.h2
-rw-r--r--lib/smack.h2
-rw-r--r--lib/snprintf.c2
-rw-r--r--lib/sockets.c2
-rw-r--r--lib/sockets.h2
-rw-r--r--lib/stat-size.h2
-rw-r--r--lib/stat-time.h18
-rw-r--r--lib/stat.c2
-rw-r--r--lib/stdalign.in.h7
-rw-r--r--lib/stdarg.in.h2
-rw-r--r--lib/stdbool.in.h2
-rw-r--r--lib/stddef.in.h54
-rw-r--r--lib/stdint.in.h2
-rw-r--r--lib/stdio--.h2
-rw-r--r--lib/stdio-impl.h7
-rw-r--r--lib/stdio-safer.h2
-rw-r--r--lib/stdio.in.h12
-rw-r--r--lib/stdlib--.h2
-rw-r--r--lib/stdlib-safer.h2
-rw-r--r--lib/stdlib.in.h25
-rw-r--r--lib/stpcpy.c2
-rw-r--r--lib/stpncpy.c2
-rw-r--r--lib/str-kmp.h2
-rw-r--r--lib/str-two-way.h2
-rw-r--r--lib/strdup.c2
-rw-r--r--lib/streq.h2
-rw-r--r--lib/strerror-override.c2
-rw-r--r--lib/strerror-override.h2
-rw-r--r--lib/strerror.c2
-rw-r--r--lib/strftime.c2
-rw-r--r--lib/strftime.h2
-rw-r--r--lib/striconv.c2
-rw-r--r--lib/striconv.h2
-rw-r--r--lib/string.in.h23
-rw-r--r--lib/strintcmp.c2
-rw-r--r--lib/stripslash.c2
-rw-r--r--lib/strncat.c2
-rw-r--r--lib/strndup.c2
-rw-r--r--lib/strnlen.c2
-rw-r--r--lib/strnlen1.c2
-rw-r--r--lib/strnlen1.h2
-rw-r--r--lib/strnumcmp-in.h2
-rw-r--r--lib/strnumcmp.c2
-rw-r--r--lib/strpbrk.c2
-rw-r--r--lib/strsignal.c2
-rw-r--r--lib/strstr.c2
-rw-r--r--lib/strtod.c2
-rw-r--r--lib/strtoimax.c2
-rw-r--r--lib/strtol.c2
-rw-r--r--lib/strtoll.c2
-rw-r--r--lib/strtoul.c2
-rw-r--r--lib/strtoull.c2
-rw-r--r--lib/symlink.c2
-rw-r--r--lib/sys_ioctl.in.h2
-rw-r--r--lib/sys_resource.in.h2
-rw-r--r--lib/sys_select.in.h17
-rw-r--r--lib/sys_socket.in.h2
-rw-r--r--lib/sys_stat.in.h2
-rw-r--r--lib/sys_time.in.h2
-rw-r--r--lib/sys_types.in.h2
-rw-r--r--lib/sys_uio.in.h2
-rw-r--r--lib/sys_utsname.in.h2
-rw-r--r--lib/sys_wait.in.h2
-rw-r--r--lib/tempname.c135
-rw-r--r--lib/tempname.h20
-rw-r--r--lib/termios.in.h2
-rw-r--r--lib/time.in.h4
-rw-r--r--lib/time_r.c2
-rw-r--r--lib/timespec.h6
-rw-r--r--lib/trim.c2
-rw-r--r--lib/trim.h2
-rw-r--r--lib/u64.h2
-rw-r--r--lib/uname.c2
-rw-r--r--lib/unicodeio.c2
-rw-r--r--lib/unicodeio.h2
-rw-r--r--lib/unistd--.h2
-rw-r--r--lib/unistd-safer.h2
-rw-r--r--lib/unistd.in.h39
-rw-r--r--lib/unistr.in.h2
-rw-r--r--lib/unistr/u8-mbtoucr.c2
-rw-r--r--lib/unistr/u8-uctomb-aux.c2
-rw-r--r--lib/unistr/u8-uctomb.c2
-rw-r--r--lib/unitypes.in.h2
-rw-r--r--lib/uniwidth.in.h2
-rw-r--r--lib/uniwidth/cjk.h2
-rw-r--r--lib/uniwidth/width.c152
-rw-r--r--lib/unlink.c2
-rw-r--r--lib/unlinkat.c23
-rw-r--r--lib/unlocked-io.h2
-rw-r--r--lib/unsetenv.c2
-rw-r--r--lib/userspec.c4
-rw-r--r--lib/utimecmp.c2
-rw-r--r--lib/utimecmp.h2
-rw-r--r--lib/utimens.c4
-rw-r--r--lib/utimens.h2
-rw-r--r--lib/utimensat.c2
-rw-r--r--lib/vasnprintf.c199
-rw-r--r--lib/vasnprintf.h2
-rw-r--r--lib/vasprintf.c2
-rw-r--r--lib/verify.h2
-rw-r--r--lib/verror.c2
-rw-r--r--lib/verror.h2
-rw-r--r--lib/version-etc-fsf.c2
-rw-r--r--lib/version-etc.c4
-rw-r--r--lib/version-etc.h2
-rw-r--r--lib/vfprintf.c2
-rw-r--r--lib/vprintf.c2
-rw-r--r--lib/w32sock.h2
-rw-r--r--lib/wchar.in.h11
-rw-r--r--lib/wcrtomb.c2
-rw-r--r--lib/wcswidth-impl.h2
-rw-r--r--lib/wcswidth.c2
-rw-r--r--lib/wctype.in.h2
-rw-r--r--lib/wcwidth.c2
-rw-r--r--lib/write-any-file.c2
-rw-r--r--lib/write.c2
-rw-r--r--lib/xalloc-die.c2
-rw-r--r--lib/xalloc-oversized.h2
-rw-r--r--lib/xalloc.h6
-rw-r--r--lib/xasprintf.c2
-rw-r--r--lib/xdectoimax.c6
-rw-r--r--lib/xdectoint.c86
-rw-r--r--lib/xdectoint.h36
-rw-r--r--lib/xdectoumax.c6
-rw-r--r--lib/xfreopen.c2
-rw-r--r--lib/xfts.c2
-rw-r--r--lib/xgetcwd.c2
-rw-r--r--lib/xgetcwd.h2
-rw-r--r--lib/xgetgroups.c2
-rw-r--r--lib/xgethostname.c2
-rw-r--r--lib/xmalloc.c2
-rw-r--r--lib/xmemcoll.c2
-rw-r--r--lib/xnanosleep.c2
-rw-r--r--lib/xprintf.c2
-rw-r--r--lib/xprintf.h2
-rw-r--r--lib/xreadlink.c2
-rw-r--r--lib/xreadlink.h2
-rw-r--r--lib/xsize.h2
-rw-r--r--lib/xstriconv.c2
-rw-r--r--lib/xstriconv.h2
-rw-r--r--lib/xstrndup.c2
-rw-r--r--lib/xstrndup.h2
-rw-r--r--lib/xstrtod.c2
-rw-r--r--lib/xstrtod.h2
-rw-r--r--lib/xstrtol-error.c2
-rw-r--r--lib/xstrtol.c9
-rw-r--r--lib/xstrtol.h2
-rw-r--r--lib/xtime.h2
-rw-r--r--lib/xvasprintf.c2
-rw-r--r--lib/xvasprintf.h2
-rw-r--r--lib/yesno.c7
-rw-r--r--lib/yesno.h2
605 files changed, 6905 insertions, 3790 deletions
diff --git a/lib/ChangeLog-2007 b/lib/ChangeLog-2007
index f9bd37ff..8e6f1765 100644
--- a/lib/ChangeLog-2007
+++ b/lib/ChangeLog-2007
@@ -8746,7 +8746,7 @@
-----
- Copyright (C) 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2015 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice
diff --git a/lib/acl-errno-valid.c b/lib/acl-errno-valid.c
index 3287382e..a64d3d3b 100644
--- a/lib/acl-errno-valid.c
+++ b/lib/acl-errno-valid.c
@@ -1,6 +1,6 @@
/* Test whether ACLs are well supported on this system.
- Copyright 2013-2014 Free Software Foundation, Inc.
+ Copyright 2013-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/acl-internal.c b/lib/acl-internal.c
new file mode 100644
index 00000000..1a2f8c44
--- /dev/null
+++ b/lib/acl-internal.c
@@ -0,0 +1,500 @@
+/* Test whether a file has a nontrivial access control list.
+
+ Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible. */
+
+#include <config.h>
+
+#include "acl.h"
+
+#include "acl-internal.h"
+
+#if USE_ACL && HAVE_ACL_GET_FILE
+
+# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
+
+/* ACL is an ACL, from a file, stored as type ACL_TYPE_EXTENDED.
+ Return 1 if the given ACL is non-trivial.
+ Return 0 if it is trivial. */
+int
+acl_extended_nontrivial (acl_t acl)
+{
+ /* acl is non-trivial if it is non-empty. */
+ return (acl_entries (acl) > 0);
+}
+
+# else /* Linux, FreeBSD, IRIX, Tru64 */
+
+/* ACL is an ACL, from a file, stored as type ACL_TYPE_ACCESS.
+ Return 1 if the given ACL is non-trivial.
+ Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.
+ Return -1 and set errno upon failure to determine it. */
+int
+acl_access_nontrivial (acl_t acl)
+{
+ /* acl is non-trivial if it has some entries other than for "user::",
+ "group::", and "other::". Normally these three should be present
+ at least, allowing us to write
+ return (3 < acl_entries (acl));
+ but the following code is more robust. */
+# if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD */
+
+ acl_entry_t ace;
+ int got_one;
+
+ for (got_one = acl_get_entry (acl, ACL_FIRST_ENTRY, &ace);
+ got_one > 0;
+ got_one = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace))
+ {
+ acl_tag_t tag;
+ if (acl_get_tag_type (ace, &tag) < 0)
+ return -1;
+ if (!(tag == ACL_USER_OBJ || tag == ACL_GROUP_OBJ || tag == ACL_OTHER))
+ return 1;
+ }
+ return got_one;
+
+# elif HAVE_ACL_TO_SHORT_TEXT /* IRIX */
+ /* Don't use acl_get_entry: it is undocumented. */
+
+ int count = acl->acl_cnt;
+ int i;
+
+ for (i = 0; i < count; i++)
+ {
+ acl_entry_t ace = &acl->acl_entry[i];
+ acl_tag_t tag = ace->ae_tag;
+
+ if (!(tag == ACL_USER_OBJ || tag == ACL_GROUP_OBJ
+ || tag == ACL_OTHER_OBJ))
+ return 1;
+ }
+ return 0;
+
+# elif HAVE_ACL_FREE_TEXT /* Tru64 */
+ /* Don't use acl_get_entry: it takes only one argument and does not work. */
+
+ int count = acl->acl_num;
+ acl_entry_t ace;
+
+ for (ace = acl->acl_first; count > 0; ace = ace->next, count--)
+ {
+ acl_tag_t tag;
+ acl_perm_t perm;
+
+ tag = ace->entry->acl_type;
+ if (!(tag == ACL_USER_OBJ || tag == ACL_GROUP_OBJ || tag == ACL_OTHER))
+ return 1;
+
+ perm = ace->entry->acl_perm;
+ /* On Tru64, perm can also contain non-standard bits such as
+ PERM_INSERT, PERM_DELETE, PERM_MODIFY, PERM_LOOKUP, ... */
+ if ((perm & ~(ACL_READ | ACL_WRITE | ACL_EXECUTE)) != 0)
+ return 1;
+ }
+ return 0;
+
+# else
+
+ errno = ENOSYS;
+ return -1;
+# endif
+}
+
+# endif
+
+#elif USE_ACL && HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
+
+/* Test an ACL retrieved with GETACL.
+ Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
+ Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
+int
+acl_nontrivial (int count, aclent_t *entries)
+{
+ int i;
+
+ for (i = 0; i < count; i++)
+ {
+ aclent_t *ace = &entries[i];
+
+ /* Note: If ace->a_type = USER_OBJ, ace->a_id is the st_uid from stat().
+ If ace->a_type = GROUP_OBJ, ace->a_id is the st_gid from stat().
+ We don't need to check ace->a_id in these cases. */
+ if (!(ace->a_type == USER_OBJ
+ || ace->a_type == GROUP_OBJ
+ || ace->a_type == OTHER_OBJ
+ /* Note: Cygwin does not return a CLASS_OBJ ("mask:") entry
+ sometimes. */
+ || ace->a_type == CLASS_OBJ))
+ return 1;
+ }
+ return 0;
+}
+
+# ifdef ACE_GETACL
+
+/* A shortcut for a bitmask. */
+# define NEW_ACE_WRITEA_DATA (NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA)
+
+/* Test an ACL retrieved with ACE_GETACL.
+ Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
+ Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
+int
+acl_ace_nontrivial (int count, ace_t *entries)
+{
+ int i;
+
+ /* The flags in the ace_t structure changed in a binary incompatible way
+ when ACL_NO_TRIVIAL etc. were introduced in <sys/acl.h> version 1.15.
+ How to distinguish the two conventions at runtime?
+ In the old convention, usually three ACEs have a_flags = ACE_OWNER /
+ ACE_GROUP / ACE_OTHER, in the range 0x0100..0x0400. In the new
+ convention, these values are not used. */
+ int old_convention = 0;
+
+ for (i = 0; i < count; i++)
+ if (entries[i].a_flags & (OLD_ACE_OWNER | OLD_ACE_GROUP | OLD_ACE_OTHER))
+ {
+ old_convention = 1;
+ break;
+ }
+
+ if (old_convention)
+ /* Running on Solaris 10. */
+ for (i = 0; i < count; i++)
+ {
+ ace_t *ace = &entries[i];
+
+ /* Note:
+ If ace->a_flags = ACE_OWNER, ace->a_who is the st_uid from stat().
+ If ace->a_flags = ACE_GROUP, ace->a_who is the st_gid from stat().
+ We don't need to check ace->a_who in these cases. */
+ if (!(ace->a_type == OLD_ALLOW
+ && (ace->a_flags == OLD_ACE_OWNER
+ || ace->a_flags == OLD_ACE_GROUP
+ || ace->a_flags == OLD_ACE_OTHER)))
+ return 1;
+ }
+ else
+ {
+ /* Running on Solaris 10 (newer version) or Solaris 11. */
+ unsigned int access_masks[6] =
+ {
+ 0, /* owner@ deny */
+ 0, /* owner@ allow */
+ 0, /* group@ deny */
+ 0, /* group@ allow */
+ 0, /* everyone@ deny */
+ 0 /* everyone@ allow */
+ };
+
+ for (i = 0; i < count; i++)
+ {
+ ace_t *ace = &entries[i];
+ unsigned int index1;
+ unsigned int index2;
+
+ if (ace->a_type == NEW_ACE_ACCESS_ALLOWED_ACE_TYPE)
+ index1 = 1;
+ else if (ace->a_type == NEW_ACE_ACCESS_DENIED_ACE_TYPE)
+ index1 = 0;
+ else
+ return 1;
+
+ if (ace->a_flags == NEW_ACE_OWNER)
+ index2 = 0;
+ else if (ace->a_flags == (NEW_ACE_GROUP | NEW_ACE_IDENTIFIER_GROUP))
+ index2 = 2;
+ else if (ace->a_flags == NEW_ACE_EVERYONE)
+ index2 = 4;
+ else
+ return 1;
+
+ access_masks[index1 + index2] |= ace->a_access_mask;
+ }
+
+ /* The same bit shouldn't be both allowed and denied. */
+ if (access_masks[0] & access_masks[1])
+ return 1;
+ if (access_masks[2] & access_masks[3])
+ return 1;
+ if (access_masks[4] & access_masks[5])
+ return 1;
+
+ /* Check minimum masks. */
+ if ((NEW_ACE_WRITE_NAMED_ATTRS
+ | NEW_ACE_WRITE_ATTRIBUTES
+ | NEW_ACE_WRITE_ACL
+ | NEW_ACE_WRITE_OWNER)
+ & ~ access_masks[1])
+ return 1;
+ access_masks[1] &= ~(NEW_ACE_WRITE_NAMED_ATTRS
+ | NEW_ACE_WRITE_ATTRIBUTES
+ | NEW_ACE_WRITE_ACL
+ | NEW_ACE_WRITE_OWNER);
+ if ((NEW_ACE_READ_NAMED_ATTRS
+ | NEW_ACE_READ_ATTRIBUTES
+ | NEW_ACE_READ_ACL
+ | NEW_ACE_SYNCHRONIZE)
+ & ~ access_masks[5])
+ return 1;
+ access_masks[5] &= ~(NEW_ACE_READ_NAMED_ATTRS
+ | NEW_ACE_READ_ATTRIBUTES
+ | NEW_ACE_READ_ACL
+ | NEW_ACE_SYNCHRONIZE);
+
+ /* Check the allowed or denied bits. */
+ switch ((access_masks[0] | access_masks[1])
+ & ~(NEW_ACE_READ_NAMED_ATTRS
+ | NEW_ACE_READ_ATTRIBUTES
+ | NEW_ACE_READ_ACL
+ | NEW_ACE_SYNCHRONIZE))
+ {
+ case 0:
+ case NEW_ACE_READ_DATA:
+ case NEW_ACE_WRITEA_DATA:
+ case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA:
+ case NEW_ACE_EXECUTE:
+ case NEW_ACE_READ_DATA | NEW_ACE_EXECUTE:
+ case NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
+ case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
+ break;
+ default:
+ return 1;
+ }
+ switch ((access_masks[2] | access_masks[3])
+ & ~(NEW_ACE_READ_NAMED_ATTRS
+ | NEW_ACE_READ_ATTRIBUTES
+ | NEW_ACE_READ_ACL
+ | NEW_ACE_SYNCHRONIZE))
+ {
+ case 0:
+ case NEW_ACE_READ_DATA:
+ case NEW_ACE_WRITEA_DATA:
+ case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA:
+ case NEW_ACE_EXECUTE:
+ case NEW_ACE_READ_DATA | NEW_ACE_EXECUTE:
+ case NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
+ case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
+ break;
+ default:
+ return 1;
+ }
+ switch ((access_masks[4] | access_masks[5])
+ & ~(NEW_ACE_WRITE_NAMED_ATTRS
+ | NEW_ACE_WRITE_ATTRIBUTES
+ | NEW_ACE_WRITE_ACL
+ | NEW_ACE_WRITE_OWNER))
+ {
+ case 0:
+ case NEW_ACE_READ_DATA:
+ case NEW_ACE_WRITEA_DATA:
+ case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA:
+ case NEW_ACE_EXECUTE:
+ case NEW_ACE_READ_DATA | NEW_ACE_EXECUTE:
+ case NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
+ case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
+ break;
+ default:
+ return 1;
+ }
+
+ /* Check that the NEW_ACE_WRITE_DATA and NEW_ACE_APPEND_DATA bits are
+ either both allowed or both denied. */
+ if (((access_masks[0] & NEW_ACE_WRITE_DATA) != 0)
+ != ((access_masks[0] & NEW_ACE_APPEND_DATA) != 0))
+ return 1;
+ if (((access_masks[2] & NEW_ACE_WRITE_DATA) != 0)
+ != ((access_masks[2] & NEW_ACE_APPEND_DATA) != 0))
+ return 1;
+ if (((access_masks[4] & NEW_ACE_WRITE_DATA) != 0)
+ != ((access_masks[4] & NEW_ACE_APPEND_DATA) != 0))
+ return 1;
+ }
+
+ return 0;
+}
+
+# endif
+
+#elif USE_ACL && HAVE_GETACL /* HP-UX */
+
+/* Return 1 if the given ACL is non-trivial.
+ Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
+int
+acl_nontrivial (int count, struct acl_entry *entries)
+{
+ int i;
+
+ if (count > 3)
+ return 1;
+
+ for (i = 0; i < count; i++)
+ {
+ struct acl_entry *ace = &entries[i];
+
+ if (ace->uid != ACL_NSUSER && ace->gid != ACL_NSGROUP)
+ return 1;
+ }
+ return 0;
+}
+
+# if HAVE_ACLV_H /* HP-UX >= 11.11 */
+
+/* Return 1 if the given ACL is non-trivial.
+ Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
+int
+aclv_nontrivial (int count, struct acl *entries)
+{
+ int i;
+
+ for (i = 0; i < count; i++)
+ {
+ struct acl *ace = &entries[i];
+
+ /* Note: If ace->a_type = USER_OBJ, ace->a_id is the st_uid from stat().
+ If ace->a_type = GROUP_OBJ, ace->a_id is the st_gid from stat().
+ We don't need to check ace->a_id in these cases. */
+ if (!(ace->a_type == USER_OBJ /* no need to check ace->a_id here */
+ || ace->a_type == GROUP_OBJ /* no need to check ace->a_id here */
+ || ace->a_type == CLASS_OBJ
+ || ace->a_type == OTHER_OBJ))
+ return 1;
+ }
+ return 0;
+}
+
+# endif
+
+#elif USE_ACL && (HAVE_ACLX_GET || HAVE_STATACL) /* AIX */
+
+/* Return 1 if the given ACL is non-trivial.
+ Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
+int
+acl_nontrivial (struct acl *a)
+{
+ /* The normal way to iterate through an ACL is like this:
+ struct acl_entry *ace;
+ for (ace = a->acl_ext; ace != acl_last (a); ace = acl_nxt (ace))
+ {
+ struct ace_id *aei;
+ switch (ace->ace_type)
+ {
+ case ACC_PERMIT:
+ case ACC_DENY:
+ case ACC_SPECIFY:
+ ...;
+ }
+ for (aei = ace->ace_id; aei != id_last (ace); aei = id_nxt (aei))
+ ...
+ }
+ */
+ return (acl_last (a) != a->acl_ext ? 1 : 0);
+}
+
+# if HAVE_ACLX_GET && defined ACL_AIX_WIP /* newer AIX */
+
+/* Return 1 if the given ACL is non-trivial.
+ Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
+int
+acl_nfs4_nontrivial (nfs4_acl_int_t *a)
+{
+# if 1 /* let's try this first */
+ return (a->aclEntryN > 0 ? 1 : 0);
+# else
+ int count = a->aclEntryN;
+ int i;
+
+ for (i = 0; i < count; i++)
+ {
+ nfs4_ace_int_t *ace = &a->aclEntry[i];
+
+ if (!((ace->flags & ACE4_ID_SPECIAL) != 0
+ && (ace->aceWho.special_whoid == ACE4_WHO_OWNER
+ || ace->aceWho.special_whoid == ACE4_WHO_GROUP
+ || ace->aceWho.special_whoid == ACE4_WHO_EVERYONE)
+ && ace->aceType == ACE4_ACCESS_ALLOWED_ACE_TYPE
+ && ace->aceFlags == 0
+ && (ace->aceMask & ~(ACE4_READ_DATA | ACE4_LIST_DIRECTORY
+ | ACE4_WRITE_DATA | ACE4_ADD_FILE
+ | ACE4_EXECUTE)) == 0))
+ return 1;
+ }
+ return 0;
+# endif
+}
+
+# endif
+
+#elif USE_ACL && HAVE_ACLSORT /* NonStop Kernel */
+
+/* Test an ACL retrieved with ACL_GET.
+ Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
+ Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
+int
+acl_nontrivial (int count, struct acl *entries)
+{
+ int i;
+
+ for (i = 0; i < count; i++)
+ {
+ struct acl *ace = &entries[i];
+
+ /* Note: If ace->a_type = USER_OBJ, ace->a_id is the st_uid from stat().
+ If ace->a_type = GROUP_OBJ, ace->a_id is the st_gid from stat().
+ We don't need to check ace->a_id in these cases. */
+ if (!(ace->a_type == USER_OBJ /* no need to check ace->a_id here */
+ || ace->a_type == GROUP_OBJ /* no need to check ace->a_id here */
+ || ace->a_type == CLASS_OBJ
+ || ace->a_type == OTHER_OBJ))
+ return 1;
+ }
+ return 0;
+}
+
+#endif
+
+void
+free_permission_context (struct permission_context *ctx)
+{
+#ifdef USE_ACL
+# if HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
+ if (ctx->acl)
+ acl_free (ctx->acl);
+# if !HAVE_ACL_TYPE_EXTENDED
+ if (ctx->default_acl)
+ acl_free (ctx->default_acl);
+# endif
+
+# elif defined GETACL /* Solaris, Cygwin */
+ free (ctx->entries);
+# ifdef ACE_GETACL
+ free (ctx->ace_entries);
+# endif
+
+# elif HAVE_GETACL /* HP-UX */
+
+# if HAVE_ACLV_H
+# endif
+
+# elif HAVE_STATACL /* older AIX */
+
+# elif HAVE_ACLSORT /* NonStop Kernel */
+
+# endif
+#endif
+}
diff --git a/lib/acl-internal.h b/lib/acl-internal.h
index b2380068..4f042adc 100644
--- a/lib/acl-internal.h
+++ b/lib/acl-internal.h
@@ -1,6 +1,6 @@
/* Internal implementation of access control lists.
- Copyright (C) 2002-2003, 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -127,18 +127,13 @@ rpl_acl_set_fd (int fd, acl_t acl)
# define acl_extended_file(name) (-1)
# endif
-/* Linux-specific */
-# ifndef HAVE_ACL_FROM_MODE
-# define HAVE_ACL_FROM_MODE false
-# define acl_from_mode(mode) (NULL)
+# if ! defined HAVE_ACL_FROM_MODE && ! defined HAVE_ACL_FROM_TEXT
+# define acl_from_mode (NULL)
# endif
-/* Set to 1 if a file's mode is implicit by the ACL.
- Set to 0 if a file's mode is stored independently from the ACL. */
+/* Set to 0 if a file's mode is stored independently from the ACL. */
# if (HAVE_ACL_COPY_EXT_NATIVE && HAVE_ACL_CREATE_ENTRY_NP) || defined __sgi /* Mac OS X, IRIX */
# define MODE_INSIDE_ACL 0
-# else
-# define MODE_INSIDE_ACL 1
# endif
/* Return the number of entries in ACL.
@@ -164,12 +159,9 @@ extern int acl_access_nontrivial (acl_t);
# elif HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
-/* Set to 1 if a file's mode is implicit by the ACL.
- Set to 0 if a file's mode is stored independently from the ACL. */
+/* Set to 0 if a file's mode is stored independently from the ACL. */
# if defined __CYGWIN__ /* Cygwin */
# define MODE_INSIDE_ACL 0
-# else /* Solaris */
-# define MODE_INSIDE_ACL 1
# endif
/* Return 1 if the given ACL is non-trivial.
@@ -220,7 +212,7 @@ extern int acl_ace_nontrivial (int count, ace_t *entries) _GL_ATTRIBUTE_PURE;
/* Return 1 if the given ACL is non-trivial.
Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
-extern int acl_nontrivial (int count, struct acl_entry *entries, struct stat *sb);
+extern int acl_nontrivial (int count, struct acl_entry *entries);
# if HAVE_ACLV_H /* HP-UX >= 11.11 */
@@ -248,6 +240,57 @@ extern int acl_nontrivial (int count, struct acl *entries);
# endif
+/* Set to 1 if a file's mode is implicit by the ACL. */
+# ifndef MODE_INSIDE_ACL
+# define MODE_INSIDE_ACL 1
+# endif
+
+#endif
+
+struct permission_context {
+ mode_t mode;
+#ifdef USE_ACL
+# if HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
+ acl_t acl;
+# if !HAVE_ACL_TYPE_EXTENDED
+ acl_t default_acl;
+# endif
+ bool acls_not_supported;
+
+# elif defined GETACL /* Solaris, Cygwin */
+ int count;
+ aclent_t *entries;
+# ifdef ACE_GETACL
+ int ace_count;
+ ace_t *ace_entries;
+# endif
+
+# elif HAVE_GETACL /* HP-UX */
+ struct acl_entry entries[NACLENTRIES];
+ int count;
+# if HAVE_ACLV_H
+ struct acl aclv_entries[NACLVENTRIES];
+ int aclv_count;
+# endif
+
+# elif HAVE_STATACL /* older AIX */
+ union { struct acl a; char room[4096]; } u;
+ bool have_u;
+
+# elif HAVE_ACLSORT /* NonStop Kernel */
+ struct acl entries[NACLENTRIES];
+ int count;
+
+# endif
+#endif
+};
+
+int get_permissions (const char *, int, mode_t, struct permission_context *);
+int set_permissions (struct permission_context *, const char *, int);
+void free_permission_context (struct permission_context *)
+#if ! (defined USE_ACL && (HAVE_ACL_GET_FILE || defined GETACL))
+ _GL_ATTRIBUTE_CONST
#endif
+ ;
_GL_INLINE_HEADER_END
diff --git a/lib/acl.h b/lib/acl.h
index f67e350d..88ea08d8 100644
--- a/lib/acl.h
+++ b/lib/acl.h
@@ -1,6 +1,6 @@
/* acl.c - access control lists
- Copyright (C) 2002, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/acl_entries.c b/lib/acl_entries.c
index 39d6b28f..936a1318 100644
--- a/lib/acl_entries.c
+++ b/lib/acl_entries.c
@@ -1,6 +1,6 @@
/* Return the number of entries in an ACL.
- Copyright (C) 2002-2003, 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/alignof.h b/lib/alignof.h
index 9d161dfb..be53fa50 100644
--- a/lib/alignof.h
+++ b/lib/alignof.h
@@ -1,5 +1,5 @@
/* Determine alignment of types.
- Copyright (C) 2003-2004, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2004, 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/alloca.in.h b/lib/alloca.in.h
index 5de9aaab..906fe923 100644
--- a/lib/alloca.in.h
+++ b/lib/alloca.in.h
@@ -1,6 +1,6 @@
/* Memory allocation on the stack.
- Copyright (C) 1995, 1999, 2001-2004, 2006-2014 Free Software Foundation,
+ Copyright (C) 1995, 1999, 2001-2004, 2006-2015 Free Software Foundation,
Inc.
This program is free software; you can redistribute it and/or modify it
diff --git a/lib/allocator.h b/lib/allocator.h
index 0904b321..c7c851f9 100644
--- a/lib/allocator.h
+++ b/lib/allocator.h
@@ -1,6 +1,6 @@
/* Memory allocators such as malloc+free.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/anytostr.c b/lib/anytostr.c
index 011a31fa..fb1e2158 100644
--- a/lib/anytostr.c
+++ b/lib/anytostr.c
@@ -1,6 +1,6 @@
/* anytostr.c -- convert integers to printable strings
- Copyright (C) 2001, 2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/areadlink-with-size.c b/lib/areadlink-with-size.c
index 161d4743..e3a8c503 100644
--- a/lib/areadlink-with-size.c
+++ b/lib/areadlink-with-size.c
@@ -1,7 +1,7 @@
/* readlink wrapper to return the link name in malloc'd storage.
Unlike xreadlink and xreadlink_with_size, don't ever call exit.
- Copyright (C) 2001, 2003-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/areadlink.c b/lib/areadlink.c
index b4b856c5..248cc6bb 100644
--- a/lib/areadlink.c
+++ b/lib/areadlink.c
@@ -1,7 +1,7 @@
/* areadlink.c -- readlink wrapper to return the link name in malloc'd storage
Unlike xreadlink and xreadlink_with_size, don't ever call exit.
- Copyright (C) 2001, 2003-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/areadlink.h b/lib/areadlink.h
index 59abb37c..d9e0fa14 100644
--- a/lib/areadlink.h
+++ b/lib/areadlink.h
@@ -1,6 +1,6 @@
/* Read symbolic links without size limitation.
- Copyright (C) 2001, 2003-2004, 2007, 2009-2014 Free Software Foundation,
+ Copyright (C) 2001, 2003-2004, 2007, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/areadlinkat.c b/lib/areadlinkat.c
index 9e1a9597..b639056a 100644
--- a/lib/areadlinkat.c
+++ b/lib/areadlinkat.c
@@ -1,7 +1,7 @@
/* areadlinkat.c -- readlinkat wrapper to return malloc'd link name
Unlike xreadlinkat, only call exit on failure to change directory.
- Copyright (C) 2001, 2003-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/argmatch.c b/lib/argmatch.c
index f56ab55f..0e452bd1 100644
--- a/lib/argmatch.c
+++ b/lib/argmatch.c
@@ -1,6 +1,6 @@
/* argmatch.c -- find a match for a string in an array
- Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2014 Free Software
+ Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/argmatch.h b/lib/argmatch.h
index 09645db6..bbbfe64d 100644
--- a/lib/argmatch.h
+++ b/lib/argmatch.h
@@ -1,6 +1,6 @@
/* argmatch.h -- definitions and prototypes for argmatch.c
- Copyright (C) 1990, 1998-1999, 2001-2002, 2004-2005, 2009-2014 Free Software
+ Copyright (C) 1990, 1998-1999, 2001-2002, 2004-2005, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/argv-iter.c b/lib/argv-iter.c
index f0704a47..4c06e7b2 100644
--- a/lib/argv-iter.c
+++ b/lib/argv-iter.c
@@ -1,5 +1,5 @@
/* Iterate over arguments from argv or --files0-from=FILE
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/argv-iter.h b/lib/argv-iter.h
index f2cf77d3..083b8267 100644
--- a/lib/argv-iter.h
+++ b/lib/argv-iter.h
@@ -1,5 +1,5 @@
/* Iterate over arguments from argv or --files0-from=FILE
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h
index b8c2e18b..4cad48f7 100644
--- a/lib/arpa_inet.in.h
+++ b/lib/arpa_inet.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <arpa/inet.h>.
- Copyright (C) 2005-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/asnprintf.c b/lib/asnprintf.c
index 0c62197f..d6776caa 100644
--- a/lib/asnprintf.c
+++ b/lib/asnprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 1999, 2002, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/asprintf.c b/lib/asprintf.c
index 9a69ac48..06ae3dd7 100644
--- a/lib/asprintf.c
+++ b/lib/asprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 1999, 2002, 2006-2007, 2009-2014 Free Software Foundation,
+ Copyright (C) 1999, 2002, 2006-2007, 2009-2015 Free Software Foundation,
Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/assure.h b/lib/assure.h
new file mode 100644
index 00000000..f44f380b
--- /dev/null
+++ b/lib/assure.h
@@ -0,0 +1,37 @@
+/* Run-time assert-like macros.
+
+ Copyright (C) 2014-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Paul Eggert. */
+
+#ifndef _GL_ASSURE_H
+#define _GL_ASSURE_H
+
+#include <assert.h>
+
+/* Check E's value at runtime, and report an error and abort if not.
+ However, do nothng if NDEBUG is defined.
+
+ Unlike standard 'assert', this macro always compiles E even when NDEBUG
+ is defined, so as to catch typos and avoid some GCC warnings. */
+
+#ifdef NDEBUG
+# define assure(E) ((void) (0 && (E)))
+#else
+# define assure(E) assert (E)
+#endif
+
+#endif
diff --git a/lib/at-func.c b/lib/at-func.c
index c8ee073d..bbbe458d 100644
--- a/lib/at-func.c
+++ b/lib/at-func.c
@@ -1,5 +1,5 @@
/* Define at-style functions like fstatat, unlinkat, fchownat, etc.
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/at-func2.c b/lib/at-func2.c
index b4d6067a..32a64ff2 100644
--- a/lib/at-func2.c
+++ b/lib/at-func2.c
@@ -1,5 +1,5 @@
/* Define 2-FD at-style functions like linkat or renameat.
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/backupfile.c b/lib/backupfile.c
index 2ad030f8..824c9d08 100644
--- a/lib/backupfile.c
+++ b/lib/backupfile.c
@@ -1,6 +1,6 @@
/* backupfile.c -- make Emacs style backup file names
- Copyright (C) 1990-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1990-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/backupfile.h b/lib/backupfile.h
index e2034c77..678b996a 100644
--- a/lib/backupfile.h
+++ b/lib/backupfile.h
@@ -1,6 +1,6 @@
/* backupfile.h -- declarations for making Emacs style backup file names
- Copyright (C) 1990-1992, 1997-1999, 2003-2004, 2009-2014 Free Software
+ Copyright (C) 1990-1992, 1997-1999, 2003-2004, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/base64.c b/lib/base64.c
index c7f7ac58..291d58f6 100644
--- a/lib/base64.c
+++ b/lib/base64.c
@@ -1,5 +1,5 @@
/* base64.c -- Encode binary data using printable characters.
- Copyright (C) 1999-2001, 2004-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2001, 2004-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/base64.h b/lib/base64.h
index f550cccf..ab57d526 100644
--- a/lib/base64.h
+++ b/lib/base64.h
@@ -1,5 +1,5 @@
/* base64.h -- Encode binary data using printable characters.
- Copyright (C) 2004-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004-2006, 2009-2015 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/basename-lgpl.c b/lib/basename-lgpl.c
index cec50e93..aae1280f 100644
--- a/lib/basename-lgpl.c
+++ b/lib/basename-lgpl.c
@@ -1,6 +1,6 @@
/* basename.c -- return the last element in a file name
- Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/basename.c b/lib/basename.c
index 67d9420a..faebe761 100644
--- a/lib/basename.c
+++ b/lib/basename.c
@@ -1,6 +1,6 @@
/* basename.c -- return the last element in a file name
- Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/bitrotate.h b/lib/bitrotate.h
index 9ec0b47b..1665e996 100644
--- a/lib/bitrotate.h
+++ b/lib/bitrotate.h
@@ -1,5 +1,5 @@
/* bitrotate.h - Rotate bits in integers
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/btowc.c b/lib/btowc.c
index b06ca2e4..2e32deec 100644
--- a/lib/btowc.c
+++ b/lib/btowc.c
@@ -1,5 +1,5 @@
/* Convert unibyte character to wide character.
- Copyright (C) 2008, 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2010-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/buffer-lcm.c b/lib/buffer-lcm.c
index d27e1564..65abfd9c 100644
--- a/lib/buffer-lcm.c
+++ b/lib/buffer-lcm.c
@@ -1,6 +1,6 @@
/* buffer-lcm.c - compute a good buffer size for dealing with two files
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/c-ctype.c b/lib/c-ctype.c
index 48c64783..1fb5fe67 100644
--- a/lib/c-ctype.c
+++ b/lib/c-ctype.c
@@ -1,6 +1,6 @@
/* Character handling in C locale.
- Copyright 2000-2003, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright 2000-2003, 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/c-ctype.h b/lib/c-ctype.h
index b4652776..47644731 100644
--- a/lib/c-ctype.h
+++ b/lib/c-ctype.h
@@ -5,7 +5,7 @@
<ctype.h> functions' behaviour depends on the current locale set via
setlocale.
- Copyright (C) 2000-2003, 2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2003, 2006, 2008-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/c-strcase.h b/lib/c-strcase.h
index 8e660441..f25bcca2 100644
--- a/lib/c-strcase.h
+++ b/lib/c-strcase.h
@@ -1,5 +1,5 @@
/* Case-insensitive string comparison functions in C locale.
- Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2014 Free Software
+ Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c
index b9b26a4c..6deb6d12 100644
--- a/lib/c-strcasecmp.c
+++ b/lib/c-strcasecmp.c
@@ -1,5 +1,5 @@
/* c-strcasecmp.c -- case insensitive string comparator in C locale
- Copyright (C) 1998-1999, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/c-strcaseeq.h b/lib/c-strcaseeq.h
index 5139a30b..ffd05a23 100644
--- a/lib/c-strcaseeq.h
+++ b/lib/c-strcaseeq.h
@@ -1,5 +1,5 @@
/* Optimized case-insensitive string comparison in C locale.
- Copyright (C) 2001-2002, 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c
index 972eb800..b98e3683 100644
--- a/lib/c-strncasecmp.c
+++ b/lib/c-strncasecmp.c
@@ -1,5 +1,5 @@
/* c-strncasecmp.c -- case insensitive string comparator in C locale
- Copyright (C) 1998-1999, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/c-strtod.c b/lib/c-strtod.c
index c1c771c5..11439895 100644
--- a/lib/c-strtod.c
+++ b/lib/c-strtod.c
@@ -1,6 +1,6 @@
/* Convert string to double, using the C locale.
- Copyright (C) 2003-2004, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2004, 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/c-strtod.h b/lib/c-strtod.h
index 2460668b..b80254d2 100644
--- a/lib/c-strtod.h
+++ b/lib/c-strtod.h
@@ -1,6 +1,6 @@
/* Convert string to double, using the C locale.
- Copyright (C) 2003-2004, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2004, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/calloc.c b/lib/calloc.c
index 6fbca8b9..52601b86 100644
--- a/lib/calloc.c
+++ b/lib/calloc.c
@@ -1,6 +1,6 @@
/* calloc() function that is glibc compatible.
This wrapper function is required at least on Tru64 UNIX 5.1 and mingw.
- Copyright (C) 2004-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/canon-host.c b/lib/canon-host.c
index 862a7010..ade4aa69 100644
--- a/lib/canon-host.c
+++ b/lib/canon-host.c
@@ -1,6 +1,6 @@
/* Host name canonicalization
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
Written by Derek Price <derek@ximbiot.com>.
diff --git a/lib/canon-host.h b/lib/canon-host.h
index 5f564817..9fc6e9e5 100644
--- a/lib/canon-host.h
+++ b/lib/canon-host.h
@@ -1,6 +1,6 @@
/* Host name canonicalization
- Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009-2015 Free Software Foundation, Inc.
Written by Derek Price <derek@ximbiot.com>
diff --git a/lib/canonicalize.c b/lib/canonicalize.c
index 2b94ebc0..397ac762 100644
--- a/lib/canonicalize.c
+++ b/lib/canonicalize.c
@@ -1,5 +1,5 @@
/* Return the canonical absolute name of a given file.
- Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/canonicalize.h b/lib/canonicalize.h
index 5fac1191..236cba56 100644
--- a/lib/canonicalize.h
+++ b/lib/canonicalize.h
@@ -1,5 +1,5 @@
/* Return the canonical absolute name of a given file.
- Copyright (C) 1996-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c
index b36fea28..f2f5da23 100644
--- a/lib/careadlinkat.c
+++ b/lib/careadlinkat.c
@@ -1,6 +1,6 @@
/* Read symbolic links into a buffer without size limitation, relative to fd.
- Copyright (C) 2001, 2003-2004, 2007, 2009-2014 Free Software Foundation,
+ Copyright (C) 2001, 2003-2004, 2007, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h
index 704f8159..4eb9fccc 100644
--- a/lib/careadlinkat.h
+++ b/lib/careadlinkat.h
@@ -1,6 +1,6 @@
/* Read symbolic links into a buffer without size limitation, relative to fd.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/chdir-long.c b/lib/chdir-long.c
index 5b1b18fc..ecc025a8 100644
--- a/lib/chdir-long.c
+++ b/lib/chdir-long.c
@@ -1,5 +1,5 @@
/* provide a chdir function that tries not to fail due to ENAMETOOLONG
- Copyright (C) 2004-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,7 +20,6 @@
#include "chdir-long.h"
-#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
@@ -28,6 +27,8 @@
#include <string.h>
#include <stdio.h>
+#include "assure.h"
+
#ifndef PATH_MAX
# error "compile this file only if your system defines PATH_MAX"
#endif
@@ -60,7 +61,7 @@ cdb_free (struct cd_buf const *cdb)
if (0 <= cdb->fd)
{
bool close_fail = close (cdb->fd);
- assert (! close_fail);
+ assure (! close_fail);
}
}
@@ -122,8 +123,8 @@ chdir_long (char *dir)
/* If DIR is the empty string, then the chdir above
must have failed and set errno to ENOENT. */
- assert (0 < len);
- assert (PATH_MAX <= len);
+ assure (0 < len);
+ assure (PATH_MAX <= len);
/* Count leading slashes. */
n_leading_slash = strspn (dir, "/");
@@ -158,8 +159,8 @@ chdir_long (char *dir)
dir += n_leading_slash;
}
- assert (*dir != '/');
- assert (dir <= dir_end);
+ assure (*dir != '/');
+ assure (dir <= dir_end);
while (PATH_MAX <= dir_end - dir)
{
@@ -175,7 +176,7 @@ chdir_long (char *dir)
}
*slash = '\0';
- assert (slash - dir < PATH_MAX);
+ assure (slash - dir < PATH_MAX);
err = cdb_advance_fd (&cdb, dir);
*slash = '/';
if (err != 0)
diff --git a/lib/chdir-long.h b/lib/chdir-long.h
index 4b5b9404..81dacc39 100644
--- a/lib/chdir-long.h
+++ b/lib/chdir-long.h
@@ -1,5 +1,5 @@
/* provide a chdir function that tries not to fail due to ENAMETOOLONG
- Copyright (C) 2004-2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004-2005, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/chown.c b/lib/chown.c
index 691cebe4..11238ebd 100644
--- a/lib/chown.c
+++ b/lib/chown.c
@@ -1,7 +1,7 @@
/* provide consistent interface to chown for systems that don't interpret
an ID of -1 as meaning "don't change the corresponding ID".
- Copyright (C) 1997, 2004-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/cloexec.c b/lib/cloexec.c
index 48a0c973..29d1a38a 100644
--- a/lib/cloexec.c
+++ b/lib/cloexec.c
@@ -1,6 +1,6 @@
/* closexec.c - set or clear the close-on-exec descriptor flag
- Copyright (C) 1991, 2004-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1991, 2004-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/cloexec.h b/lib/cloexec.h
index 6c442dca..ef5bacc2 100644
--- a/lib/cloexec.h
+++ b/lib/cloexec.h
@@ -1,6 +1,6 @@
/* closexec.c - set or clear the close-on-exec descriptor flag
- Copyright (C) 2004, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/close-stream.c b/lib/close-stream.c
index 87921d42..6e3d8658 100644
--- a/lib/close-stream.c
+++ b/lib/close-stream.c
@@ -1,6 +1,6 @@
/* Close a stream, with nicer error checking than fclose's.
- Copyright (C) 1998-2002, 2004, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2002, 2004, 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/close.c b/lib/close.c
index d7dcb3f1..54d1f71b 100644
--- a/lib/close.c
+++ b/lib/close.c
@@ -1,5 +1,5 @@
/* close replacement.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/closedir.c b/lib/closedir.c
index 940c6f9f..f80843f9 100644
--- a/lib/closedir.c
+++ b/lib/closedir.c
@@ -1,5 +1,5 @@
/* Stop reading the entries of a directory.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/closein.c b/lib/closein.c
index 5b2c9150..54426070 100644
--- a/lib/closein.c
+++ b/lib/closein.c
@@ -1,6 +1,6 @@
/* Close standard input, rewinding seekable stdin if necessary.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/closein.h b/lib/closein.h
index 1c01156f..a465d2b2 100644
--- a/lib/closein.h
+++ b/lib/closein.h
@@ -1,6 +1,6 @@
/* Close standard input, rewinding seekable stdin if necessary.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/closeout.c b/lib/closeout.c
index 674db787..761d7151 100644
--- a/lib/closeout.c
+++ b/lib/closeout.c
@@ -1,6 +1,6 @@
/* Close standard output and standard error, exiting with a diagnostic on error.
- Copyright (C) 1998-2002, 2004, 2006, 2008-2014 Free Software Foundation,
+ Copyright (C) 1998-2002, 2004, 2006, 2008-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/closeout.h b/lib/closeout.h
index 28d80ea5..87cea5b1 100644
--- a/lib/closeout.h
+++ b/lib/closeout.h
@@ -1,6 +1,6 @@
/* Close standard output and standard error.
- Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2014 Free Software
+ Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/config.charset b/lib/config.charset
index 289bc44e..f06d7e9f 100644
--- a/lib/config.charset
+++ b/lib/config.charset
@@ -1,7 +1,7 @@
#! /bin/sh
# Output a system dependent table of character encoding aliases.
#
-# Copyright (C) 2000-2004, 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2000-2004, 2006-2015 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -348,12 +348,10 @@ case "$os" in
#echo "sun_eu_greek ?" # what is this?
echo "UTF-8 UTF-8"
;;
- freebsd* | os2*)
+ freebsd*)
# FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
# localcharset.c falls back to using the full locale name
# from the environment variables.
- # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
- # reuse FreeBSD's locale data for OS/2.
echo "C ASCII"
echo "US-ASCII ASCII"
for l in la_LN lt_LN; do
diff --git a/lib/config.hin b/lib/config.hin
index ce408318..919ee502 100644
--- a/lib/config.hin
+++ b/lib/config.hin
@@ -179,6 +179,10 @@
declaration of the second argument to gettimeofday. */
#undef GETTIMEOFDAY_TIMEZONE
+/* Define to 1 if getxattr works with XATTR_NAME_POSIX_ACL_ACCESS and
+ XATTR_NAME_POSIX_ACL_DEFAULT. */
+#undef GETXATTR_WITH_POSIX_ACLS
+
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
whether the gnulib module areadlinkat shall be considered present. */
#undef GNULIB_AREADLINKAT
@@ -274,6 +278,10 @@
/* enable some gnulib portability checks */
#undef GNULIB_PORTCHECK
+/* Define to 1 if printf and friends should be labeled with attribute
+ "__gnu_printf__" instead of "__printf__" */
+#undef GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
+
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
whether the gnulib module pthread shall be considered present. */
#undef GNULIB_PTHREAD
@@ -1037,6 +1045,10 @@
don't. */
#undef HAVE_DECL_GETDELIM
+/* Define to 1 if you have the declaration of `getdtablesize', and to 0 if you
+ don't. */
+#undef HAVE_DECL_GETDTABLESIZE
+
/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
*/
#undef HAVE_DECL_GETENV
@@ -1301,6 +1313,9 @@
/* Define to 1 if you have the `facl' function. */
#undef HAVE_FACL
+/* Define to 1 if you have the `fallocate' function. */
+#undef HAVE_FALLOCATE
+
/* Define to 1 if you have the `fchdir' function. */
#undef HAVE_FCHDIR
@@ -1335,6 +1350,9 @@
/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK
+/* whether fpsetprec is present and required */
+#undef HAVE_FPSETPREC
+
/* Define to 1 if you have the `fpurge' function. */
#undef HAVE_FPURGE
@@ -1383,6 +1401,10 @@
/* Define to 1 if you have the `getattrat' function. */
#undef HAVE_GETATTRAT
+/* Define to 1 if getcwd works, but with shorter paths than is generally
+ tested with the replacement. */
+#undef HAVE_GETCWD_SHORTER
+
/* Define to 1 if you have the `getdelim' function. */
#undef HAVE_GETDELIM
@@ -1593,6 +1615,9 @@
/* Define to 1 if you have the `linkat' function. */
#undef HAVE_LINKAT
+/* Define to 1 if you have the <linux/falloc.h> header file. */
+#undef HAVE_LINUX_FALLOC_H
+
/* Define to 1 if you have the `listmntent' function. */
#undef HAVE_LISTMNTENT
@@ -1726,7 +1751,7 @@
/* Define to 1 if you have the `nl_langinfo' function. */
#undef HAVE_NL_LANGINFO
-/* Define to 1 if libc includes obstacks. */
+/* Define to 1 if the system has obstacks that work with any size object. */
#undef HAVE_OBSTACK
/* Define to 1 if you have the `openat' function. */
@@ -2175,6 +2200,9 @@
/* Define to 1 if you have the `sync' function. */
#undef HAVE_SYNC
+/* Define to 1 if you have the `syncfs' function. */
+#undef HAVE_SYNCFS
+
/* Define to 1 if you have the `sysctl' function. */
#undef HAVE_SYSCTL
@@ -2521,6 +2549,9 @@
/* Define as the word index where to find the sign of 'long double'. */
#undef LDBL_SIGNBIT_WORD
+/* Define to 1 if linkat can create hardlinks to symlinks */
+#undef LINKAT_SYMLINK_NOTSUP
+
/* Define to 1 if linkat fails to recognize a trailing slash. */
#undef LINKAT_TRAILING_SLASH_BUG
@@ -2942,6 +2973,10 @@
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
+/* Use GNU style printf and scanf. */
+#ifndef __USE_MINGW_ANSI_STDIO
+# undef __USE_MINGW_ANSI_STDIO
+#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
@@ -3083,13 +3118,28 @@
'reference to static identifier "f" in extern inline function'.
This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16.
- Suppress the use of extern inline on problematic Apple configurations.
- OS X 10.8 and earlier mishandle it; see, e.g.,
- <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
+ Suppress extern inline (with or without __attribute__ ((__gnu_inline__)))
+ on configurations that mistakenly use 'static inline' to implement
+ functions or macros in standard C headers like <ctype.h>. For example,
+ if isdigit is mistakenly implemented via a static inline function,
+ a program containing an extern inline function that calls isdigit
+ may not work since the C standard prohibits extern inline functions
+ from calling static functions. This bug is known to occur on:
+
+ OS X 10.8 and earlier; see:
+ http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html
+
+ DragonFly; see
+ http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log
+
+ FreeBSD; see:
+ http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html
+
OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and
for clang but remains for g++; see <http://trac.macports.org/ticket/41033>.
- Perhaps Apple will fix this some day. */
-#if (defined __APPLE__ \
+ Assume DragonFly and FreeBSD will be similar. */
+#if (((defined __APPLE__ && defined __MACH__) \
+ || defined __DragonFly__ || defined __FreeBSD__) \
&& (defined __header_inline \
? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \
&& ! defined __clang__) \
@@ -3097,19 +3147,19 @@
&& (defined __GNUC__ || defined __cplusplus)) \
|| (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
&& defined __GNUC__ && ! defined __cplusplus))))
-# define _GL_EXTERN_INLINE_APPLE_BUG
+# define _GL_EXTERN_INLINE_STDHEADER_BUG
#endif
#if ((__GNUC__ \
? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
: (199901L <= __STDC_VERSION__ \
&& !defined __HP_cc \
&& !(defined __SUNPRO_C && __STDC__))) \
- && !defined _GL_EXTERN_INLINE_APPLE_BUG)
+ && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
# define _GL_INLINE inline
# define _GL_EXTERN_INLINE extern inline
# define _GL_EXTERN_INLINE_IN_USE
#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
- && !defined _GL_EXTERN_INLINE_APPLE_BUG)
+ && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__
/* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
@@ -3123,17 +3173,19 @@
# define _GL_EXTERN_INLINE static _GL_UNUSED
#endif
-#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
+/* In GCC 4.6 (inclusive) to 5.1 (exclusive),
+ suppress bogus "no previous prototype for 'FOO'"
+ and "no previous declaration for 'FOO'" diagnostics,
+ when FOO is an inline function in the header; see
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */
+#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__
# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
# define _GL_INLINE_HEADER_CONST_PRAGMA
# else
# define _GL_INLINE_HEADER_CONST_PRAGMA \
_Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
# endif
- /* Suppress GCC's bogus "no previous prototype for 'FOO'"
- and "no previous declaration for 'FOO'" diagnostics,
- when FOO is an inline function in the header; see
- <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */
# define _GL_INLINE_HEADER_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
diff --git a/lib/copy-acl.c b/lib/copy-acl.c
index eebb359b..49679eb9 100644
--- a/lib/copy-acl.c
+++ b/lib/copy-acl.c
@@ -1,6 +1,6 @@
/* copy-acl.c - copy access control list from one file to another file
- Copyright (C) 2002-2003, 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/creat-safer.c b/lib/creat-safer.c
index 984857b8..5645d31b 100644
--- a/lib/creat-safer.c
+++ b/lib/creat-safer.c
@@ -1,6 +1,6 @@
/* Invoke creat, but avoid some glitches.
- Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/ctype.in.h b/lib/ctype.in.h
index 6d292d85..def19e94 100644
--- a/lib/ctype.in.h
+++ b/lib/ctype.in.h
@@ -1,6 +1,6 @@
/* A substitute for ISO C99 <ctype.h>, for platforms on which it is incomplete.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/cycle-check.c b/lib/cycle-check.c
index f7b3d078..a198b091 100644
--- a/lib/cycle-check.c
+++ b/lib/cycle-check.c
@@ -1,6 +1,6 @@
/* help detect directory cycles efficiently
- Copyright (C) 2003-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,15 +19,15 @@
#include <config.h>
+#include "cycle-check.h"
+
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
-#include <assert.h>
#include <stdlib.h>
-
#include <stdbool.h>
-#include "cycle-check.h"
+#include "assure.h"
#define CC_MAGIC 9827862
@@ -57,7 +57,7 @@ cycle_check_init (struct cycle_check_state *state)
bool
cycle_check (struct cycle_check_state *state, struct stat const *sb)
{
- assert (state->magic == CC_MAGIC);
+ assure (state->magic == CC_MAGIC);
/* If the current directory ever happens to be the same
as the one we last recorded for the cycle detection,
diff --git a/lib/cycle-check.h b/lib/cycle-check.h
index 7649606a..9756658d 100644
--- a/lib/cycle-check.h
+++ b/lib/cycle-check.h
@@ -1,6 +1,6 @@
/* help detect directory cycles efficiently
- Copyright (C) 2003-2004, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2004, 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/di-set.c b/lib/di-set.c
index fa21d2dd..ee58c777 100644
--- a/lib/di-set.c
+++ b/lib/di-set.c
@@ -1,6 +1,6 @@
/* Set operations for device-inode pairs stored in a space-efficient manner.
- Copyright 2009-2014 Free Software Foundation, Inc.
+ Copyright 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/diacrit.c b/lib/diacrit.c
index f3b6c1dd..dab6c972 100644
--- a/lib/diacrit.c
+++ b/lib/diacrit.c
@@ -1,6 +1,6 @@
/* Diacritics processing for a few character codes.
- Copyright (C) 1990-1993, 2000, 2006, 2009-2014 Free Software Foundation,
+ Copyright (C) 1990-1993, 2000, 2006, 2009-2015 Free Software Foundation,
Inc.
François Pinard <pinard@iro.umontreal.ca>, 1988.
diff --git a/lib/diacrit.h b/lib/diacrit.h
index 3002c434..b7f025fd 100644
--- a/lib/diacrit.h
+++ b/lib/diacrit.h
@@ -1,5 +1,5 @@
/* Diacritics processing for a few character codes.
- Copyright (C) 1990-1993, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1990-1993, 2009-2015 Free Software Foundation, Inc.
François Pinard <pinard@iro.umontreal.ca>, 1988.
All this file is a temporary hack, waiting for locales in GNU.
diff --git a/lib/dirchownmod.c b/lib/dirchownmod.c
index 45cb2d2d..f2cbda04 100644
--- a/lib/dirchownmod.c
+++ b/lib/dirchownmod.c
@@ -1,6 +1,6 @@
/* Change the ownership and mode bits of a directory.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/dirent--.h b/lib/dirent--.h
index d7c51bac..aa3f4929 100644
--- a/lib/dirent--.h
+++ b/lib/dirent--.h
@@ -1,6 +1,6 @@
/* Like dirent.h, but redefine some names to avoid glitches.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,3 +21,4 @@
#undef opendir
#define opendir opendir_safer
+#define GNULIB_defined_opendir 1
diff --git a/lib/dirent-private.h b/lib/dirent-private.h
index 83531a16..aa01f602 100644
--- a/lib/dirent-private.h
+++ b/lib/dirent-private.h
@@ -1,5 +1,5 @@
/* Private details of the DIR type.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/dirent-safer.h b/lib/dirent-safer.h
index 8cc75d8d..da62b2e3 100644
--- a/lib/dirent-safer.h
+++ b/lib/dirent-safer.h
@@ -1,6 +1,6 @@
/* Invoke dirent-like functions, but avoid some glitches.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/dirent.in.h b/lib/dirent.in.h
index 4822d6b2..154d2689 100644
--- a/lib/dirent.in.h
+++ b/lib/dirent.in.h
@@ -1,5 +1,5 @@
/* A GNU-like <dirent.h>.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -77,6 +77,7 @@ typedef struct gl_directory DIR;
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef opendir
# define opendir rpl_opendir
+# define GNULIB_defined_opendir 1
# endif
_GL_FUNCDECL_RPL (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name));
@@ -128,6 +129,7 @@ _GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef closedir
# define closedir rpl_closedir
+# define GNULIB_defined_closedir 1
# endif
_GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (closedir, int, (DIR *dirp));
diff --git a/lib/dirfd.c b/lib/dirfd.c
index 4d37928c..c91f8e55 100644
--- a/lib/dirfd.c
+++ b/lib/dirfd.c
@@ -1,6 +1,6 @@
/* dirfd.c -- return the file descriptor associated with an open DIR*
- Copyright (C) 2001, 2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/dirname-lgpl.c b/lib/dirname-lgpl.c
index d4a69730..98391356 100644
--- a/lib/dirname-lgpl.c
+++ b/lib/dirname-lgpl.c
@@ -1,6 +1,6 @@
/* dirname.c -- return all but the last element in a file name
- Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/dirname.c b/lib/dirname.c
index 94f1a36a..c22be314 100644
--- a/lib/dirname.c
+++ b/lib/dirname.c
@@ -1,6 +1,6 @@
/* dirname.c -- return all but the last element in a file name
- Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/dirname.h b/lib/dirname.h
index a1b70093..55021ec5 100644
--- a/lib/dirname.h
+++ b/lib/dirname.h
@@ -1,6 +1,6 @@
/* Take file names apart into directory and base names.
- Copyright (C) 1998, 2001, 2003-2006, 2009-2014 Free Software Foundation,
+ Copyright (C) 1998, 2001, 2003-2006, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
@@ -31,6 +31,10 @@
# define DOUBLE_SLASH_IS_DISTINCT_ROOT 0
# endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
# if GNULIB_DIRNAME
char *base_name (char const *file);
char *dir_name (char const *file);
@@ -43,4 +47,8 @@ char *last_component (char const *file) _GL_ATTRIBUTE_PURE;
bool strip_trailing_slashes (char *file);
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
#endif /* not DIRNAME_H_ */
diff --git a/lib/dosname.h b/lib/dosname.h
index b92adfac..893baf6c 100644
--- a/lib/dosname.h
+++ b/lib/dosname.h
@@ -1,6 +1,6 @@
/* File names on MS-DOS/Windows systems.
- Copyright (C) 2000-2001, 2004-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2001, 2004-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/dtotimespec.c b/lib/dtotimespec.c
index 57a0cee2..c28d219f 100644
--- a/lib/dtotimespec.c
+++ b/lib/dtotimespec.c
@@ -1,6 +1,6 @@
/* Convert double to timespec.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/dup-safer-flag.c b/lib/dup-safer-flag.c
index 2d860fbc..f4610eec 100644
--- a/lib/dup-safer-flag.c
+++ b/lib/dup-safer-flag.c
@@ -1,7 +1,7 @@
/* Duplicate a file descriptor result, avoiding clobbering
STD{IN,OUT,ERR}_FILENO, with specific flags.
- Copyright (C) 2001, 2004-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/dup-safer.c b/lib/dup-safer.c
index 8df3cdab..c6436cd9 100644
--- a/lib/dup-safer.c
+++ b/lib/dup-safer.c
@@ -1,6 +1,6 @@
/* Invoke dup, but avoid some glitches.
- Copyright (C) 2001, 2004-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/dup.c b/lib/dup.c
index c813df62..20f04534 100644
--- a/lib/dup.c
+++ b/lib/dup.c
@@ -1,6 +1,6 @@
/* Duplicate an open file descriptor.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/dup2.c b/lib/dup2.c
index 7de68054..0e13214c 100644
--- a/lib/dup2.c
+++ b/lib/dup2.c
@@ -1,6 +1,6 @@
/* Duplicate an open file descriptor to a specified file descriptor.
- Copyright (C) 1999, 2004-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/errno.in.h b/lib/errno.in.h
index 832afc8f..affbb979 100644
--- a/lib/errno.in.h
+++ b/lib/errno.in.h
@@ -1,6 +1,6 @@
/* A POSIX-like <errno.h>.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/error.c b/lib/error.c
index 7b99cd73..0ac76951 100644
--- a/lib/error.c
+++ b/lib/error.c
@@ -1,5 +1,5 @@
/* Error handler for noninteractive utilities
- Copyright (C) 1990-1998, 2000-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1990-1998, 2000-2007, 2009-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
@@ -75,7 +75,7 @@ extern void __error (int status, int errnum, const char *message, ...)
extern void __error_at_line (int status, int errnum, const char *file_name,
unsigned int line_number, const char *message,
...)
- __attribute__ ((__format__ (__printf__, 5, 6)));;
+ __attribute__ ((__format__ (__printf__, 5, 6)));
# define error __error
# define error_at_line __error_at_line
@@ -379,10 +379,10 @@ error_at_line (int status, int errnum, const char *file_name,
}
#if _LIBC
- __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ",
+ __fxprintf (NULL, file_name != NULL ? "%s:%u: " : " ",
file_name, line_number);
#else
- fprintf (stderr, file_name != NULL ? "%s:%d: " : " ",
+ fprintf (stderr, file_name != NULL ? "%s:%u: " : " ",
file_name, line_number);
#endif
diff --git a/lib/error.h b/lib/error.h
index 4aaafb36..eb4fb701 100644
--- a/lib/error.h
+++ b/lib/error.h
@@ -1,5 +1,5 @@
/* Declaration for error-reporting function
- Copyright (C) 1995-1997, 2003, 2006, 2008-2014 Free Software Foundation,
+ Copyright (C) 1995-1997, 2003, 2006, 2008-2015 Free Software Foundation,
Inc.
This file is part of the GNU C Library.
@@ -31,6 +31,16 @@
# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
#endif
+/* On mingw, the flavor of printf depends on whether the extensions module
+ * is in use; the check for <stdio.h> determines the witness macro. */
+#ifndef _GL_ATTRIBUTE_SPEC_PRINTF
+# if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
+# define _GL_ATTRIBUTE_SPEC_PRINTF __gnu_printf__
+# else
+# define _GL_ATTRIBUTE_SPEC_PRINTF __printf__
+# endif
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -40,11 +50,11 @@ extern "C" {
If STATUS is nonzero, terminate the program with 'exit (STATUS)'. */
extern void error (int __status, int __errnum, const char *__format, ...)
- _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4));
+ _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF, 3, 4));
extern void error_at_line (int __status, int __errnum, const char *__fname,
unsigned int __lineno, const char *__format, ...)
- _GL_ATTRIBUTE_FORMAT ((__printf__, 5, 6));
+ _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF, 5, 6));
/* If NULL, error will flush stdout, then print on stderr the program
name, a colon and a space. Otherwise, error will call this
diff --git a/lib/euidaccess.c b/lib/euidaccess.c
index 363e6fe2..c7e6cfb7 100644
--- a/lib/euidaccess.c
+++ b/lib/euidaccess.c
@@ -1,6 +1,6 @@
/* euidaccess -- check if effective user id can access file
- Copyright (C) 1990-1991, 1995, 1998, 2000, 2003-2006, 2008-2014 Free
+ Copyright (C) 1990-1991, 1995, 1998, 2000, 2003-2006, 2008-2015 Free
Software Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/exclude.c b/lib/exclude.c
index 14b59b70..20dedf7e 100644
--- a/lib/exclude.c
+++ b/lib/exclude.c
@@ -1,6 +1,6 @@
/* exclude.c -- exclude file names
- Copyright (C) 1992-1994, 1997, 1999-2007, 2009-2014 Free Software
+ Copyright (C) 1992-1994, 1997, 1999-2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -392,7 +392,7 @@ exclude_fnmatch (char const *pattern, char const *f, int options)
return matched;
}
-bool
+static bool
exclude_patopts (struct patopts const *opts, char const *f)
{
int options = opts->options;
diff --git a/lib/exclude.h b/lib/exclude.h
index 95552186..b522d35f 100644
--- a/lib/exclude.h
+++ b/lib/exclude.h
@@ -1,6 +1,6 @@
/* exclude.h -- declarations for excluding file names
- Copyright (C) 1992-1994, 1997, 1999, 2001-2003, 2005-2006, 2009-2014 Free
+ Copyright (C) 1992-1994, 1997, 1999, 2001-2003, 2005-2006, 2009-2015 Free
Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/exitfail.c b/lib/exitfail.c
index 609afc5a..8035b895 100644
--- a/lib/exitfail.c
+++ b/lib/exitfail.c
@@ -1,6 +1,6 @@
/* Failure exit status
- Copyright (C) 2002-2003, 2005-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/exitfail.h b/lib/exitfail.h
index 66807d51..62d0ac5d 100644
--- a/lib/exitfail.h
+++ b/lib/exitfail.h
@@ -1,6 +1,6 @@
/* Failure exit status
- Copyright (C) 2002, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/faccessat.c b/lib/faccessat.c
index 44a38ae6..5bd7ecfd 100644
--- a/lib/faccessat.c
+++ b/lib/faccessat.c
@@ -1,5 +1,5 @@
/* Check the access rights of a file relative to an open directory.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fadvise.c b/lib/fadvise.c
index a4bc96f4..8f65fc46 100644
--- a/lib/fadvise.c
+++ b/lib/fadvise.c
@@ -1,5 +1,5 @@
/* Declare an access pattern hint for files.
- Copyright (C) 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2010-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fadvise.h b/lib/fadvise.h
index 11ecd8f0..ed4c4529 100644
--- a/lib/fadvise.h
+++ b/lib/fadvise.h
@@ -1,5 +1,5 @@
/* Declare an access pattern hint for files.
- Copyright (C) 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2010-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fchdir.c b/lib/fchdir.c
index 5d713773..944d1bdf 100644
--- a/lib/fchdir.c
+++ b/lib/fchdir.c
@@ -1,5 +1,5 @@
/* fchdir replacement.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,7 +19,6 @@
/* Specification. */
#include <unistd.h>
-#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
@@ -29,6 +28,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include "assure.h"
#include "dosname.h"
#include "filenamecat.h"
@@ -132,7 +132,7 @@ _gl_register_fd (int fd, const char *filename)
{
struct stat statbuf;
- assert (0 <= fd);
+ assure (0 <= fd);
if (REPLACE_OPEN_DIRECTORY
|| (fstat (fd, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)))
{
@@ -156,7 +156,7 @@ _gl_register_fd (int fd, const char *filename)
int
_gl_register_dup (int oldfd, int newfd)
{
- assert (0 <= oldfd && 0 <= newfd && oldfd != newfd);
+ assure (0 <= oldfd && 0 <= newfd && oldfd != newfd);
if (oldfd < dirs_allocated && dirs[oldfd].name)
{
/* Duplicated a directory; must ensure newfd is allocated. */
diff --git a/lib/fchmodat.c b/lib/fchmodat.c
index 8b0bbb32..c09d02d0 100644
--- a/lib/fchmodat.c
+++ b/lib/fchmodat.c
@@ -1,5 +1,5 @@
/* Change the protections of file relative to an open directory.
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fchownat.c b/lib/fchownat.c
index 65ced30b..3bf5daa1 100644
--- a/lib/fchownat.c
+++ b/lib/fchownat.c
@@ -4,7 +4,7 @@
when the buggy fchownat-with-AT_SYMLINK_NOFOLLOW operates on a symlink, it
mistakenly affects the symlink referent, rather than the symlink itself.
- Copyright (C) 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fclose.c b/lib/fclose.c
index d238ab18..1df51e6d 100644
--- a/lib/fclose.c
+++ b/lib/fclose.c
@@ -1,5 +1,5 @@
/* fclose replacement.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fcntl--.h b/lib/fcntl--.h
index 37be26c3..c158db54 100644
--- a/lib/fcntl--.h
+++ b/lib/fcntl--.h
@@ -1,6 +1,6 @@
/* Like fcntl.h, but redefine some names to avoid glitches.
- Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fcntl-safer.h b/lib/fcntl-safer.h
index 73b7ad78..9585c56f 100644
--- a/lib/fcntl-safer.h
+++ b/lib/fcntl-safer.h
@@ -1,6 +1,6 @@
/* Invoke fcntl-like functions, but avoid some glitches.
- Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fcntl.c b/lib/fcntl.c
index 54f74860..23b73e97 100644
--- a/lib/fcntl.c
+++ b/lib/fcntl.c
@@ -1,6 +1,6 @@
/* Provide file descriptor control.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -89,8 +89,25 @@ dupfd (int oldfd, int newfd, int flags)
inherit, /* InheritHandle */
DUPLICATE_SAME_ACCESS)) /* Options */
{
- /* TODO: Translate GetLastError () into errno. */
- errno = EMFILE;
+ switch (GetLastError ())
+ {
+ case ERROR_TOO_MANY_OPEN_FILES:
+ errno = EMFILE;
+ break;
+ case ERROR_INVALID_HANDLE:
+ case ERROR_INVALID_TARGET_HANDLE:
+ case ERROR_DIRECT_ACCESS_HANDLE:
+ errno = EBADF;
+ break;
+ case ERROR_INVALID_PARAMETER:
+ case ERROR_INVALID_FUNCTION:
+ case ERROR_INVALID_ACCESS:
+ errno = EINVAL;
+ break;
+ default:
+ errno = EACCES;
+ break;
+ }
result = -1;
break;
}
@@ -98,7 +115,6 @@ dupfd (int oldfd, int newfd, int flags)
if (duplicated_fd < 0)
{
CloseHandle (new_handle);
- errno = EMFILE;
result = -1;
break;
}
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index e23b4b2b..e2880185 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -1,6 +1,6 @@
/* Like <fcntl.h>, but with non-working flags defined to 0.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@
extern "C" { ... } block, which leads to errors in C++ mode with the
overridden <sys/stat.h> from gnulib. These errors are known to be gone
with g++ version >= 4.3. */
-#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
+#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))))
# include <sys/stat.h>
#endif
#@INCLUDE_NEXT@ @NEXT_FCNTL_H@
@@ -53,7 +53,7 @@
extern "C" { ... } block, which leads to errors in C++ mode with the
overridden <sys/stat.h> from gnulib. These errors are known to be gone
with g++ version >= 4.3. */
-#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
+#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))))
# include <sys/stat.h>
#endif
/* The include_next requires a split double-inclusion guard. */
diff --git a/lib/fd-hook.c b/lib/fd-hook.c
index 0171cc60..b1488c4c 100644
--- a/lib/fd-hook.c
+++ b/lib/fd-hook.c
@@ -1,5 +1,5 @@
/* Hook for making making file descriptor functions close(), ioctl() extensible.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/fd-hook.h b/lib/fd-hook.h
index 1aa264eb..bdb9aefe 100644
--- a/lib/fd-hook.h
+++ b/lib/fd-hook.h
@@ -1,5 +1,5 @@
/* Hook for making making file descriptor functions close(), ioctl() extensible.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
diff --git a/lib/fd-reopen.c b/lib/fd-reopen.c
index 1fba807b..153db41b 100644
--- a/lib/fd-reopen.c
+++ b/lib/fd-reopen.c
@@ -1,6 +1,6 @@
/* Invoke open, but return either a desired file descriptor or -1.
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fd-reopen.h b/lib/fd-reopen.h
index 7245a32d..0085ed09 100644
--- a/lib/fd-reopen.h
+++ b/lib/fd-reopen.h
@@ -1,6 +1,6 @@
/* Invoke open, but return either a desired file descriptor or -1.
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fd-safer-flag.c b/lib/fd-safer-flag.c
index 17011000..b24861dd 100644
--- a/lib/fd-safer-flag.c
+++ b/lib/fd-safer-flag.c
@@ -1,7 +1,7 @@
/* Adjust a file descriptor result so that it avoids clobbering
STD{IN,OUT,ERR}_FILENO, with specific flags.
- Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fd-safer.c b/lib/fd-safer.c
index 148f735d..6c1fb2b6 100644
--- a/lib/fd-safer.c
+++ b/lib/fd-safer.c
@@ -1,6 +1,6 @@
/* Return a safer copy of a file descriptor.
- Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fdatasync.c b/lib/fdatasync.c
index 688543f8..bbc30396 100644
--- a/lib/fdatasync.c
+++ b/lib/fdatasync.c
@@ -1,6 +1,6 @@
/* Emulate fdatasync on platforms that lack it.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
diff --git a/lib/fdopen.c b/lib/fdopen.c
index eded1a67..b72c0e8f 100644
--- a/lib/fdopen.c
+++ b/lib/fdopen.c
@@ -1,5 +1,5 @@
/* Open a stream with a given file descriptor.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fdopendir.c b/lib/fdopendir.c
index b6c94a09..837a8219 100644
--- a/lib/fdopendir.c
+++ b/lib/fdopendir.c
@@ -1,5 +1,5 @@
/* provide a replacement fdopendir function
- Copyright (C) 2004-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -93,7 +93,7 @@ fdopendir (int fd)
That way, barring race conditions, fd_clone_opendir returns a
stream whose file descriptor is FD.
- If REPLACE_CHDIR or CWD is null, use opendir ("/proc/self/fd/...",
+ If REPLACE_FCHDIR or CWD is null, use opendir ("/proc/self/fd/...",
falling back on fchdir metadata. Otherwise, CWD is a saved version
of the working directory; use fchdir/opendir(".")/restore_cwd(CWD). */
static DIR *
@@ -156,7 +156,16 @@ fd_clone_opendir (int fd, struct saved_cwd const *cwd)
if (! dir && EXPECTED_ERRNO (saved_errno))
{
char const *name = _gl_directory_name (fd);
- return (name ? opendir (name) : NULL);
+ DIR *dp = name ? opendir (name) : NULL;
+
+ /* The caller has done an elaborate dance to arrange for opendir to
+ consume just the right file descriptor. If dirfd returns -1,
+ though, we're on a system like mingw where opendir does not
+ consume a file descriptor. Consume it via 'dup' instead. */
+ if (dp && dirfd (dp) < 0)
+ dup (fd);
+
+ return dp;
}
# endif
errno = saved_errno;
diff --git a/lib/fdutimensat.c b/lib/fdutimensat.c
index fafa0a4d..739507b5 100644
--- a/lib/fdutimensat.c
+++ b/lib/fdutimensat.c
@@ -1,6 +1,6 @@
/* Set file access and modification times.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
diff --git a/lib/fflush.c b/lib/fflush.c
index dc9fbcd4..5ae3e417 100644
--- a/lib/fflush.c
+++ b/lib/fflush.c
@@ -1,5 +1,5 @@
/* fflush.c -- allow flushing input streams
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -50,7 +50,8 @@ clear_ungetc_buffer_preserving_position (FILE *fp)
static void
clear_ungetc_buffer (FILE *fp)
{
-# if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
+# if defined __sferror || defined __DragonFly__ || defined __ANDROID__
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
if (HASUB (fp))
{
fp_->_p += fp_->_r;
@@ -73,7 +74,8 @@ clear_ungetc_buffer (FILE *fp)
#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
-# if (defined __sferror || defined __DragonFly__) && defined __SNPT /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
+# if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
+/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
static int
disable_seek_optimization (FILE *fp)
@@ -95,7 +97,8 @@ static void
update_fpos_cache (FILE *fp _GL_UNUSED_PARAMETER,
off_t pos _GL_UNUSED_PARAMETER)
{
-# if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
+# if defined __sferror || defined __DragonFly__ || defined __ANDROID__
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
# if defined __CYGWIN__
/* fp_->_offset is typed as an integer. */
fp_->_offset = pos;
@@ -195,7 +198,8 @@ rpl_fflush (FILE *stream)
return result;
}
-# if (defined __sferror || defined __DragonFly__) && defined __SNPT /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
+# if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
{
/* Disable seek optimization for the next fseeko call. This tells the
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
index 5104a41e..8488b7e6 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -1,6 +1,6 @@
/* Test whether a file has a nontrivial access control list.
- Copyright (C) 2002-2003, 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,465 +29,49 @@
#include "acl-internal.h"
+#if GETXATTR_WITH_POSIX_ACLS
+# include <sys/xattr.h>
+# include <linux/xattr.h>
+#endif
-#if USE_ACL && HAVE_ACL_GET_FILE
-
-# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
-
-/* ACL is an ACL, from a file, stored as type ACL_TYPE_EXTENDED.
- Return 1 if the given ACL is non-trivial.
- Return 0 if it is trivial. */
-int
-acl_extended_nontrivial (acl_t acl)
-{
- /* acl is non-trivial if it is non-empty. */
- return (acl_entries (acl) > 0);
-}
-
-# else /* Linux, FreeBSD, IRIX, Tru64 */
+/* Return 1 if NAME has a nontrivial access control list,
+ 0 if ACLs are not supported, or if NAME has no or only a base ACL,
+ and -1 (setting errno) on error. Note callers can determine
+ if ACLs are not supported as errno is set in that case also.
+ SB must be set to the stat buffer of NAME,
+ obtained through stat() or lstat(). */
-/* ACL is an ACL, from a file, stored as type ACL_TYPE_ACCESS.
- Return 1 if the given ACL is non-trivial.
- Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.
- Return -1 and set errno upon failure to determine it. */
int
-acl_access_nontrivial (acl_t acl)
+file_has_acl (char const *name, struct stat const *sb)
{
- /* acl is non-trivial if it has some entries other than for "user::",
- "group::", and "other::". Normally these three should be present
- at least, allowing us to write
- return (3 < acl_entries (acl));
- but the following code is more robust. */
-# if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD */
-
- acl_entry_t ace;
- int got_one;
-
- for (got_one = acl_get_entry (acl, ACL_FIRST_ENTRY, &ace);
- got_one > 0;
- got_one = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace))
+#if USE_ACL
+ if (! S_ISLNK (sb->st_mode))
{
- acl_tag_t tag;
- if (acl_get_tag_type (ace, &tag) < 0)
- return -1;
- if (!(tag == ACL_USER_OBJ || tag == ACL_GROUP_OBJ || tag == ACL_OTHER))
- return 1;
- }
- return got_one;
-# elif HAVE_ACL_TO_SHORT_TEXT /* IRIX */
- /* Don't use acl_get_entry: it is undocumented. */
+# if GETXATTR_WITH_POSIX_ACLS
- int count = acl->acl_cnt;
- int i;
-
- for (i = 0; i < count; i++)
- {
- acl_entry_t ace = &acl->acl_entry[i];
- acl_tag_t tag = ace->ae_tag;
+ ssize_t ret;
- if (!(tag == ACL_USER_OBJ || tag == ACL_GROUP_OBJ
- || tag == ACL_OTHER_OBJ))
+ ret = getxattr (name, XATTR_NAME_POSIX_ACL_ACCESS, NULL, 0);
+ if (ret < 0 && errno == ENODATA)
+ ret = 0;
+ else if (ret > 0)
return 1;
- }
- return 0;
-
-# elif HAVE_ACL_FREE_TEXT /* Tru64 */
- /* Don't use acl_get_entry: it takes only one argument and does not work. */
-
- int count = acl->acl_num;
- acl_entry_t ace;
- for (ace = acl->acl_first; count > 0; ace = ace->next, count--)
- {
- acl_tag_t tag;
- acl_perm_t perm;
-
- tag = ace->entry->acl_type;
- if (!(tag == ACL_USER_OBJ || tag == ACL_GROUP_OBJ || tag == ACL_OTHER))
- return 1;
-
- perm = ace->entry->acl_perm;
- /* On Tru64, perm can also contain non-standard bits such as
- PERM_INSERT, PERM_DELETE, PERM_MODIFY, PERM_LOOKUP, ... */
- if ((perm & ~(ACL_READ | ACL_WRITE | ACL_EXECUTE)) != 0)
- return 1;
- }
- return 0;
-
-# else
-
- errno = ENOSYS;
- return -1;
-# endif
-}
-
-# endif
-
-
-#elif USE_ACL && HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
-
-/* Test an ACL retrieved with GETACL.
- Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
- Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
-int
-acl_nontrivial (int count, aclent_t *entries)
-{
- int i;
-
- for (i = 0; i < count; i++)
- {
- aclent_t *ace = &entries[i];
-
- /* Note: If ace->a_type = USER_OBJ, ace->a_id is the st_uid from stat().
- If ace->a_type = GROUP_OBJ, ace->a_id is the st_gid from stat().
- We don't need to check ace->a_id in these cases. */
- if (!(ace->a_type == USER_OBJ
- || ace->a_type == GROUP_OBJ
- || ace->a_type == OTHER_OBJ
- /* Note: Cygwin does not return a CLASS_OBJ ("mask:") entry
- sometimes. */
- || ace->a_type == CLASS_OBJ))
- return 1;
- }
- return 0;
-}
-
-# ifdef ACE_GETACL
-
-/* A shortcut for a bitmask. */
-# define NEW_ACE_WRITEA_DATA (NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA)
-
-/* Test an ACL retrieved with ACE_GETACL.
- Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
- Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
-int
-acl_ace_nontrivial (int count, ace_t *entries)
-{
- int i;
-
- /* The flags in the ace_t structure changed in a binary incompatible way
- when ACL_NO_TRIVIAL etc. were introduced in <sys/acl.h> version 1.15.
- How to distinguish the two conventions at runtime?
- In the old convention, usually three ACEs have a_flags = ACE_OWNER /
- ACE_GROUP / ACE_OTHER, in the range 0x0100..0x0400. In the new
- convention, these values are not used. */
- int old_convention = 0;
-
- for (i = 0; i < count; i++)
- if (entries[i].a_flags & (OLD_ACE_OWNER | OLD_ACE_GROUP | OLD_ACE_OTHER))
- {
- old_convention = 1;
- break;
- }
-
- if (old_convention)
- /* Running on Solaris 10. */
- for (i = 0; i < count; i++)
- {
- ace_t *ace = &entries[i];
-
- /* Note:
- If ace->a_flags = ACE_OWNER, ace->a_who is the st_uid from stat().
- If ace->a_flags = ACE_GROUP, ace->a_who is the st_gid from stat().
- We don't need to check ace->a_who in these cases. */
- if (!(ace->a_type == OLD_ALLOW
- && (ace->a_flags == OLD_ACE_OWNER
- || ace->a_flags == OLD_ACE_GROUP
- || ace->a_flags == OLD_ACE_OTHER)))
- return 1;
- }
- else
- {
- /* Running on Solaris 10 (newer version) or Solaris 11. */
- unsigned int access_masks[6] =
- {
- 0, /* owner@ deny */
- 0, /* owner@ allow */
- 0, /* group@ deny */
- 0, /* group@ allow */
- 0, /* everyone@ deny */
- 0 /* everyone@ allow */
- };
-
- for (i = 0; i < count; i++)
+ if (ret == 0 && S_ISDIR (sb->st_mode))
{
- ace_t *ace = &entries[i];
- unsigned int index1;
- unsigned int index2;
-
- if (ace->a_type == NEW_ACE_ACCESS_ALLOWED_ACE_TYPE)
- index1 = 1;
- else if (ace->a_type == NEW_ACE_ACCESS_DENIED_ACE_TYPE)
- index1 = 0;
- else
+ ret = getxattr (name, XATTR_NAME_POSIX_ACL_DEFAULT, NULL, 0);
+ if (ret < 0 && errno == ENODATA)
+ ret = 0;
+ else if (ret > 0)
return 1;
-
- if (ace->a_flags == NEW_ACE_OWNER)
- index2 = 0;
- else if (ace->a_flags == (NEW_ACE_GROUP | NEW_ACE_IDENTIFIER_GROUP))
- index2 = 2;
- else if (ace->a_flags == NEW_ACE_EVERYONE)
- index2 = 4;
- else
- return 1;
-
- access_masks[index1 + index2] |= ace->a_access_mask;
- }
-
- /* The same bit shouldn't be both allowed and denied. */
- if (access_masks[0] & access_masks[1])
- return 1;
- if (access_masks[2] & access_masks[3])
- return 1;
- if (access_masks[4] & access_masks[5])
- return 1;
-
- /* Check minimum masks. */
- if ((NEW_ACE_WRITE_NAMED_ATTRS
- | NEW_ACE_WRITE_ATTRIBUTES
- | NEW_ACE_WRITE_ACL
- | NEW_ACE_WRITE_OWNER)
- & ~ access_masks[1])
- return 1;
- access_masks[1] &= ~(NEW_ACE_WRITE_NAMED_ATTRS
- | NEW_ACE_WRITE_ATTRIBUTES
- | NEW_ACE_WRITE_ACL
- | NEW_ACE_WRITE_OWNER);
- if ((NEW_ACE_READ_NAMED_ATTRS
- | NEW_ACE_READ_ATTRIBUTES
- | NEW_ACE_READ_ACL
- | NEW_ACE_SYNCHRONIZE)
- & ~ access_masks[5])
- return 1;
- access_masks[5] &= ~(NEW_ACE_READ_NAMED_ATTRS
- | NEW_ACE_READ_ATTRIBUTES
- | NEW_ACE_READ_ACL
- | NEW_ACE_SYNCHRONIZE);
-
- /* Check the allowed or denied bits. */
- switch ((access_masks[0] | access_masks[1])
- & ~(NEW_ACE_READ_NAMED_ATTRS
- | NEW_ACE_READ_ATTRIBUTES
- | NEW_ACE_READ_ACL
- | NEW_ACE_SYNCHRONIZE))
- {
- case 0:
- case NEW_ACE_READ_DATA:
- case NEW_ACE_WRITEA_DATA:
- case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA:
- case NEW_ACE_EXECUTE:
- case NEW_ACE_READ_DATA | NEW_ACE_EXECUTE:
- case NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
- case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
- break;
- default:
- return 1;
- }
- switch ((access_masks[2] | access_masks[3])
- & ~(NEW_ACE_READ_NAMED_ATTRS
- | NEW_ACE_READ_ATTRIBUTES
- | NEW_ACE_READ_ACL
- | NEW_ACE_SYNCHRONIZE))
- {
- case 0:
- case NEW_ACE_READ_DATA:
- case NEW_ACE_WRITEA_DATA:
- case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA:
- case NEW_ACE_EXECUTE:
- case NEW_ACE_READ_DATA | NEW_ACE_EXECUTE:
- case NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
- case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
- break;
- default:
- return 1;
- }
- switch ((access_masks[4] | access_masks[5])
- & ~(NEW_ACE_WRITE_NAMED_ATTRS
- | NEW_ACE_WRITE_ATTRIBUTES
- | NEW_ACE_WRITE_ACL
- | NEW_ACE_WRITE_OWNER))
- {
- case 0:
- case NEW_ACE_READ_DATA:
- case NEW_ACE_WRITEA_DATA:
- case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA:
- case NEW_ACE_EXECUTE:
- case NEW_ACE_READ_DATA | NEW_ACE_EXECUTE:
- case NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
- case NEW_ACE_READ_DATA | NEW_ACE_WRITEA_DATA | NEW_ACE_EXECUTE:
- break;
- default:
- return 1;
}
- /* Check that the NEW_ACE_WRITE_DATA and NEW_ACE_APPEND_DATA bits are
- either both allowed or both denied. */
- if (((access_masks[0] & NEW_ACE_WRITE_DATA) != 0)
- != ((access_masks[0] & NEW_ACE_APPEND_DATA) != 0))
- return 1;
- if (((access_masks[2] & NEW_ACE_WRITE_DATA) != 0)
- != ((access_masks[2] & NEW_ACE_APPEND_DATA) != 0))
- return 1;
- if (((access_masks[4] & NEW_ACE_WRITE_DATA) != 0)
- != ((access_masks[4] & NEW_ACE_APPEND_DATA) != 0))
- return 1;
- }
-
- return 0;
-}
-
-# endif
-
-#elif USE_ACL && HAVE_GETACL /* HP-UX */
-
-/* Return 1 if the given ACL is non-trivial.
- Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
-int
-acl_nontrivial (int count, struct acl_entry *entries, struct stat *sb)
-{
- int i;
-
- for (i = 0; i < count; i++)
- {
- struct acl_entry *ace = &entries[i];
-
- if (!((ace->uid == sb->st_uid && ace->gid == ACL_NSGROUP)
- || (ace->uid == ACL_NSUSER && ace->gid == sb->st_gid)
- || (ace->uid == ACL_NSUSER && ace->gid == ACL_NSGROUP)))
- return 1;
- }
- return 0;
-}
-
-# if HAVE_ACLV_H /* HP-UX >= 11.11 */
-
-/* Return 1 if the given ACL is non-trivial.
- Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
-int
-aclv_nontrivial (int count, struct acl *entries)
-{
- int i;
-
- for (i = 0; i < count; i++)
- {
- struct acl *ace = &entries[i];
-
- /* Note: If ace->a_type = USER_OBJ, ace->a_id is the st_uid from stat().
- If ace->a_type = GROUP_OBJ, ace->a_id is the st_gid from stat().
- We don't need to check ace->a_id in these cases. */
- if (!(ace->a_type == USER_OBJ /* no need to check ace->a_id here */
- || ace->a_type == GROUP_OBJ /* no need to check ace->a_id here */
- || ace->a_type == CLASS_OBJ
- || ace->a_type == OTHER_OBJ))
- return 1;
- }
- return 0;
-}
-
-# endif
-
-#elif USE_ACL && (HAVE_ACLX_GET || HAVE_STATACL) /* AIX */
-
-/* Return 1 if the given ACL is non-trivial.
- Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
-int
-acl_nontrivial (struct acl *a)
-{
- /* The normal way to iterate through an ACL is like this:
- struct acl_entry *ace;
- for (ace = a->acl_ext; ace != acl_last (a); ace = acl_nxt (ace))
- {
- struct ace_id *aei;
- switch (ace->ace_type)
- {
- case ACC_PERMIT:
- case ACC_DENY:
- case ACC_SPECIFY:
- ...;
- }
- for (aei = ace->ace_id; aei != id_last (ace); aei = id_nxt (aei))
- ...
- }
- */
- return (acl_last (a) != a->acl_ext ? 1 : 0);
-}
-
-# if HAVE_ACLX_GET && defined ACL_AIX_WIP /* newer AIX */
-
-/* Return 1 if the given ACL is non-trivial.
- Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
-int
-acl_nfs4_nontrivial (nfs4_acl_int_t *a)
-{
-# if 1 /* let's try this first */
- return (a->aclEntryN > 0 ? 1 : 0);
-# else
- int count = a->aclEntryN;
- int i;
-
- for (i = 0; i < count; i++)
- {
- nfs4_ace_int_t *ace = &a->aclEntry[i];
-
- if (!((ace->flags & ACE4_ID_SPECIAL) != 0
- && (ace->aceWho.special_whoid == ACE4_WHO_OWNER
- || ace->aceWho.special_whoid == ACE4_WHO_GROUP
- || ace->aceWho.special_whoid == ACE4_WHO_EVERYONE)
- && ace->aceType == ACE4_ACCESS_ALLOWED_ACE_TYPE
- && ace->aceFlags == 0
- && (ace->aceMask & ~(ACE4_READ_DATA | ACE4_LIST_DIRECTORY
- | ACE4_WRITE_DATA | ACE4_ADD_FILE
- | ACE4_EXECUTE)) == 0))
- return 1;
- }
- return 0;
-# endif
-}
-
-# endif
-
-#elif USE_ACL && HAVE_ACLSORT /* NonStop Kernel */
-
-/* Test an ACL retrieved with ACL_GET.
- Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
- Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
-int
-acl_nontrivial (int count, struct acl *entries)
-{
- int i;
-
- for (i = 0; i < count; i++)
- {
- struct acl *ace = &entries[i];
-
- /* Note: If ace->a_type = USER_OBJ, ace->a_id is the st_uid from stat().
- If ace->a_type = GROUP_OBJ, ace->a_id is the st_gid from stat().
- We don't need to check ace->a_id in these cases. */
- if (!(ace->a_type == USER_OBJ /* no need to check ace->a_id here */
- || ace->a_type == GROUP_OBJ /* no need to check ace->a_id here */
- || ace->a_type == CLASS_OBJ
- || ace->a_type == OTHER_OBJ))
- return 1;
- }
- return 0;
-}
-
-#endif
-
-
-/* Return 1 if NAME has a nontrivial access control list, 0 if NAME
- only has no or a base access control list, and -1 (setting errno)
- on error. SB must be set to the stat buffer of NAME, obtained
- through stat() or lstat(). */
+ if (ret < 0)
+ return - acl_errno_valid (errno);
+ return ret;
-int
-file_has_acl (char const *name, struct stat const *sb)
-{
-#if USE_ACL
- if (! S_ISLNK (sb->st_mode))
- {
-# if HAVE_ACL_GET_FILE
+# elif HAVE_ACL_GET_FILE
/* POSIX 1003.1e (draft 17 -- abandoned) specific version. */
/* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
@@ -873,7 +457,7 @@ file_has_acl (char const *name, struct stat const *sb)
union { struct acl a; char room[4096]; } u;
- if (statacl (name, STX_NORMAL, &u.a, sizeof (u)) < 0)
+ if (statacl ((char *) name, STX_NORMAL, &u.a, sizeof (u)) < 0)
return -1;
return acl_nontrivial (&u.a);
diff --git a/lib/file-set.c b/lib/file-set.c
index c3130d98..1cf2f0c3 100644
--- a/lib/file-set.c
+++ b/lib/file-set.c
@@ -1,5 +1,5 @@
/* Specialized functions to manipulate a set of files.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/file-type.c b/lib/file-type.c
index bf3026f3..b58845fe 100644
--- a/lib/file-type.c
+++ b/lib/file-type.c
@@ -1,6 +1,6 @@
/* Return a string describing the type of a file.
- Copyright (C) 1993-1994, 2001-2002, 2004-2006, 2009-2014 Free Software
+ Copyright (C) 1993-1994, 2001-2002, 2004-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/file-type.h b/lib/file-type.h
index ff99a9d7..7cfc8a18 100644
--- a/lib/file-type.h
+++ b/lib/file-type.h
@@ -1,6 +1,6 @@
/* Return a string describing the type of a file.
- Copyright (C) 1993-1994, 2001-2002, 2004-2005, 2009-2014 Free Software
+ Copyright (C) 1993-1994, 2001-2002, 2004-2005, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/fileblocks.c b/lib/fileblocks.c
index 6de113b2..27f49c04 100644
--- a/lib/fileblocks.c
+++ b/lib/fileblocks.c
@@ -1,6 +1,6 @@
/* Convert file size to number of blocks on System V-like machines.
- Copyright (C) 1990, 1997-1999, 2004-2006, 2009-2014 Free Software
+ Copyright (C) 1990, 1997-1999, 2004-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/filemode.c b/lib/filemode.c
index 3e2f8c03..3b19507f 100644
--- a/lib/filemode.c
+++ b/lib/filemode.c
@@ -1,6 +1,6 @@
/* filemode.c -- make a string describing file modes
- Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2014 Free
+ Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2015 Free
Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/filemode.h b/lib/filemode.h
index c51e6a3a..ff0460a5 100644
--- a/lib/filemode.h
+++ b/lib/filemode.h
@@ -1,6 +1,6 @@
/* Make a string describing file modes.
- Copyright (C) 1998-1999, 2003, 2006, 2009-2014 Free Software Foundation,
+ Copyright (C) 1998-1999, 2003, 2006, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/filename.h b/lib/filename.h
index 96dbaaa7..45769931 100644
--- a/lib/filename.h
+++ b/lib/filename.h
@@ -1,5 +1,5 @@
/* Basic filename support macros.
- Copyright (C) 2001-2004, 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/filenamecat-lgpl.c b/lib/filenamecat-lgpl.c
index e817f97c..a359a516 100644
--- a/lib/filenamecat-lgpl.c
+++ b/lib/filenamecat-lgpl.c
@@ -1,6 +1,6 @@
/* Concatenate two arbitrary file names.
- Copyright (C) 1996-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/filenamecat.c b/lib/filenamecat.c
index 64c27f20..34ad6921 100644
--- a/lib/filenamecat.c
+++ b/lib/filenamecat.c
@@ -1,6 +1,6 @@
/* Concatenate two arbitrary file names.
- Copyright (C) 1996-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/filenamecat.h b/lib/filenamecat.h
index b33dce84..62f81b00 100644
--- a/lib/filenamecat.h
+++ b/lib/filenamecat.h
@@ -1,6 +1,6 @@
/* Concatenate two arbitrary file names.
- Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2014 Free Software
+ Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/filevercmp.c b/lib/filevercmp.c
index f09205ac..80e4547c 100644
--- a/lib/filevercmp.c
+++ b/lib/filevercmp.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au>
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/filevercmp.h b/lib/filevercmp.h
index 72785cd6..050e7c9b 100644
--- a/lib/filevercmp.h
+++ b/lib/filevercmp.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au>
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -37,6 +37,6 @@
PREFIX VER2 SUFFIX) < 0.
This function is intended to be a replacement for strverscmp. */
-int filevercmp (const char *s1, const char *s2);
+int filevercmp (const char *s1, const char *s2) _GL_ATTRIBUTE_PURE;
#endif /* FILEVERCMP_H */
diff --git a/lib/float+.h b/lib/float+.h
index 5ff15110..e6aaa922 100644
--- a/lib/float+.h
+++ b/lib/float+.h
@@ -1,5 +1,5 @@
/* Supplemental information about the floating-point formats.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/float.c b/lib/float.c
index b7c321dd..dac9f88e 100644
--- a/lib/float.c
+++ b/lib/float.c
@@ -1,5 +1,5 @@
/* Auxiliary definitions for <float.h>.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/float.in.h b/lib/float.in.h
index db809f8f..3bb38264 100644
--- a/lib/float.in.h
+++ b/lib/float.in.h
@@ -1,6 +1,6 @@
/* A correct <float.h>.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fnmatch.c b/lib/fnmatch.c
index 4246d822..f4a9e7c6 100644
--- a/lib/fnmatch.c
+++ b/lib/fnmatch.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1993, 1996-2007, 2009-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993, 1996-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fnmatch.in.h b/lib/fnmatch.in.h
index d4cea656..eb5815a0 100644
--- a/lib/fnmatch.in.h
+++ b/lib/fnmatch.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2014 Free
+/* Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2015 Free
Software Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/fnmatch_loop.c b/lib/fnmatch_loop.c
index 4c6000fa..61778bdd 100644
--- a/lib/fnmatch_loop.c
+++ b/lib/fnmatch_loop.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1993, 1996-2006, 2009-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993, 1996-2006, 2009-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/fopen-safer.c b/lib/fopen-safer.c
index 3c9e286a..c3a4f6dd 100644
--- a/lib/fopen-safer.c
+++ b/lib/fopen-safer.c
@@ -1,6 +1,6 @@
/* Invoke fopen, but avoid some glitches.
- Copyright (C) 2001, 2004-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fopen.c b/lib/fopen.c
index 8fead5a8..139ede28 100644
--- a/lib/fopen.c
+++ b/lib/fopen.c
@@ -1,5 +1,5 @@
/* Open a stream to a file.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fpending.c b/lib/fpending.c
index 31aba1ad..c4b4a519 100644
--- a/lib/fpending.c
+++ b/lib/fpending.c
@@ -1,5 +1,5 @@
/* fpending.c -- return the number of pending output bytes on a stream
- Copyright (C) 2000, 2004, 2006-2007, 2009-2014 Free Software Foundation,
+ Copyright (C) 2000, 2004, 2006-2007, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/fpending.h b/lib/fpending.h
index dd607fe2..5a1b2ad9 100644
--- a/lib/fpending.h
+++ b/lib/fpending.h
@@ -1,6 +1,6 @@
/* Declare __fpending.
- Copyright (C) 2000, 2003, 2005-2006, 2009-2014 Free Software Foundation,
+ Copyright (C) 2000, 2003, 2005-2006, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/fprintftime.h b/lib/fprintftime.h
index 9b367cd6..0034fc8d 100644
--- a/lib/fprintftime.h
+++ b/lib/fprintftime.h
@@ -1,6 +1,6 @@
/* Generate time strings directly to the output. */
-/* Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fpucw.h b/lib/fpucw.h
index 9170c27f..cedd5b42 100644
--- a/lib/fpucw.h
+++ b/lib/fpucw.h
@@ -1,5 +1,5 @@
/* Manipulating the FPU control word.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/fpurge.c b/lib/fpurge.c
index 54a27225..f313b221 100644
--- a/lib/fpurge.c
+++ b/lib/fpurge.c
@@ -1,5 +1,5 @@
/* Flushing buffers of a FILE stream.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -43,7 +43,8 @@ fpurge (FILE *fp)
extern int fpurge (FILE *);
# endif
int result = fpurge (fp);
-# if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
+# if defined __sferror || defined __DragonFly__ || defined __ANDROID__
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
if (result == 0)
/* Correct the invariants that fpurge broke.
<stdio.h> on BSD systems says:
@@ -71,7 +72,8 @@ fpurge (FILE *fp)
fp->_IO_save_base = NULL;
}
return 0;
-# elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
+# elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
fp_->_p = fp_->_bf._base;
fp_->_r = 0;
fp_->_w = ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
diff --git a/lib/freadahead.c b/lib/freadahead.c
index 01b08108..094daabf 100644
--- a/lib/freadahead.c
+++ b/lib/freadahead.c
@@ -1,5 +1,5 @@
/* Retrieve information about a FILE stream.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -31,7 +31,8 @@ freadahead (FILE *fp)
return (fp->_IO_read_end - fp->_IO_read_ptr)
+ (fp->_flags & _IO_IN_BACKUP ? fp->_IO_save_end - fp->_IO_save_base :
0);
-#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
+#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
if ((fp_->_flags & __SWR) != 0 || fp_->_r < 0)
return 0;
# if defined __DragonFly__
diff --git a/lib/freadahead.h b/lib/freadahead.h
index 85c16b99..b6e7d2ff 100644
--- a/lib/freadahead.h
+++ b/lib/freadahead.h
@@ -1,5 +1,5 @@
/* Retrieve information about a FILE stream.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/freading.c b/lib/freading.c
index dee43256..0512b190 100644
--- a/lib/freading.c
+++ b/lib/freading.c
@@ -1,5 +1,5 @@
/* Retrieve information about a FILE stream.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -35,7 +35,8 @@ freading (FILE *fp)
return ((fp->_flags & _IO_NO_WRITES) != 0
|| ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
&& fp->_IO_read_base != NULL));
-# elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
+# elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
return (fp_->_flags & __SRD) != 0;
# elif defined __EMX__ /* emx+gcc */
return (fp->_flags & _IOREAD) != 0;
diff --git a/lib/freading.h b/lib/freading.h
index 3d1c7b2c..f295e9da 100644
--- a/lib/freading.h
+++ b/lib/freading.h
@@ -1,5 +1,5 @@
/* Retrieve information about a FILE stream.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/freadptr.c b/lib/freadptr.c
index 26c66ede..818c7ee6 100644
--- a/lib/freadptr.c
+++ b/lib/freadptr.c
@@ -1,5 +1,5 @@
/* Retrieve information about a FILE stream.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -37,7 +37,8 @@ freadptr (FILE *fp, size_t *sizep)
return NULL;
*sizep = size;
return (const char *) fp->_IO_read_ptr;
-#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
+#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
if ((fp_->_flags & __SWR) != 0 || fp_->_r < 0)
return NULL;
size = fp_->_r;
diff --git a/lib/freadptr.h b/lib/freadptr.h
index 45fb93fd..8651e943 100644
--- a/lib/freadptr.h
+++ b/lib/freadptr.h
@@ -1,5 +1,5 @@
/* Retrieve information about a FILE stream.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/freadseek.c b/lib/freadseek.c
index 5301794b..43a80cbe 100644
--- a/lib/freadseek.c
+++ b/lib/freadseek.c
@@ -1,5 +1,5 @@
/* Skipping input from a FILE stream.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -38,7 +38,8 @@ freadptrinc (FILE *fp, size_t increment)
__freadptrinc (fp, increment);
#elif defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_IO_read_ptr += increment;
-#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
+#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
fp_->_p += increment;
fp_->_r -= increment;
#elif defined __EMX__ /* emx+gcc */
diff --git a/lib/freadseek.h b/lib/freadseek.h
index 84ce3508..0518a597 100644
--- a/lib/freadseek.h
+++ b/lib/freadseek.h
@@ -1,5 +1,5 @@
/* Skipping input from a FILE stream.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/freopen-safer.c b/lib/freopen-safer.c
index 714dc1df..2759b516 100644
--- a/lib/freopen-safer.c
+++ b/lib/freopen-safer.c
@@ -1,6 +1,6 @@
/* Invoke freopen, but avoid some glitches.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/freopen.c b/lib/freopen.c
index 384eba64..7ceef765 100644
--- a/lib/freopen.c
+++ b/lib/freopen.c
@@ -1,5 +1,5 @@
/* Open a stream to a file.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,6 +26,8 @@
#include <stdio.h>
#undef __need_FILE
+#include <errno.h>
+
static FILE *
orig_freopen (const char *filename, const char *mode, FILE *stream)
{
@@ -42,10 +44,24 @@ orig_freopen (const char *filename, const char *mode, FILE *stream)
FILE *
rpl_freopen (const char *filename, const char *mode, FILE *stream)
{
+ FILE *result;
+
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
if (filename != NULL && strcmp (filename, "/dev/null") == 0)
filename = "NUL";
#endif
- return orig_freopen (filename, mode, stream);
+ /* Clear errno to check the success of freopen() with it */
+ errno = 0;
+
+ result = orig_freopen (filename, mode, stream);
+
+#ifdef __KLIBC__
+ /* On OS/2 kLIBC, freopen() returns NULL even if it is successful
+ if filename is NULL. */
+ if (!filename && !result && !errno)
+ result = stream;
+#endif
+
+ return result;
}
diff --git a/lib/frexp.c b/lib/frexp.c
index 17ddcef8..776bd53c 100644
--- a/lib/frexp.c
+++ b/lib/frexp.c
@@ -1,5 +1,5 @@
/* Split a double into fraction and mantissa.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/frexpl.c b/lib/frexpl.c
index 78e1c704..e09cc108 100644
--- a/lib/frexpl.c
+++ b/lib/frexpl.c
@@ -1,5 +1,5 @@
/* Split a 'long double' into fraction and mantissa.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fseek.c b/lib/fseek.c
index f778145c..0d2e3067 100644
--- a/lib/fseek.c
+++ b/lib/fseek.c
@@ -1,5 +1,5 @@
/* An fseek() function that, together with fflush(), is POSIX compliant.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fseeko.c b/lib/fseeko.c
index e56ad0bc..1c65d2a8 100644
--- a/lib/fseeko.c
+++ b/lib/fseeko.c
@@ -1,5 +1,5 @@
/* An fseeko() function that, together with fflush(), is POSIX compliant.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -51,7 +51,8 @@ fseeko (FILE *fp, off_t offset, int whence)
if (fp->_IO_read_end == fp->_IO_read_ptr
&& fp->_IO_write_ptr == fp->_IO_write_base
&& fp->_IO_save_base == NULL)
-#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
+#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
# if defined __SL64 && defined __SCLE /* Cygwin */
if ((fp->_flags & __SL64) == 0)
{
@@ -115,7 +116,8 @@ fseeko (FILE *fp, off_t offset, int whence)
off_t pos = lseek (fileno (fp), offset, whence);
if (pos == -1)
{
-#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
+#if defined __sferror || defined __DragonFly__ || defined __ANDROID__
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
fp_->_flags &= ~__SOFF;
#endif
return -1;
@@ -124,8 +126,9 @@ fseeko (FILE *fp, off_t offset, int whence)
#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_flags &= ~_IO_EOF_SEEN;
fp->_offset = pos;
-#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
-# if defined __CYGWIN__
+#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
+# if defined __CYGWIN__ || (defined __NetBSD__ && __NetBSD_Version__ >= 600000000)
/* fp_->_offset is typed as an integer. */
fp_->_offset = pos;
# else
diff --git a/lib/fseterr.c b/lib/fseterr.c
index 1e212e42..a35daa73 100644
--- a/lib/fseterr.c
+++ b/lib/fseterr.c
@@ -1,5 +1,5 @@
/* Set the error indicator of a stream.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -31,7 +31,8 @@ fseterr (FILE *fp)
fast macros. */
#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_flags |= _IO_ERR_SEEN;
-#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
+#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
fp_->_flags |= __SERR;
#elif defined __EMX__ /* emx+gcc */
fp->_flags |= _IOERR;
diff --git a/lib/fseterr.h b/lib/fseterr.h
index 81672fb9..a3a4dbcc 100644
--- a/lib/fseterr.h
+++ b/lib/fseterr.h
@@ -1,5 +1,5 @@
/* Set the error indicator of a stream.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fstat.c b/lib/fstat.c
index ffcda9f5..7a0521fa 100644
--- a/lib/fstat.c
+++ b/lib/fstat.c
@@ -1,5 +1,5 @@
/* fstat() replacement.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fstatat.c b/lib/fstatat.c
index 44e32668..6a9e8623 100644
--- a/lib/fstatat.c
+++ b/lib/fstatat.c
@@ -1,6 +1,6 @@
/* Work around an fstatat bug on Solaris 9.
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fsusage.c b/lib/fsusage.c
index 5bfc9cd0..905c39fd 100644
--- a/lib/fsusage.c
+++ b/lib/fsusage.c
@@ -1,6 +1,6 @@
/* fsusage.c -- return space usage of mounted file systems
- Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2014 Free Software
+ Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/fsusage.h b/lib/fsusage.h
index c1ce2811..b45e706a 100644
--- a/lib/fsusage.h
+++ b/lib/fsusage.h
@@ -1,6 +1,6 @@
/* fsusage.h -- declarations for file system space usage info
- Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/fsync.c b/lib/fsync.c
index b09a8e64..b51d654d 100644
--- a/lib/fsync.c
+++ b/lib/fsync.c
@@ -7,7 +7,7 @@
Written by Richard W.M. Jones <rjones.at.redhat.com>
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
diff --git a/lib/ftell.c b/lib/ftell.c
index d5cbccd7..7f11eb3c 100644
--- a/lib/ftell.c
+++ b/lib/ftell.c
@@ -1,5 +1,5 @@
/* An ftell() function that works around platform bugs.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/ftello.c b/lib/ftello.c
index ee4f7dc0..d6f221a6 100644
--- a/lib/ftello.c
+++ b/lib/ftello.c
@@ -1,5 +1,5 @@
/* An ftello() function that works around platform bugs.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/ftoastr.c b/lib/ftoastr.c
index 7780d008..5cdaedf4 100644
--- a/lib/ftoastr.c
+++ b/lib/ftoastr.c
@@ -1,6 +1,6 @@
/* floating point to accurate string
- Copyright (C) 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2010-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/ftoastr.h b/lib/ftoastr.h
index 26cad736..970c3b1c 100644
--- a/lib/ftoastr.h
+++ b/lib/ftoastr.h
@@ -1,6 +1,6 @@
/* floating point to accurate string
- Copyright (C) 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2010-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/ftruncate.c b/lib/ftruncate.c
index d7a5f203..b3ac8027 100644
--- a/lib/ftruncate.c
+++ b/lib/ftruncate.c
@@ -1,5 +1,5 @@
/* ftruncate emulations for native Windows.
- Copyright (C) 1992-2014 Free Software Foundation, Inc.
+ Copyright (C) 1992-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/fts-cycle.c b/lib/fts-cycle.c
index 95da56e2..7c96bc66 100644
--- a/lib/fts-cycle.c
+++ b/lib/fts-cycle.c
@@ -1,6 +1,6 @@
/* Detect cycles in file tree walks.
- Copyright (C) 2003-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2006, 2009-2015 Free Software Foundation, Inc.
Written by Jim Meyering.
diff --git a/lib/fts.c b/lib/fts.c
index 500e92c6..a2f65eb8 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -1,6 +1,6 @@
/* Traverse a file hierarchy.
- Copyright (C) 2004-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -62,6 +62,7 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
#endif
#include <fcntl.h>
#include <errno.h>
+#include <stdalign.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
@@ -189,7 +190,7 @@ enum Fts_stat
#endif
#ifdef NDEBUG
-# define fts_assert(expr) ((void) 0)
+# define fts_assert(expr) ((void) (0 && (expr)))
#else
# define fts_assert(expr) \
do \
@@ -1079,9 +1080,6 @@ cd_dot_dot:
}
} else if (p->fts_flags & FTS_SYMFOLLOW) {
if (FCHDIR(sp, p->fts_symfd)) {
- int saved_errno = errno;
- (void)close(p->fts_symfd);
- __set_errno (saved_errno);
p->fts_errno = errno;
SET(FTS_STOP);
}
@@ -1091,9 +1089,15 @@ cd_dot_dot:
p->fts_errno = errno;
SET(FTS_STOP);
}
- p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
- if (p->fts_errno == 0)
- LEAVE_DIR (sp, p, "3");
+
+ /* If the directory causes a cycle, preserve the FTS_DC flag and keep
+ the corresponding dev/ino pair in the hash table. It is going to be
+ removed when leaving the original directory. */
+ if (p->fts_info != FTS_DC) {
+ p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
+ if (p->fts_errno == 0)
+ LEAVE_DIR (sp, p, "3");
+ }
return ISSET(FTS_STOP) ? NULL : p;
}
@@ -1293,6 +1297,7 @@ fts_build (register FTS *sp, int type)
int dir_fd;
FTSENT *cur = sp->fts_cur;
bool continue_readdir = !!cur->fts_dirp;
+ size_t max_entries;
/* When cur->fts_dirp is non-NULL, that means we should
continue calling readdir on that existing DIR* pointer
@@ -1354,8 +1359,7 @@ fts_build (register FTS *sp, int type)
function. But when no such function is specified, we can read
entries in batches that are large enough to help us with inode-
sorting, yet not so large that we risk exhausting memory. */
- size_t max_entries = (sp->fts_compar == NULL
- ? FTS_MAX_READDIR_ENTRIES : SIZE_MAX);
+ max_entries = sp->fts_compar ? SIZE_MAX : FTS_MAX_READDIR_ENTRIES;
/*
* Nlinks is the number of possible entries of type directory in the
@@ -1902,7 +1906,13 @@ fts_alloc (FTS *sp, const char *name, register size_t namelen)
* The file name is a variable length array. Allocate the FTSENT
* structure and the file name in one chunk.
*/
- len = sizeof(FTSENT) + namelen;
+ len = offsetof(FTSENT, fts_name) + namelen + 1;
+ /* Round the allocation up so it has the same alignment as FTSENT,
+ so that trailing padding may be referenced by direct access
+ to the flexible array members, without triggering undefined behavior
+ by accessing bytes beyond the heap allocation. This implicit access
+ was seen for example with ISDOT() and GCC 5.1.1 at -O2. */
+ len = (len + alignof(FTSENT) - 1) & ~(alignof(FTSENT) - 1);
if ((p = malloc(len)) == NULL)
return (NULL);
diff --git a/lib/fts_.h b/lib/fts_.h
index 63d4b742..b9a3f12c 100644
--- a/lib/fts_.h
+++ b/lib/fts_.h
@@ -1,6 +1,6 @@
/* Traverse a file hierarchy.
- Copyright (C) 2004-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -51,7 +51,13 @@
# ifdef _LIBC
# include <features.h>
+# if __STDC_VERSION__ < 199901L
+# define __FLEXIBLE_ARRAY_MEMBER 1
+# else
+# define __FLEXIBLE_ARRAY_MEMBER
+# endif
# else
+# define __FLEXIBLE_ARRAY_MEMBER FLEXIBLE_ARRAY_MEMBER
# undef __THROW
# define __THROW
# undef __BEGIN_DECLS
@@ -243,7 +249,7 @@ typedef struct _ftsent {
unsigned short int fts_instr; /* fts_set() instructions */
struct stat fts_statp[1]; /* stat(2) information */
- char fts_name[1]; /* file name */
+ char fts_name[__FLEXIBLE_ARRAY_MEMBER]; /* file name */
} FTSENT;
#ifndef __GNUC_PREREQ
diff --git a/lib/full-read.c b/lib/full-read.c
index 31b600bb..e8bfe7a2 100644
--- a/lib/full-read.c
+++ b/lib/full-read.c
@@ -1,5 +1,5 @@
/* An interface to read that retries after partial reads and interrupts.
- Copyright (C) 2002-2003, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/full-read.h b/lib/full-read.h
index 5eadd158..8ed6581c 100644
--- a/lib/full-read.h
+++ b/lib/full-read.h
@@ -1,6 +1,6 @@
/* An interface to read() that reads all it is asked to read.
- Copyright (C) 2002, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -13,7 +13,6 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, read to the Free Software Foundation,
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <stddef.h>
diff --git a/lib/full-write.c b/lib/full-write.c
index b8036772..027f77ad 100644
--- a/lib/full-write.c
+++ b/lib/full-write.c
@@ -1,6 +1,6 @@
/* An interface to read and write that retries (if necessary) until complete.
- Copyright (C) 1993-1994, 1997-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1993-1994, 1997-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/full-write.h b/lib/full-write.h
index 589f6e1b..b32b53d9 100644
--- a/lib/full-write.h
+++ b/lib/full-write.h
@@ -1,6 +1,6 @@
/* An interface to write() that writes all it is asked to write.
- Copyright (C) 2002-2003, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/futimens.c b/lib/futimens.c
index 96c0b73e..b729babb 100644
--- a/lib/futimens.c
+++ b/lib/futimens.c
@@ -1,5 +1,5 @@
/* Set the access and modification time of an open fd.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/gai_strerror.c b/lib/gai_strerror.c
index 9c393880..6ed4bb79 100644
--- a/lib/gai_strerror.c
+++ b/lib/gai_strerror.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2014 Free Software
+/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2015 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
diff --git a/lib/get-permissions.c b/lib/get-permissions.c
new file mode 100644
index 00000000..6c6618df
--- /dev/null
+++ b/lib/get-permissions.c
@@ -0,0 +1,285 @@
+/* get-permissions.c - get permissions of a file
+
+ Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible. */
+
+#include <config.h>
+
+#include <string.h>
+#include "acl.h"
+
+#include "acl-internal.h"
+
+/* Read the permissions of a file into CTX. If DESC is a valid file descriptor,
+ use file descriptor operations, else use filename based operations on NAME.
+ MODE is the file mode obtained from a previous stat call.
+ Return 0 if successful. Return -1 and set errno upon failure. */
+
+int
+get_permissions (const char *name, int desc, mode_t mode,
+ struct permission_context *ctx)
+{
+ memset (ctx, 0, sizeof *ctx);
+ ctx->mode = mode;
+
+#if USE_ACL && HAVE_ACL_GET_FILE
+ /* POSIX 1003.1e (draft 17 -- abandoned) specific version. */
+ /* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
+# if !HAVE_ACL_TYPE_EXTENDED
+ /* Linux, FreeBSD, IRIX, Tru64 */
+
+ if (HAVE_ACL_GET_FD && desc != -1)
+ ctx->acl = acl_get_fd (desc);
+ else
+ ctx->acl = acl_get_file (name, ACL_TYPE_ACCESS);
+ if (ctx->acl == NULL)
+ return acl_errno_valid (errno) ? -1 : 0;
+
+ /* With POSIX ACLs, a file cannot have "no" acl; a file without
+ extended permissions has a "minimal" acl which is equivalent to the
+ file mode. */
+
+ if (S_ISDIR (mode))
+ {
+ ctx->default_acl = acl_get_file (name, ACL_TYPE_DEFAULT);
+ if (ctx->default_acl == NULL)
+ return -1;
+ }
+
+# else /* HAVE_ACL_TYPE_EXTENDED */
+ /* Mac OS X */
+
+ /* On Mac OS X, acl_get_file (name, ACL_TYPE_ACCESS)
+ and acl_get_file (name, ACL_TYPE_DEFAULT)
+ always return NULL / EINVAL. You have to use
+ acl_get_file (name, ACL_TYPE_EXTENDED)
+ or acl_get_fd (open (name, ...))
+ to retrieve an ACL.
+ On the other hand,
+ acl_set_file (name, ACL_TYPE_ACCESS, acl)
+ and acl_set_file (name, ACL_TYPE_DEFAULT, acl)
+ have the same effect as
+ acl_set_file (name, ACL_TYPE_EXTENDED, acl):
+ Each of these calls sets the file's ACL. */
+
+ if (HAVE_ACL_GET_FD && desc != -1)
+ ctx->acl = acl_get_fd (desc);
+ else
+ ctx->acl = acl_get_file (name, ACL_TYPE_EXTENDED);
+ if (ctx->acl == NULL)
+ return acl_errno_valid (errno) ? -1 : 0;
+
+# endif
+
+#elif USE_ACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
+
+ /* Solaris 2.5 through Solaris 10, Cygwin, and contemporaneous versions
+ of Unixware. The acl() call returns the access and default ACL both
+ at once. */
+# ifdef ACE_GETACL
+ /* Solaris also has a different variant of ACLs, used in ZFS and NFSv4
+ file systems (whereas the other ones are used in UFS file systems).
+ There is an API
+ pathconf (name, _PC_ACL_ENABLED)
+ fpathconf (desc, _PC_ACL_ENABLED)
+ that allows to determine which of the two kinds of ACLs is supported
+ for the given file. But some file systems may implement this call
+ incorrectly, so better not use it.
+ When fetching the source ACL, we simply fetch both ACL types.
+ When setting the destination ACL, we try either ACL types, assuming
+ that the kernel will translate the ACL from one form to the other.
+ (See in <http://docs.sun.com/app/docs/doc/819-2241/6n4huc7ia?l=en&a=view>
+ the description of ENOTSUP.) */
+ for (;;)
+ {
+ int ret;
+
+ if (desc != -1)
+ ret = facl (desc, ACE_GETACLCNT, 0, NULL);
+ else
+ ret = acl (name, ACE_GETACLCNT, 0, NULL);
+ if (ret < 0)
+ {
+ if (errno == ENOSYS || errno == EINVAL)
+ ret = 0;
+ else
+ return -1;
+ }
+ ctx->ace_count = ret;
+
+ if (ctx->ace_count == 0)
+ break;
+
+ ctx->ace_entries = (ace_t *) malloc (ctx->ace_count * sizeof (ace_t));
+ if (ctx->ace_entries == NULL)
+ {
+ errno = ENOMEM;
+ return -1;
+ }
+
+ if (desc != -1)
+ ret = facl (desc, ACE_GETACL, ctx->ace_count, ctx->ace_entries);
+ else
+ ret = acl (name, ACE_GETACL, ctx->ace_count, ctx->ace_entries);
+ if (ret < 0)
+ {
+ if (errno == ENOSYS || errno == EINVAL)
+ {
+ free (ctx->ace_entries);
+ ctx->ace_entries = NULL;
+ ctx->ace_count = 0;
+ break;
+ }
+ else
+ return -1;
+ }
+ if (ret <= ctx->ace_count)
+ {
+ ctx->ace_count = ret;
+ break;
+ }
+ /* Huh? The number of ACL entries has increased since the last call.
+ Repeat. */
+ free (ctx->ace_entries);
+ ctx->ace_entries = NULL;
+ }
+# endif
+
+ for (;;)
+ {
+ int ret;
+
+ if (desc != -1)
+ ret = facl (desc, GETACLCNT, 0, NULL);
+ else
+ ret = acl (name, GETACLCNT, 0, NULL);
+ if (ret < 0)
+ {
+ if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP)
+ ret = 0;
+ else
+ return -1;
+ }
+ ctx->count = ret;
+
+ if (ctx->count == 0)
+ break;
+
+ ctx->entries = (aclent_t *) malloc (ctx->count * sizeof (aclent_t));
+ if (ctx->entries == NULL)
+ {
+ errno = ENOMEM;
+ return -1;
+ }
+
+ if (desc != -1)
+ ret = facl (desc, GETACL, ctx->count, ctx->entries);
+ else
+ ret = acl (name, GETACL, ctx->count, ctx->entries);
+ if (ret < 0)
+ {
+ if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP)
+ {
+ free (ctx->entries);
+ ctx->entries = NULL;
+ ctx->count = 0;
+ break;
+ }
+ else
+ return -1;
+ }
+ if (ret <= ctx->count)
+ {
+ ctx->count = ret;
+ break;
+ }
+ /* Huh? The number of ACL entries has increased since the last call.
+ Repeat. */
+ free (ctx->entries);
+ ctx->entries = NULL;
+ }
+
+#elif USE_ACL && HAVE_GETACL /* HP-UX */
+
+ {
+ int ret;
+
+ if (desc != -1)
+ ret = fgetacl (desc, NACLENTRIES, ctx->entries);
+ else
+ ret = getacl (name, NACLENTRIES, ctx->entries);
+ if (ret < 0)
+ {
+ if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
+ ret = 0;
+ else
+ return -1;
+ }
+ else if (ret > NACLENTRIES)
+ /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
+ abort ();
+ ctx->count = ret;
+
+# if HAVE_ACLV_H
+ ret = acl ((char *) name, ACL_GET, NACLVENTRIES, ctx->aclv_entries);
+ if (ret < 0)
+ {
+ if (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
+ ret = 0;
+ else
+ return -2;
+ }
+ else if (ret > NACLVENTRIES)
+ /* If NACLVENTRIES cannot be trusted, use dynamic memory allocation. */
+ abort ();
+ ctx->aclv_count = ret;
+# endif
+ }
+
+#elif USE_ACL && HAVE_ACLX_GET && ACL_AIX_WIP /* AIX */
+
+ /* TODO (see set_permissions). */
+
+#elif USE_ACL && HAVE_STATACL /* older AIX */
+
+ {
+ int ret;
+ if (desc != -1)
+ ret = fstatacl (desc, STX_NORMAL, &ctx->u.a, sizeof ctx->u);
+ else
+ ret = statacl ((char *) name, STX_NORMAL, &ctx->u.a, sizeof ctx->u);
+ if (ret == 0)
+ ctx->have_u = true;
+ }
+
+#elif USE_ACL && HAVE_ACLSORT /* NonStop Kernel */
+
+ {
+ int ret = acl ((char *) name, ACL_GET, NACLENTRIES, ctx->entries);
+ if (ret < 0)
+ return -1;
+ else if (ret > NACLENTRIES)
+ /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
+ abort ();
+ ctx->count = ret;
+ }
+
+#endif
+
+ return 0;
+
+}
diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c
index eef7a0c4..d80974c6 100644
--- a/lib/getaddrinfo.c
+++ b/lib/getaddrinfo.c
@@ -1,5 +1,5 @@
/* Get address information (partial implementation).
- Copyright (C) 1997, 2001-2002, 2004-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2001-2002, 2004-2015 Free Software Foundation, Inc.
Contributed by Simon Josefsson <simon@josefsson.org>.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/getcwd-lgpl.c b/lib/getcwd-lgpl.c
index 044c0000..1e17e193 100644
--- a/lib/getcwd-lgpl.c
+++ b/lib/getcwd-lgpl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2015 Free Software Foundation, Inc.
This file is part of gnulib.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/getcwd.c b/lib/getcwd.c
index 1a013f47..db5279db 100644
--- a/lib/getcwd.c
+++ b/lib/getcwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1999, 2004-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999, 2004-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
@@ -93,8 +93,12 @@
FIXME - if the kernel ever adds support for multi-thread safety for
avoiding standard fds, then we should use opendir_safer and
openat_safer. */
-#undef opendir
-#undef closedir
+#ifdef GNULIB_defined_opendir
+# undef opendir
+#endif
+#ifdef GNULIB_defined_closedir
+# undef closedir
+#endif
/* Get the name of the current working directory, and put it in SIZE
bytes of BUF. Returns NULL if the directory couldn't be determined or
diff --git a/lib/getdelim.c b/lib/getdelim.c
index e5714baf..88258e55 100644
--- a/lib/getdelim.c
+++ b/lib/getdelim.c
@@ -1,5 +1,5 @@
/* getdelim.c --- Implementation of replacement getdelim function.
- Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2014 Free Software
+ Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or
diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c
index 946738cd..03eb7ef1 100644
--- a/lib/getdtablesize.c
+++ b/lib/getdtablesize.c
@@ -1,5 +1,5 @@
/* getdtablesize() function for platforms that don't have it.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
@@ -84,24 +84,38 @@ getdtablesize (void)
return dtablesize;
}
-#elif HAVE_GETDTABLESIZE
+#else
+# include <limits.h>
# include <sys/resource.h>
-# undef getdtablesize
+
+# ifndef RLIM_SAVED_CUR
+# define RLIM_SAVED_CUR RLIM_INFINITY
+# endif
+# ifndef RLIM_SAVED_MAX
+# define RLIM_SAVED_MAX RLIM_INFINITY
+# endif
+
+# ifdef __CYGWIN__
+ /* Cygwin 1.7.25 auto-increases the RLIMIT_NOFILE soft limit until it
+ hits the compile-time constant hard limit of 3200. We might as
+ well just report the hard limit. */
+# define rlim_cur rlim_max
+# endif
int
-rpl_getdtablesize(void)
+getdtablesize (void)
{
- /* To date, this replacement is only compiled for Cygwin 1.7.25,
- which auto-increased the RLIMIT_NOFILE soft limit until it
- hits the compile-time constant hard limit of 3200. Although
- that version of cygwin supported a child process inheriting
- a smaller soft limit, the smaller limit is not enforced, so
- we might as well just report the hard limit. */
struct rlimit lim;
- if (!getrlimit (RLIMIT_NOFILE, &lim) && lim.rlim_max != RLIM_INFINITY)
- return lim.rlim_max;
- return getdtablesize ();
+
+ if (getrlimit (RLIMIT_NOFILE, &lim) == 0
+ && 0 <= lim.rlim_cur && lim.rlim_cur <= INT_MAX
+ && lim.rlim_cur != RLIM_INFINITY
+ && lim.rlim_cur != RLIM_SAVED_CUR
+ && lim.rlim_cur != RLIM_SAVED_MAX)
+ return lim.rlim_cur;
+
+ return INT_MAX;
}
#endif
diff --git a/lib/getfilecon.c b/lib/getfilecon.c
index 2aa489e5..ef6adc8d 100644
--- a/lib/getfilecon.c
+++ b/lib/getfilecon.c
@@ -1,5 +1,5 @@
/* wrap getfilecon, lgetfilecon, and fgetfilecon
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -57,6 +57,7 @@ map_to_failure (int ret, security_context_t *con)
if (ret == 10 && strcmp (*con, "unlabeled") == 0)
{
freecon (*con);
+ *con = NULL;
errno = ENODATA;
return -1;
}
diff --git a/lib/getgroups.c b/lib/getgroups.c
index 91a340f3..5563dfb4 100644
--- a/lib/getgroups.c
+++ b/lib/getgroups.c
@@ -1,6 +1,6 @@
/* provide consistent interface to getgroups for systems that don't allow N==0
- Copyright (C) 1996, 1999, 2003, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1999, 2003, 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/gethostname.c b/lib/gethostname.c
index 785fd715..665a04db 100644
--- a/lib/gethostname.c
+++ b/lib/gethostname.c
@@ -1,6 +1,6 @@
/* gethostname emulation for SysV and POSIX.1.
- Copyright (C) 1992, 2003, 2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 1992, 2003, 2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/gethrxtime.c b/lib/gethrxtime.c
index 788ef56e..efbb132a 100644
--- a/lib/gethrxtime.c
+++ b/lib/gethrxtime.c
@@ -1,6 +1,6 @@
/* gethrxtime -- get high resolution real time
- Copyright (C) 2005-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/gethrxtime.h b/lib/gethrxtime.h
index 87dcdcf8..51ece313 100644
--- a/lib/gethrxtime.h
+++ b/lib/gethrxtime.h
@@ -1,6 +1,6 @@
/* gethrxtime -- get high resolution real time
- Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/getline.c b/lib/getline.c
index 5282e80f..811c773d 100644
--- a/lib/getline.c
+++ b/lib/getline.c
@@ -1,5 +1,5 @@
/* getline.c --- Implementation of replacement getline function.
- Copyright (C) 2005-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
diff --git a/lib/getloadavg.c b/lib/getloadavg.c
index cdba5259..0cbca265 100644
--- a/lib/getloadavg.c
+++ b/lib/getloadavg.c
@@ -1,6 +1,6 @@
/* Get the system load averages.
- Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2014 Free Software
+ Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2015 Free Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with gnulib.
diff --git a/lib/getlogin.c b/lib/getlogin.c
index 3737d36c..61f7fcad 100644
--- a/lib/getlogin.c
+++ b/lib/getlogin.c
@@ -1,6 +1,6 @@
/* Provide a working getlogin for systems which lack it.
- Copyright (C) 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2010-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/getndelim2.c b/lib/getndelim2.c
index d19e55c8..d47409bf 100644
--- a/lib/getndelim2.c
+++ b/lib/getndelim2.c
@@ -1,7 +1,7 @@
/* getndelim2 - Read a line from a stream, stopping at one of 2 delimiters,
with bounded memory allocation.
- Copyright (C) 1993, 1996-1998, 2000, 2003-2004, 2006, 2008-2014 Free
+ Copyright (C) 1993, 1996-1998, 2000, 2003-2004, 2006, 2008-2015 Free
Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/getndelim2.h b/lib/getndelim2.h
index badf7836..d9e803e6 100644
--- a/lib/getndelim2.h
+++ b/lib/getndelim2.h
@@ -1,7 +1,7 @@
/* getndelim2 - Read a line from a stream, stopping at one of 2 delimiters,
with bounded memory allocation.
- Copyright (C) 2003-2004, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2004, 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/getopt.c b/lib/getopt.c
index 7d950af1..212cbf73 100644
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -2,7 +2,7 @@
NOTE: getopt is part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
- Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2014 Free Software
+ Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2015 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
@@ -487,7 +487,20 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
const struct option *p;
struct option_list *next;
} *ambig_list = NULL;
+#ifdef _LIBC
+/* malloc() not used for _LIBC to simplify failure messages. */
+# define free_option_list(l)
+#else
+# define free_option_list(l) \
+ while (l != NULL) \
+ { \
+ struct option_list *pn = l->next; \
+ free (l); \
+ l = pn; \
+ }
+#endif
int exact = 0;
+ int ambig = 0;
int indfound = -1;
int option_index;
@@ -514,22 +527,37 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
pfound = p;
indfound = option_index;
}
+ else if (ambig)
+ ; /* Taking simpler path to handling ambiguities. */
else if (long_only
|| pfound->has_arg != p->has_arg
|| pfound->flag != p->flag
|| pfound->val != p->val)
{
/* Second or later nonexact match found. */
+#ifdef _LIBC
+ struct option_list *newp = alloca (sizeof (*newp));
+#else
struct option_list *newp = malloc (sizeof (*newp));
- newp->p = p;
- newp->next = ambig_list;
- ambig_list = newp;
+ if (newp == NULL)
+ {
+ free_option_list (ambig_list);
+ ambig_list = NULL;
+ ambig = 1; /* Use simpler fallback message. */
+ }
+ else
+#endif
+ {
+ newp->p = p;
+ newp->next = ambig_list;
+ ambig_list = newp;
+ }
}
}
- if (ambig_list != NULL && !exact)
+ if ((ambig || ambig_list) && !exact)
{
- if (print_errors)
+ if (print_errors && ambig_list)
{
struct option_list first;
first.p = pfound;
@@ -585,18 +613,20 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
fputc ('\n', stderr);
#endif
}
+ else if (print_errors && ambig)
+ {
+ fprintf (stderr,
+ _("%s: option '%s' is ambiguous\n"),
+ argv[0], argv[d->optind]);
+ }
d->__nextchar += strlen (d->__nextchar);
d->optind++;
d->optopt = 0;
+ free_option_list (ambig_list);
return '?';
}
- while (ambig_list != NULL)
- {
- struct option_list *pn = ambig_list->next;
- free (ambig_list);
- ambig_list = pn;
- }
+ free_option_list (ambig_list);
if (pfound != NULL)
{
diff --git a/lib/getopt.in.h b/lib/getopt.in.h
index 7ab99fb8..9248f76e 100644
--- a/lib/getopt.in.h
+++ b/lib/getopt.in.h
@@ -1,5 +1,5 @@
/* Declarations for getopt.
- Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2014 Free Software
+ Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2015 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/getopt1.c b/lib/getopt1.c
index a184865e..2b1feb6e 100644
--- a/lib/getopt1.c
+++ b/lib/getopt1.c
@@ -1,5 +1,5 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
- Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2014 Free Software
+ Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2015 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/getopt_int.h b/lib/getopt_int.h
index 24ed672e..e893a6e1 100644
--- a/lib/getopt_int.h
+++ b/lib/getopt_int.h
@@ -1,5 +1,5 @@
/* Internal declarations for getopt.
- Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2014 Free Software
+ Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2015 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/getpagesize.c b/lib/getpagesize.c
index 86e12710..10e9c187 100644
--- a/lib/getpagesize.c
+++ b/lib/getpagesize.c
@@ -1,6 +1,6 @@
/* getpagesize emulation for systems where it cannot be done in a C macro.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/getpass.c b/lib/getpass.c
index 1fee36ba..5b82cfca 100644
--- a/lib/getpass.c
+++ b/lib/getpass.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2001, 2003-2007, 2009-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -85,7 +85,9 @@ getpass (const char *prompt)
{
FILE *tty;
FILE *in, *out;
+# if HAVE_TCGETATTR
struct termios s, t;
+# endif
bool tty_changed = false;
static char *buf;
static size_t bufsize;
diff --git a/lib/getpass.h b/lib/getpass.h
index 1e03cbd7..7c51fc2f 100644
--- a/lib/getpass.h
+++ b/lib/getpass.h
@@ -1,5 +1,5 @@
/* getpass.h -- Read a password of arbitrary length from /dev/tty or stdin.
- Copyright (C) 2004, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2009-2015 Free Software Foundation, Inc.
Contributed by Simon Josefsson <jas@extundo.com>, 2004.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/gettext.h b/lib/gettext.h
index c7d6fd34..599a14ec 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -1,5 +1,5 @@
/* Convenience header for conditional use of GNU <libintl.h>.
- Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2014 Free Software
+ Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/gettime.c b/lib/gettime.c
index 1b4ca8d2..1c47e3b2 100644
--- a/lib/gettime.c
+++ b/lib/gettime.c
@@ -1,6 +1,6 @@
/* gettime -- get the system clock
- Copyright (C) 2002, 2004-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c
index 8b2058e8..e0e2e696 100644
--- a/lib/gettimeofday.c
+++ b/lib/gettimeofday.c
@@ -1,6 +1,6 @@
/* Provide gettimeofday for systems that don't have it or for which it's broken.
- Copyright (C) 2001-2003, 2005-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003, 2005-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/getugroups.c b/lib/getugroups.c
index d6634baf..7c6d34c9 100644
--- a/lib/getugroups.c
+++ b/lib/getugroups.c
@@ -1,6 +1,6 @@
/* getugroups.c -- return a list of the groups a user is in
- Copyright (C) 1990-1991, 1998-2000, 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 1990-1991, 1998-2000, 2003-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,10 +27,13 @@
#include <string.h>
#include <unistd.h>
-#if !HAVE_GRP_H
+#if !HAVE_GRP_H || defined __ANDROID__
/* Mingw lacks all things related to group management. The best we
- can do is fail with ENOSYS. */
+ can do is fail with ENOSYS.
+
+ Bionic declares e.g. getgrent() in <grp.h> but it isn't actually
+ defined in the library. */
int
getugroups (int maxcount _GL_UNUSED,
diff --git a/lib/getugroups.h b/lib/getugroups.h
index 4a5a5e86..25a6462e 100644
--- a/lib/getugroups.h
+++ b/lib/getugroups.h
@@ -1,5 +1,5 @@
/* Get a list of group IDs associated with a specified user ID.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/getusershell.c b/lib/getusershell.c
index ba5c5484..abc1f78a 100644
--- a/lib/getusershell.c
+++ b/lib/getusershell.c
@@ -1,6 +1,6 @@
/* getusershell.c -- Return names of valid user shells.
- Copyright (C) 1991, 1997, 2000-2001, 2003-2006, 2008-2014 Free Software
+ Copyright (C) 1991, 1997, 2000-2001, 2003-2006, 2008-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/gl_anylinked_list1.h b/lib/gl_anylinked_list1.h
new file mode 100644
index 00000000..aa336e30
--- /dev/null
+++ b/lib/gl_anylinked_list1.h
@@ -0,0 +1,48 @@
+/* Sequential list data type implemented by a linked list.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2006.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Common code of gl_linked_list.c and gl_linkedhash_list.c. */
+
+/* -------------------------- gl_list_t Data Type -------------------------- */
+
+/* Concrete list node implementation, valid for this file only. */
+struct gl_list_node_impl
+{
+#if WITH_HASHTABLE
+ struct gl_hash_entry h; /* hash table entry fields; must be first */
+#endif
+ struct gl_list_node_impl *next;
+ struct gl_list_node_impl *prev;
+ const void *value;
+};
+
+/* Concrete gl_list_impl type, valid for this file only. */
+struct gl_list_impl
+{
+ struct gl_list_impl_base base;
+#if WITH_HASHTABLE
+ /* A hash table: managed as an array of collision lists. */
+ struct gl_hash_entry **table;
+ size_t table_size;
+#endif
+ /* A circular list anchored at root.
+ The first node is = root.next, the last node is = root.prev.
+ The root's value is unused. */
+ struct gl_list_node_impl root;
+ /* Number of list nodes, excluding the root. */
+ size_t count;
+};
diff --git a/lib/gl_anylinked_list2.h b/lib/gl_anylinked_list2.h
new file mode 100644
index 00000000..5ba28064
--- /dev/null
+++ b/lib/gl_anylinked_list2.h
@@ -0,0 +1,1195 @@
+/* Sequential list data type implemented by a linked list.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2006.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Common code of gl_linked_list.c and gl_linkedhash_list.c. */
+
+/* If the symbol SIGNAL_SAFE_LIST is defined, the code is compiled in such
+ a way that a gl_list_t data structure may be used from within a signal
+ handler. The operations allowed in the signal handler are:
+ gl_list_iterator, gl_list_iterator_next, gl_list_iterator_free.
+ The list and node fields that are therefore accessed from the signal handler
+ are:
+ list->root, node->next, node->value.
+ We are careful to make modifications to these fields only in an order
+ that maintains the consistency of the list data structure at any moment,
+ and we use 'volatile' assignments to prevent the compiler from reordering
+ such assignments. */
+#ifdef SIGNAL_SAFE_LIST
+# define ASYNCSAFE(type) *(volatile type *)&
+#else
+# define ASYNCSAFE(type)
+#endif
+
+/* -------------------------- gl_list_t Data Type -------------------------- */
+
+static gl_list_t
+gl_linked_nx_create_empty (gl_list_implementation_t implementation,
+ gl_listelement_equals_fn equals_fn,
+ gl_listelement_hashcode_fn hashcode_fn,
+ gl_listelement_dispose_fn dispose_fn,
+ bool allow_duplicates)
+{
+ struct gl_list_impl *list =
+ (struct gl_list_impl *) malloc (sizeof (struct gl_list_impl));
+
+ if (list == NULL)
+ return NULL;
+
+ list->base.vtable = implementation;
+ list->base.equals_fn = equals_fn;
+ list->base.hashcode_fn = hashcode_fn;
+ list->base.dispose_fn = dispose_fn;
+ list->base.allow_duplicates = allow_duplicates;
+#if WITH_HASHTABLE
+ list->table_size = 11;
+ list->table =
+ (gl_hash_entry_t *) calloc (list->table_size, sizeof (gl_hash_entry_t));
+ if (list->table == NULL)
+ goto fail;
+#endif
+ list->root.next = &list->root;
+ list->root.prev = &list->root;
+ list->count = 0;
+
+ return list;
+
+#if WITH_HASHTABLE
+ fail:
+ free (list);
+ return NULL;
+#endif
+}
+
+static gl_list_t
+gl_linked_nx_create (gl_list_implementation_t implementation,
+ gl_listelement_equals_fn equals_fn,
+ gl_listelement_hashcode_fn hashcode_fn,
+ gl_listelement_dispose_fn dispose_fn,
+ bool allow_duplicates,
+ size_t count, const void **contents)
+{
+ struct gl_list_impl *list =
+ (struct gl_list_impl *) malloc (sizeof (struct gl_list_impl));
+ gl_list_node_t tail;
+
+ if (list == NULL)
+ return NULL;
+
+ list->base.vtable = implementation;
+ list->base.equals_fn = equals_fn;
+ list->base.hashcode_fn = hashcode_fn;
+ list->base.dispose_fn = dispose_fn;
+ list->base.allow_duplicates = allow_duplicates;
+#if WITH_HASHTABLE
+ {
+ size_t estimate = xsum (count, count / 2); /* 1.5 * count */
+ if (estimate < 10)
+ estimate = 10;
+ list->table_size = next_prime (estimate);
+ if (size_overflow_p (xtimes (list->table_size, sizeof (gl_hash_entry_t))))
+ goto fail1;
+ list->table =
+ (gl_hash_entry_t *) calloc (list->table_size, sizeof (gl_hash_entry_t));
+ if (list->table == NULL)
+ goto fail1;
+ }
+#endif
+ list->count = count;
+ tail = &list->root;
+ for (; count > 0; contents++, count--)
+ {
+ gl_list_node_t node =
+ (struct gl_list_node_impl *) malloc (sizeof (struct gl_list_node_impl));
+
+ if (node == NULL)
+ goto fail2;
+
+ node->value = *contents;
+#if WITH_HASHTABLE
+ node->h.hashcode =
+ (list->base.hashcode_fn != NULL
+ ? list->base.hashcode_fn (node->value)
+ : (size_t)(uintptr_t) node->value);
+
+ /* Add node to the hash table. */
+ if (add_to_bucket (list, node) < 0)
+ {
+ free (node);
+ goto fail2;
+ }
+#endif
+
+ /* Add node to the list. */
+ node->prev = tail;
+ tail->next = node;
+ tail = node;
+ }
+ tail->next = &list->root;
+ list->root.prev = tail;
+
+ return list;
+
+ fail2:
+ {
+ gl_list_node_t node;
+
+ for (node = tail; node != &list->root; )
+ {
+ gl_list_node_t prev = node->prev;
+
+ free (node);
+ node = prev;
+ }
+ }
+#if WITH_HASHTABLE
+ free (list->table);
+ fail1:
+#endif
+ free (list);
+ return NULL;
+}
+
+static size_t _GL_ATTRIBUTE_PURE
+gl_linked_size (gl_list_t list)
+{
+ return list->count;
+}
+
+static const void * _GL_ATTRIBUTE_PURE
+gl_linked_node_value (gl_list_t list, gl_list_node_t node)
+{
+ return node->value;
+}
+
+static int
+gl_linked_node_nx_set_value (gl_list_t list, gl_list_node_t node,
+ const void *elt)
+{
+#if WITH_HASHTABLE
+ if (elt != node->value)
+ {
+ size_t new_hashcode =
+ (list->base.hashcode_fn != NULL
+ ? list->base.hashcode_fn (elt)
+ : (size_t)(uintptr_t) elt);
+
+ if (new_hashcode != node->h.hashcode)
+ {
+ remove_from_bucket (list, node);
+ node->value = elt;
+ node->h.hashcode = new_hashcode;
+ if (add_to_bucket (list, node) < 0)
+ {
+ /* Out of memory. We removed node from a bucket but cannot add
+ it to another bucket. In order to avoid inconsistencies, we
+ must remove node entirely from the list. */
+ gl_list_node_t before_removed = node->prev;
+ gl_list_node_t after_removed = node->next;
+ ASYNCSAFE(gl_list_node_t) before_removed->next = after_removed;
+ after_removed->prev = before_removed;
+ list->count--;
+ free (node);
+ return -1;
+ }
+ }
+ else
+ node->value = elt;
+ }
+#else
+ node->value = elt;
+#endif
+ return 0;
+}
+
+static gl_list_node_t _GL_ATTRIBUTE_PURE
+gl_linked_next_node (gl_list_t list, gl_list_node_t node)
+{
+ return (node->next != &list->root ? node->next : NULL);
+}
+
+static gl_list_node_t _GL_ATTRIBUTE_PURE
+gl_linked_previous_node (gl_list_t list, gl_list_node_t node)
+{
+ return (node->prev != &list->root ? node->prev : NULL);
+}
+
+static const void * _GL_ATTRIBUTE_PURE
+gl_linked_get_at (gl_list_t list, size_t position)
+{
+ size_t count = list->count;
+ gl_list_node_t node;
+
+ if (!(position < count))
+ /* Invalid argument. */
+ abort ();
+ /* Here we know count > 0. */
+ if (position <= ((count - 1) / 2))
+ {
+ node = list->root.next;
+ for (; position > 0; position--)
+ node = node->next;
+ }
+ else
+ {
+ position = count - 1 - position;
+ node = list->root.prev;
+ for (; position > 0; position--)
+ node = node->prev;
+ }
+ return node->value;
+}
+
+static gl_list_node_t
+gl_linked_nx_set_at (gl_list_t list, size_t position, const void *elt)
+{
+ size_t count = list->count;
+ gl_list_node_t node;
+
+ if (!(position < count))
+ /* Invalid argument. */
+ abort ();
+ /* Here we know count > 0. */
+ if (position <= ((count - 1) / 2))
+ {
+ node = list->root.next;
+ for (; position > 0; position--)
+ node = node->next;
+ }
+ else
+ {
+ position = count - 1 - position;
+ node = list->root.prev;
+ for (; position > 0; position--)
+ node = node->prev;
+ }
+#if WITH_HASHTABLE
+ if (elt != node->value)
+ {
+ size_t new_hashcode =
+ (list->base.hashcode_fn != NULL
+ ? list->base.hashcode_fn (elt)
+ : (size_t)(uintptr_t) elt);
+
+ if (new_hashcode != node->h.hashcode)
+ {
+ remove_from_bucket (list, node);
+ node->value = elt;
+ node->h.hashcode = new_hashcode;
+ if (add_to_bucket (list, node) < 0)
+ {
+ /* Out of memory. We removed node from a bucket but cannot add
+ it to another bucket. In order to avoid inconsistencies, we
+ must remove node entirely from the list. */
+ gl_list_node_t before_removed = node->prev;
+ gl_list_node_t after_removed = node->next;
+ ASYNCSAFE(gl_list_node_t) before_removed->next = after_removed;
+ after_removed->prev = before_removed;
+ list->count--;
+ free (node);
+ return NULL;
+ }
+ }
+ else
+ node->value = elt;
+ }
+#else
+ node->value = elt;
+#endif
+ return node;
+}
+
+static gl_list_node_t _GL_ATTRIBUTE_PURE
+gl_linked_search_from_to (gl_list_t list, size_t start_index, size_t end_index,
+ const void *elt)
+{
+ size_t count = list->count;
+
+ if (!(start_index <= end_index && end_index <= count))
+ /* Invalid arguments. */
+ abort ();
+ {
+#if WITH_HASHTABLE
+ size_t hashcode =
+ (list->base.hashcode_fn != NULL
+ ? list->base.hashcode_fn (elt)
+ : (size_t)(uintptr_t) elt);
+ size_t bucket = hashcode % list->table_size;
+ gl_listelement_equals_fn equals = list->base.equals_fn;
+
+ if (!list->base.allow_duplicates)
+ {
+ /* Look for the first match in the hash bucket. */
+ gl_list_node_t found = NULL;
+ gl_list_node_t node;
+
+ for (node = (gl_list_node_t) list->table[bucket];
+ node != NULL;
+ node = (gl_list_node_t) node->h.hash_next)
+ if (node->h.hashcode == hashcode
+ && (equals != NULL
+ ? equals (elt, node->value)
+ : elt == node->value))
+ {
+ found = node;
+ break;
+ }
+ if (start_index > 0)
+ /* Look whether found's index is < start_index. */
+ for (node = list->root.next; ; node = node->next)
+ {
+ if (node == found)
+ return NULL;
+ if (--start_index == 0)
+ break;
+ }
+ if (end_index < count)
+ /* Look whether found's index is >= end_index. */
+ {
+ end_index = count - end_index;
+ for (node = list->root.prev; ; node = node->prev)
+ {
+ if (node == found)
+ return NULL;
+ if (--end_index == 0)
+ break;
+ }
+ }
+ return found;
+ }
+ else
+ {
+ /* Look whether there is more than one match in the hash bucket. */
+ bool multiple_matches = false;
+ gl_list_node_t first_match = NULL;
+ gl_list_node_t node;
+
+ for (node = (gl_list_node_t) list->table[bucket];
+ node != NULL;
+ node = (gl_list_node_t) node->h.hash_next)
+ if (node->h.hashcode == hashcode
+ && (equals != NULL
+ ? equals (elt, node->value)
+ : elt == node->value))
+ {
+ if (first_match == NULL)
+ first_match = node;
+ else
+ {
+ multiple_matches = true;
+ break;
+ }
+ }
+ if (multiple_matches)
+ {
+ /* We need the match with the smallest index. But we don't have
+ a fast mapping node -> index. So we have to walk the list. */
+ end_index -= start_index;
+ node = list->root.next;
+ for (; start_index > 0; start_index--)
+ node = node->next;
+
+ for (;
+ end_index > 0;
+ node = node->next, end_index--)
+ if (node->h.hashcode == hashcode
+ && (equals != NULL
+ ? equals (elt, node->value)
+ : elt == node->value))
+ return node;
+ /* The matches must have all been at indices < start_index or
+ >= end_index. */
+ return NULL;
+ }
+ else
+ {
+ if (start_index > 0)
+ /* Look whether first_match's index is < start_index. */
+ for (node = list->root.next; node != &list->root; node = node->next)
+ {
+ if (node == first_match)
+ return NULL;
+ if (--start_index == 0)
+ break;
+ }
+ if (end_index < list->count)
+ /* Look whether first_match's index is >= end_index. */
+ {
+ end_index = list->count - end_index;
+ for (node = list->root.prev; ; node = node->prev)
+ {
+ if (node == first_match)
+ return NULL;
+ if (--end_index == 0)
+ break;
+ }
+ }
+ return first_match;
+ }
+ }
+#else
+ gl_listelement_equals_fn equals = list->base.equals_fn;
+ gl_list_node_t node = list->root.next;
+
+ end_index -= start_index;
+ for (; start_index > 0; start_index--)
+ node = node->next;
+
+ if (equals != NULL)
+ {
+ for (; end_index > 0; node = node->next, end_index--)
+ if (equals (elt, node->value))
+ return node;
+ }
+ else
+ {
+ for (; end_index > 0; node = node->next, end_index--)
+ if (elt == node->value)
+ return node;
+ }
+ return NULL;
+#endif
+ }
+}
+
+static size_t _GL_ATTRIBUTE_PURE
+gl_linked_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index,
+ const void *elt)
+{
+ size_t count = list->count;
+
+ if (!(start_index <= end_index && end_index <= count))
+ /* Invalid arguments. */
+ abort ();
+ {
+#if WITH_HASHTABLE
+ /* Here the hash table doesn't help much. It only allows us to minimize
+ the number of equals() calls, by looking up first the node and then
+ its index. */
+ size_t hashcode =
+ (list->base.hashcode_fn != NULL
+ ? list->base.hashcode_fn (elt)
+ : (size_t)(uintptr_t) elt);
+ size_t bucket = hashcode % list->table_size;
+ gl_listelement_equals_fn equals = list->base.equals_fn;
+ gl_list_node_t node;
+
+ /* First step: Look up the node. */
+ if (!list->base.allow_duplicates)
+ {
+ /* Look for the first match in the hash bucket. */
+ for (node = (gl_list_node_t) list->table[bucket];
+ node != NULL;
+ node = (gl_list_node_t) node->h.hash_next)
+ if (node->h.hashcode == hashcode
+ && (equals != NULL
+ ? equals (elt, node->value)
+ : elt == node->value))
+ break;
+ }
+ else
+ {
+ /* Look whether there is more than one match in the hash bucket. */
+ bool multiple_matches = false;
+ gl_list_node_t first_match = NULL;
+
+ for (node = (gl_list_node_t) list->table[bucket];
+ node != NULL;
+ node = (gl_list_node_t) node->h.hash_next)
+ if (node->h.hashcode == hashcode
+ && (equals != NULL
+ ? equals (elt, node->value)
+ : elt == node->value))
+ {
+ if (first_match == NULL)
+ first_match = node;
+ else
+ {
+ multiple_matches = true;
+ break;
+ }
+ }
+ if (multiple_matches)
+ {
+ /* We need the match with the smallest index. But we don't have
+ a fast mapping node -> index. So we have to walk the list. */
+ size_t index;
+
+ index = start_index;
+ node = list->root.next;
+ for (; start_index > 0; start_index--)
+ node = node->next;
+
+ for (;
+ index < end_index;
+ node = node->next, index++)
+ if (node->h.hashcode == hashcode
+ && (equals != NULL
+ ? equals (elt, node->value)
+ : elt == node->value))
+ return index;
+ /* The matches must have all been at indices < start_index or
+ >= end_index. */
+ return (size_t)(-1);
+ }
+ node = first_match;
+ }
+
+ /* Second step: Look up the index of the node. */
+ if (node == NULL)
+ return (size_t)(-1);
+ else
+ {
+ size_t index = 0;
+
+ for (; node->prev != &list->root; node = node->prev)
+ index++;
+
+ if (index >= start_index && index < end_index)
+ return index;
+ else
+ return (size_t)(-1);
+ }
+#else
+ gl_listelement_equals_fn equals = list->base.equals_fn;
+ size_t index = start_index;
+ gl_list_node_t node = list->root.next;
+
+ for (; start_index > 0; start_index--)
+ node = node->next;
+
+ if (equals != NULL)
+ {
+ for (;
+ index < end_index;
+ node = node->next, index++)
+ if (equals (elt, node->value))
+ return index;
+ }
+ else
+ {
+ for (;
+ index < end_index;
+ node = node->next, index++)
+ if (elt == node->value)
+ return index;
+ }
+ return (size_t)(-1);
+#endif
+ }
+}
+
+static gl_list_node_t
+gl_linked_nx_add_first (gl_list_t list, const void *elt)
+{
+ gl_list_node_t node =
+ (struct gl_list_node_impl *) malloc (sizeof (struct gl_list_node_impl));
+
+ if (node == NULL)
+ return NULL;
+
+ ASYNCSAFE(const void *) node->value = elt;
+#if WITH_HASHTABLE
+ node->h.hashcode =
+ (list->base.hashcode_fn != NULL
+ ? list->base.hashcode_fn (node->value)
+ : (size_t)(uintptr_t) node->value);
+
+ /* Add node to the hash table. */
+ if (add_to_bucket (list, node) < 0)
+ {
+ free (node);
+ return NULL;
+ }
+#endif
+
+ /* Add node to the list. */
+ node->prev = &list->root;
+ ASYNCSAFE(gl_list_node_t) node->next = list->root.next;
+ node->next->prev = node;
+ ASYNCSAFE(gl_list_node_t) list->root.next = node;
+ list->count++;
+
+#if WITH_HASHTABLE
+ hash_resize_after_add (list);
+#endif
+
+ return node;
+}
+
+static gl_list_node_t
+gl_linked_nx_add_last (gl_list_t list, const void *elt)
+{
+ gl_list_node_t node =
+ (struct gl_list_node_impl *) malloc (sizeof (struct gl_list_node_impl));
+
+ if (node == NULL)
+ return NULL;
+
+ ASYNCSAFE(const void *) node->value = elt;
+#if WITH_HASHTABLE
+ node->h.hashcode =
+ (list->base.hashcode_fn != NULL
+ ? list->base.hashcode_fn (node->value)
+ : (size_t)(uintptr_t) node->value);
+
+ /* Add node to the hash table. */
+ if (add_to_bucket (list, node) < 0)
+ {
+ free (node);
+ return NULL;
+ }
+#endif
+
+ /* Add node to the list. */
+ ASYNCSAFE(gl_list_node_t) node->next = &list->root;
+ node->prev = list->root.prev;
+ ASYNCSAFE(gl_list_node_t) node->prev->next = node;
+ list->root.prev = node;
+ list->count++;
+
+#if WITH_HASHTABLE
+ hash_resize_after_add (list);
+#endif
+
+ return node;
+}
+
+static gl_list_node_t
+gl_linked_nx_add_before (gl_list_t list, gl_list_node_t node, const void *elt)
+{
+ gl_list_node_t new_node =
+ (struct gl_list_node_impl *) malloc (sizeof (struct gl_list_node_impl));
+
+ if (new_node == NULL)
+ return NULL;
+
+ ASYNCSAFE(const void *) new_node->value = elt;
+#if WITH_HASHTABLE
+ new_node->h.hashcode =
+ (list->base.hashcode_fn != NULL
+ ? list->base.hashcode_fn (new_node->value)
+ : (size_t)(uintptr_t) new_node->value);
+
+ /* Add new_node to the hash table. */
+ if (add_to_bucket (list, new_node) < 0)
+ {
+ free (new_node);
+ return NULL;
+ }
+#endif
+
+ /* Add new_node to the list. */
+ ASYNCSAFE(gl_list_node_t) new_node->next = node;
+ new_node->prev = node->prev;
+ ASYNCSAFE(gl_list_node_t) new_node->prev->next = new_node;
+ node->prev = new_node;
+ list->count++;
+
+#if WITH_HASHTABLE
+ hash_resize_after_add (list);
+#endif
+
+ return new_node;
+}
+
+static gl_list_node_t
+gl_linked_nx_add_after (gl_list_t list, gl_list_node_t node, const void *elt)
+{
+ gl_list_node_t new_node =
+ (struct gl_list_node_impl *) malloc (sizeof (struct gl_list_node_impl));
+
+ if (new_node == NULL)
+ return NULL;
+
+ ASYNCSAFE(const void *) new_node->value = elt;
+#if WITH_HASHTABLE
+ new_node->h.hashcode =
+ (list->base.hashcode_fn != NULL
+ ? list->base.hashcode_fn (new_node->value)
+ : (size_t)(uintptr_t) new_node->value);
+
+ /* Add new_node to the hash table. */
+ if (add_to_bucket (list, new_node) < 0)
+ {
+ free (new_node);
+ return NULL;
+ }
+#endif
+
+ /* Add new_node to the list. */
+ new_node->prev = node;
+ ASYNCSAFE(gl_list_node_t) new_node->next = node->next;
+ new_node->next->prev = new_node;
+ ASYNCSAFE(gl_list_node_t) node->next = new_node;
+ list->count++;
+
+#if WITH_HASHTABLE
+ hash_resize_after_add (list);
+#endif
+
+ return new_node;
+}
+
+static gl_list_node_t
+gl_linked_nx_add_at (gl_list_t list, size_t position, const void *elt)
+{
+ size_t count = list->count;
+ gl_list_node_t new_node;
+
+ if (!(position <= count))
+ /* Invalid argument. */
+ abort ();
+
+ new_node = (struct gl_list_node_impl *) malloc (sizeof (struct gl_list_node_impl));
+ if (new_node == NULL)
+ return NULL;
+
+ ASYNCSAFE(const void *) new_node->value = elt;
+#if WITH_HASHTABLE
+ new_node->h.hashcode =
+ (list->base.hashcode_fn != NULL
+ ? list->base.hashcode_fn (new_node->value)
+ : (size_t)(uintptr_t) new_node->value);
+
+ /* Add new_node to the hash table. */
+ if (add_to_bucket (list, new_node) < 0)
+ {
+ free (new_node);
+ return NULL;
+ }
+#endif
+
+ /* Add new_node to the list. */
+ if (position <= (count / 2))
+ {
+ gl_list_node_t node;
+
+ node = &list->root;
+ for (; position > 0; position--)
+ node = node->next;
+ new_node->prev = node;
+ ASYNCSAFE(gl_list_node_t) new_node->next = node->next;
+ new_node->next->prev = new_node;
+ ASYNCSAFE(gl_list_node_t) node->next = new_node;
+ }
+ else
+ {
+ gl_list_node_t node;
+
+ position = count - position;
+ node = &list->root;
+ for (; position > 0; position--)
+ node = node->prev;
+ ASYNCSAFE(gl_list_node_t) new_node->next = node;
+ new_node->prev = node->prev;
+ ASYNCSAFE(gl_list_node_t) new_node->prev->next = new_node;
+ node->prev = new_node;
+ }
+ list->count++;
+
+#if WITH_HASHTABLE
+ hash_resize_after_add (list);
+#endif
+
+ return new_node;
+}
+
+static bool
+gl_linked_remove_node (gl_list_t list, gl_list_node_t node)
+{
+ gl_list_node_t prev;
+ gl_list_node_t next;
+
+#if WITH_HASHTABLE
+ /* Remove node from the hash table. */
+ remove_from_bucket (list, node);
+#endif
+
+ /* Remove node from the list. */
+ prev = node->prev;
+ next = node->next;
+
+ ASYNCSAFE(gl_list_node_t) prev->next = next;
+ next->prev = prev;
+ list->count--;
+
+ if (list->base.dispose_fn != NULL)
+ list->base.dispose_fn (node->value);
+ free (node);
+ return true;
+}
+
+static bool
+gl_linked_remove_at (gl_list_t list, size_t position)
+{
+ size_t count = list->count;
+ gl_list_node_t removed_node;
+
+ if (!(position < count))
+ /* Invalid argument. */
+ abort ();
+ /* Here we know count > 0. */
+ if (position <= ((count - 1) / 2))
+ {
+ gl_list_node_t node;
+ gl_list_node_t after_removed;
+
+ node = &list->root;
+ for (; position > 0; position--)
+ node = node->next;
+ removed_node = node->next;
+ after_removed = node->next->next;
+ ASYNCSAFE(gl_list_node_t) node->next = after_removed;
+ after_removed->prev = node;
+ }
+ else
+ {
+ gl_list_node_t node;
+ gl_list_node_t before_removed;
+
+ position = count - 1 - position;
+ node = &list->root;
+ for (; position > 0; position--)
+ node = node->prev;
+ removed_node = node->prev;
+ before_removed = node->prev->prev;
+ node->prev = before_removed;
+ ASYNCSAFE(gl_list_node_t) before_removed->next = node;
+ }
+#if WITH_HASHTABLE
+ remove_from_bucket (list, removed_node);
+#endif
+ list->count--;
+
+ if (list->base.dispose_fn != NULL)
+ list->base.dispose_fn (removed_node->value);
+ free (removed_node);
+ return true;
+}
+
+static bool
+gl_linked_remove (gl_list_t list, const void *elt)
+{
+ gl_list_node_t node = gl_linked_search_from_to (list, 0, list->count, elt);
+
+ if (node != NULL)
+ return gl_linked_remove_node (list, node);
+ else
+ return false;
+}
+
+static void
+gl_linked_list_free (gl_list_t list)
+{
+ gl_listelement_dispose_fn dispose = list->base.dispose_fn;
+ gl_list_node_t node;
+
+ for (node = list->root.next; node != &list->root; )
+ {
+ gl_list_node_t next = node->next;
+ if (dispose != NULL)
+ dispose (node->value);
+ free (node);
+ node = next;
+ }
+#if WITH_HASHTABLE
+ free (list->table);
+#endif
+ free (list);
+}
+
+/* --------------------- gl_list_iterator_t Data Type --------------------- */
+
+static gl_list_iterator_t
+gl_linked_iterator (gl_list_t list)
+{
+ gl_list_iterator_t result;
+
+ result.vtable = list->base.vtable;
+ result.list = list;
+ result.p = list->root.next;
+ result.q = &list->root;
+#ifdef lint
+ result.i = 0;
+ result.j = 0;
+ result.count = 0;
+#endif
+
+ return result;
+}
+
+static gl_list_iterator_t
+gl_linked_iterator_from_to (gl_list_t list,
+ size_t start_index, size_t end_index)
+{
+ gl_list_iterator_t result;
+ size_t n1, n2, n3;
+
+ if (!(start_index <= end_index && end_index <= list->count))
+ /* Invalid arguments. */
+ abort ();
+ result.vtable = list->base.vtable;
+ result.list = list;
+ n1 = start_index;
+ n2 = end_index - start_index;
+ n3 = list->count - end_index;
+ /* Find the maximum among n1, n2, n3, so as to reduce the number of
+ loop iterations to n1 + n2 + n3 - max(n1,n2,n3). */
+ if (n1 > n2 && n1 > n3)
+ {
+ /* n1 is the maximum, use n2 and n3. */
+ gl_list_node_t node;
+ size_t i;
+
+ node = &list->root;
+ for (i = n3; i > 0; i--)
+ node = node->prev;
+ result.q = node;
+ for (i = n2; i > 0; i--)
+ node = node->prev;
+ result.p = node;
+ }
+ else if (n2 > n3)
+ {
+ /* n2 is the maximum, use n1 and n3. */
+ gl_list_node_t node;
+ size_t i;
+
+ node = list->root.next;
+ for (i = n1; i > 0; i--)
+ node = node->next;
+ result.p = node;
+
+ node = &list->root;
+ for (i = n3; i > 0; i--)
+ node = node->prev;
+ result.q = node;
+ }
+ else
+ {
+ /* n3 is the maximum, use n1 and n2. */
+ gl_list_node_t node;
+ size_t i;
+
+ node = list->root.next;
+ for (i = n1; i > 0; i--)
+ node = node->next;
+ result.p = node;
+ for (i = n2; i > 0; i--)
+ node = node->next;
+ result.q = node;
+ }
+
+#ifdef lint
+ result.i = 0;
+ result.j = 0;
+ result.count = 0;
+#endif
+
+ return result;
+}
+
+static bool
+gl_linked_iterator_next (gl_list_iterator_t *iterator,
+ const void **eltp, gl_list_node_t *nodep)
+{
+ if (iterator->p != iterator->q)
+ {
+ gl_list_node_t node = (gl_list_node_t) iterator->p;
+ *eltp = node->value;
+ if (nodep != NULL)
+ *nodep = node;
+ iterator->p = node->next;
+ return true;
+ }
+ else
+ return false;
+}
+
+static void
+gl_linked_iterator_free (gl_list_iterator_t *iterator)
+{
+}
+
+/* ---------------------- Sorted gl_list_t Data Type ---------------------- */
+
+static gl_list_node_t _GL_ATTRIBUTE_PURE
+gl_linked_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar,
+ const void *elt)
+{
+ gl_list_node_t node;
+
+ for (node = list->root.next; node != &list->root; node = node->next)
+ {
+ int cmp = compar (node->value, elt);
+
+ if (cmp > 0)
+ break;
+ if (cmp == 0)
+ return node;
+ }
+ return NULL;
+}
+
+static gl_list_node_t _GL_ATTRIBUTE_PURE
+gl_linked_sortedlist_search_from_to (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ size_t low, size_t high,
+ const void *elt)
+{
+ size_t count = list->count;
+
+ if (!(low <= high && high <= list->count))
+ /* Invalid arguments. */
+ abort ();
+
+ high -= low;
+ if (high > 0)
+ {
+ /* Here we know low < count. */
+ size_t position = low;
+ gl_list_node_t node;
+
+ if (position <= ((count - 1) / 2))
+ {
+ node = list->root.next;
+ for (; position > 0; position--)
+ node = node->next;
+ }
+ else
+ {
+ position = count - 1 - position;
+ node = list->root.prev;
+ for (; position > 0; position--)
+ node = node->prev;
+ }
+
+ do
+ {
+ int cmp = compar (node->value, elt);
+
+ if (cmp > 0)
+ break;
+ if (cmp == 0)
+ return node;
+ node = node->next;
+ }
+ while (--high > 0);
+ }
+ return NULL;
+}
+
+static size_t _GL_ATTRIBUTE_PURE
+gl_linked_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar,
+ const void *elt)
+{
+ gl_list_node_t node;
+ size_t index;
+
+ for (node = list->root.next, index = 0;
+ node != &list->root;
+ node = node->next, index++)
+ {
+ int cmp = compar (node->value, elt);
+
+ if (cmp > 0)
+ break;
+ if (cmp == 0)
+ return index;
+ }
+ return (size_t)(-1);
+}
+
+static size_t _GL_ATTRIBUTE_PURE
+gl_linked_sortedlist_indexof_from_to (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ size_t low, size_t high,
+ const void *elt)
+{
+ size_t count = list->count;
+
+ if (!(low <= high && high <= list->count))
+ /* Invalid arguments. */
+ abort ();
+
+ high -= low;
+ if (high > 0)
+ {
+ /* Here we know low < count. */
+ size_t index = low;
+ size_t position = low;
+ gl_list_node_t node;
+
+ if (position <= ((count - 1) / 2))
+ {
+ node = list->root.next;
+ for (; position > 0; position--)
+ node = node->next;
+ }
+ else
+ {
+ position = count - 1 - position;
+ node = list->root.prev;
+ for (; position > 0; position--)
+ node = node->prev;
+ }
+
+ do
+ {
+ int cmp = compar (node->value, elt);
+
+ if (cmp > 0)
+ break;
+ if (cmp == 0)
+ return index;
+ node = node->next;
+ index++;
+ }
+ while (--high > 0);
+ }
+ return (size_t)(-1);
+}
+
+static gl_list_node_t
+gl_linked_sortedlist_nx_add (gl_list_t list, gl_listelement_compar_fn compar,
+ const void *elt)
+{
+ gl_list_node_t node;
+
+ for (node = list->root.next; node != &list->root; node = node->next)
+ if (compar (node->value, elt) >= 0)
+ return gl_linked_nx_add_before (list, node, elt);
+ return gl_linked_nx_add_last (list, elt);
+}
+
+static bool
+gl_linked_sortedlist_remove (gl_list_t list, gl_listelement_compar_fn compar,
+ const void *elt)
+{
+ gl_list_node_t node;
+
+ for (node = list->root.next; node != &list->root; node = node->next)
+ {
+ int cmp = compar (node->value, elt);
+
+ if (cmp > 0)
+ break;
+ if (cmp == 0)
+ return gl_linked_remove_node (list, node);
+ }
+ return false;
+}
diff --git a/lib/gl_linked_list.c b/lib/gl_linked_list.c
new file mode 100644
index 00000000..b83e1644
--- /dev/null
+++ b/lib/gl_linked_list.c
@@ -0,0 +1,64 @@
+/* Sequential list data type implemented by a linked list.
+ Copyright (C) 2006, 2008-2015 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2006.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include "gl_linked_list.h"
+
+#include <stdlib.h>
+
+/* -------------------------- gl_list_t Data Type -------------------------- */
+
+/* Generic linked list code. */
+#include "gl_anylinked_list1.h"
+#include "gl_anylinked_list2.h"
+
+
+const struct gl_list_implementation gl_linked_list_implementation =
+ {
+ gl_linked_nx_create_empty,
+ gl_linked_nx_create,
+ gl_linked_size,
+ gl_linked_node_value,
+ gl_linked_node_nx_set_value,
+ gl_linked_next_node,
+ gl_linked_previous_node,
+ gl_linked_get_at,
+ gl_linked_nx_set_at,
+ gl_linked_search_from_to,
+ gl_linked_indexof_from_to,
+ gl_linked_nx_add_first,
+ gl_linked_nx_add_last,
+ gl_linked_nx_add_before,
+ gl_linked_nx_add_after,
+ gl_linked_nx_add_at,
+ gl_linked_remove_node,
+ gl_linked_remove_at,
+ gl_linked_remove,
+ gl_linked_list_free,
+ gl_linked_iterator,
+ gl_linked_iterator_from_to,
+ gl_linked_iterator_next,
+ gl_linked_iterator_free,
+ gl_linked_sortedlist_search,
+ gl_linked_sortedlist_search_from_to,
+ gl_linked_sortedlist_indexof,
+ gl_linked_sortedlist_indexof_from_to,
+ gl_linked_sortedlist_nx_add,
+ gl_linked_sortedlist_remove
+ };
diff --git a/lib/gl_linked_list.h b/lib/gl_linked_list.h
new file mode 100644
index 00000000..a7b7eec8
--- /dev/null
+++ b/lib/gl_linked_list.h
@@ -0,0 +1,34 @@
+/* Sequential list data type implemented by a linked list.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2006.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _GL_LINKED_LIST_H
+#define _GL_LINKED_LIST_H
+
+#include "gl_list.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const struct gl_list_implementation gl_linked_list_implementation;
+#define GL_LINKED_LIST &gl_linked_list_implementation
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GL_LINKED_LIST_H */
diff --git a/lib/gl_list.c b/lib/gl_list.c
new file mode 100644
index 00000000..87932980
--- /dev/null
+++ b/lib/gl_list.c
@@ -0,0 +1,3 @@
+#include <config.h>
+#define GL_LIST_INLINE _GL_EXTERN_INLINE
+#include "gl_list.h"
diff --git a/lib/gl_list.h b/lib/gl_list.h
new file mode 100644
index 00000000..916f57f7
--- /dev/null
+++ b/lib/gl_list.h
@@ -0,0 +1,841 @@
+/* Abstract sequential list data type.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2006.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _GL_LIST_H
+#define _GL_LIST_H
+
+#include <stdbool.h>
+#include <stddef.h>
+
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
+_GL_INLINE_HEADER_BEGIN
+#ifndef GL_LIST_INLINE
+# define GL_LIST_INLINE _GL_INLINE
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* gl_list is an abstract list data type. It can contain any number of
+ objects ('void *' or 'const void *' pointers) in any given order.
+ Duplicates are allowed, but can optionally be forbidden.
+
+ There are several implementations of this list datatype, optimized for
+ different operations or for memory. You can start using the simplest list
+ implementation, GL_ARRAY_LIST, and switch to a different implementation
+ later, when you realize which operations are performed the most frequently.
+ The API of the different implementations is exactly the same; when
+ switching to a different implementation, you only have to change the
+ gl_list_create call.
+
+ The implementations are:
+ GL_ARRAY_LIST a growable array
+ GL_CARRAY_LIST a growable circular array
+ GL_LINKED_LIST a linked list
+ GL_AVLTREE_LIST a binary tree (AVL tree)
+ GL_RBTREE_LIST a binary tree (red-black tree)
+ GL_LINKEDHASH_LIST a hash table with a linked list
+ GL_AVLTREEHASH_LIST a hash table with a binary tree (AVL tree)
+ GL_RBTREEHASH_LIST a hash table with a binary tree (red-black tree)
+
+ The memory consumption is asymptotically the same: O(1) for every object
+ in the list. When looking more closely at the average memory consumed
+ for an object, GL_ARRAY_LIST is the most compact representation, and
+ GL_LINKEDHASH_LIST and GL_TREEHASH_LIST need more memory.
+
+ The guaranteed average performance of the operations is, for a list of
+ n elements:
+
+ Operation ARRAY LINKED TREE LINKEDHASH TREEHASH
+ CARRAY with|without with|without
+ duplicates duplicates
+
+ gl_list_size O(1) O(1) O(1) O(1) O(1)
+ gl_list_node_value O(1) O(1) O(1) O(1) O(1)
+ gl_list_node_set_value O(1) O(1) O(1) O(1) O((log n)²)/O(1)
+ gl_list_next_node O(1) O(1) O(log n) O(1) O(log n)
+ gl_list_previous_node O(1) O(1) O(log n) O(1) O(log n)
+ gl_list_get_at O(1) O(n) O(log n) O(n) O(log n)
+ gl_list_set_at O(1) O(n) O(log n) O(n) O((log n)²)/O(log n)
+ gl_list_search O(n) O(n) O(n) O(n)/O(1) O(log n)/O(1)
+ gl_list_search_from O(n) O(n) O(n) O(n)/O(1) O((log n)²)/O(log n)
+ gl_list_search_from_to O(n) O(n) O(n) O(n)/O(1) O((log n)²)/O(log n)
+ gl_list_indexof O(n) O(n) O(n) O(n) O(log n)
+ gl_list_indexof_from O(n) O(n) O(n) O(n) O((log n)²)/O(log n)
+ gl_list_indexof_from_to O(n) O(n) O(n) O(n) O((log n)²)/O(log n)
+ gl_list_add_first O(n)/O(1) O(1) O(log n) O(1) O((log n)²)/O(log n)
+ gl_list_add_last O(1) O(1) O(log n) O(1) O((log n)²)/O(log n)
+ gl_list_add_before O(n) O(1) O(log n) O(1) O((log n)²)/O(log n)
+ gl_list_add_after O(n) O(1) O(log n) O(1) O((log n)²)/O(log n)
+ gl_list_add_at O(n) O(n) O(log n) O(n) O((log n)²)/O(log n)
+ gl_list_remove_node O(n) O(1) O(log n) O(n)/O(1) O((log n)²)/O(log n)
+ gl_list_remove_at O(n) O(n) O(log n) O(n) O((log n)²)/O(log n)
+ gl_list_remove O(n) O(n) O(n) O(n)/O(1) O((log n)²)/O(log n)
+ gl_list_iterator O(1) O(1) O(log n) O(1) O(log n)
+ gl_list_iterator_from_to O(1) O(n) O(log n) O(n) O(log n)
+ gl_list_iterator_next O(1) O(1) O(log n) O(1) O(log n)
+ gl_sortedlist_search O(log n) O(n) O(log n) O(n) O(log n)
+ gl_sortedlist_search_from O(log n) O(n) O(log n) O(n) O(log n)
+ gl_sortedlist_indexof O(log n) O(n) O(log n) O(n) O(log n)
+ gl_sortedlist_indexof_fro O(log n) O(n) O(log n) O(n) O(log n)
+ gl_sortedlist_add O(n) O(n) O(log n) O(n) O((log n)²)/O(log n)
+ gl_sortedlist_remove O(n) O(n) O(log n) O(n) O((log n)²)/O(log n)
+ */
+
+/* -------------------------- gl_list_t Data Type -------------------------- */
+
+/* Type of function used to compare two elements.
+ NULL denotes pointer comparison. */
+typedef bool (*gl_listelement_equals_fn) (const void *elt1, const void *elt2);
+
+/* Type of function used to compute a hash code.
+ NULL denotes a function that depends only on the pointer itself. */
+typedef size_t (*gl_listelement_hashcode_fn) (const void *elt);
+
+/* Type of function used to dispose an element once it's removed from a list.
+ NULL denotes a no-op. */
+typedef void (*gl_listelement_dispose_fn) (const void *elt);
+
+struct gl_list_impl;
+/* Type representing an entire list. */
+typedef struct gl_list_impl * gl_list_t;
+
+struct gl_list_node_impl;
+/* Type representing the position of an element in the list, in a way that
+ is more adapted to the list implementation than a plain index.
+ Note: It is invalidated by insertions and removals! */
+typedef struct gl_list_node_impl * gl_list_node_t;
+
+struct gl_list_implementation;
+/* Type representing a list datatype implementation. */
+typedef const struct gl_list_implementation * gl_list_implementation_t;
+
+#if 0 /* Unless otherwise specified, these are defined inline below. */
+
+/* Create an empty list.
+ IMPLEMENTATION is one of GL_ARRAY_LIST, GL_CARRAY_LIST, GL_LINKED_LIST,
+ GL_AVLTREE_LIST, GL_RBTREE_LIST, GL_LINKEDHASH_LIST, GL_AVLTREEHASH_LIST,
+ GL_RBTREEHASH_LIST.
+ EQUALS_FN is an element comparison function or NULL.
+ HASHCODE_FN is an element hash code function or NULL.
+ DISPOSE_FN is an element disposal function or NULL.
+ ALLOW_DUPLICATES is false if duplicate elements shall not be allowed in
+ the list. The implementation may verify this at runtime. */
+/* declared in gl_xlist.h */
+extern gl_list_t gl_list_create_empty (gl_list_implementation_t implementation,
+ gl_listelement_equals_fn equals_fn,
+ gl_listelement_hashcode_fn hashcode_fn,
+ gl_listelement_dispose_fn dispose_fn,
+ bool allow_duplicates);
+/* Likewise. Return NULL upon out-of-memory. */
+extern gl_list_t gl_list_nx_create_empty (gl_list_implementation_t implementation,
+ gl_listelement_equals_fn equals_fn,
+ gl_listelement_hashcode_fn hashcode_fn,
+ gl_listelement_dispose_fn dispose_fn,
+ bool allow_duplicates);
+
+/* Create a list with given contents.
+ IMPLEMENTATION is one of GL_ARRAY_LIST, GL_CARRAY_LIST, GL_LINKED_LIST,
+ GL_AVLTREE_LIST, GL_RBTREE_LIST, GL_LINKEDHASH_LIST, GL_AVLTREEHASH_LIST,
+ GL_RBTREEHASH_LIST.
+ EQUALS_FN is an element comparison function or NULL.
+ HASHCODE_FN is an element hash code function or NULL.
+ DISPOSE_FN is an element disposal function or NULL.
+ ALLOW_DUPLICATES is false if duplicate elements shall not be allowed in
+ the list. The implementation may verify this at runtime.
+ COUNT is the number of initial elements.
+ CONTENTS[0..COUNT-1] is the initial contents. */
+/* declared in gl_xlist.h */
+extern gl_list_t gl_list_create (gl_list_implementation_t implementation,
+ gl_listelement_equals_fn equals_fn,
+ gl_listelement_hashcode_fn hashcode_fn,
+ gl_listelement_dispose_fn dispose_fn,
+ bool allow_duplicates,
+ size_t count, const void **contents);
+/* Likewise. Return NULL upon out-of-memory. */
+extern gl_list_t gl_list_nx_create (gl_list_implementation_t implementation,
+ gl_listelement_equals_fn equals_fn,
+ gl_listelement_hashcode_fn hashcode_fn,
+ gl_listelement_dispose_fn dispose_fn,
+ bool allow_duplicates,
+ size_t count, const void **contents);
+
+/* Return the current number of elements in a list. */
+extern size_t gl_list_size (gl_list_t list);
+
+/* Return the element value represented by a list node. */
+extern const void * gl_list_node_value (gl_list_t list, gl_list_node_t node);
+
+/* Replace the element value represented by a list node. */
+/* declared in gl_xlist.h */
+extern void gl_list_node_set_value (gl_list_t list, gl_list_node_t node,
+ const void *elt);
+/* Likewise. Return 0 upon success, -1 upon out-of-memory. */
+extern int gl_list_node_nx_set_value (gl_list_t list, gl_list_node_t node,
+ const void *elt)
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+ ;
+
+/* Return the node immediately after the given node in the list, or NULL
+ if the given node is the last (rightmost) one in the list. */
+extern gl_list_node_t gl_list_next_node (gl_list_t list, gl_list_node_t node);
+
+/* Return the node immediately before the given node in the list, or NULL
+ if the given node is the first (leftmost) one in the list. */
+extern gl_list_node_t gl_list_previous_node (gl_list_t list, gl_list_node_t node);
+
+/* Return the element at a given position in the list.
+ POSITION must be >= 0 and < gl_list_size (list). */
+extern const void * gl_list_get_at (gl_list_t list, size_t position);
+
+/* Replace the element at a given position in the list.
+ POSITION must be >= 0 and < gl_list_size (list).
+ Return its node. */
+/* declared in gl_xlist.h */
+extern gl_list_node_t gl_list_set_at (gl_list_t list, size_t position,
+ const void *elt);
+/* Likewise. Return NULL upon out-of-memory. */
+extern gl_list_node_t gl_list_nx_set_at (gl_list_t list, size_t position,
+ const void *elt)
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+ ;
+
+/* Search whether an element is already in the list.
+ Return its node if found, or NULL if not present in the list. */
+extern gl_list_node_t gl_list_search (gl_list_t list, const void *elt);
+
+/* Search whether an element is already in the list,
+ at a position >= START_INDEX.
+ Return its node if found, or NULL if not present in the list. */
+extern gl_list_node_t gl_list_search_from (gl_list_t list, size_t start_index,
+ const void *elt);
+
+/* Search whether an element is already in the list,
+ at a position >= START_INDEX and < END_INDEX.
+ Return its node if found, or NULL if not present in the list. */
+extern gl_list_node_t gl_list_search_from_to (gl_list_t list,
+ size_t start_index,
+ size_t end_index,
+ const void *elt);
+
+/* Search whether an element is already in the list.
+ Return its position if found, or (size_t)(-1) if not present in the list. */
+extern size_t gl_list_indexof (gl_list_t list, const void *elt);
+
+/* Search whether an element is already in the list,
+ at a position >= START_INDEX.
+ Return its position if found, or (size_t)(-1) if not present in the list. */
+extern size_t gl_list_indexof_from (gl_list_t list, size_t start_index,
+ const void *elt);
+
+/* Search whether an element is already in the list,
+ at a position >= START_INDEX and < END_INDEX.
+ Return its position if found, or (size_t)(-1) if not present in the list. */
+extern size_t gl_list_indexof_from_to (gl_list_t list,
+ size_t start_index, size_t end_index,
+ const void *elt);
+
+/* Add an element as the first element of the list.
+ Return its node. */
+/* declared in gl_xlist.h */
+extern gl_list_node_t gl_list_add_first (gl_list_t list, const void *elt);
+/* Likewise. Return NULL upon out-of-memory. */
+extern gl_list_node_t gl_list_nx_add_first (gl_list_t list, const void *elt)
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+ ;
+
+/* Add an element as the last element of the list.
+ Return its node. */
+/* declared in gl_xlist.h */
+extern gl_list_node_t gl_list_add_last (gl_list_t list, const void *elt);
+/* Likewise. Return NULL upon out-of-memory. */
+extern gl_list_node_t gl_list_nx_add_last (gl_list_t list, const void *elt)
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+ ;
+
+/* Add an element before a given element node of the list.
+ Return its node. */
+/* declared in gl_xlist.h */
+extern gl_list_node_t gl_list_add_before (gl_list_t list, gl_list_node_t node,
+ const void *elt);
+/* Likewise. Return NULL upon out-of-memory. */
+extern gl_list_node_t gl_list_nx_add_before (gl_list_t list,
+ gl_list_node_t node,
+ const void *elt)
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+ ;
+
+/* Add an element after a given element node of the list.
+ Return its node. */
+/* declared in gl_xlist.h */
+extern gl_list_node_t gl_list_add_after (gl_list_t list, gl_list_node_t node,
+ const void *elt);
+/* Likewise. Return NULL upon out-of-memory. */
+extern gl_list_node_t gl_list_nx_add_after (gl_list_t list, gl_list_node_t node,
+ const void *elt)
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+ ;
+
+/* Add an element at a given position in the list.
+ POSITION must be >= 0 and <= gl_list_size (list). */
+/* declared in gl_xlist.h */
+extern gl_list_node_t gl_list_add_at (gl_list_t list, size_t position,
+ const void *elt);
+/* Likewise. Return NULL upon out-of-memory. */
+extern gl_list_node_t gl_list_nx_add_at (gl_list_t list, size_t position,
+ const void *elt)
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+ ;
+
+/* Remove an element from the list.
+ Return true. */
+extern bool gl_list_remove_node (gl_list_t list, gl_list_node_t node);
+
+/* Remove an element at a given position from the list.
+ POSITION must be >= 0 and < gl_list_size (list).
+ Return true. */
+extern bool gl_list_remove_at (gl_list_t list, size_t position);
+
+/* Search and remove an element from the list.
+ Return true if it was found and removed. */
+extern bool gl_list_remove (gl_list_t list, const void *elt);
+
+/* Free an entire list.
+ (But this call does not free the elements of the list.) */
+extern void gl_list_free (gl_list_t list);
+
+#endif /* End of inline and gl_xlist.h-defined functions. */
+
+/* --------------------- gl_list_iterator_t Data Type --------------------- */
+
+/* Functions for iterating through a list. */
+
+/* Type of an iterator that traverses a list.
+ This is a fixed-size struct, so that creation of an iterator doesn't need
+ memory allocation on the heap. */
+typedef struct
+{
+ /* For fast dispatch of gl_list_iterator_next. */
+ const struct gl_list_implementation *vtable;
+ /* For detecting whether the last returned element was removed. */
+ gl_list_t list;
+ size_t count;
+ /* Other, implementation-private fields. */
+ void *p; void *q;
+ size_t i; size_t j;
+} gl_list_iterator_t;
+
+#if 0 /* These are defined inline below. */
+
+/* Create an iterator traversing a list.
+ The list contents must not be modified while the iterator is in use,
+ except for replacing or removing the last returned element. */
+extern gl_list_iterator_t gl_list_iterator (gl_list_t list);
+
+/* Create an iterator traversing the element with indices i,
+ start_index <= i < end_index, of a list.
+ The list contents must not be modified while the iterator is in use,
+ except for replacing or removing the last returned element. */
+extern gl_list_iterator_t gl_list_iterator_from_to (gl_list_t list,
+ size_t start_index,
+ size_t end_index);
+
+/* If there is a next element, store the next element in *ELTP, store its
+ node in *NODEP if NODEP is non-NULL, advance the iterator and return true.
+ Otherwise, return false. */
+extern bool gl_list_iterator_next (gl_list_iterator_t *iterator,
+ const void **eltp, gl_list_node_t *nodep);
+
+/* Free an iterator. */
+extern void gl_list_iterator_free (gl_list_iterator_t *iterator);
+
+#endif /* End of inline functions. */
+
+/* ---------------------- Sorted gl_list_t Data Type ---------------------- */
+
+/* The following functions are for lists without duplicates where the
+ order is given by a sort criterion. */
+
+/* Type of function used to compare two elements. Same as for qsort().
+ NULL denotes pointer comparison. */
+typedef int (*gl_listelement_compar_fn) (const void *elt1, const void *elt2);
+
+#if 0 /* Unless otherwise specified, these are defined inline below. */
+
+/* Search whether an element is already in the list.
+ The list is assumed to be sorted with COMPAR.
+ Return its node if found, or NULL if not present in the list.
+ If the list contains several copies of ELT, the node of the leftmost one is
+ returned. */
+extern gl_list_node_t gl_sortedlist_search (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ const void *elt);
+
+/* Search whether an element is already in the list.
+ The list is assumed to be sorted with COMPAR.
+ Only list elements with indices >= START_INDEX and < END_INDEX are
+ considered; the implementation uses these bounds to minimize the number
+ of COMPAR invocations.
+ Return its node if found, or NULL if not present in the list.
+ If the list contains several copies of ELT, the node of the leftmost one is
+ returned. */
+extern gl_list_node_t gl_sortedlist_search_from_to (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ size_t start_index,
+ size_t end_index,
+ const void *elt);
+
+/* Search whether an element is already in the list.
+ The list is assumed to be sorted with COMPAR.
+ Return its position if found, or (size_t)(-1) if not present in the list.
+ If the list contains several copies of ELT, the position of the leftmost one
+ is returned. */
+extern size_t gl_sortedlist_indexof (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ const void *elt);
+
+/* Search whether an element is already in the list.
+ The list is assumed to be sorted with COMPAR.
+ Only list elements with indices >= START_INDEX and < END_INDEX are
+ considered; the implementation uses these bounds to minimize the number
+ of COMPAR invocations.
+ Return its position if found, or (size_t)(-1) if not present in the list.
+ If the list contains several copies of ELT, the position of the leftmost one
+ is returned. */
+extern size_t gl_sortedlist_indexof_from_to (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ size_t start_index,
+ size_t end_index,
+ const void *elt);
+
+/* Add an element at the appropriate position in the list.
+ The list is assumed to be sorted with COMPAR.
+ Return its node. */
+/* declared in gl_xlist.h */
+extern gl_list_node_t gl_sortedlist_add (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ const void *elt);
+/* Likewise. Return NULL upon out-of-memory. */
+extern gl_list_node_t gl_sortedlist_nx_add (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ const void *elt)
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+ ;
+
+/* Search and remove an element from the list.
+ The list is assumed to be sorted with COMPAR.
+ Return true if it was found and removed.
+ If the list contains several copies of ELT, only the leftmost one is
+ removed. */
+extern bool gl_sortedlist_remove (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ const void *elt);
+
+#endif /* End of inline and gl_xlist.h-defined functions. */
+
+/* ------------------------ Implementation Details ------------------------ */
+
+struct gl_list_implementation
+{
+ /* gl_list_t functions. */
+ gl_list_t (*nx_create_empty) (gl_list_implementation_t implementation,
+ gl_listelement_equals_fn equals_fn,
+ gl_listelement_hashcode_fn hashcode_fn,
+ gl_listelement_dispose_fn dispose_fn,
+ bool allow_duplicates);
+ gl_list_t (*nx_create) (gl_list_implementation_t implementation,
+ gl_listelement_equals_fn equals_fn,
+ gl_listelement_hashcode_fn hashcode_fn,
+ gl_listelement_dispose_fn dispose_fn,
+ bool allow_duplicates,
+ size_t count, const void **contents);
+ size_t (*size) (gl_list_t list);
+ const void * (*node_value) (gl_list_t list, gl_list_node_t node);
+ int (*node_nx_set_value) (gl_list_t list, gl_list_node_t node,
+ const void *elt);
+ gl_list_node_t (*next_node) (gl_list_t list, gl_list_node_t node);
+ gl_list_node_t (*previous_node) (gl_list_t list, gl_list_node_t node);
+ const void * (*get_at) (gl_list_t list, size_t position);
+ gl_list_node_t (*nx_set_at) (gl_list_t list, size_t position,
+ const void *elt);
+ gl_list_node_t (*search_from_to) (gl_list_t list, size_t start_index,
+ size_t end_index, const void *elt);
+ size_t (*indexof_from_to) (gl_list_t list, size_t start_index,
+ size_t end_index, const void *elt);
+ gl_list_node_t (*nx_add_first) (gl_list_t list, const void *elt);
+ gl_list_node_t (*nx_add_last) (gl_list_t list, const void *elt);
+ gl_list_node_t (*nx_add_before) (gl_list_t list, gl_list_node_t node,
+ const void *elt);
+ gl_list_node_t (*nx_add_after) (gl_list_t list, gl_list_node_t node,
+ const void *elt);
+ gl_list_node_t (*nx_add_at) (gl_list_t list, size_t position,
+ const void *elt);
+ bool (*remove_node) (gl_list_t list, gl_list_node_t node);
+ bool (*remove_at) (gl_list_t list, size_t position);
+ bool (*remove_elt) (gl_list_t list, const void *elt);
+ void (*list_free) (gl_list_t list);
+ /* gl_list_iterator_t functions. */
+ gl_list_iterator_t (*iterator) (gl_list_t list);
+ gl_list_iterator_t (*iterator_from_to) (gl_list_t list,
+ size_t start_index,
+ size_t end_index);
+ bool (*iterator_next) (gl_list_iterator_t *iterator,
+ const void **eltp, gl_list_node_t *nodep);
+ void (*iterator_free) (gl_list_iterator_t *iterator);
+ /* Sorted gl_list_t functions. */
+ gl_list_node_t (*sortedlist_search) (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ const void *elt);
+ gl_list_node_t (*sortedlist_search_from_to) (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ size_t start_index,
+ size_t end_index,
+ const void *elt);
+ size_t (*sortedlist_indexof) (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ const void *elt);
+ size_t (*sortedlist_indexof_from_to) (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ size_t start_index, size_t end_index,
+ const void *elt);
+ gl_list_node_t (*sortedlist_nx_add) (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ const void *elt);
+ bool (*sortedlist_remove) (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ const void *elt);
+};
+
+struct gl_list_impl_base
+{
+ const struct gl_list_implementation *vtable;
+ gl_listelement_equals_fn equals_fn;
+ gl_listelement_hashcode_fn hashcode_fn;
+ gl_listelement_dispose_fn dispose_fn;
+ bool allow_duplicates;
+};
+
+/* Define all functions of this file as accesses to the
+ struct gl_list_implementation. */
+
+GL_LIST_INLINE gl_list_t
+gl_list_nx_create_empty (gl_list_implementation_t implementation,
+ gl_listelement_equals_fn equals_fn,
+ gl_listelement_hashcode_fn hashcode_fn,
+ gl_listelement_dispose_fn dispose_fn,
+ bool allow_duplicates)
+{
+ return implementation->nx_create_empty (implementation, equals_fn,
+ hashcode_fn, dispose_fn,
+ allow_duplicates);
+}
+
+GL_LIST_INLINE gl_list_t
+gl_list_nx_create (gl_list_implementation_t implementation,
+ gl_listelement_equals_fn equals_fn,
+ gl_listelement_hashcode_fn hashcode_fn,
+ gl_listelement_dispose_fn dispose_fn,
+ bool allow_duplicates,
+ size_t count, const void **contents)
+{
+ return implementation->nx_create (implementation, equals_fn, hashcode_fn,
+ dispose_fn, allow_duplicates, count,
+ contents);
+}
+
+GL_LIST_INLINE size_t
+gl_list_size (gl_list_t list)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->size (list);
+}
+
+GL_LIST_INLINE const void *
+gl_list_node_value (gl_list_t list, gl_list_node_t node)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->node_value (list, node);
+}
+
+GL_LIST_INLINE int
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+gl_list_node_nx_set_value (gl_list_t list, gl_list_node_t node,
+ const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->node_nx_set_value (list, node, elt);
+}
+
+GL_LIST_INLINE gl_list_node_t
+gl_list_next_node (gl_list_t list, gl_list_node_t node)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->next_node (list, node);
+}
+
+GL_LIST_INLINE gl_list_node_t
+gl_list_previous_node (gl_list_t list, gl_list_node_t node)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->previous_node (list, node);
+}
+
+GL_LIST_INLINE const void *
+gl_list_get_at (gl_list_t list, size_t position)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->get_at (list, position);
+}
+
+GL_LIST_INLINE gl_list_node_t
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+gl_list_nx_set_at (gl_list_t list, size_t position, const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->nx_set_at (list, position, elt);
+}
+
+GL_LIST_INLINE gl_list_node_t
+gl_list_search (gl_list_t list, const void *elt)
+{
+ size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list);
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->search_from_to (list, 0, size, elt);
+}
+
+GL_LIST_INLINE gl_list_node_t
+gl_list_search_from (gl_list_t list, size_t start_index, const void *elt)
+{
+ size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list);
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->search_from_to (list, start_index, size, elt);
+}
+
+GL_LIST_INLINE gl_list_node_t
+gl_list_search_from_to (gl_list_t list, size_t start_index, size_t end_index,
+ const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->search_from_to (list, start_index, end_index, elt);
+}
+
+GL_LIST_INLINE size_t
+gl_list_indexof (gl_list_t list, const void *elt)
+{
+ size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list);
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->indexof_from_to (list, 0, size, elt);
+}
+
+GL_LIST_INLINE size_t
+gl_list_indexof_from (gl_list_t list, size_t start_index, const void *elt)
+{
+ size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list);
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->indexof_from_to (list, start_index, size, elt);
+}
+
+GL_LIST_INLINE size_t
+gl_list_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index,
+ const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->indexof_from_to (list, start_index, end_index, elt);
+}
+
+GL_LIST_INLINE gl_list_node_t
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+gl_list_nx_add_first (gl_list_t list, const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->nx_add_first (list, elt);
+}
+
+GL_LIST_INLINE gl_list_node_t
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+gl_list_nx_add_last (gl_list_t list, const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->nx_add_last (list, elt);
+}
+
+GL_LIST_INLINE gl_list_node_t
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+gl_list_nx_add_before (gl_list_t list, gl_list_node_t node, const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->nx_add_before (list, node, elt);
+}
+
+GL_LIST_INLINE gl_list_node_t
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+gl_list_nx_add_after (gl_list_t list, gl_list_node_t node, const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->nx_add_after (list, node, elt);
+}
+
+GL_LIST_INLINE gl_list_node_t
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+gl_list_nx_add_at (gl_list_t list, size_t position, const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->nx_add_at (list, position, elt);
+}
+
+GL_LIST_INLINE bool
+gl_list_remove_node (gl_list_t list, gl_list_node_t node)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->remove_node (list, node);
+}
+
+GL_LIST_INLINE bool
+gl_list_remove_at (gl_list_t list, size_t position)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->remove_at (list, position);
+}
+
+GL_LIST_INLINE bool
+gl_list_remove (gl_list_t list, const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->remove_elt (list, elt);
+}
+
+GL_LIST_INLINE void
+gl_list_free (gl_list_t list)
+{
+ ((const struct gl_list_impl_base *) list)->vtable->list_free (list);
+}
+
+GL_LIST_INLINE gl_list_iterator_t
+gl_list_iterator (gl_list_t list)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->iterator (list);
+}
+
+GL_LIST_INLINE gl_list_iterator_t
+gl_list_iterator_from_to (gl_list_t list, size_t start_index, size_t end_index)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->iterator_from_to (list, start_index, end_index);
+}
+
+GL_LIST_INLINE bool
+gl_list_iterator_next (gl_list_iterator_t *iterator,
+ const void **eltp, gl_list_node_t *nodep)
+{
+ return iterator->vtable->iterator_next (iterator, eltp, nodep);
+}
+
+GL_LIST_INLINE void
+gl_list_iterator_free (gl_list_iterator_t *iterator)
+{
+ iterator->vtable->iterator_free (iterator);
+}
+
+GL_LIST_INLINE gl_list_node_t
+gl_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->sortedlist_search (list, compar, elt);
+}
+
+GL_LIST_INLINE gl_list_node_t
+gl_sortedlist_search_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t start_index, size_t end_index, const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->sortedlist_search_from_to (list, compar, start_index, end_index,
+ elt);
+}
+
+GL_LIST_INLINE size_t
+gl_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->sortedlist_indexof (list, compar, elt);
+}
+
+GL_LIST_INLINE size_t
+gl_sortedlist_indexof_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t start_index, size_t end_index, const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->sortedlist_indexof_from_to (list, compar, start_index, end_index,
+ elt);
+}
+
+GL_LIST_INLINE gl_list_node_t
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ __attribute__ ((__warn_unused_result__))
+#endif
+gl_sortedlist_nx_add (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->sortedlist_nx_add (list, compar, elt);
+}
+
+GL_LIST_INLINE bool
+gl_sortedlist_remove (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
+{
+ return ((const struct gl_list_impl_base *) list)->vtable
+ ->sortedlist_remove (list, compar, elt);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+_GL_INLINE_HEADER_END
+
+#endif /* _GL_LIST_H */
diff --git a/lib/gl_openssl.h b/lib/gl_openssl.h
index 24144215..697cd855 100644
--- a/lib/gl_openssl.h
+++ b/lib/gl_openssl.h
@@ -1,6 +1,6 @@
/* gl_openssl.h -- wrap openssl crypto hash routines in gnulib interface
- Copyright (C) 2013-2014 Free Software Foundation, Inc.
+ Copyright (C) 2013-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/gl_xlist.c b/lib/gl_xlist.c
new file mode 100644
index 00000000..fe3c8933
--- /dev/null
+++ b/lib/gl_xlist.c
@@ -0,0 +1,3 @@
+#include <config.h>
+#define GL_XLIST_INLINE _GL_EXTERN_INLINE
+#include "gl_xlist.h"
diff --git a/lib/gl_xlist.h b/lib/gl_xlist.h
new file mode 100644
index 00000000..7ea62c1c
--- /dev/null
+++ b/lib/gl_xlist.h
@@ -0,0 +1,177 @@
+/* Abstract sequential list data type, with out-of-memory checking.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2009.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _GL_XLIST_H
+#define _GL_XLIST_H
+
+#include "gl_list.h"
+#include "xalloc.h"
+
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
+_GL_INLINE_HEADER_BEGIN
+#ifndef GL_XLIST_INLINE
+# define GL_XLIST_INLINE _GL_INLINE
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* These functions are thin wrappers around the corresponding functions with
+ _nx_ infix from gl_list.h. Upon out-of-memory, they invoke xalloc_die (),
+ instead of returning an error indicator. */
+#if 0 /* These are defined inline below. */
+extern gl_list_t gl_list_create_empty (gl_list_implementation_t implementation,
+ gl_listelement_equals_fn equals_fn,
+ gl_listelement_hashcode_fn hashcode_fn,
+ gl_listelement_dispose_fn dispose_fn,
+ bool allow_duplicates);
+extern gl_list_t gl_list_create (gl_list_implementation_t implementation,
+ gl_listelement_equals_fn equals_fn,
+ gl_listelement_hashcode_fn hashcode_fn,
+ gl_listelement_dispose_fn dispose_fn,
+ bool allow_duplicates,
+ size_t count, const void **contents);
+extern void gl_list_node_set_value (gl_list_t list, gl_list_node_t node,
+ const void *elt);
+extern gl_list_node_t gl_list_set_at (gl_list_t list, size_t position,
+ const void *elt);
+extern gl_list_node_t gl_list_add_first (gl_list_t list, const void *elt);
+extern gl_list_node_t gl_list_add_last (gl_list_t list, const void *elt);
+extern gl_list_node_t gl_list_add_before (gl_list_t list, gl_list_node_t node,
+ const void *elt);
+extern gl_list_node_t gl_list_add_after (gl_list_t list, gl_list_node_t node,
+ const void *elt);
+extern gl_list_node_t gl_list_add_at (gl_list_t list, size_t position,
+ const void *elt);
+extern gl_list_node_t gl_sortedlist_add (gl_list_t list,
+ gl_listelement_compar_fn compar,
+ const void *elt);
+#endif
+
+GL_XLIST_INLINE gl_list_t
+gl_list_create_empty (gl_list_implementation_t implementation,
+ gl_listelement_equals_fn equals_fn,
+ gl_listelement_hashcode_fn hashcode_fn,
+ gl_listelement_dispose_fn dispose_fn,
+ bool allow_duplicates)
+{
+ gl_list_t result =
+ gl_list_nx_create_empty (implementation, equals_fn, hashcode_fn, dispose_fn,
+ allow_duplicates);
+ if (result == NULL)
+ xalloc_die ();
+ return result;
+}
+
+GL_XLIST_INLINE gl_list_t
+gl_list_create (gl_list_implementation_t implementation,
+ gl_listelement_equals_fn equals_fn,
+ gl_listelement_hashcode_fn hashcode_fn,
+ gl_listelement_dispose_fn dispose_fn,
+ bool allow_duplicates,
+ size_t count, const void **contents)
+{
+ gl_list_t result =
+ gl_list_nx_create (implementation, equals_fn, hashcode_fn, dispose_fn,
+ allow_duplicates, count, contents);
+ if (result == NULL)
+ xalloc_die ();
+ return result;
+}
+
+GL_XLIST_INLINE void
+gl_list_node_set_value (gl_list_t list, gl_list_node_t node, const void *elt)
+{
+ int result = gl_list_node_nx_set_value (list, node, elt);
+ if (result < 0)
+ xalloc_die ();
+}
+
+GL_XLIST_INLINE gl_list_node_t
+gl_list_set_at (gl_list_t list, size_t position, const void *elt)
+{
+ gl_list_node_t result = gl_list_nx_set_at (list, position, elt);
+ if (result == NULL)
+ xalloc_die ();
+ return result;
+}
+
+GL_XLIST_INLINE gl_list_node_t
+gl_list_add_first (gl_list_t list, const void *elt)
+{
+ gl_list_node_t result = gl_list_nx_add_first (list, elt);
+ if (result == NULL)
+ xalloc_die ();
+ return result;
+}
+
+GL_XLIST_INLINE gl_list_node_t
+gl_list_add_last (gl_list_t list, const void *elt)
+{
+ gl_list_node_t result = gl_list_nx_add_last (list, elt);
+ if (result == NULL)
+ xalloc_die ();
+ return result;
+}
+
+GL_XLIST_INLINE gl_list_node_t
+gl_list_add_before (gl_list_t list, gl_list_node_t node, const void *elt)
+{
+ gl_list_node_t result = gl_list_nx_add_before (list, node, elt);
+ if (result == NULL)
+ xalloc_die ();
+ return result;
+}
+
+GL_XLIST_INLINE gl_list_node_t
+gl_list_add_after (gl_list_t list, gl_list_node_t node, const void *elt)
+{
+ gl_list_node_t result = gl_list_nx_add_after (list, node, elt);
+ if (result == NULL)
+ xalloc_die ();
+ return result;
+}
+
+GL_XLIST_INLINE gl_list_node_t
+gl_list_add_at (gl_list_t list, size_t position, const void *elt)
+{
+ gl_list_node_t result = gl_list_nx_add_at (list, position, elt);
+ if (result == NULL)
+ xalloc_die ();
+ return result;
+}
+
+GL_XLIST_INLINE gl_list_node_t
+gl_sortedlist_add (gl_list_t list, gl_listelement_compar_fn compar,
+ const void *elt)
+{
+ gl_list_node_t result = gl_sortedlist_nx_add (list, compar, elt);
+ if (result == NULL)
+ xalloc_die ();
+ return result;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+_GL_INLINE_HEADER_END
+
+#endif /* _GL_XLIST_H */
diff --git a/lib/glthread/lock.c b/lib/glthread/lock.c
index 33c15a0d..b64132ab 100644
--- a/lib/glthread/lock.c
+++ b/lib/glthread/lock.c
@@ -1,5 +1,5 @@
/* Locking in multithreaded situations.
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/glthread/lock.h b/lib/glthread/lock.h
index 36096c4b..cf3d0d95 100644
--- a/lib/glthread/lock.h
+++ b/lib/glthread/lock.h
@@ -1,5 +1,5 @@
/* Locking in multithreaded situations.
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/glthread/threadlib.c b/lib/glthread/threadlib.c
index 26870de2..f01d351c 100644
--- a/lib/glthread/threadlib.c
+++ b/lib/glthread/threadlib.c
@@ -1,5 +1,5 @@
/* Multithreading primitives.
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/glthread/tls.c b/lib/glthread/tls.c
index 971c72ab..f1c0cd71 100644
--- a/lib/glthread/tls.c
+++ b/lib/glthread/tls.c
@@ -1,5 +1,5 @@
/* Thread-local storage in multithreaded situations.
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/glthread/tls.h b/lib/glthread/tls.h
index c0a56e49..cf53a2bd 100644
--- a/lib/glthread/tls.h
+++ b/lib/glthread/tls.h
@@ -1,5 +1,5 @@
/* Thread-local storage in multithreaded situations.
- Copyright (C) 2005, 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index e1d74db7..2bff8c69 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -1,6 +1,6 @@
## DO NOT EDIT! GENERATED AUTOMATICALLY!
## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2015 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libcoreutils --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=gnulib-tests --aux-dir=build-aux --with-tests --avoid=canonicalize-lgpl --avoid=dummy --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl acl alignof alloca announce-gen areadlink-with-size argmatch argv-iter assert autobuild backupfile base64 buffer-lcm c-strcase c-strtod c-strtold calloc-gnu canon-host canonicalize chown cloexec closein closeout config-h configmake crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 cycle-check d-ino d-type di-set diacrit dirfd dirname do-release-commit-and-tag dtoastr dup2 environ error euidaccess exclude exitfail faccessat fadvise fchdir fchmodat fchownat fclose fcntl fcntl-safer fd-reopen fdatasync fdl fdopen fdutimensat file-type fileblocks filemode filenamecat filevercmp fnmatch-gnu fopen-safer fprintftime freopen freopen-safer fseeko fstatat fsusage fsync ftello ftoastr ftruncate fts full-read full-write getgroups gethrxtime getline getloadavg getlogin getndelim2 getopt-gnu getpagesize getpass-gnu gettext-h gettime gettimeofday getugroups getusershell git-version-gen gitlog-to-changelog gnu-make gnu-web-doc-update gnumakefile gnupload group-member hard-locale hash hash-pjw heap host-os human idcache ignore-value inttostr inttypes isapipe isatty isblank largefile lchmod lchown ldtoastr lib-ignore linebuffer link link-follow linkat long-options lstat maintainer-makefile malloc-gnu manywarnings mbrlen mbrtowc mbsalign mbswidth memcasecmp memchr memcmp2 mempcpy memrchr mgetgroups mkancesdirs mkdir mkdir-p mkfifo mknod mkstemp mktime modechange mountlist mpsort netinet_in non-recursive-gnulib-prefix-hack nproc obstack parse-datetime pathmax perl physmem pipe-posix posix-shell posixtm posixver priv-set progname propername pthread putenv quote quotearg randint randperm read-file readlink readtokens readtokens0 readutmp realloc-gnu regex remove rename rmdir root-dev-ino rpmatch safe-read same save-cwd savedir savewd selinux-at settime sig2str sigaction smack ssize_t stat-macros stat-size stat-time statat stdbool stdlib-safer stpcpy stpncpy strdup-posix strftime strncat strnumcmp strpbrk strsignal strtod strtoimax strtoumax symlink sys_ioctl sys_resource sys_stat sys_wait termios timer-time timespec tzset uname unicodeio unistd-safer unlink-busy unlinkat unlocked-io unsetenv update-copyright uptime useless-if-before-free userspec utimecmp utimens vasprintf-posix vc-list-files verify verror version-etc-fsf wcswidth wcwidth winsz-ioctl winsz-termios write-any-file xalloc xfreopen xfts xgetcwd xgetgroups xgethostname xmemcoll xnanosleep xprintf xprintf-posix xreadlink xstrtod xstrtoimax xstrtol xstrtold xstrtoumax yesno
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libcoreutils --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=gnulib-tests --aux-dir=build-aux --with-tests --avoid=canonicalize-lgpl --avoid=dummy --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl acl alignof alloca announce-gen areadlink-with-size argmatch argv-iter assert autobuild backupfile base64 buffer-lcm c-strcase c-strtod c-strtold calloc-gnu canon-host canonicalize chown cloexec closein closeout config-h configmake crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 cycle-check d-ino d-type di-set diacrit dirfd dirname do-release-commit-and-tag dtoastr dup2 environ error euidaccess exclude exitfail faccessat fadvise fchdir fchmodat fchownat fclose fcntl fcntl-safer fd-reopen fdatasync fdl fdopen fdutimensat file-has-acl file-type fileblocks filemode filenamecat filevercmp fnmatch-gnu fopen-safer fprintftime freopen freopen-safer fseeko fstatat fsusage fsync ftello ftoastr ftruncate fts full-read full-write getgroups gethrxtime getline getloadavg getlogin getndelim2 getopt-gnu getpagesize getpass-gnu gettext-h gettime gettimeofday getugroups getusershell git-version-gen gitlog-to-changelog gnu-make gnu-web-doc-update gnumakefile gnupload group-member hard-locale hash hash-pjw heap host-os human idcache ignore-value inttostr inttypes isapipe isatty isblank largefile lchmod lchown ldtoastr lib-ignore linebuffer link link-follow linkat linked-list long-options lstat maintainer-makefile malloc-gnu manywarnings mbrlen mbrtowc mbsalign mbswidth memcasecmp memchr memcmp2 mempcpy memrchr mgetgroups mkancesdirs mkdir mkdir-p mkfifo mknod mkstemp mktime modechange mountlist mpsort netinet_in non-recursive-gnulib-prefix-hack nproc obstack parse-datetime pathmax perl physmem pipe-posix posix-shell posixtm posixver priv-set progname propername pthread putenv quote quotearg randint randperm read-file readlink readtokens readtokens0 readutmp realloc-gnu regex remove rename rmdir root-dev-ino rpmatch safe-read same save-cwd savedir savewd selinux-at setenv settime sig2str sigaction smack ssize_t stat-macros stat-size stat-time statat stdbool stdlib-safer stpcpy stpncpy strdup-posix strftime strncat strnumcmp strpbrk strsignal strtod strtoimax strtoumax symlink sys_ioctl sys_resource sys_stat sys_wait tempname termios timer-time timespec tzset uname unicodeio unistd-safer unlink-busy unlinkat unlocked-io unsetenv update-copyright uptime useless-if-before-free userspec utimecmp utimens vasprintf-posix vc-list-files verify verror version-etc-fsf wcswidth wcwidth winsz-ioctl winsz-termios write-any-file xalloc xdectoint xfreopen xfts xgetcwd xgetgroups xgethostname xlist xmemcoll xnanosleep xprintf xprintf-posix xreadlink xstrtod xstrtoimax xstrtol xstrtold xstrtoumax yesno
MOSTLYCLEANFILES += lib/core lib/*.stackdump
@@ -48,6 +48,16 @@ lib_libcoreutils_a_SOURCES += lib/copy-acl.c lib/set-acl.c
## end gnulib module acl
+## begin gnulib module acl-permissions
+
+lib_libcoreutils_a_SOURCES += lib/acl-errno-valid.c lib/acl-internal.c lib/get-permissions.c lib/set-permissions.c
+
+EXTRA_DIST += lib/acl-internal.h lib/acl.h lib/acl_entries.c
+
+EXTRA_lib_libcoreutils_a_SOURCES += lib/acl_entries.c
+
+## end gnulib module acl-permissions
+
## begin gnulib module alignof
@@ -180,6 +190,13 @@ EXTRA_DIST += lib/arpa_inet.in.h
## end gnulib module arpa_inet
+## begin gnulib module assure
+
+
+EXTRA_DIST += lib/assure.h
+
+## end gnulib module assure
+
## begin gnulib module at-internal
@@ -870,6 +887,12 @@ EXTRA_lib_libcoreutils_a_SOURCES += lib/fflush.c
## end gnulib module fflush
+## begin gnulib module file-has-acl
+
+lib_libcoreutils_a_SOURCES += lib/file-has-acl.c
+
+## end gnulib module file-has-acl
+
## begin gnulib module file-set
lib_libcoreutils_a_SOURCES += lib/file-set.c
@@ -1664,12 +1687,7 @@ EXTRA_DIST += lib/intprops.h
## begin gnulib module inttostr
-lib_libcoreutils_a_SOURCES += \
- lib/imaxtostr.c \
- lib/inttostr.c \
- lib/offtostr.c \
- lib/uinttostr.c \
- lib/umaxtostr.c
+lib_libcoreutils_a_SOURCES += lib/imaxtostr.c lib/inttostr.c lib/offtostr.c lib/uinttostr.c lib/umaxtostr.c
EXTRA_DIST += lib/anytostr.c lib/inttostr.h
@@ -1861,6 +1879,18 @@ EXTRA_lib_libcoreutils_a_SOURCES += lib/at-func2.c lib/linkat.c
## end gnulib module linkat
+## begin gnulib module linked-list
+
+lib_libcoreutils_a_SOURCES += lib/gl_linked_list.h lib/gl_linked_list.c lib/gl_anylinked_list1.h lib/gl_anylinked_list2.h
+
+## end gnulib module linked-list
+
+## begin gnulib module list
+
+lib_libcoreutils_a_SOURCES += lib/gl_list.h lib/gl_list.c
+
+## end gnulib module list
+
## begin gnulib module localcharset
lib_libcoreutils_a_SOURCES += lib/localcharset.h lib/localcharset.c
@@ -2908,15 +2938,17 @@ EXTRA_lib_libcoreutils_a_SOURCES += lib/putenv.c
## end gnulib module putenv
-## begin gnulib module qacl
+## begin gnulib module qcopy-acl
-lib_libcoreutils_a_SOURCES += lib/acl-errno-valid.c lib/file-has-acl.c lib/qcopy-acl.c lib/qset-acl.c
+lib_libcoreutils_a_SOURCES += lib/qcopy-acl.c
-EXTRA_DIST += lib/acl-internal.h lib/acl.h lib/acl_entries.c
+## end gnulib module qcopy-acl
-EXTRA_lib_libcoreutils_a_SOURCES += lib/acl_entries.c
+## begin gnulib module qset-acl
-## end gnulib module qacl
+lib_libcoreutils_a_SOURCES += lib/qset-acl.c
+
+## end gnulib module qset-acl
## begin gnulib module quote
@@ -3624,6 +3656,7 @@ lib/stddef.h: lib/stddef.in.h $(top_builddir)/config.status
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
+ -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \
-e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
-e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
< $(top_srcdir)/lib/stddef.in.h; \
@@ -3850,6 +3883,7 @@ lib/stdlib.h: lib/stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \
-e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \
-e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \
+ -e 's/@''GNULIB_QSORT_R''@/$(GNULIB_QSORT_R)/g' \
-e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \
-e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \
-e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
@@ -3901,6 +3935,7 @@ lib/stdlib.h: lib/stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \
-e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
-e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
+ -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \
-e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
-e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
-e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
@@ -4650,6 +4685,7 @@ lib/time.h: lib/time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \
-e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
-e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+ -e 's|@''UNISTD_H_DEFINES_STRUCT_TIMESPEC''@|$(UNISTD_H_DEFINES_STRUCT_TIMESPEC)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
@@ -4847,9 +4883,11 @@ lib/unistd.h: lib/unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_N
-e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \
-e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \
-e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \
+ -e 's|@''REPLACE_READLINKAT''@|$(REPLACE_READLINKAT)|g' \
-e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \
-e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \
-e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \
+ -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \
-e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \
-e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \
-e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \
@@ -5325,6 +5363,16 @@ EXTRA_DIST += lib/xalloc-oversized.h
## end gnulib module xalloc-oversized
+## begin gnulib module xdectoint
+
+lib_libcoreutils_a_SOURCES += lib/xdectoimax.c lib/xdectoumax.c
+
+EXTRA_DIST += lib/xdectoint.c lib/xdectoint.h
+
+EXTRA_lib_libcoreutils_a_SOURCES += lib/xdectoint.c
+
+## end gnulib module xdectoint
+
## begin gnulib module xfreopen
lib_libcoreutils_a_SOURCES += lib/xfreopen.c lib/xfreopen.h
@@ -5357,6 +5405,12 @@ lib_libcoreutils_a_SOURCES += lib/xgethostname.h lib/xgethostname.c
## end gnulib module xgethostname
+## begin gnulib module xlist
+
+lib_libcoreutils_a_SOURCES += lib/gl_xlist.h lib/gl_xlist.c
+
+## end gnulib module xlist
+
## begin gnulib module xmemcoll
lib_libcoreutils_a_SOURCES += lib/xmemcoll.h lib/xmemcoll.c
diff --git a/lib/group-member.c b/lib/group-member.c
index e869dca9..23074e4f 100644
--- a/lib/group-member.c
+++ b/lib/group-member.c
@@ -1,6 +1,6 @@
/* group-member.c -- determine whether group id is in calling user's group list
- Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2014 Free Software
+ Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/hard-locale.c b/lib/hard-locale.c
index 93c53866..b1802d0d 100644
--- a/lib/hard-locale.c
+++ b/lib/hard-locale.c
@@ -1,6 +1,6 @@
/* hard-locale.c -- Determine whether a locale is hard.
- Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2014 Free Software
+ Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/hard-locale.h b/lib/hard-locale.h
index ee9dd43a..c45eeca9 100644
--- a/lib/hard-locale.h
+++ b/lib/hard-locale.h
@@ -1,6 +1,6 @@
/* Determine whether a locale is hard.
- Copyright (C) 1999, 2003-2004, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003-2004, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/hash-pjw.c b/lib/hash-pjw.c
index 18f9f01b..b2e02512 100644
--- a/lib/hash-pjw.c
+++ b/lib/hash-pjw.c
@@ -1,6 +1,6 @@
/* hash-pjw.c -- compute a hash value from a NUL-terminated string.
- Copyright (C) 2001, 2003, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/hash-pjw.h b/lib/hash-pjw.h
index e6456134..f4b005c1 100644
--- a/lib/hash-pjw.h
+++ b/lib/hash-pjw.h
@@ -1,5 +1,5 @@
/* hash-pjw.h -- declaration for a simple hash function
- Copyright (C) 2001, 2003, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/hash-triple.c b/lib/hash-triple.c
index d305fbf5..c3b6d9f5 100644
--- a/lib/hash-triple.c
+++ b/lib/hash-triple.c
@@ -1,5 +1,5 @@
/* Hash functions for file-related triples: name, device, inode.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/hash.c b/lib/hash.c
index d312a264..4f27d5c8 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -1,6 +1,6 @@
/* hash - hashing table processing.
- Copyright (C) 1998-2004, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2004, 2006-2007, 2009-2015 Free Software Foundation, Inc.
Written by Jim Meyering, 1992.
@@ -1116,14 +1116,6 @@ hash_insert_if_absent (Hash_table *table, void const *entry,
return 1;
}
-/* hash_insert0 is the deprecated name for hash_insert_if_absent.
- . */
-int
-hash_insert0 (Hash_table *table, void const *entry, void const **matched_ent)
-{
- return hash_insert_if_absent (table, entry, matched_ent);
-}
-
/* If ENTRY matches an entry already in the hash table, return the pointer
to the entry from the table. Otherwise, insert ENTRY and return ENTRY.
Return NULL if the storage required for insertion cannot be allocated.
diff --git a/lib/hash.h b/lib/hash.h
index 9994f5f6..1e90c31a 100644
--- a/lib/hash.h
+++ b/lib/hash.h
@@ -1,5 +1,5 @@
/* hash - hashing table processing.
- Copyright (C) 1998-1999, 2001, 2003, 2009-2014 Free Software Foundation,
+ Copyright (C) 1998-1999, 2001, 2003, 2009-2015 Free Software Foundation,
Inc.
Written by Jim Meyering <meyering@ascend.com>, 1998.
@@ -96,10 +96,6 @@ void hash_free (Hash_table *);
bool hash_rehash (Hash_table *, size_t) _GL_ATTRIBUTE_WUR;
void *hash_insert (Hash_table *, const void *) _GL_ATTRIBUTE_WUR;
-/* Deprecate this interface. It has been renamed to hash_insert_if_absent. */
-int hash_insert0 (Hash_table *table, /* FIXME: remove in 2013 */
- const void *entry,
- const void **matched_ent) _GL_ATTRIBUTE_DEPRECATED;
int hash_insert_if_absent (Hash_table *table, const void *entry,
const void **matched_ent);
void *hash_delete (Hash_table *, const void *);
diff --git a/lib/heap.c b/lib/heap.c
index 75bd071a..cee179f8 100644
--- a/lib/heap.c
+++ b/lib/heap.c
@@ -1,6 +1,6 @@
/* Barebones heap implementation supporting only insert and pop.
- Copyright (C) 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2010-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/heap.h b/lib/heap.h
index 02dc2ac6..4752421c 100644
--- a/lib/heap.h
+++ b/lib/heap.h
@@ -1,6 +1,6 @@
/* Barebones heap implementation supporting only insert and pop.
- Copyright (C) 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2010-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/human.c b/lib/human.c
index ab6b30d2..7863f9c7 100644
--- a/lib/human.c
+++ b/lib/human.c
@@ -1,6 +1,6 @@
/* human.c -- print human readable file size
- Copyright (C) 1996-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/human.h b/lib/human.h
index 2cb1c9e7..464787f0 100644
--- a/lib/human.h
+++ b/lib/human.h
@@ -1,6 +1,6 @@
/* human.h -- print human readable file size
- Copyright (C) 1996-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/i-ring.c b/lib/i-ring.c
index 4173a03f..9a8a0afb 100644
--- a/lib/i-ring.c
+++ b/lib/i-ring.c
@@ -1,5 +1,5 @@
/* a simple ring buffer
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/i-ring.h b/lib/i-ring.h
index 7d993fa4..f1832574 100644
--- a/lib/i-ring.h
+++ b/lib/i-ring.h
@@ -1,5 +1,5 @@
/* definitions for a simple ring buffer
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/iconv.c b/lib/iconv.c
index b5a427be..28c13c59 100644
--- a/lib/iconv.c
+++ b/lib/iconv.c
@@ -1,5 +1,5 @@
/* Character set conversion.
- Copyright (C) 1999-2001, 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2001, 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/iconv.in.h b/lib/iconv.in.h
index d0e98360..94ab8065 100644
--- a/lib/iconv.in.h
+++ b/lib/iconv.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <iconv.h>.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/iconv_close.c b/lib/iconv_close.c
index d66c1155..59e0aca6 100644
--- a/lib/iconv_close.c
+++ b/lib/iconv_close.c
@@ -1,5 +1,5 @@
/* Character set conversion.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/iconv_open.c b/lib/iconv_open.c
index 37ce9ce2..09d042d1 100644
--- a/lib/iconv_open.c
+++ b/lib/iconv_open.c
@@ -1,5 +1,5 @@
/* Character set conversion.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/idcache.c b/lib/idcache.c
index 8c921bfe..378fe2d9 100644
--- a/lib/idcache.c
+++ b/lib/idcache.c
@@ -1,6 +1,6 @@
/* idcache.c -- map user and group IDs, cached for speed
- Copyright (C) 1985, 1988-1990, 1997-1998, 2003, 2005-2007, 2009-2014 Free
+ Copyright (C) 1985, 1988-1990, 1997-1998, 2003, 2005-2007, 2009-2015 Free
Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/ignore-value.h b/lib/ignore-value.h
index 4dd0946d..68521edb 100644
--- a/lib/ignore-value.h
+++ b/lib/ignore-value.h
@@ -1,6 +1,6 @@
/* ignore a function return without a compiler warning
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c
index c0258687..79bbf139 100644
--- a/lib/inet_ntop.c
+++ b/lib/inet_ntop.c
@@ -1,6 +1,6 @@
/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
- Copyright (C) 2005-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/ino-map.c b/lib/ino-map.c
index 2171279f..16c1a415 100644
--- a/lib/ino-map.c
+++ b/lib/ino-map.c
@@ -1,6 +1,6 @@
/* Map an ino_t inode number to a small integer.
- Copyright 2009-2014 Free Software Foundation, Inc.
+ Copyright 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/intprops.h b/lib/intprops.h
index d0bb7a6f..f85ccade 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -1,6 +1,6 @@
/* intprops.h -- properties of integer types
- Copyright (C) 2001-2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2005, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/inttostr.h b/lib/inttostr.h
index ff58c2b6..77818dd5 100644
--- a/lib/inttostr.h
+++ b/lib/inttostr.h
@@ -1,6 +1,6 @@
/* inttostr.h -- convert integers to printable strings
- Copyright (C) 2001-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h
index 4b2a13be..78846f69 100644
--- a/lib/inttypes.in.h
+++ b/lib/inttypes.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2006-2015 Free Software Foundation, Inc.
Written by Paul Eggert, Bruno Haible, Derek Price.
This file is part of gnulib.
@@ -51,6 +51,10 @@
#endif
/* Get CHAR_BIT. */
#include <limits.h>
+/* On mingw, __USE_MINGW_ANSI_STDIO only works if <stdio.h> is also included */
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# include <stdio.h>
+#endif
#if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX)
# error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
diff --git a/lib/isapipe.c b/lib/isapipe.c
index b59e2359..fe7c2f7d 100644
--- a/lib/isapipe.c
+++ b/lib/isapipe.c
@@ -1,6 +1,6 @@
/* Test whether a file descriptor is a pipe.
- Copyright (C) 2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/isatty.c b/lib/isatty.c
index 7180eadd..f7b552bf 100644
--- a/lib/isatty.c
+++ b/lib/isatty.c
@@ -1,5 +1,5 @@
/* isatty() replacement.
- Copyright (C) 2012-2014 Free Software Foundation, Inc.
+ Copyright (C) 2012-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/isblank.c b/lib/isblank.c
index 4e0aed1d..ac871ef1 100644
--- a/lib/isblank.c
+++ b/lib/isblank.c
@@ -1,6 +1,6 @@
/* Test whether a character is a blank.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/isnan.c b/lib/isnan.c
index 878c1804..5eb11d9a 100644
--- a/lib/isnan.c
+++ b/lib/isnan.c
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/isnand-nolibm.h b/lib/isnand-nolibm.h
index cee7eec0..ca3a87af 100644
--- a/lib/isnand-nolibm.h
+++ b/lib/isnand-nolibm.h
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/isnand.c b/lib/isnand.c
index 318c3595..3fd803b9 100644
--- a/lib/isnand.c
+++ b/lib/isnand.c
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/isnanf-nolibm.h b/lib/isnanf-nolibm.h
index 41c2ef30..1e8d75a4 100644
--- a/lib/isnanf-nolibm.h
+++ b/lib/isnanf-nolibm.h
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/isnanf.c b/lib/isnanf.c
index 583a607e..7fc5da2b 100644
--- a/lib/isnanf.c
+++ b/lib/isnanf.c
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/isnanl-nolibm.h b/lib/isnanl-nolibm.h
index 371de004..22d536d5 100644
--- a/lib/isnanl-nolibm.h
+++ b/lib/isnanl-nolibm.h
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/isnanl.c b/lib/isnanl.c
index 4575e4c3..8f05eb73 100644
--- a/lib/isnanl.c
+++ b/lib/isnanl.c
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/iswblank.c b/lib/iswblank.c
index 9c1672fb..94be1159 100644
--- a/lib/iswblank.c
+++ b/lib/iswblank.c
@@ -1,5 +1,5 @@
/* Test wide character for being blank.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/itold.c b/lib/itold.c
index 937f4805..1eee03e3 100644
--- a/lib/itold.c
+++ b/lib/itold.c
@@ -1,5 +1,5 @@
/* Replacement for 'int' to 'long double' conversion routine.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/langinfo.in.h b/lib/langinfo.in.h
index 338ffb6a..04fd5354 100644
--- a/lib/langinfo.in.h
+++ b/lib/langinfo.in.h
@@ -1,5 +1,5 @@
/* Substitute for and wrapper around <langinfo.h>.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/lchown.c b/lib/lchown.c
index 647b0a8a..7f5f6026 100644
--- a/lib/lchown.c
+++ b/lib/lchown.c
@@ -1,6 +1,6 @@
/* Provide a stub lchown function for systems that lack it.
- Copyright (C) 1998-1999, 2002, 2004, 2006-2007, 2009-2014 Free Software
+ Copyright (C) 1998-1999, 2002, 2004, 2006-2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/linebuffer.c b/lib/linebuffer.c
index d1582fe3..5452e81d 100644
--- a/lib/linebuffer.c
+++ b/lib/linebuffer.c
@@ -1,6 +1,6 @@
/* linebuffer.c -- read arbitrarily long lines
- Copyright (C) 1986, 1991, 1998-1999, 2001, 2003-2004, 2006-2007, 2009-2014
+ Copyright (C) 1986, 1991, 1998-1999, 2001, 2003-2004, 2006-2007, 2009-2015
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/linebuffer.h b/lib/linebuffer.h
index 740d5c41..dc57b14a 100644
--- a/lib/linebuffer.h
+++ b/lib/linebuffer.h
@@ -1,6 +1,6 @@
/* linebuffer.h -- declarations for reading arbitrarily long lines
- Copyright (C) 1986, 1991, 1998-1999, 2002-2003, 2007, 2009-2014 Free
+ Copyright (C) 1986, 1991, 1998-1999, 2002-2003, 2007, 2009-2015 Free
Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/link.c b/lib/link.c
index 80f4f097..4151ea32 100644
--- a/lib/link.c
+++ b/lib/link.c
@@ -1,6 +1,6 @@
/* Emulate link on platforms that lack it, namely native Windows platforms.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/linkat.c b/lib/linkat.c
index 6ee30fb4..4bdbae67 100644
--- a/lib/linkat.c
+++ b/lib/linkat.c
@@ -1,5 +1,5 @@
/* Create a hard link relative to open directories.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@
# endif
#endif
-#if !HAVE_LINKAT
+#if !HAVE_LINKAT || LINKAT_SYMLINK_NOTSUP
/* Create a link. If FILE1 is a symlink, either create a hardlink to
that symlink, or fake it by creating an identical symlink. */
@@ -195,6 +195,10 @@ solaris_optimized_link_follow (char const *file1, char const *file2)
# endif
+#endif /* !HAVE_LINKAT || LINKAT_SYMLINK_NOTSUP */
+
+#if !HAVE_LINKAT
+
/* Create a link to FILE1, in the directory open on descriptor FD1, to FILE2,
in the directory open on descriptor FD2. If FILE1 is a symlink, FLAG
controls whether to dereference FILE1 first. If possible, do it without
@@ -321,7 +325,17 @@ rpl_linkat (int fd1, char const *file1, int fd2, char const *file2, int flag)
# endif
if (!flag)
- return linkat (fd1, file1, fd2, file2, flag);
+ {
+ int result = linkat (fd1, file1, fd2, file2, flag);
+# if LINKAT_SYMLINK_NOTSUP
+ /* OS X 10.10 has linkat() but it doesn't support
+ hardlinks to symlinks. Fallback to our emulation
+ in that case. */
+ if (result == -1 && (errno == ENOTSUP || errno == EOPNOTSUPP))
+ return at_func2 (fd1, file1, fd2, file2, link_immediate);
+# endif
+ return result;
+ }
/* Cache the information on whether the system call really works. */
{
diff --git a/lib/localcharset.c b/lib/localcharset.c
index a9288673..1f02aa59 100644
--- a/lib/localcharset.c
+++ b/lib/localcharset.c
@@ -1,6 +1,6 @@
/* Determine a canonical name for the current locale's character encoding.
- Copyright (C) 2000-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2006, 2008-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,6 +34,7 @@
#if defined _WIN32 || defined __WIN32__
# define WINDOWS_NATIVE
+# include <locale.h>
#endif
#if defined __EMX__
@@ -127,7 +128,7 @@ get_charset_aliases (void)
cp = charset_aliases;
if (cp == NULL)
{
-#if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__)
+#if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__ || defined OS2)
const char *dir;
const char *base = "charset.alias";
char *file_name;
@@ -341,6 +342,36 @@ get_charset_aliases (void)
"CP54936" "\0" "GB18030" "\0"
"CP65001" "\0" "UTF-8" "\0";
# endif
+# if defined OS2
+ /* To avoid the troubles of installing a separate file in the same
+ directory as the DLL and of retrieving the DLL's directory at
+ runtime, simply inline the aliases here. */
+
+ /* The list of encodings is taken from "List of OS/2 Codepages"
+ by Alex Taylor:
+ <http://altsan.org/os2/toolkits/uls/index.html#codepages>.
+ See also "IBM Globalization - Code page identifiers":
+ <http://www-01.ibm.com/software/globalization/cp/cp_cpgid.html>. */
+ cp = "CP813" "\0" "ISO-8859-7" "\0"
+ "CP878" "\0" "KOI8-R" "\0"
+ "CP819" "\0" "ISO-8859-1" "\0"
+ "CP912" "\0" "ISO-8859-2" "\0"
+ "CP913" "\0" "ISO-8859-3" "\0"
+ "CP914" "\0" "ISO-8859-4" "\0"
+ "CP915" "\0" "ISO-8859-5" "\0"
+ "CP916" "\0" "ISO-8859-8" "\0"
+ "CP920" "\0" "ISO-8859-9" "\0"
+ "CP921" "\0" "ISO-8859-13" "\0"
+ "CP923" "\0" "ISO-8859-15" "\0"
+ "CP954" "\0" "EUC-JP" "\0"
+ "CP964" "\0" "EUC-TW" "\0"
+ "CP970" "\0" "EUC-KR" "\0"
+ "CP1089" "\0" "ISO-8859-6" "\0"
+ "CP1208" "\0" "UTF-8" "\0"
+ "CP1381" "\0" "GB2312" "\0"
+ "CP1386" "\0" "GBK" "\0"
+ "CP3372" "\0" "EUC-JP" "\0";
+# endif
#endif
charset_aliases = cp;
@@ -461,14 +492,34 @@ locale_charset (void)
static char buf[2 + 10 + 1];
- /* The Windows API has a function returning the locale's codepage as a
- number: GetACP().
- When the output goes to a console window, it needs to be provided in
- GetOEMCP() encoding if the console is using a raster font, or in
- GetConsoleOutputCP() encoding if it is using a TrueType font.
- But in GUI programs and for output sent to files and pipes, GetACP()
- encoding is the best bet. */
- sprintf (buf, "CP%u", GetACP ());
+ /* The Windows API has a function returning the locale's codepage as
+ a number, but the value doesn't change according to what the
+ 'setlocale' call specified. So we use it as a last resort, in
+ case the string returned by 'setlocale' doesn't specify the
+ codepage. */
+ char *current_locale = setlocale (LC_ALL, NULL);
+ char *pdot;
+
+ /* If they set different locales for different categories,
+ 'setlocale' will return a semi-colon separated list of locale
+ values. To make sure we use the correct one, we choose LC_CTYPE. */
+ if (strchr (current_locale, ';'))
+ current_locale = setlocale (LC_CTYPE, NULL);
+
+ pdot = strrchr (current_locale, '.');
+ if (pdot)
+ sprintf (buf, "CP%s", pdot + 1);
+ else
+ {
+ /* The Windows API has a function returning the locale's codepage as a
+ number: GetACP().
+ When the output goes to a console window, it needs to be provided in
+ GetOEMCP() encoding if the console is using a raster font, or in
+ GetConsoleOutputCP() encoding if it is using a TrueType font.
+ But in GUI programs and for output sent to files and pipes, GetACP()
+ encoding is the best bet. */
+ sprintf (buf, "CP%u", GetACP ());
+ }
codeset = buf;
#elif defined OS2
@@ -478,6 +529,8 @@ locale_charset (void)
ULONG cp[3];
ULONG cplen;
+ codeset = NULL;
+
/* Allow user to override the codeset, as set in the operating system,
with standard language environment variables. */
locale = getenv ("LC_ALL");
@@ -509,10 +562,12 @@ locale_charset (void)
}
}
- /* Resolve through the charset.alias file. */
- codeset = locale;
+ /* For the POSIX locale, don't use the system's codepage. */
+ if (strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0)
+ codeset = "";
}
- else
+
+ if (codeset == NULL)
{
/* OS/2 has a function returning the locale's codepage as a number. */
if (DosQueryCp (sizeof (cp), cp, &cplen))
diff --git a/lib/localcharset.h b/lib/localcharset.h
index 9011d580..c5e6d463 100644
--- a/lib/localcharset.h
+++ b/lib/localcharset.h
@@ -1,5 +1,5 @@
/* Determine a canonical name for the current locale's character encoding.
- Copyright (C) 2000-2003, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2003, 2009-2015 Free Software Foundation, Inc.
This file is part of the GNU CHARSET Library.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/locale.in.h b/lib/locale.in.h
index 10cc44b1..05e974df 100644
--- a/lib/locale.in.h
+++ b/lib/locale.in.h
@@ -1,5 +1,5 @@
/* A POSIX <locale.h>.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/localeconv.c b/lib/localeconv.c
index 014e739c..8f2d0840 100644
--- a/lib/localeconv.c
+++ b/lib/localeconv.c
@@ -1,5 +1,5 @@
/* Query locale dependent information for formatting numbers.
- Copyright (C) 2012-2014 Free Software Foundation, Inc.
+ Copyright (C) 2012-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/long-options.c b/lib/long-options.c
index fa7d1cd7..d1e98f20 100644
--- a/lib/long-options.c
+++ b/lib/long-options.c
@@ -1,6 +1,6 @@
/* Utility to accept --help and --version options as unobtrusively as possible.
- Copyright (C) 1993-1994, 1998-2000, 2002-2006, 2009-2014 Free Software
+ Copyright (C) 1993-1994, 1998-2000, 2002-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/long-options.h b/lib/long-options.h
index a44ae2e8..78f00ae9 100644
--- a/lib/long-options.h
+++ b/lib/long-options.h
@@ -1,5 +1,5 @@
/* long-options.h -- declaration for --help- and --version-handling function.
- Copyright (C) 1993-1994, 1998-1999, 2003, 2009-2014 Free Software
+ Copyright (C) 1993-1994, 1998-1999, 2003, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/lseek.c b/lib/lseek.c
index f19b41b1..fdec6cdf 100644
--- a/lib/lseek.c
+++ b/lib/lseek.c
@@ -1,5 +1,5 @@
/* An lseek() function that detects pipes.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/lstat.c b/lib/lstat.c
index f70fd435..31dee138 100644
--- a/lib/lstat.c
+++ b/lib/lstat.c
@@ -1,6 +1,6 @@
/* Work around a bug of lstat on some systems
- Copyright (C) 1997-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/malloc.c b/lib/malloc.c
index bc81c54d..00800a28 100644
--- a/lib/malloc.c
+++ b/lib/malloc.c
@@ -1,6 +1,6 @@
/* malloc() function that is glibc compatible.
- Copyright (C) 1997-1998, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-1998, 2006-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/malloca.c b/lib/malloca.c
index 370551c5..198a96ce 100644
--- a/lib/malloca.c
+++ b/lib/malloca.c
@@ -1,5 +1,5 @@
/* Safe automatic memory allocation.
- Copyright (C) 2003, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2007, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/malloca.h b/lib/malloca.h
index 5071e46f..7a4190cf 100644
--- a/lib/malloca.h
+++ b/lib/malloca.h
@@ -1,5 +1,5 @@
/* Safe automatic memory allocation.
- Copyright (C) 2003-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2007, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/math.in.h b/lib/math.in.h
index 9d73c5e5..62a089ab 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <math.h>.
- Copyright (C) 2002-2003, 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/mbchar.c b/lib/mbchar.c
index 7d5bfcc1..ae9b7eb9 100644
--- a/lib/mbchar.c
+++ b/lib/mbchar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2006, 2009-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/mbchar.h b/lib/mbchar.h
index 700174c5..fcdefaf0 100644
--- a/lib/mbchar.h
+++ b/lib/mbchar.h
@@ -1,5 +1,5 @@
/* Multibyte character data type.
- Copyright (C) 2001, 2005-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/mbiter.h b/lib/mbiter.h
index 32fff8cf..ccc1d195 100644
--- a/lib/mbiter.h
+++ b/lib/mbiter.h
@@ -1,5 +1,5 @@
/* Iterating through multibyte strings: macros for multi-byte encodings.
- Copyright (C) 2001, 2005, 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005, 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/mbrlen.c b/lib/mbrlen.c
index 5f180ba2..b6334f29 100644
--- a/lib/mbrlen.c
+++ b/lib/mbrlen.c
@@ -1,5 +1,5 @@
/* Recognize multibyte character.
- Copyright (C) 1999-2000, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2008-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c
index 5743f437..e49d55b3 100644
--- a/lib/mbrtowc.c
+++ b/lib/mbrtowc.c
@@ -1,5 +1,5 @@
/* Convert multibyte character to wide character.
- Copyright (C) 1999-2002, 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2002, 2005-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbsalign.c b/lib/mbsalign.c
index fe0e6408..69bd524e 100644
--- a/lib/mbsalign.c
+++ b/lib/mbsalign.c
@@ -1,5 +1,5 @@
/* Align/Truncate a string in a given screen width
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/mbsalign.h b/lib/mbsalign.h
index b3aa0fbf..a8597090 100644
--- a/lib/mbsalign.h
+++ b/lib/mbsalign.h
@@ -1,5 +1,5 @@
/* Align/Truncate a string in a given screen width
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/mbscasecmp.c b/lib/mbscasecmp.c
index d52448fe..9288fb29 100644
--- a/lib/mbscasecmp.c
+++ b/lib/mbscasecmp.c
@@ -1,5 +1,5 @@
/* Case-insensitive string comparison function.
- Copyright (C) 1998-1999, 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-1999, 2005-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2005,
based on earlier glibc code.
diff --git a/lib/mbsinit.c b/lib/mbsinit.c
index df4bcd18..4effdd80 100644
--- a/lib/mbsinit.c
+++ b/lib/mbsinit.c
@@ -1,5 +1,5 @@
/* Test for initial conversion state.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbslen.c b/lib/mbslen.c
index 74c6ec12..011f821d 100644
--- a/lib/mbslen.c
+++ b/lib/mbslen.c
@@ -1,5 +1,5 @@
/* Counting the multibyte characters in a string.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbsrtowcs-impl.h b/lib/mbsrtowcs-impl.h
index d42af012..a0f42717 100644
--- a/lib/mbsrtowcs-impl.h
+++ b/lib/mbsrtowcs-impl.h
@@ -1,5 +1,5 @@
/* Convert string to wide string.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbsrtowcs-state.c b/lib/mbsrtowcs-state.c
index 2a7019aa..522eb690 100644
--- a/lib/mbsrtowcs-state.c
+++ b/lib/mbsrtowcs-state.c
@@ -1,5 +1,5 @@
/* Convert string to wide string.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbsrtowcs.c b/lib/mbsrtowcs.c
index 136ec343..c37eba72 100644
--- a/lib/mbsrtowcs.c
+++ b/lib/mbsrtowcs.c
@@ -1,5 +1,5 @@
/* Convert string to wide string.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbsstr.c b/lib/mbsstr.c
index 1ae9fe42..a38f3013 100644
--- a/lib/mbsstr.c
+++ b/lib/mbsstr.c
@@ -1,5 +1,5 @@
/* Searching in a string.
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2005.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbswidth.c b/lib/mbswidth.c
index d39067a4..75ca79a8 100644
--- a/lib/mbswidth.c
+++ b/lib/mbswidth.c
@@ -1,5 +1,5 @@
/* Determine the number of screen columns needed for a string.
- Copyright (C) 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/mbswidth.h b/lib/mbswidth.h
index ab7c1503..f5b0fc3e 100644
--- a/lib/mbswidth.h
+++ b/lib/mbswidth.h
@@ -1,5 +1,5 @@
/* Determine the number of screen columns needed for a string.
- Copyright (C) 2000-2004, 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2004, 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/mbtowc-impl.h b/lib/mbtowc-impl.h
index 3cc70b0e..5c60478a 100644
--- a/lib/mbtowc-impl.h
+++ b/lib/mbtowc-impl.h
@@ -1,5 +1,5 @@
/* Convert multibyte character to wide character.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbtowc.c b/lib/mbtowc.c
index 93a74454..e58053d1 100644
--- a/lib/mbtowc.c
+++ b/lib/mbtowc.c
@@ -1,5 +1,5 @@
/* Convert multibyte character to wide character.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbuiter.h b/lib/mbuiter.h
index 1702f14c..acdec297 100644
--- a/lib/mbuiter.h
+++ b/lib/mbuiter.h
@@ -1,5 +1,5 @@
/* Iterating through multibyte strings: macros for multi-byte encodings.
- Copyright (C) 2001, 2005, 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005, 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/md5.c b/lib/md5.c
index ece24ac9..30525dc8 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -1,6 +1,6 @@
/* Functions to compute MD5 message digest of files or memory blocks.
according to the definition of MD5 in RFC 1321 from April 1992.
- Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2014 Free Software
+ Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2015 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/md5.h b/lib/md5.h
index 1d6974ae..43add999 100644
--- a/lib/md5.h
+++ b/lib/md5.h
@@ -1,6 +1,6 @@
/* Declaration of functions and data types used for MD5 sum computing
library functions.
- Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2014 Free Software
+ Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2015 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/memcasecmp.c b/lib/memcasecmp.c
index c24039a4..fab7f697 100644
--- a/lib/memcasecmp.c
+++ b/lib/memcasecmp.c
@@ -1,5 +1,5 @@
/* Case-insensitive buffer comparator.
- Copyright (C) 1996-1997, 2000, 2003, 2006, 2009-2014 Free Software
+ Copyright (C) 1996-1997, 2000, 2003, 2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/memcasecmp.h b/lib/memcasecmp.h
index 8b53c302..7e440e93 100644
--- a/lib/memcasecmp.h
+++ b/lib/memcasecmp.h
@@ -1,6 +1,6 @@
/* Case-insensitive buffer comparator.
- Copyright (C) 1996, 1998, 2003, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1998, 2003, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/memchr.c b/lib/memchr.c
index 6709f6ea..f74cc9af 100644
--- a/lib/memchr.c
+++ b/lib/memchr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2014
+/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2015
Free Software Foundation, Inc.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
diff --git a/lib/memchr2.c b/lib/memchr2.c
index 3d79f2a2..d7468d9d 100644
--- a/lib/memchr2.c
+++ b/lib/memchr2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2014
+/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2015
Free Software Foundation, Inc.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
diff --git a/lib/memchr2.h b/lib/memchr2.h
index 220c2b54..d49c6e8d 100644
--- a/lib/memchr2.h
+++ b/lib/memchr2.h
@@ -1,5 +1,5 @@
/* Scan memory for the first of two bytes.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/memcmp2.c b/lib/memcmp2.c
index a31ed5b5..91a8b3dd 100644
--- a/lib/memcmp2.c
+++ b/lib/memcmp2.c
@@ -1,5 +1,5 @@
/* Compare two memory areas with possibly different lengths.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
diff --git a/lib/memcmp2.h b/lib/memcmp2.h
index e346b389..3dd51382 100644
--- a/lib/memcmp2.h
+++ b/lib/memcmp2.h
@@ -1,5 +1,5 @@
/* Compare two memory areas with possibly different lengths.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
diff --git a/lib/memcoll.c b/lib/memcoll.c
index 51321048..0dfff3bd 100644
--- a/lib/memcoll.c
+++ b/lib/memcoll.c
@@ -1,6 +1,6 @@
/* Locale-specific memory comparison.
- Copyright (C) 1999, 2002-2004, 2006, 2009-2014 Free Software Foundation,
+ Copyright (C) 1999, 2002-2004, 2006, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/memcoll.h b/lib/memcoll.h
index 7f193b85..722479a7 100644
--- a/lib/memcoll.h
+++ b/lib/memcoll.h
@@ -1,6 +1,6 @@
/* Locale-specific memory comparison.
- Copyright (C) 1999, 2003, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/mempcpy.c b/lib/mempcpy.c
index ff83ee11..e9f2e34f 100644
--- a/lib/mempcpy.c
+++ b/lib/mempcpy.c
@@ -1,5 +1,5 @@
/* Copy memory area and return pointer after last written byte.
- Copyright (C) 2003, 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/memrchr.c b/lib/memrchr.c
index 742a0c9b..3827208d 100644
--- a/lib/memrchr.c
+++ b/lib/memrchr.c
@@ -1,6 +1,6 @@
/* memrchr -- find the last occurrence of a byte in a memory block
- Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2014 Free Software
+ Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2015 Free Software
Foundation, Inc.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
diff --git a/lib/mgetgroups.c b/lib/mgetgroups.c
index 9d302e74..6acb0191 100644
--- a/lib/mgetgroups.c
+++ b/lib/mgetgroups.c
@@ -1,6 +1,6 @@
/* mgetgroups.c -- return a list of the groups a user or current process is in
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -33,6 +33,12 @@
#include "getugroups.h"
#include "xalloc-oversized.h"
+/* Work around an incompatibility of OS X 10.11: getgrouplist
+ accepts int *, not gid_t *, and int and gid_t differ in sign. */
+#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+# pragma GCC diagnostic ignored "-Wpointer-sign"
+#endif
+
static gid_t *
realloc_groupbuf (gid_t *g, size_t num)
{
diff --git a/lib/mgetgroups.h b/lib/mgetgroups.h
index 8ccac074..51f2ea54 100644
--- a/lib/mgetgroups.h
+++ b/lib/mgetgroups.h
@@ -1,5 +1,5 @@
/* Get a list of all group IDs associated with a specified user ID.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/mkancesdirs.c b/lib/mkancesdirs.c
index 0638b194..91ed694a 100644
--- a/lib/mkancesdirs.c
+++ b/lib/mkancesdirs.c
@@ -1,6 +1,6 @@
/* Make a file's ancestor directories.
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/mkdir-p.c b/lib/mkdir-p.c
index 188fa3a4..e55b1ddf 100644
--- a/lib/mkdir-p.c
+++ b/lib/mkdir-p.c
@@ -1,6 +1,6 @@
/* mkdir-p.c -- Ensure that a directory and its parents exist.
- Copyright (C) 1990, 1997-2000, 2002-2007, 2009-2014 Free Software
+ Copyright (C) 1990, 1997-2000, 2002-2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mkdir-p.h b/lib/mkdir-p.h
index c6d37aa9..a85c5e9c 100644
--- a/lib/mkdir-p.h
+++ b/lib/mkdir-p.h
@@ -1,6 +1,6 @@
/* mkdir-p.h -- Ensure that a directory and its parents exist.
- Copyright (C) 1994-1997, 2000, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1994-1997, 2000, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mkdir.c b/lib/mkdir.c
index 481bbf37..37de12e3 100644
--- a/lib/mkdir.c
+++ b/lib/mkdir.c
@@ -1,7 +1,7 @@
/* On some systems, mkdir ("foo/", 0700) fails because of the trailing
slash. On those systems, this wrapper removes the trailing slash.
- Copyright (C) 2001, 2003, 2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/mkfifo.c b/lib/mkfifo.c
index a04b2252..ae4b9309 100644
--- a/lib/mkfifo.c
+++ b/lib/mkfifo.c
@@ -1,5 +1,5 @@
/* Create a named fifo.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/mknod.c b/lib/mknod.c
index c738e591..86a7c39d 100644
--- a/lib/mknod.c
+++ b/lib/mknod.c
@@ -1,5 +1,5 @@
/* Create a device inode.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/mkstemp-safer.c b/lib/mkstemp-safer.c
index 03a205f3..7d350403 100644
--- a/lib/mkstemp-safer.c
+++ b/lib/mkstemp-safer.c
@@ -1,6 +1,6 @@
/* Invoke mkstemp, but avoid some glitches.
- Copyright (C) 2005-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/mkstemp.c b/lib/mkstemp.c
index ce9c6db8..f9096a8f 100644
--- a/lib/mkstemp.c
+++ b/lib/mkstemp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2014 Free Software
+/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2015 Free Software
Foundation, Inc.
This file is derived from the one in the GNU C Library.
diff --git a/lib/mktime.c b/lib/mktime.c
index 48b3a40f..580bc8ed 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -1,5 +1,5 @@
/* Convert a 'struct tm' to a time_t value.
- Copyright (C) 1993-2014 Free Software Foundation, Inc.
+ Copyright (C) 1993-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Paul Eggert <eggert@twinsun.com>.
diff --git a/lib/modechange.c b/lib/modechange.c
index 412fe1d2..9f707546 100644
--- a/lib/modechange.c
+++ b/lib/modechange.c
@@ -1,6 +1,6 @@
/* modechange.c -- file mode manipulation
- Copyright (C) 1989-1990, 1997-1999, 2001, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1989-1990, 1997-1999, 2001, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/modechange.h b/lib/modechange.h
index e969ba97..db80ddf2 100644
--- a/lib/modechange.h
+++ b/lib/modechange.h
@@ -1,6 +1,6 @@
/* modechange.h -- definitions for file mode manipulation
- Copyright (C) 1989-1990, 1997, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1989-1990, 1997, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mountlist.c b/lib/mountlist.c
index b3be011a..6f04f555 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -1,6 +1,6 @@
/* mountlist.c -- return a list of mounted file systems
- Copyright (C) 1991-1992, 1997-2014 Free Software Foundation, Inc.
+ Copyright (C) 1991-1992, 1997-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -58,6 +58,7 @@
#ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
# include <mntent.h>
+# include <sys/types.h>
# if !defined MOUNTED
# if defined _PATH_MOUNTED /* GNU libc */
# define MOUNTED _PATH_MOUNTED
@@ -151,8 +152,12 @@
/* The results of opendir() in this file are not used with dirfd and fchdir,
therefore save some unnecessary work in fchdir.c. */
-#undef opendir
-#undef closedir
+#ifdef GNULIB_defined_opendir
+# undef opendir
+#endif
+#ifdef GNULIB_defined_closedir
+# undef closedir
+#endif
#define ME_DUMMY_0(Fs_name, Fs_type) \
(strcmp (Fs_type, "autofs") == 0 \
@@ -177,10 +182,9 @@
we grant an exception to any with "bind" in its list of mount options.
I.e., those are *not* dummy entries. */
#ifdef MOUNTED_GETMNTENT1
-# define ME_DUMMY(Fs_name, Fs_type, Fs_ent) \
+# define ME_DUMMY(Fs_name, Fs_type, Bind) \
(ME_DUMMY_0 (Fs_name, Fs_type) \
- || (strcmp (Fs_type, "none") == 0 \
- && !hasmntopt (Fs_ent, "bind")))
+ || (strcmp (Fs_type, "none") == 0 && !Bind))
#else
# define ME_DUMMY(Fs_name, Fs_type) \
(ME_DUMMY_0 (Fs_name, Fs_type) || strcmp (Fs_type, "none") == 0)
@@ -383,6 +387,34 @@ dev_from_mount_options (char const *mount_options)
#endif
+#if defined MOUNTED_GETMNTENT1 && defined __linux__
+
+/* Unescape the paths in mount tables.
+ STR is updated in place. */
+
+static void
+unescape_tab (char *str)
+{
+ size_t i, j = 0;
+ size_t len = strlen (str) + 1;
+ for (i = 0; i < len; i++)
+ {
+ if (str[i] == '\\' && (i + 4 < len)
+ && str[i + 1] >= '0' && str[i + 1] <= '3'
+ && str[i + 2] >= '0' && str[i + 2] <= '7'
+ && str[i + 3] >= '0' && str[i + 3] <= '7')
+ {
+ str[j++] = (str[i + 1] - '0') * 64 +
+ (str[i + 2] - '0') * 8 +
+ (str[i + 3] - '0');
+ i += 3;
+ }
+ else
+ str[j++] = str[i];
+ }
+}
+#endif
+
/* Return a list of the currently mounted file systems, or NULL on error.
Add each entry to the tail of the list so that they stay in order.
If NEED_FS_TYPE is true, ensure that the file system type fields in
@@ -429,32 +461,125 @@ read_file_system_list (bool need_fs_type)
#ifdef MOUNTED_GETMNTENT1 /* GNU/Linux, 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
{
- struct mntent *mnt;
- char const *table = MOUNTED;
FILE *fp;
- fp = setmntent (table, "r");
- if (fp == NULL)
- return NULL;
-
- while ((mnt = getmntent (fp)))
+#ifdef __linux__
+ /* Try parsing mountinfo first, as that make device IDs available.
+ Note we could use libmount routines to simplify this parsing a little
+ (and that code is in previous versions of this function), however
+ libmount depends on libselinux which pulls in many dependencies. */
+ char const *mountinfo = "/proc/self/mountinfo";
+ fp = fopen (mountinfo, "r");
+ if (fp != NULL)
{
- me = xmalloc (sizeof *me);
- me->me_devname = xstrdup (mnt->mnt_fsname);
- me->me_mountdir = xstrdup (mnt->mnt_dir);
- me->me_type = xstrdup (mnt->mnt_type);
- me->me_type_malloced = 1;
- me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, mnt);
- me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
- me->me_dev = dev_from_mount_options (mnt->mnt_opts);
+ char *line = NULL;
+ size_t buf_size = 0;
- /* Add to the linked list. */
- *mtail = me;
- mtail = &me->me_next;
+ while (getline (&line, &buf_size, fp) != -1)
+ {
+ unsigned int devmaj, devmin;
+ int target_s, target_e, type_s, type_e, source_s, source_e;
+ char test;
+ char *dash;
+ int rc;
+
+ rc = sscanf(line, "%*u " /* id - discarded */
+ "%*u " /* parent - discarded */
+ "%u:%u " /* dev major:minor */
+ "%*s " /* mountroot - discarded */
+ "%n%*s%n" /* target, start and end */
+ "%c", /* more data... */
+ &devmaj, &devmin,
+ &target_s, &target_e,
+ &test);
+ if (rc != 3 && rc != 5) /* 5 if %n included in count. */
+ continue;
+
+ /* skip optional fields, terminated by " - " */
+ dash = strstr (line + target_e, " - ");
+ if (! dash)
+ continue;
+
+ rc = sscanf(dash, " - "
+ "%n%*s%n " /* FS type, start and end */
+ "%n%*s%n " /* source, start and end */
+ "%c", /* more data... */
+ &type_s, &type_e,
+ &source_s, &source_e,
+ &test);
+ if (rc != 1 && rc != 5) /* 5 if %n included in count. */
+ continue;
+
+ /* manipulate the sub-strings in place. */
+ line[target_e] = '\0';
+ dash[type_e] = '\0';
+ dash[source_e] = '\0';
+ unescape_tab (dash + source_s);
+ unescape_tab (line + target_s);
+
+ me = xmalloc (sizeof *me);
+
+ me->me_devname = xstrdup (dash + source_s);
+ me->me_mountdir = xstrdup (line + target_s);
+ me->me_type = xstrdup (dash + type_s);
+ me->me_type_malloced = 1;
+ me->me_dev = makedev (devmaj, devmin);
+ /* we pass "false" for the "Bind" option as that's only
+ significant when the Fs_type is "none" which will not be
+ the case when parsing "/proc/self/mountinfo", and only
+ applies for static /etc/mtab files. */
+ me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, false);
+ me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
+
+ /* Add to the linked list. */
+ *mtail = me;
+ mtail = &me->me_next;
+ }
+
+ free (line);
+
+ if (ferror (fp))
+ {
+ int saved_errno = errno;
+ fclose (fp);
+ errno = saved_errno;
+ goto free_then_fail;
+ }
+
+ if (fclose (fp) == EOF)
+ goto free_then_fail;
}
+ else /* fallback to /proc/self/mounts (/etc/mtab). */
+#endif /* __linux __ */
+ {
+ struct mntent *mnt;
+ char const *table = MOUNTED;
- if (endmntent (fp) == 0)
- goto free_then_fail;
+ fp = setmntent (table, "r");
+ if (fp == NULL)
+ return NULL;
+
+ while ((mnt = getmntent (fp)))
+ {
+ bool bind = hasmntopt (mnt, "bind");
+
+ me = xmalloc (sizeof *me);
+ me->me_devname = xstrdup (mnt->mnt_fsname);
+ me->me_mountdir = xstrdup (mnt->mnt_dir);
+ me->me_type = xstrdup (mnt->mnt_type);
+ me->me_type_malloced = 1;
+ me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, bind);
+ me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
+ me->me_dev = dev_from_mount_options (mnt->mnt_opts);
+
+ /* Add to the linked list. */
+ *mtail = me;
+ mtail = &me->me_next;
+ }
+
+ if (endmntent (fp) == 0)
+ goto free_then_fail;
+ }
}
#endif /* MOUNTED_GETMNTENT1. */
@@ -845,18 +970,20 @@ read_file_system_list (bool need_fs_type)
#ifdef MOUNTED_VMOUNT /* AIX. */
{
int bufsize;
- char *entries, *thisent;
+ void *entries;
+ char *thisent;
struct vmount *vmp;
int n_entries;
int i;
/* Ask how many bytes to allocate for the mounted file system info. */
- if (mntctl (MCTL_QUERY, sizeof bufsize, (struct vmount *) &bufsize) != 0)
+ entries = &bufsize;
+ if (mntctl (MCTL_QUERY, sizeof bufsize, entries) != 0)
return NULL;
entries = xmalloc (bufsize);
/* Get the list of mounted file systems. */
- n_entries = mntctl (MCTL_QUERY, bufsize, (struct vmount *) entries);
+ n_entries = mntctl (MCTL_QUERY, bufsize, entries);
if (n_entries < 0)
{
int saved_errno = errno;
@@ -955,7 +1082,7 @@ read_file_system_list (bool need_fs_type)
return mount_list;
- free_then_fail:
+ free_then_fail: _GL_UNUSED_LABEL
{
int saved_errno = errno;
*mtail = NULL;
diff --git a/lib/mountlist.h b/lib/mountlist.h
index 1e4dfae8..735776b0 100644
--- a/lib/mountlist.h
+++ b/lib/mountlist.h
@@ -1,6 +1,6 @@
/* mountlist.h -- declarations for list of mounted file systems
- Copyright (C) 1991-1992, 1998, 2000-2005, 2009-2014 Free Software
+ Copyright (C) 1991-1992, 1998, 2000-2005, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mpsort.c b/lib/mpsort.c
index 08a8b3da..858001f9 100644
--- a/lib/mpsort.c
+++ b/lib/mpsort.c
@@ -1,6 +1,6 @@
/* Sort a vector of pointers to data.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/msvc-inval.c b/lib/msvc-inval.c
index f83827fb..a1f1dc0e 100644
--- a/lib/msvc-inval.c
+++ b/lib/msvc-inval.c
@@ -1,5 +1,5 @@
/* Invalid parameter handler for MSVC runtime libraries.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/msvc-inval.h b/lib/msvc-inval.h
index a0ef540f..8b07269a 100644
--- a/lib/msvc-inval.h
+++ b/lib/msvc-inval.h
@@ -1,5 +1,5 @@
/* Invalid parameter handler for MSVC runtime libraries.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/msvc-nothrow.c b/lib/msvc-nothrow.c
index b1e5f0c9..90cf8014 100644
--- a/lib/msvc-nothrow.c
+++ b/lib/msvc-nothrow.c
@@ -1,6 +1,6 @@
/* Wrappers that don't throw invalid parameter notifications
with MSVC runtime libraries.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/msvc-nothrow.h b/lib/msvc-nothrow.h
index 0d4dea58..67b151e6 100644
--- a/lib/msvc-nothrow.h
+++ b/lib/msvc-nothrow.h
@@ -1,6 +1,6 @@
/* Wrappers that don't throw invalid parameter notifications
with MSVC runtime libraries.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/nanosleep.c b/lib/nanosleep.c
index d0b12e7a..3060db09 100644
--- a/lib/nanosleep.c
+++ b/lib/nanosleep.c
@@ -1,6 +1,6 @@
/* Provide a replacement for the POSIX nanosleep function.
- Copyright (C) 1999-2000, 2002, 2004-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002, 2004-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/netdb.in.h b/lib/netdb.in.h
index bb9d34ab..33948b36 100644
--- a/lib/netdb.in.h
+++ b/lib/netdb.in.h
@@ -1,5 +1,5 @@
/* Provide a netdb.h header file for systems lacking it (read: MinGW).
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/netinet_in.in.h b/lib/netinet_in.in.h
index f0129dfe..1a0d2597 100644
--- a/lib/netinet_in.in.h
+++ b/lib/netinet_in.in.h
@@ -1,5 +1,5 @@
/* Substitute for <netinet/in.h>.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/nl_langinfo.c b/lib/nl_langinfo.c
index 1ab551d0..79b0406e 100644
--- a/lib/nl_langinfo.c
+++ b/lib/nl_langinfo.c
@@ -1,6 +1,6 @@
/* nl_langinfo() replacement: query locale dependent information.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/nproc.c b/lib/nproc.c
index cadf959b..562bb58c 100644
--- a/lib/nproc.c
+++ b/lib/nproc.c
@@ -1,6 +1,6 @@
/* Detect the number of processors.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/nproc.h b/lib/nproc.h
index 0cf65839..3dbd6494 100644
--- a/lib/nproc.h
+++ b/lib/nproc.h
@@ -1,6 +1,6 @@
/* Detect the number of processors.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/obstack.c b/lib/obstack.c
index 2db87b35..dd6e1f70 100644
--- a/lib/obstack.c
+++ b/lib/obstack.c
@@ -1,5 +1,5 @@
/* obstack.c - subroutines used implicitly by object stack macros
- Copyright (C) 1988-2014 Free Software Foundation, Inc.
+ Copyright (C) 1988-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -19,16 +19,14 @@
#ifdef _LIBC
# include <obstack.h>
-# include <shlib-compat.h>
#else
# include <config.h>
# include "obstack.h"
#endif
-/* NOTE BEFORE MODIFYING THIS FILE: This version number must be
- incremented whenever callers compiled using an old obstack.h can no
- longer properly call the functions in this obstack.c. */
-#define OBSTACK_INTERFACE_VERSION 1
+/* NOTE BEFORE MODIFYING THIS FILE: _OBSTACK_INTERFACE_VERSION in
+ obstack.h must be incremented whenever callers compiled using an old
+ obstack.h can no longer properly call the functions in this file. */
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself, and the installed library
@@ -38,113 +36,78 @@
(especially if it is a shared library). Rather than having every GNU
program understand 'configure --with-gnu-libc' and omit the object
files, it is simpler to just do this in the source for each such file. */
-
-#include <stdio.h> /* Random thing to get __GNU_LIBRARY__. */
#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
# include <gnu-versions.h>
-# if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION
-# define ELIDE_CODE
+# if (_GNU_OBSTACK_INTERFACE_VERSION == _OBSTACK_INTERFACE_VERSION \
+ || (_GNU_OBSTACK_INTERFACE_VERSION == 1 \
+ && _OBSTACK_INTERFACE_VERSION == 2 \
+ && defined SIZEOF_INT && defined SIZEOF_SIZE_T \
+ && SIZEOF_INT == SIZEOF_SIZE_T))
+# define _OBSTACK_ELIDE_CODE
# endif
#endif
-#include <stddef.h>
-
-#ifndef ELIDE_CODE
-
-
-# include <stdint.h>
-
-/* Determine default alignment. */
-union fooround
-{
- uintmax_t i;
- long double d;
- void *p;
-};
-struct fooalign
-{
- char c;
- union fooround u;
-};
-/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
- But in fact it might be less smart and round addresses to as much as
- DEFAULT_ROUNDING. So we prepare for it to do that. */
-enum
-{
- DEFAULT_ALIGNMENT = offsetof (struct fooalign, u),
- DEFAULT_ROUNDING = sizeof (union fooround)
-};
-
-/* When we copy a long block of data, this is the unit to do it with.
- On some machines, copying successive ints does not work;
- in such a case, redefine COPYING_UNIT to 'long' (if that works)
- or 'char' as a last resort. */
-# ifndef COPYING_UNIT
-# define COPYING_UNIT int
+#ifndef _OBSTACK_ELIDE_CODE
+/* If GCC, or if an oddball (testing?) host that #defines __alignof__,
+ use the already-supplied __alignof__. Otherwise, this must be Gnulib
+ (as glibc assumes GCC); defer to Gnulib's alignof_type. */
+# if !defined __GNUC__ && !defined __alignof__
+# include <alignof.h>
+# define __alignof__(type) alignof_type (type)
# endif
-
-
-/* The functions allocating more room by calling 'obstack_chunk_alloc'
- jump to the handler pointed to by 'obstack_alloc_failed_handler'.
- This can be set to a user defined function which should either
- abort gracefully or use longjump - but shouldn't return. This
- variable by default points to the internal function
- 'print_and_abort'. */
-static _Noreturn void print_and_abort (void);
-void (*obstack_alloc_failed_handler) (void) = print_and_abort;
-
-/* Exit value used when 'print_and_abort' is used. */
# include <stdlib.h>
-# ifdef _LIBC
-int obstack_exit_failure = EXIT_FAILURE;
-# else
-# include "exitfail.h"
-# define obstack_exit_failure exit_failure
-# endif
+# include <stdint.h>
-# ifdef _LIBC
-# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
-/* A looong time ago (before 1994, anyway; we're not sure) this global variable
- was used by non-GNU-C macros to avoid multiple evaluation. The GNU C
- library still exports it because somebody might use it. */
-struct obstack *_obstack_compat = 0;
-compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0);
-# endif
+# ifndef MAX
+# define MAX(a,b) ((a) > (b) ? (a) : (b))
# endif
-/* Define a macro that either calls functions with the traditional malloc/free
- calling interface, or calls functions with the mmalloc/mfree interface
- (that adds an extra first argument), based on the state of use_extra_arg.
- For free, do not use ?:, since some compilers, like the MIPS compilers,
- do not allow (expr) ? void : void. */
+/* Determine default alignment. */
-# define CALL_CHUNKFUN(h, size) \
- (((h)->use_extra_arg) \
- ? (*(h)->chunkfun)((h)->extra_arg, (size)) \
- : (*(struct _obstack_chunk *(*)(long))(h)->chunkfun)((size)))
+/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
+ But in fact it might be less smart and round addresses to as much as
+ DEFAULT_ROUNDING. So we prepare for it to do that.
+
+ DEFAULT_ALIGNMENT cannot be an enum constant; see gnulib's alignof.h. */
+#define DEFAULT_ALIGNMENT MAX (__alignof__ (long double), \
+ MAX (__alignof__ (uintmax_t), \
+ __alignof__ (void *)))
+#define DEFAULT_ROUNDING MAX (sizeof (long double), \
+ MAX (sizeof (uintmax_t), \
+ sizeof (void *)))
+
+/* Call functions with either the traditional malloc/free calling
+ interface, or the mmalloc/mfree interface (that adds an extra first
+ argument), based on the value of use_extra_arg. */
+
+static void *
+call_chunkfun (struct obstack *h, size_t size)
+{
+ if (h->use_extra_arg)
+ return h->chunkfun.extra (h->extra_arg, size);
+ else
+ return h->chunkfun.plain (size);
+}
-# define CALL_FREEFUN(h, old_chunk) \
- do { \
- if ((h)->use_extra_arg) \
- (*(h)->freefun)((h)->extra_arg, (old_chunk)); \
- else \
- (*(void (*)(void *))(h)->freefun)((old_chunk)); \
- } while (0)
+static void
+call_freefun (struct obstack *h, void *old_chunk)
+{
+ if (h->use_extra_arg)
+ h->freefun.extra (h->extra_arg, old_chunk);
+ else
+ h->freefun.plain (old_chunk);
+}
/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default).
Objects start on multiples of ALIGNMENT (0 means use default).
- CHUNKFUN is the function to use to allocate chunks,
- and FREEFUN the function to free them.
Return nonzero if successful, calls obstack_alloc_failed_handler if
allocation fails. */
-int
-_obstack_begin (struct obstack *h,
- int size, int alignment,
- void *(*chunkfun) (long),
- void (*freefun) (void *))
+static int
+_obstack_begin_worker (struct obstack *h,
+ _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment)
{
struct _obstack_chunk *chunk; /* points to new chunk */
@@ -167,19 +130,15 @@ _obstack_begin (struct obstack *h,
size = 4096 - extra;
}
- h->chunkfun = (struct _obstack_chunk * (*) (void *, long)) chunkfun;
- h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
h->chunk_size = size;
h->alignment_mask = alignment - 1;
- h->use_extra_arg = 0;
- chunk = h->chunk = CALL_CHUNKFUN (h, h->chunk_size);
+ chunk = h->chunk = call_chunkfun (h, h->chunk_size);
if (!chunk)
(*obstack_alloc_failed_handler) ();
h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents,
alignment - 1);
- h->chunk_limit = chunk->limit
- = (char *) chunk + h->chunk_size;
+ h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size;
chunk->prev = 0;
/* The initial chunk now contains no empty object. */
h->maybe_empty_object = 0;
@@ -188,51 +147,29 @@ _obstack_begin (struct obstack *h,
}
int
-_obstack_begin_1 (struct obstack *h, int size, int alignment,
- void *(*chunkfun) (void *, long),
+_obstack_begin (struct obstack *h,
+ _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment,
+ void *(*chunkfun) (size_t),
+ void (*freefun) (void *))
+{
+ h->chunkfun.plain = chunkfun;
+ h->freefun.plain = freefun;
+ h->use_extra_arg = 0;
+ return _obstack_begin_worker (h, size, alignment);
+}
+
+int
+_obstack_begin_1 (struct obstack *h,
+ _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment,
+ void *(*chunkfun) (void *, size_t),
void (*freefun) (void *, void *),
void *arg)
{
- struct _obstack_chunk *chunk; /* points to new chunk */
-
- if (alignment == 0)
- alignment = DEFAULT_ALIGNMENT;
- if (size == 0)
- /* Default size is what GNU malloc can fit in a 4096-byte block. */
- {
- /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc.
- Use the values for range checking, because if range checking is off,
- the extra bytes won't be missed terribly, but if range checking is on
- and we used a larger request, a whole extra 4096 bytes would be
- allocated.
-
- These number are irrelevant to the new GNU malloc. I suspect it is
- less sensitive to the size of the request. */
- int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1))
- + 4 + DEFAULT_ROUNDING - 1)
- & ~(DEFAULT_ROUNDING - 1));
- size = 4096 - extra;
- }
-
- h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun;
- h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
- h->chunk_size = size;
- h->alignment_mask = alignment - 1;
+ h->chunkfun.extra = chunkfun;
+ h->freefun.extra = freefun;
h->extra_arg = arg;
h->use_extra_arg = 1;
-
- chunk = h->chunk = CALL_CHUNKFUN (h, h->chunk_size);
- if (!chunk)
- (*obstack_alloc_failed_handler) ();
- h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents,
- alignment - 1);
- h->chunk_limit = chunk->limit
- = (char *) chunk + h->chunk_size;
- chunk->prev = 0;
- /* The initial chunk now contains no empty object. */
- h->maybe_empty_object = 0;
- h->alloc_failed = 0;
- return 1;
+ return _obstack_begin_worker (h, size, alignment);
}
/* Allocate a new current chunk for the obstack *H
@@ -242,23 +179,25 @@ _obstack_begin_1 (struct obstack *h, int size, int alignment,
to the beginning of the new one. */
void
-_obstack_newchunk (struct obstack *h, int length)
+_obstack_newchunk (struct obstack *h, _OBSTACK_SIZE_T length)
{
struct _obstack_chunk *old_chunk = h->chunk;
- struct _obstack_chunk *new_chunk;
- long new_size;
- long obj_size = h->next_free - h->object_base;
- long i;
- long already;
+ struct _obstack_chunk *new_chunk = 0;
+ size_t obj_size = h->next_free - h->object_base;
char *object_base;
/* Compute size for new chunk. */
- new_size = (obj_size + length) + (obj_size >> 3) + h->alignment_mask + 100;
+ size_t sum1 = obj_size + length;
+ size_t sum2 = sum1 + h->alignment_mask;
+ size_t new_size = sum2 + (obj_size >> 3) + 100;
+ if (new_size < sum2)
+ new_size = sum2;
if (new_size < h->chunk_size)
new_size = h->chunk_size;
/* Allocate and initialize the new chunk. */
- new_chunk = CALL_CHUNKFUN (h, new_size);
+ if (obj_size <= sum1 && sum1 <= sum2)
+ new_chunk = call_chunkfun (h, new_size);
if (!new_chunk)
(*obstack_alloc_failed_handler)();
h->chunk = new_chunk;
@@ -269,25 +208,8 @@ _obstack_newchunk (struct obstack *h, int length)
object_base =
__PTR_ALIGN ((char *) new_chunk, new_chunk->contents, h->alignment_mask);
- /* Move the existing object to the new chunk.
- Word at a time is fast and is safe if the object
- is sufficiently aligned. */
- if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT)
- {
- for (i = obj_size / sizeof (COPYING_UNIT) - 1;
- i >= 0; i--)
- ((COPYING_UNIT *) object_base)[i]
- = ((COPYING_UNIT *) h->object_base)[i];
- /* We used to copy the odd few remaining bytes as one extra COPYING_UNIT,
- but that can cross a page boundary on a machine
- which does not do strict alignment for COPYING_UNITS. */
- already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT);
- }
- else
- already = 0;
- /* Copy remaining bytes one by one. */
- for (i = already; i < obj_size; i++)
- object_base[i] = h->object_base[i];
+ /* Move the existing object to the new chunk. */
+ memcpy (object_base, h->object_base, obj_size);
/* If the object just copied was the only data in OLD_CHUNK,
free that chunk and remove it from the chain.
@@ -298,7 +220,7 @@ _obstack_newchunk (struct obstack *h, int length)
h->alignment_mask)))
{
new_chunk->prev = old_chunk->prev;
- CALL_FREEFUN (h, old_chunk);
+ call_freefun (h, old_chunk);
}
h->object_base = object_base;
@@ -306,9 +228,6 @@ _obstack_newchunk (struct obstack *h, int length)
/* The new chunk certainly contains no empty object yet. */
h->maybe_empty_object = 0;
}
-# ifdef _LIBC
-libc_hidden_def (_obstack_newchunk)
-# endif
/* Return nonzero if object OBJ has been allocated from obstack H.
This is here for debugging.
@@ -339,10 +258,8 @@ _obstack_allocated_p (struct obstack *h, void *obj)
/* Free objects in obstack H, including OBJ and everything allocate
more recently than OBJ. If OBJ is zero, free everything in H. */
-# undef obstack_free
-
void
-__obstack_free (struct obstack *h, void *obj)
+_obstack_free (struct obstack *h, void *obj)
{
struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
struct _obstack_chunk *plp; /* point to previous chunk if any */
@@ -354,7 +271,7 @@ __obstack_free (struct obstack *h, void *obj)
while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj))
{
plp = lp->prev;
- CALL_FREEFUN (h, lp);
+ call_freefun (h, lp);
lp = plp;
/* If we switch chunks, we can't tell whether the new current
chunk contains an empty object, so assume that it may. */
@@ -371,17 +288,11 @@ __obstack_free (struct obstack *h, void *obj)
abort ();
}
-# ifdef _LIBC
-/* Older versions of libc used a function _obstack_free intended to be
- called by non-GCC compilers. */
-strong_alias (obstack_free, _obstack_free)
-# endif
-
-int
+_OBSTACK_SIZE_T
_obstack_memory_used (struct obstack *h)
{
struct _obstack_chunk *lp;
- int nbytes = 0;
+ _OBSTACK_SIZE_T nbytes = 0;
for (lp = h->chunk; lp != 0; lp = lp->prev)
{
@@ -390,19 +301,30 @@ _obstack_memory_used (struct obstack *h)
return nbytes;
}
+# ifndef _OBSTACK_NO_ERROR_HANDLER
/* Define the error handler. */
-# ifdef _LIBC
-# include <libintl.h>
-# else
-# include "gettext.h"
-# endif
-# ifndef _
-# define _(msgid) gettext (msgid)
-# endif
+# include <stdio.h>
-# ifdef _LIBC
-# include <libio/iolibio.h>
-# endif
+/* Exit value used when 'print_and_abort' is used. */
+# ifdef _LIBC
+int obstack_exit_failure = EXIT_FAILURE;
+# else
+# include "exitfail.h"
+# define obstack_exit_failure exit_failure
+# endif
+
+# ifdef _LIBC
+# include <libintl.h>
+# else
+# include "gettext.h"
+# endif
+# ifndef _
+# define _(msgid) gettext (msgid)
+# endif
+
+# ifdef _LIBC
+# include <libio/iolibio.h>
+# endif
static _Noreturn void
print_and_abort (void)
@@ -412,12 +334,20 @@ print_and_abort (void)
happen because the "memory exhausted" message appears in other places
like this and the translation should be reused instead of creating
a very similar string which requires a separate translation. */
-# ifdef _LIBC
+# ifdef _LIBC
(void) __fxprintf (NULL, "%s\n", _("memory exhausted"));
-# else
+# else
fprintf (stderr, "%s\n", _("memory exhausted"));
-# endif
+# endif
exit (obstack_exit_failure);
}
-#endif /* !ELIDE_CODE */
+/* The functions allocating more room by calling 'obstack_chunk_alloc'
+ jump to the handler pointed to by 'obstack_alloc_failed_handler'.
+ This can be set to a user defined function which should either
+ abort gracefully or use longjump - but shouldn't return. This
+ variable by default points to the internal function
+ 'print_and_abort'. */
+void (*obstack_alloc_failed_handler) (void) = print_and_abort;
+# endif /* !_OBSTACK_NO_ERROR_HANDLER */
+#endif /* !_OBSTACK_ELIDE_CODE */
diff --git a/lib/obstack.h b/lib/obstack.h
index ebaa622f..2b7d13b7 100644
--- a/lib/obstack.h
+++ b/lib/obstack.h
@@ -1,5 +1,5 @@
/* obstack.h - object stack macros
- Copyright (C) 1988-2014 Free Software Foundation, Inc.
+ Copyright (C) 1988-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -104,16 +104,24 @@
#ifndef _OBSTACK_H
#define _OBSTACK_H 1
-/* We need the type of a pointer subtraction. If __PTRDIFF_TYPE__ is
- defined, as with GNU C, use that; that way we don't pollute the
- namespace with <stddef.h>'s symbols. Otherwise, include <stddef.h>
- and use ptrdiff_t. */
+#ifndef _OBSTACK_INTERFACE_VERSION
+# define _OBSTACK_INTERFACE_VERSION 2
+#endif
+
+#include <stddef.h> /* For size_t and ptrdiff_t. */
+#include <string.h> /* For __GNU_LIBRARY__, and memcpy. */
-#ifdef __PTRDIFF_TYPE__
-# define PTR_INT_TYPE __PTRDIFF_TYPE__
+#if _OBSTACK_INTERFACE_VERSION == 1
+/* For binary compatibility with obstack version 1, which used "int"
+ and "long" for these two types. */
+# define _OBSTACK_SIZE_T unsigned int
+# define _CHUNK_SIZE_T unsigned long
+# define _OBSTACK_CAST(type, expr) ((type) (expr))
#else
-# include <stddef.h>
-# define PTR_INT_TYPE ptrdiff_t
+/* Version 2 with sane types, especially for 64-bit hosts. */
+# define _OBSTACK_SIZE_T size_t
+# define _CHUNK_SIZE_T size_t
+# define _OBSTACK_CAST(type, expr) (expr)
#endif
/* If B is the base of an object addressed by P, return the result of
@@ -122,19 +130,17 @@
#define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A)))
-/* Similar to _BPTR_ALIGN (B, P, A), except optimize the common case
+/* Similar to __BPTR_ALIGN (B, P, A), except optimize the common case
where pointers can be converted to integers, aligned as integers,
- and converted back again. If PTR_INT_TYPE is narrower than a
+ and converted back again. If ptrdiff_t is narrower than a
pointer (e.g., the AS/400), play it safe and compute the alignment
relative to B. Otherwise, use the faster strategy of computing the
alignment relative to 0. */
#define __PTR_ALIGN(B, P, A) \
- __BPTR_ALIGN (sizeof (PTR_INT_TYPE) < sizeof (void *) ? (B) : (char *) 0, \
+ __BPTR_ALIGN (sizeof (ptrdiff_t) < sizeof (void *) ? (B) : (char *) 0, \
P, A)
-#include <string.h>
-
#ifndef __attribute_pure__
# define __attribute_pure__ _GL_ATTRIBUTE_PURE
#endif
@@ -152,22 +158,30 @@ struct _obstack_chunk /* Lives at front of each chunk. */
struct obstack /* control current object in current chunk */
{
- long chunk_size; /* preferred size to allocate chunks in */
+ _CHUNK_SIZE_T chunk_size; /* preferred size to allocate chunks in */
struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */
char *object_base; /* address of object we are building */
char *next_free; /* where to add next char to current object */
char *chunk_limit; /* address of char after current chunk */
union
{
- PTR_INT_TYPE tempint;
- void *tempptr;
+ _OBSTACK_SIZE_T i;
+ void *p;
} temp; /* Temporary for some macros. */
- int alignment_mask; /* Mask of alignment for each object. */
- /* These prototypes vary based on 'use_extra_arg', and we use
- casts to the prototypeless function type in all assignments,
- but having prototypes here quiets -Wstrict-prototypes. */
- struct _obstack_chunk *(*chunkfun) (void *, long);
- void (*freefun) (void *, struct _obstack_chunk *);
+ _OBSTACK_SIZE_T alignment_mask; /* Mask of alignment for each object. */
+
+ /* These prototypes vary based on 'use_extra_arg'. */
+ union
+ {
+ void *(*plain) (size_t);
+ void *(*extra) (void *, size_t);
+ } chunkfun;
+ union
+ {
+ void (*plain) (void *);
+ void (*extra) (void *, void *);
+ } freefun;
+
void *extra_arg; /* first arg for chunk alloc/dealloc funcs */
unsigned use_extra_arg : 1; /* chunk alloc/dealloc funcs take extra arg */
unsigned maybe_empty_object : 1; /* There is a possibility that the current
@@ -181,20 +195,17 @@ struct obstack /* control current object in current chunk */
/* Declare the external functions we use; they are in obstack.c. */
-extern void _obstack_newchunk (struct obstack *, int);
-extern int _obstack_begin (struct obstack *, int, int,
- void *(*)(long), void (*)(void *));
-extern int _obstack_begin_1 (struct obstack *, int, int,
- void *(*)(void *, long),
- void (*)(void *, void *), void *);
-extern int _obstack_memory_used (struct obstack *) __attribute_pure__;
-
-/* The default name of the function for freeing a chunk is 'obstack_free',
- but gnulib users can override this by defining '__obstack_free'. */
-#ifndef __obstack_free
-# define __obstack_free obstack_free
-#endif
-extern void __obstack_free (struct obstack *, void *);
+extern void _obstack_newchunk (struct obstack *, _OBSTACK_SIZE_T);
+extern void _obstack_free (struct obstack *, void *);
+extern int _obstack_begin (struct obstack *,
+ _OBSTACK_SIZE_T, _OBSTACK_SIZE_T,
+ void *(*) (size_t), void (*) (void *));
+extern int _obstack_begin_1 (struct obstack *,
+ _OBSTACK_SIZE_T, _OBSTACK_SIZE_T,
+ void *(*) (void *, size_t),
+ void (*) (void *, void *), void *);
+extern _OBSTACK_SIZE_T _obstack_memory_used (struct obstack *)
+ __attribute_pure__;
/* Error handler called when 'obstack_chunk_alloc' failed to allocate
@@ -218,7 +229,7 @@ extern int obstack_exit_failure;
/* Pointer to next byte not yet allocated in current chunk. */
-#define obstack_next_free(h) ((h)->next_free)
+#define obstack_next_free(h) ((void *) (h)->next_free)
/* Mask specifying low bits that should be clear in address of an object. */
@@ -227,38 +238,38 @@ extern int obstack_exit_failure;
/* To prevent prototype warnings provide complete argument list. */
#define obstack_init(h) \
_obstack_begin ((h), 0, 0, \
- (void *(*)(long))obstack_chunk_alloc, \
- (void (*)(void *))obstack_chunk_free)
+ _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc), \
+ _OBSTACK_CAST (void (*) (void *), obstack_chunk_free))
#define obstack_begin(h, size) \
_obstack_begin ((h), (size), 0, \
- (void *(*)(long))obstack_chunk_alloc, \
- (void (*)(void *))obstack_chunk_free)
+ _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc), \
+ _OBSTACK_CAST (void (*) (void *), obstack_chunk_free))
-#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
+#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
_obstack_begin ((h), (size), (alignment), \
- (void *(*)(long))(chunkfun), \
- (void (*)(void *))(freefun))
+ _OBSTACK_CAST (void *(*) (size_t), chunkfun), \
+ _OBSTACK_CAST (void (*) (void *), freefun))
#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
_obstack_begin_1 ((h), (size), (alignment), \
- (void *(*)(void *, long))(chunkfun), \
- (void (*)(void *, void *))(freefun), (arg))
+ _OBSTACK_CAST (void *(*) (void *, size_t), chunkfun), \
+ _OBSTACK_CAST (void (*) (void *, void *), freefun), arg)
-#define obstack_chunkfun(h, newchunkfun) \
- ((h)->chunkfun = (struct _obstack_chunk *(*)(void *, long))(newchunkfun))
+#define obstack_chunkfun(h, newchunkfun) \
+ ((void) ((h)->chunkfun.extra = (void *(*) (void *, size_t)) (newchunkfun)))
-#define obstack_freefun(h, newfreefun) \
- ((h)->freefun = (void (*)(void *, struct _obstack_chunk *))(newfreefun))
+#define obstack_freefun(h, newfreefun) \
+ ((void) ((h)->freefun.extra = (void *(*) (void *, void *)) (newfreefun)))
-#define obstack_1grow_fast(h, achar) (*((h)->next_free)++ = (achar))
+#define obstack_1grow_fast(h, achar) ((void) (*((h)->next_free)++ = (achar)))
-#define obstack_blank_fast(h, n) ((h)->next_free += (n))
+#define obstack_blank_fast(h, n) ((void) ((h)->next_free += (n)))
#define obstack_memory_used(h) _obstack_memory_used (h)
#if defined __GNUC__
-# if ! (2 < __GNUC__ + (8 <= __GNUC_MINOR__))
+# if !defined __GNUC_MINOR__ || __GNUC__ * 1000 + __GNUC_MINOR__ < 2008
# define __extension__
# endif
@@ -270,18 +281,20 @@ extern int obstack_exit_failure;
# define obstack_object_size(OBSTACK) \
__extension__ \
({ struct obstack const *__o = (OBSTACK); \
- (unsigned) (__o->next_free - __o->object_base); })
+ (_OBSTACK_SIZE_T) (__o->next_free - __o->object_base); })
+/* The local variable is named __o1 to avoid a shadowed variable
+ warning when invoked from other obstack macros. */
# define obstack_room(OBSTACK) \
__extension__ \
- ({ struct obstack const *__o = (OBSTACK); \
- (unsigned) (__o->chunk_limit - __o->next_free); })
+ ({ struct obstack const *__o1 = (OBSTACK); \
+ (_OBSTACK_SIZE_T) (__o1->chunk_limit - __o1->next_free); })
# define obstack_make_room(OBSTACK, length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
- if (__o->chunk_limit - __o->next_free < __len) \
+ _OBSTACK_SIZE_T __len = (length); \
+ if (obstack_room (__o) < __len) \
_obstack_newchunk (__o, __len); \
(void) 0; })
@@ -296,8 +309,8 @@ extern int obstack_exit_failure;
# define obstack_grow(OBSTACK, where, length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
- if (__o->next_free + __len > __o->chunk_limit) \
+ _OBSTACK_SIZE_T __len = (length); \
+ if (obstack_room (__o) < __len) \
_obstack_newchunk (__o, __len); \
memcpy (__o->next_free, where, __len); \
__o->next_free += __len; \
@@ -306,8 +319,8 @@ extern int obstack_exit_failure;
# define obstack_grow0(OBSTACK, where, length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
- if (__o->next_free + __len + 1 > __o->chunk_limit) \
+ _OBSTACK_SIZE_T __len = (length); \
+ if (obstack_room (__o) < __len + 1) \
_obstack_newchunk (__o, __len + 1); \
memcpy (__o->next_free, where, __len); \
__o->next_free += __len; \
@@ -317,10 +330,9 @@ extern int obstack_exit_failure;
# define obstack_1grow(OBSTACK, datum) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
- if (__o->next_free + 1 > __o->chunk_limit) \
+ if (obstack_room (__o) < 1) \
_obstack_newchunk (__o, 1); \
- obstack_1grow_fast (__o, datum); \
- (void) 0; })
+ obstack_1grow_fast (__o, datum); })
/* These assume that the obstack alignment is good enough for pointers
or ints, and that the data added so far to the current object
@@ -329,14 +341,14 @@ extern int obstack_exit_failure;
# define obstack_ptr_grow(OBSTACK, datum) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
- if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
+ if (obstack_room (__o) < sizeof (void *)) \
_obstack_newchunk (__o, sizeof (void *)); \
- obstack_ptr_grow_fast (__o, datum); }) \
+ obstack_ptr_grow_fast (__o, datum); })
# define obstack_int_grow(OBSTACK, datum) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
- if (__o->next_free + sizeof (int) > __o->chunk_limit) \
+ if (obstack_room (__o) < sizeof (int)) \
_obstack_newchunk (__o, sizeof (int)); \
obstack_int_grow_fast (__o, datum); })
@@ -359,11 +371,10 @@ extern int obstack_exit_failure;
# define obstack_blank(OBSTACK, length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
- if (__o->chunk_limit - __o->next_free < __len) \
+ _OBSTACK_SIZE_T __len = (length); \
+ if (obstack_room (__o) < __len) \
_obstack_newchunk (__o, __len); \
- obstack_blank_fast (__o, __len); \
- (void) 0; })
+ obstack_blank_fast (__o, __len); })
# define obstack_alloc(OBSTACK, length) \
__extension__ \
@@ -383,8 +394,8 @@ extern int obstack_exit_failure;
obstack_grow0 (__h, (where), (length)); \
obstack_finish (__h); })
-/* The local variable is named __o1 to avoid a name conflict
- when obstack_blank is called. */
+/* The local variable is named __o1 to avoid a shadowed variable
+ warning when invoked from other obstack macros, typically obstack_free. */
# define obstack_finish(OBSTACK) \
__extension__ \
({ struct obstack *__o1 = (OBSTACK); \
@@ -394,8 +405,8 @@ extern int obstack_exit_failure;
__o1->next_free \
= __PTR_ALIGN (__o1->object_base, __o1->next_free, \
__o1->alignment_mask); \
- if (__o1->next_free - (char *) __o1->chunk \
- > __o1->chunk_limit - (char *) __o1->chunk) \
+ if ((size_t) (__o1->next_free - (char *) __o1->chunk) \
+ > (size_t) (__o1->chunk_limit - (char *) __o1->chunk)) \
__o1->next_free = __o1->chunk_limit; \
__o1->object_base = __o1->next_free; \
__value; })
@@ -403,20 +414,21 @@ extern int obstack_exit_failure;
# define obstack_free(OBSTACK, OBJ) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
- void *__obj = (OBJ); \
+ void *__obj = (void *) (OBJ); \
if (__obj > (void *) __o->chunk && __obj < (void *) __o->chunk_limit) \
__o->next_free = __o->object_base = (char *) __obj; \
- else (__obstack_free) (__o, __obj); })
+ else \
+ _obstack_free (__o, __obj); })
#else /* not __GNUC__ */
-# define obstack_object_size(h) \
- (unsigned) ((h)->next_free - (h)->object_base)
+# define obstack_object_size(h) \
+ ((_OBSTACK_SIZE_T) ((h)->next_free - (h)->object_base))
# define obstack_room(h) \
- (unsigned) ((h)->chunk_limit - (h)->next_free)
+ ((_OBSTACK_SIZE_T) ((h)->chunk_limit - (h)->next_free))
-# define obstack_empty_p(h) \
+# define obstack_empty_p(h) \
((h)->chunk->prev == 0 \
&& (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \
(h)->chunk->contents, \
@@ -429,51 +441,56 @@ extern int obstack_exit_failure;
but some compilers won't accept it. */
# define obstack_make_room(h, length) \
- ((h)->temp.tempint = (length), \
- (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0))
+ ((h)->temp.i = (length), \
+ ((obstack_room (h) < (h)->temp.i) \
+ ? (_obstack_newchunk (h, (h)->temp.i), 0) : 0), \
+ (void) 0)
# define obstack_grow(h, where, length) \
- ((h)->temp.tempint = (length), \
- (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \
- memcpy ((h)->next_free, where, (h)->temp.tempint), \
- (h)->next_free += (h)->temp.tempint)
+ ((h)->temp.i = (length), \
+ ((obstack_room (h) < (h)->temp.i) \
+ ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0), \
+ memcpy ((h)->next_free, where, (h)->temp.i), \
+ (h)->next_free += (h)->temp.i, \
+ (void) 0)
# define obstack_grow0(h, where, length) \
- ((h)->temp.tempint = (length), \
- (((h)->next_free + (h)->temp.tempint + 1 > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), (h)->temp.tempint + 1), 0) : 0), \
- memcpy ((h)->next_free, where, (h)->temp.tempint), \
- (h)->next_free += (h)->temp.tempint, \
- *((h)->next_free)++ = 0)
+ ((h)->temp.i = (length), \
+ ((obstack_room (h) < (h)->temp.i + 1) \
+ ? (_obstack_newchunk ((h), (h)->temp.i + 1), 0) : 0), \
+ memcpy ((h)->next_free, where, (h)->temp.i), \
+ (h)->next_free += (h)->temp.i, \
+ *((h)->next_free)++ = 0, \
+ (void) 0)
# define obstack_1grow(h, datum) \
- ((((h)->next_free + 1 > (h)->chunk_limit) \
+ (((obstack_room (h) < 1) \
? (_obstack_newchunk ((h), 1), 0) : 0), \
obstack_1grow_fast (h, datum))
# define obstack_ptr_grow(h, datum) \
- ((((h)->next_free + sizeof (char *) > (h)->chunk_limit) \
+ (((obstack_room (h) < sizeof (char *)) \
? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \
obstack_ptr_grow_fast (h, datum))
# define obstack_int_grow(h, datum) \
- ((((h)->next_free + sizeof (int) > (h)->chunk_limit) \
+ (((obstack_room (h) < sizeof (int)) \
? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \
obstack_int_grow_fast (h, datum))
# define obstack_ptr_grow_fast(h, aptr) \
- (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr))
+ (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr), \
+ (void) 0)
# define obstack_int_grow_fast(h, aint) \
- (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint))
+ (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint), \
+ (void) 0)
# define obstack_blank(h, length) \
- ((h)->temp.tempint = (length), \
- (((h)->chunk_limit - (h)->next_free < (h)->temp.tempint) \
- ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \
- obstack_blank_fast (h, (h)->temp.tempint))
+ ((h)->temp.i = (length), \
+ ((obstack_room (h) < (h)->temp.i) \
+ ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0), \
+ obstack_blank_fast (h, (h)->temp.i))
# define obstack_alloc(h, length) \
(obstack_blank ((h), (length)), obstack_finish ((h)))
@@ -488,23 +505,22 @@ extern int obstack_exit_failure;
(((h)->next_free == (h)->object_base \
? (((h)->maybe_empty_object = 1), 0) \
: 0), \
- (h)->temp.tempptr = (h)->object_base, \
+ (h)->temp.p = (h)->object_base, \
(h)->next_free \
= __PTR_ALIGN ((h)->object_base, (h)->next_free, \
(h)->alignment_mask), \
- (((h)->next_free - (char *) (h)->chunk \
- > (h)->chunk_limit - (char *) (h)->chunk) \
+ (((size_t) ((h)->next_free - (char *) (h)->chunk) \
+ > (size_t) ((h)->chunk_limit - (char *) (h)->chunk)) \
? ((h)->next_free = (h)->chunk_limit) : 0), \
(h)->object_base = (h)->next_free, \
- (h)->temp.tempptr)
+ (h)->temp.p)
# define obstack_free(h, obj) \
- ((h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \
- ((((h)->temp.tempint > 0 \
- && (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \
- ? (void) ((h)->next_free = (h)->object_base \
- = (h)->temp.tempint + (char *) (h)->chunk) \
- : (__obstack_free) (h, (h)->temp.tempint + (char *) (h)->chunk)))
+ ((h)->temp.p = (void *) (obj), \
+ (((h)->temp.p > (void *) (h)->chunk \
+ && (h)->temp.p < (void *) (h)->chunk_limit) \
+ ? (void) ((h)->next_free = (h)->object_base = (char *) (h)->temp.p) \
+ : _obstack_free ((h), (h)->temp.p)))
#endif /* not __GNUC__ */
@@ -512,4 +528,4 @@ extern int obstack_exit_failure;
} /* C++ */
#endif
-#endif /* obstack.h */
+#endif /* _OBSTACK_H */
diff --git a/lib/open-safer.c b/lib/open-safer.c
index 91d69230..267b5cf3 100644
--- a/lib/open-safer.c
+++ b/lib/open-safer.c
@@ -1,6 +1,6 @@
/* Invoke open, but avoid some glitches.
- Copyright (C) 2005-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/open.c b/lib/open.c
index d6f8e0df..95c78114 100644
--- a/lib/open.c
+++ b/lib/open.c
@@ -1,5 +1,5 @@
/* Open a descriptor to a file.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/openat-die.c b/lib/openat-die.c
index 02f1fd7d..4accca0b 100644
--- a/lib/openat-die.c
+++ b/lib/openat-die.c
@@ -1,6 +1,6 @@
/* Report a save- or restore-cwd failure in our openat replacement and then exit.
- Copyright (C) 2005-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@
#include "gettext.h"
#define _(msgid) gettext (msgid)
-void
+_Noreturn void
openat_save_fail (int errnum)
{
#ifndef GNULIB_LIBPOSIX
@@ -49,7 +49,7 @@ openat_save_fail (int errnum)
during an openat emulation. The caller must ensure that fd 2 is
not a just-opened fd, even when openat_safer is not in use. */
-void
+_Noreturn void
openat_restore_fail (int errnum)
{
#ifndef GNULIB_LIBPOSIX
diff --git a/lib/openat-priv.h b/lib/openat-priv.h
index 326c739e..f5a36905 100644
--- a/lib/openat-priv.h
+++ b/lib/openat-priv.h
@@ -1,6 +1,6 @@
/* Internals for openat-like functions.
- Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/openat-proc.c b/lib/openat-proc.c
index 7b40bb8f..4e1d3419 100644
--- a/lib/openat-proc.c
+++ b/lib/openat-proc.c
@@ -1,6 +1,6 @@
/* Create /proc/self/fd-related names for subfiles of open directories.
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/openat-safer.c b/lib/openat-safer.c
index d0dc2d70..f2401bcd 100644
--- a/lib/openat-safer.c
+++ b/lib/openat-safer.c
@@ -1,6 +1,6 @@
/* Invoke openat, but avoid some glitches.
- Copyright (C) 2005-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/openat.c b/lib/openat.c
index 9d2f7d49..d1de8b9e 100644
--- a/lib/openat.c
+++ b/lib/openat.c
@@ -1,5 +1,5 @@
/* provide a replacement openat function
- Copyright (C) 2004-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/openat.h b/lib/openat.h
index 29e23a54..f148adfa 100644
--- a/lib/openat.h
+++ b/lib/openat.h
@@ -1,5 +1,5 @@
/* provide a replacement openat function
- Copyright (C) 2004-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004-2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/opendir-safer.c b/lib/opendir-safer.c
index e31da884..9bbcda85 100644
--- a/lib/opendir-safer.c
+++ b/lib/opendir-safer.c
@@ -1,6 +1,6 @@
/* Invoke opendir, but avoid some glitches.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/opendir.c b/lib/opendir.c
index c67f2e5a..9f531103 100644
--- a/lib/opendir.c
+++ b/lib/opendir.c
@@ -1,5 +1,5 @@
/* Start reading the entries of a directory.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/parse-datetime.c b/lib/parse-datetime.c
index 009b204b..7e01766a 100644
--- a/lib/parse-datetime.c
+++ b/lib/parse-datetime.c
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.7. */
+/* A Bison parser, made by GNU Bison 3.0.2. */
/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@@ -26,7 +26,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
@@ -44,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.7"
+#define YYBISON_VERSION "3.0.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -62,12 +62,11 @@
/* Copy the first part of user declarations. */
-/* Line 371 of yacc.c */
-#line 1 "./lib/parse-datetime.y"
+#line 1 "./lib/parse-datetime.y" /* yacc.c:339 */
/* Parse a string into an internal time stamp.
- Copyright (C) 1999-2000, 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -349,14 +348,13 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes,
}
-/* Line 371 of yacc.c */
-#line 354 "parse-datetime.c"
+#line 352 "parse-datetime.c" /* yacc.c:339 */
-# ifndef YY_NULL
+# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULL nullptr
+# define YY_NULLPTR nullptr
# else
-# define YY_NULL 0
+# define YY_NULLPTR 0
# endif
# endif
@@ -369,7 +367,7 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes,
#endif
-/* Enabling traces. */
+/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
@@ -377,33 +375,32 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes,
extern int yydebug;
#endif
-/* Tokens. */
+/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- tAGO = 258,
- tDST = 259,
- tYEAR_UNIT = 260,
- tMONTH_UNIT = 261,
- tHOUR_UNIT = 262,
- tMINUTE_UNIT = 263,
- tSEC_UNIT = 264,
- tDAY_UNIT = 265,
- tDAY_SHIFT = 266,
- tDAY = 267,
- tDAYZONE = 268,
- tLOCAL_ZONE = 269,
- tMERIDIAN = 270,
- tMONTH = 271,
- tORDINAL = 272,
- tZONE = 273,
- tSNUMBER = 274,
- tUNUMBER = 275,
- tSDECIMAL_NUMBER = 276,
- tUDECIMAL_NUMBER = 277
- };
+ enum yytokentype
+ {
+ tAGO = 258,
+ tDST = 259,
+ tYEAR_UNIT = 260,
+ tMONTH_UNIT = 261,
+ tHOUR_UNIT = 262,
+ tMINUTE_UNIT = 263,
+ tSEC_UNIT = 264,
+ tDAY_UNIT = 265,
+ tDAY_SHIFT = 266,
+ tDAY = 267,
+ tDAYZONE = 268,
+ tLOCAL_ZONE = 269,
+ tMERIDIAN = 270,
+ tMONTH = 271,
+ tORDINAL = 272,
+ tZONE = 273,
+ tSNUMBER = 274,
+ tUNUMBER = 275,
+ tSDECIMAL_NUMBER = 276,
+ tUDECIMAL_NUMBER = 277
+ };
#endif
/* Tokens. */
#define tAGO 258
@@ -427,49 +424,33 @@ extern int yydebug;
#define tSDECIMAL_NUMBER 276
#define tUDECIMAL_NUMBER 277
-
-
+/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
+typedef union YYSTYPE YYSTYPE;
+union YYSTYPE
{
-/* Line 387 of yacc.c */
-#line 297 "./lib/parse-datetime.y"
+#line 297 "./lib/parse-datetime.y" /* yacc.c:355 */
long int intval;
textint textintval;
struct timespec timespec;
relative_time rel;
-
-/* Line 387 of yacc.c */
-#line 446 "parse-datetime.c"
-} YYSTYPE;
+#line 440 "parse-datetime.c" /* yacc.c:355 */
+};
# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
+
int yyparse (parser_control *pc);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
/* Copy the second part of user declarations. */
-/* Line 390 of yacc.c */
-#line 473 "parse-datetime.c"
+#line 454 "parse-datetime.c" /* yacc.c:358 */
#ifdef short
# undef short
@@ -483,11 +464,8 @@ typedef unsigned char yytype_uint8;
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
#else
-typedef short int yytype_int8;
+typedef signed char yytype_int8;
#endif
#ifdef YYTYPE_UINT16
@@ -507,8 +485,7 @@ typedef short int yytype_int16;
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# elif ! defined YYSIZE_T
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
@@ -530,6 +507,33 @@ typedef short int yytype_int16;
# endif
#endif
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__ \
+ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
+ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+# define YY_ATTRIBUTE(Spec) /* empty */
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+# define _Noreturn __declspec (noreturn)
+# else
+# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+# endif
+#endif
+
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
@@ -537,24 +541,26 @@ typedef short int yytype_int16;
# define YYUSE(E) /* empty */
#endif
-/* Identity function, used to suppress warnings about constant conditions. */
-#ifndef lint
-# define YYID(N) (N)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
#else
-static int
-YYID (yyi)
- int yyi;
+# define YY_INITIAL_VALUE(Value) Value
#endif
-{
- return yyi;
-}
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
+
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
@@ -572,8 +578,7 @@ YYID (yyi)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
@@ -585,8 +590,8 @@ YYID (yyi)
# endif
# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+ /* Pacify GCC's 'empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
@@ -602,7 +607,7 @@ YYID (yyi)
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
+ && (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
@@ -610,15 +615,13 @@ YYID (yyi)
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
@@ -628,7 +631,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
@@ -653,16 +656,16 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (YYID (0))
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (0)
#endif
@@ -681,7 +684,7 @@ union yyalloc
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
- while (YYID (0))
+ while (0)
# endif
# endif
#endif /* !YYCOPY_NEEDED */
@@ -697,17 +700,19 @@ union yyalloc
#define YYNNTS 26
/* YYNRULES -- Number of rules. */
#define YYNRULES 91
-/* YYNRULES -- Number of states. */
+/* YYNSTATES -- Number of states. */
#define YYNSTATES 114
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+ by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 277
-#define YYTRANSLATE(YYX) \
+#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, without out-of-bounds checking. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -741,54 +746,7 @@ static const yytype_uint8 yytranslate[] =
};
#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const yytype_uint8 yyprhs[] =
-{
- 0, 0, 3, 5, 7, 10, 11, 14, 16, 18,
- 20, 22, 24, 26, 28, 30, 32, 34, 38, 41,
- 46, 53, 55, 58, 63, 70, 71, 73, 76, 78,
- 81, 83, 85, 88, 91, 95, 97, 100, 102, 105,
- 108, 111, 115, 121, 125, 129, 132, 137, 140, 144,
- 146, 150, 153, 155, 157, 160, 163, 165, 168, 171,
- 173, 176, 179, 181, 184, 187, 189, 192, 195, 197,
- 200, 203, 206, 209, 211, 213, 216, 219, 222, 225,
- 228, 231, 233, 235, 237, 239, 241, 243, 245, 247,
- 250, 251
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yytype_int8 yyrhs[] =
-{
- 29, 0, -1, 30, -1, 31, -1, 23, 48, -1,
- -1, 31, 32, -1, 33, -1, 35, -1, 39, -1,
- 40, -1, 42, -1, 41, -1, 44, -1, 51, -1,
- 52, -1, 34, -1, 43, 24, 36, -1, 20, 15,
- -1, 20, 25, 20, 15, -1, 20, 25, 20, 25,
- 50, 15, -1, 36, -1, 20, 38, -1, 20, 25,
- 20, 37, -1, 20, 25, 20, 25, 50, 37, -1,
- -1, 38, -1, 19, 53, -1, 14, -1, 14, 4,
- -1, 18, -1, 24, -1, 18, 46, -1, 24, 46,
- -1, 18, 19, 53, -1, 13, -1, 18, 4, -1,
- 12, -1, 12, 26, -1, 17, 12, -1, 20, 12,
- -1, 20, 27, 20, -1, 20, 27, 20, 27, 20,
- -1, 20, 16, 19, -1, 16, 19, 19, -1, 16,
- 20, -1, 16, 20, 26, 20, -1, 20, 16, -1,
- 20, 16, 20, -1, 43, -1, 20, 19, 19, -1,
- 45, 3, -1, 45, -1, 47, -1, 17, 5, -1,
- 20, 5, -1, 5, -1, 17, 6, -1, 20, 6,
- -1, 6, -1, 17, 10, -1, 20, 10, -1, 10,
- -1, 17, 7, -1, 20, 7, -1, 7, -1, 17,
- 8, -1, 20, 8, -1, 8, -1, 17, 9, -1,
- 20, 9, -1, 21, 9, -1, 22, 9, -1, 9,
- -1, 46, -1, 19, 5, -1, 19, 6, -1, 19,
- 10, -1, 19, 7, -1, 19, 8, -1, 19, 9,
- -1, 11, -1, 49, -1, 50, -1, 21, -1, 19,
- -1, 22, -1, 20, -1, 20, -1, 20, 46, -1,
- -1, 25, 20, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 324, 324, 325, 329, 336, 338, 342, 344, 346,
@@ -818,13 +776,13 @@ static const char *const yytname[] =
"iso_8601_time", "o_zone_offset", "zone_offset", "local_zone", "zone",
"day", "date", "iso_8601_date", "rel", "relunit", "relunit_snumber",
"dayshift", "seconds", "signed_seconds", "unsigned_seconds", "number",
- "hybrid", "o_colon_minutes", YY_NULL
+ "hybrid", "o_colon_minutes", YY_NULLPTR
};
#endif
# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+ (internal) symbol number NUM (which must be that of a token). */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
@@ -833,66 +791,18 @@ static const yytype_uint16 yytoknum[] =
};
# endif
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 28, 29, 29, 30, 31, 31, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 33, 34, 35, 35,
- 35, 35, 36, 36, 36, 37, 37, 38, 39, 39,
- 40, 40, 40, 40, 40, 40, 40, 41, 41, 41,
- 41, 42, 42, 42, 42, 42, 42, 42, 42, 42,
- 43, 44, 44, 44, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 46, 46, 46, 46, 46,
- 46, 47, 48, 48, 49, 49, 50, 50, 51, 52,
- 53, 53
-};
+#define YYPACT_NINF -93
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 1, 1, 2, 0, 2, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 3, 2, 4,
- 6, 1, 2, 4, 6, 0, 1, 2, 1, 2,
- 1, 1, 2, 2, 3, 1, 2, 1, 2, 2,
- 2, 3, 5, 3, 3, 2, 4, 2, 3, 1,
- 3, 2, 1, 1, 2, 2, 1, 2, 2, 1,
- 2, 2, 1, 2, 2, 1, 2, 2, 1, 2,
- 2, 2, 2, 1, 1, 2, 2, 2, 2, 2,
- 2, 1, 1, 1, 1, 1, 1, 1, 1, 2,
- 0, 2
-};
+#define yypact_value_is_default(Yystate) \
+ (!!((Yystate) == (-93)))
-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const yytype_uint8 yydefact[] =
-{
- 5, 0, 0, 2, 3, 85, 87, 84, 86, 4,
- 82, 83, 1, 56, 59, 65, 68, 73, 62, 81,
- 37, 35, 28, 0, 0, 30, 0, 88, 0, 0,
- 31, 6, 7, 16, 8, 21, 9, 10, 12, 11,
- 49, 13, 52, 74, 53, 14, 15, 38, 29, 0,
- 45, 54, 57, 63, 66, 69, 60, 39, 36, 90,
- 32, 75, 76, 78, 79, 80, 77, 55, 58, 64,
- 67, 70, 61, 40, 18, 47, 90, 0, 0, 22,
- 89, 71, 72, 33, 0, 51, 44, 0, 0, 34,
- 43, 48, 50, 27, 25, 41, 0, 17, 46, 91,
- 19, 90, 0, 23, 26, 0, 0, 25, 42, 25,
- 20, 24, 0, 25
-};
+#define YYTABLE_NINF -1
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int8 yydefgoto[] =
-{
- -1, 2, 3, 4, 31, 32, 33, 34, 35, 103,
- 104, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 9, 10, 11, 45, 46, 93
-};
+#define yytable_value_is_error(Yytable_value) \
+ 0
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -93
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
static const yytype_int8 yypact[] =
{
38, 27, 77, -93, 46, -93, -93, -93, -93, -93,
@@ -909,7 +819,26 @@ static const yytype_int8 yypact[] =
-93, -93, 69, 91
};
-/* YYPGOTO[NTERM-NUM]. */
+ /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
+static const yytype_uint8 yydefact[] =
+{
+ 5, 0, 0, 2, 3, 85, 87, 84, 86, 4,
+ 82, 83, 1, 56, 59, 65, 68, 73, 62, 81,
+ 37, 35, 28, 0, 0, 30, 0, 88, 0, 0,
+ 31, 6, 7, 16, 8, 21, 9, 10, 12, 11,
+ 49, 13, 52, 74, 53, 14, 15, 38, 29, 0,
+ 45, 54, 57, 63, 66, 69, 60, 39, 36, 90,
+ 32, 75, 76, 78, 79, 80, 77, 55, 58, 64,
+ 67, 70, 61, 40, 18, 47, 90, 0, 0, 22,
+ 89, 71, 72, 33, 0, 51, 44, 0, 0, 34,
+ 43, 48, 50, 27, 25, 41, 0, 17, 46, 91,
+ 19, 90, 0, 23, 26, 0, 0, 25, 42, 25,
+ 20, 24, 0, 25
+};
+
+ /* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
-93, -93, -93, -93, -93, -93, -93, -93, 20, -68,
@@ -917,10 +846,17 @@ static const yytype_int8 yypgoto[] =
-93, -93, -92, -93, -93, 43
};
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -1
+ /* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int8 yydefgoto[] =
+{
+ -1, 2, 3, 4, 31, 32, 33, 34, 35, 103,
+ 104, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 9, 10, 11, 45, 46, 93
+};
+
+ /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint8 yytable[] =
{
79, 67, 68, 69, 70, 71, 72, 58, 73, 100,
@@ -937,12 +873,6 @@ static const yytype_uint8 yytable[] =
101, 0, 88
};
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-93)))
-
-#define yytable_value_is_error(Yytable_value) \
- YYID (0)
-
static const yytype_int8 yycheck[] =
{
27, 5, 6, 7, 8, 9, 10, 4, 12, 15,
@@ -959,8 +889,8 @@ static const yytype_int8 yycheck[] =
19, -1, 25
};
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 23, 29, 30, 31, 19, 20, 21, 22, 48,
@@ -977,30 +907,46 @@ static const yytype_uint8 yystos[] =
15, 37, 25, 50
};
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. However,
- YYFAIL appears to be in use. Nevertheless, it is formally deprecated
- in Bison 2.4.2's NEWS entry, where a plan to phase it out is
- discussed. */
-
-#define YYFAIL goto yyerrlab
-#if defined YYFAIL
- /* This is here to suppress warnings from the GCC cpp's
- -Wunused-macros. Normally we don't worry about that warning, but
- some users do, and we want to make it easy for users to remove
- YYFAIL uses, which will produce warnings from Bison 2.5. */
-#endif
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 28, 29, 29, 30, 31, 31, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 33, 34, 35, 35,
+ 35, 35, 36, 36, 36, 37, 37, 38, 39, 39,
+ 40, 40, 40, 40, 40, 40, 40, 41, 41, 41,
+ 41, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+ 43, 44, 44, 44, 45, 45, 45, 45, 45, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+ 45, 45, 45, 45, 45, 46, 46, 46, 46, 46,
+ 46, 47, 48, 48, 49, 49, 50, 50, 51, 52,
+ 53, 53
+};
+
+ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 1, 1, 2, 0, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 3, 2, 4,
+ 6, 1, 2, 4, 6, 0, 1, 2, 1, 2,
+ 1, 1, 2, 2, 3, 1, 2, 1, 2, 2,
+ 2, 3, 5, 3, 3, 2, 4, 2, 3, 1,
+ 3, 2, 1, 1, 2, 2, 1, 2, 2, 1,
+ 2, 2, 1, 2, 2, 1, 2, 2, 1, 2,
+ 2, 2, 2, 1, 1, 2, 2, 2, 2, 2,
+ 2, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 0, 2
+};
+
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
#define YYRECOVERING() (!!yyerrstatus)
@@ -1017,27 +963,15 @@ do \
else \
{ \
yyerror (pc, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (YYID (0))
+ YYERROR; \
+ } \
+while (0)
/* Error token number */
-#define YYTERROR 1
-#define YYERRCODE 256
+#define YYTERROR 1
+#define YYERRCODE 256
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments. */
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval, pc)
-#endif
/* Enable debugging if requested. */
#if YYDEBUG
@@ -1047,58 +981,47 @@ while (YYID (0))
# define YYFPRINTF fprintf
# endif
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (YYID (0))
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (0)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value, pc); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (YYID (0))
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value, pc); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (0)
+
+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT. |
+`----------------------------------------*/
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_control *pc)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep, pc)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
- parser_control *pc;
-#endif
{
FILE *yyo = yyoutput;
YYUSE (yyo);
+ YYUSE (pc);
if (!yyvaluep)
return;
- YYUSE (pc);
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
- YYUSE (yyoutput);
# endif
- switch (yytype)
- {
- default:
- break;
- }
+ YYUSE (yytype);
}
@@ -1106,23 +1029,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, pc)
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_control *pc)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep, pc)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
- parser_control *pc;
-#endif
{
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+ YYFPRINTF (yyoutput, "%s %s (",
+ yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
yy_symbol_value_print (yyoutput, yytype, yyvaluep, pc);
YYFPRINTF (yyoutput, ")");
@@ -1133,16 +1044,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, pc)
| TOP (included). |
`------------------------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-#else
-static void
-yy_stack_print (yybottom, yytop)
- yytype_int16 *yybottom;
- yytype_int16 *yytop;
-#endif
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
@@ -1153,50 +1056,42 @@ yy_stack_print (yybottom, yytop)
YYFPRINTF (stderr, "\n");
}
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (YYID (0))
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (0)
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule, parser_control *pc)
-#else
-static void
-yy_reduce_print (yyvsp, yyrule, pc)
- YYSTYPE *yyvsp;
- int yyrule;
- parser_control *pc;
-#endif
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, parser_control *pc)
{
+ unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
- unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
+ yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- , pc);
+ yy_symbol_print (stderr,
+ yystos[yyssp[yyi + 1 - yynrhs]],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ , pc);
YYFPRINTF (stderr, "\n");
}
}
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyvsp, Rule, pc); \
-} while (YYID (0))
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyssp, yyvsp, Rule, pc); \
+} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
@@ -1210,7 +1105,7 @@ int yydebug;
/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
+#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
@@ -1233,15 +1128,8 @@ int yydebug;
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
- const char *yystr;
-#endif
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
@@ -1257,16 +1145,8 @@ yystrlen (yystr)
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-#endif
{
char *yyd = yydest;
const char *yys = yysrc;
@@ -1296,27 +1176,27 @@ yytnamerr (char *yyres, const char *yystr)
char const *yyp = yystr;
for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
do_not_strip_quotes: ;
}
@@ -1339,11 +1219,11 @@ static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
- YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
+ YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
- const char *yyformat = YY_NULL;
+ const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
@@ -1351,10 +1231,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
int yycount = 0;
/* There are many possibilities here to consider:
- - Assume YYFAIL is not used. It's too flawed to consider. See
- <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
- for details. YYERROR is fine as it does not invoke this
- function.
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
@@ -1404,7 +1280,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
}
yyarg[yycount++] = yytname[yyx];
{
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
@@ -1471,33 +1347,18 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, parser_control *pc)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep, pc)
- const char *yymsg;
- int yytype;
- YYSTYPE *yyvaluep;
- parser_control *pc;
-#endif
{
YYUSE (yyvaluep);
YYUSE (pc);
-
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
- switch (yytype)
- {
-
- default:
- break;
- }
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ YYUSE (yytype);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
}
@@ -1507,56 +1368,18 @@ yydestruct (yymsg, yytype, yyvaluep, pc)
| yyparse. |
`----------*/
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
int
yyparse (parser_control *pc)
-#else
-int
-yyparse (pc)
- parser_control *pc;
-#endif
-#endif
{
/* The lookahead symbol. */
int yychar;
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
- _Pragma ("GCC diagnostic pop")
-#else
+/* The semantic value of the lookahead symbol. */
/* Default value used for initialization, for pacifying older GCCs
or non-GCC compilers. */
-static YYSTYPE yyval_default;
-# define YY_INITIAL_VALUE(Value) = Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
-
-/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
+YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
+YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
/* Number of syntax errors so far. */
int yynerrs;
@@ -1566,8 +1389,8 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
int yyerrstatus;
/* The stacks and their tools:
- `yyss': related to states.
- `yyvs': related to semantic values.
+ 'yyss': related to states.
+ 'yyvs': related to semantic values.
Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
@@ -1635,23 +1458,23 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
#ifdef yyoverflow
{
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
@@ -1659,22 +1482,22 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
+ goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
+ yystacksize = YYMAXDEPTH;
{
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
@@ -1683,10 +1506,10 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
+ YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1715,7 +1538,7 @@ yybackup:
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
+ yychar = yylex (&yylval, pc);
}
if (yychar <= YYEOF)
@@ -1780,7 +1603,7 @@ yyreduce:
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
+ '$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
@@ -1794,541 +1617,540 @@ yyreduce:
switch (yyn)
{
case 4:
-/* Line 1792 of yacc.c */
-#line 330 "./lib/parse-datetime.y"
+#line 330 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
- pc->seconds = (yyvsp[(2) - (2)].timespec);
+ pc->seconds = (yyvsp[0].timespec);
pc->timespec_seen = true;
}
+#line 1626 "parse-datetime.c" /* yacc.c:1646 */
break;
case 7:
-/* Line 1792 of yacc.c */
-#line 343 "./lib/parse-datetime.y"
+#line 343 "./lib/parse-datetime.y" /* yacc.c:1646 */
{ pc->times_seen++; pc->dates_seen++; }
+#line 1632 "parse-datetime.c" /* yacc.c:1646 */
break;
case 8:
-/* Line 1792 of yacc.c */
-#line 345 "./lib/parse-datetime.y"
+#line 345 "./lib/parse-datetime.y" /* yacc.c:1646 */
{ pc->times_seen++; }
+#line 1638 "parse-datetime.c" /* yacc.c:1646 */
break;
case 9:
-/* Line 1792 of yacc.c */
-#line 347 "./lib/parse-datetime.y"
+#line 347 "./lib/parse-datetime.y" /* yacc.c:1646 */
{ pc->local_zones_seen++; }
+#line 1644 "parse-datetime.c" /* yacc.c:1646 */
break;
case 10:
-/* Line 1792 of yacc.c */
-#line 349 "./lib/parse-datetime.y"
+#line 349 "./lib/parse-datetime.y" /* yacc.c:1646 */
{ pc->zones_seen++; }
+#line 1650 "parse-datetime.c" /* yacc.c:1646 */
break;
case 11:
-/* Line 1792 of yacc.c */
-#line 351 "./lib/parse-datetime.y"
+#line 351 "./lib/parse-datetime.y" /* yacc.c:1646 */
{ pc->dates_seen++; }
+#line 1656 "parse-datetime.c" /* yacc.c:1646 */
break;
case 12:
-/* Line 1792 of yacc.c */
-#line 353 "./lib/parse-datetime.y"
+#line 353 "./lib/parse-datetime.y" /* yacc.c:1646 */
{ pc->days_seen++; }
+#line 1662 "parse-datetime.c" /* yacc.c:1646 */
break;
case 18:
-/* Line 1792 of yacc.c */
-#line 369 "./lib/parse-datetime.y"
+#line 369 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
- set_hhmmss (pc, (yyvsp[(1) - (2)].textintval).value, 0, 0, 0);
- pc->meridian = (yyvsp[(2) - (2)].intval);
+ set_hhmmss (pc, (yyvsp[-1].textintval).value, 0, 0, 0);
+ pc->meridian = (yyvsp[0].intval);
}
+#line 1671 "parse-datetime.c" /* yacc.c:1646 */
break;
case 19:
-/* Line 1792 of yacc.c */
-#line 374 "./lib/parse-datetime.y"
+#line 374 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
- set_hhmmss (pc, (yyvsp[(1) - (4)].textintval).value, (yyvsp[(3) - (4)].textintval).value, 0, 0);
- pc->meridian = (yyvsp[(4) - (4)].intval);
+ set_hhmmss (pc, (yyvsp[-3].textintval).value, (yyvsp[-1].textintval).value, 0, 0);
+ pc->meridian = (yyvsp[0].intval);
}
+#line 1680 "parse-datetime.c" /* yacc.c:1646 */
break;
case 20:
-/* Line 1792 of yacc.c */
-#line 379 "./lib/parse-datetime.y"
+#line 379 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
- set_hhmmss (pc, (yyvsp[(1) - (6)].textintval).value, (yyvsp[(3) - (6)].textintval).value, (yyvsp[(5) - (6)].timespec).tv_sec, (yyvsp[(5) - (6)].timespec).tv_nsec);
- pc->meridian = (yyvsp[(6) - (6)].intval);
+ set_hhmmss (pc, (yyvsp[-5].textintval).value, (yyvsp[-3].textintval).value, (yyvsp[-1].timespec).tv_sec, (yyvsp[-1].timespec).tv_nsec);
+ pc->meridian = (yyvsp[0].intval);
}
+#line 1689 "parse-datetime.c" /* yacc.c:1646 */
break;
case 22:
-/* Line 1792 of yacc.c */
-#line 388 "./lib/parse-datetime.y"
+#line 388 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
- set_hhmmss (pc, (yyvsp[(1) - (2)].textintval).value, 0, 0, 0);
+ set_hhmmss (pc, (yyvsp[-1].textintval).value, 0, 0, 0);
pc->meridian = MER24;
}
+#line 1698 "parse-datetime.c" /* yacc.c:1646 */
break;
case 23:
-/* Line 1792 of yacc.c */
-#line 393 "./lib/parse-datetime.y"
+#line 393 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
- set_hhmmss (pc, (yyvsp[(1) - (4)].textintval).value, (yyvsp[(3) - (4)].textintval).value, 0, 0);
+ set_hhmmss (pc, (yyvsp[-3].textintval).value, (yyvsp[-1].textintval).value, 0, 0);
pc->meridian = MER24;
}
+#line 1707 "parse-datetime.c" /* yacc.c:1646 */
break;
case 24:
-/* Line 1792 of yacc.c */
-#line 398 "./lib/parse-datetime.y"
+#line 398 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
- set_hhmmss (pc, (yyvsp[(1) - (6)].textintval).value, (yyvsp[(3) - (6)].textintval).value, (yyvsp[(5) - (6)].timespec).tv_sec, (yyvsp[(5) - (6)].timespec).tv_nsec);
+ set_hhmmss (pc, (yyvsp[-5].textintval).value, (yyvsp[-3].textintval).value, (yyvsp[-1].timespec).tv_sec, (yyvsp[-1].timespec).tv_nsec);
pc->meridian = MER24;
}
+#line 1716 "parse-datetime.c" /* yacc.c:1646 */
break;
case 27:
-/* Line 1792 of yacc.c */
-#line 411 "./lib/parse-datetime.y"
+#line 411 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
pc->zones_seen++;
- pc->time_zone = time_zone_hhmm (pc, (yyvsp[(1) - (2)].textintval), (yyvsp[(2) - (2)].intval));
+ pc->time_zone = time_zone_hhmm (pc, (yyvsp[-1].textintval), (yyvsp[0].intval));
}
+#line 1725 "parse-datetime.c" /* yacc.c:1646 */
break;
case 28:
-/* Line 1792 of yacc.c */
-#line 419 "./lib/parse-datetime.y"
+#line 419 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
- pc->local_isdst = (yyvsp[(1) - (1)].intval);
- pc->dsts_seen += (0 < (yyvsp[(1) - (1)].intval));
+ pc->local_isdst = (yyvsp[0].intval);
+ pc->dsts_seen += (0 < (yyvsp[0].intval));
}
+#line 1734 "parse-datetime.c" /* yacc.c:1646 */
break;
case 29:
-/* Line 1792 of yacc.c */
-#line 424 "./lib/parse-datetime.y"
+#line 424 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
pc->local_isdst = 1;
- pc->dsts_seen += (0 < (yyvsp[(1) - (2)].intval)) + 1;
+ pc->dsts_seen += (0 < (yyvsp[-1].intval)) + 1;
}
+#line 1743 "parse-datetime.c" /* yacc.c:1646 */
break;
case 30:
-/* Line 1792 of yacc.c */
-#line 434 "./lib/parse-datetime.y"
- { pc->time_zone = (yyvsp[(1) - (1)].intval); }
+#line 434 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { pc->time_zone = (yyvsp[0].intval); }
+#line 1749 "parse-datetime.c" /* yacc.c:1646 */
break;
case 31:
-/* Line 1792 of yacc.c */
-#line 436 "./lib/parse-datetime.y"
+#line 436 "./lib/parse-datetime.y" /* yacc.c:1646 */
{ pc->time_zone = HOUR(7); }
+#line 1755 "parse-datetime.c" /* yacc.c:1646 */
break;
case 32:
-/* Line 1792 of yacc.c */
-#line 438 "./lib/parse-datetime.y"
- { pc->time_zone = (yyvsp[(1) - (2)].intval);
- apply_relative_time (pc, (yyvsp[(2) - (2)].rel), 1); }
+#line 438 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { pc->time_zone = (yyvsp[-1].intval);
+ apply_relative_time (pc, (yyvsp[0].rel), 1); }
+#line 1762 "parse-datetime.c" /* yacc.c:1646 */
break;
case 33:
-/* Line 1792 of yacc.c */
-#line 441 "./lib/parse-datetime.y"
+#line 441 "./lib/parse-datetime.y" /* yacc.c:1646 */
{ pc->time_zone = HOUR(7);
- apply_relative_time (pc, (yyvsp[(2) - (2)].rel), 1); }
+ apply_relative_time (pc, (yyvsp[0].rel), 1); }
+#line 1769 "parse-datetime.c" /* yacc.c:1646 */
break;
case 34:
-/* Line 1792 of yacc.c */
-#line 444 "./lib/parse-datetime.y"
- { pc->time_zone = (yyvsp[(1) - (3)].intval) + time_zone_hhmm (pc, (yyvsp[(2) - (3)].textintval), (yyvsp[(3) - (3)].intval)); }
+#line 444 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { pc->time_zone = (yyvsp[-2].intval) + time_zone_hhmm (pc, (yyvsp[-1].textintval), (yyvsp[0].intval)); }
+#line 1775 "parse-datetime.c" /* yacc.c:1646 */
break;
case 35:
-/* Line 1792 of yacc.c */
-#line 446 "./lib/parse-datetime.y"
- { pc->time_zone = (yyvsp[(1) - (1)].intval) + 60; }
+#line 446 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { pc->time_zone = (yyvsp[0].intval) + 60; }
+#line 1781 "parse-datetime.c" /* yacc.c:1646 */
break;
case 36:
-/* Line 1792 of yacc.c */
-#line 448 "./lib/parse-datetime.y"
- { pc->time_zone = (yyvsp[(1) - (2)].intval) + 60; }
+#line 448 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { pc->time_zone = (yyvsp[-1].intval) + 60; }
+#line 1787 "parse-datetime.c" /* yacc.c:1646 */
break;
case 37:
-/* Line 1792 of yacc.c */
-#line 453 "./lib/parse-datetime.y"
+#line 453 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
pc->day_ordinal = 0;
- pc->day_number = (yyvsp[(1) - (1)].intval);
+ pc->day_number = (yyvsp[0].intval);
}
+#line 1796 "parse-datetime.c" /* yacc.c:1646 */
break;
case 38:
-/* Line 1792 of yacc.c */
-#line 458 "./lib/parse-datetime.y"
+#line 458 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
pc->day_ordinal = 0;
- pc->day_number = (yyvsp[(1) - (2)].intval);
+ pc->day_number = (yyvsp[-1].intval);
}
+#line 1805 "parse-datetime.c" /* yacc.c:1646 */
break;
case 39:
-/* Line 1792 of yacc.c */
-#line 463 "./lib/parse-datetime.y"
+#line 463 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
- pc->day_ordinal = (yyvsp[(1) - (2)].intval);
- pc->day_number = (yyvsp[(2) - (2)].intval);
+ pc->day_ordinal = (yyvsp[-1].intval);
+ pc->day_number = (yyvsp[0].intval);
}
+#line 1814 "parse-datetime.c" /* yacc.c:1646 */
break;
case 40:
-/* Line 1792 of yacc.c */
-#line 468 "./lib/parse-datetime.y"
+#line 468 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
- pc->day_ordinal = (yyvsp[(1) - (2)].textintval).value;
- pc->day_number = (yyvsp[(2) - (2)].intval);
+ pc->day_ordinal = (yyvsp[-1].textintval).value;
+ pc->day_number = (yyvsp[0].intval);
}
+#line 1823 "parse-datetime.c" /* yacc.c:1646 */
break;
case 41:
-/* Line 1792 of yacc.c */
-#line 476 "./lib/parse-datetime.y"
+#line 476 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
- pc->month = (yyvsp[(1) - (3)].textintval).value;
- pc->day = (yyvsp[(3) - (3)].textintval).value;
+ pc->month = (yyvsp[-2].textintval).value;
+ pc->day = (yyvsp[0].textintval).value;
}
+#line 1832 "parse-datetime.c" /* yacc.c:1646 */
break;
case 42:
-/* Line 1792 of yacc.c */
-#line 481 "./lib/parse-datetime.y"
+#line 481 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
/* Interpret as YYYY/MM/DD if the first value has 4 or more digits,
otherwise as MM/DD/YY.
The goal in recognizing YYYY/MM/DD is solely to support legacy
machine-generated dates like those in an RCS log listing. If
you want portability, use the ISO 8601 format. */
- if (4 <= (yyvsp[(1) - (5)].textintval).digits)
+ if (4 <= (yyvsp[-4].textintval).digits)
{
- pc->year = (yyvsp[(1) - (5)].textintval);
- pc->month = (yyvsp[(3) - (5)].textintval).value;
- pc->day = (yyvsp[(5) - (5)].textintval).value;
+ pc->year = (yyvsp[-4].textintval);
+ pc->month = (yyvsp[-2].textintval).value;
+ pc->day = (yyvsp[0].textintval).value;
}
else
{
- pc->month = (yyvsp[(1) - (5)].textintval).value;
- pc->day = (yyvsp[(3) - (5)].textintval).value;
- pc->year = (yyvsp[(5) - (5)].textintval);
+ pc->month = (yyvsp[-4].textintval).value;
+ pc->day = (yyvsp[-2].textintval).value;
+ pc->year = (yyvsp[0].textintval);
}
}
+#line 1856 "parse-datetime.c" /* yacc.c:1646 */
break;
case 43:
-/* Line 1792 of yacc.c */
-#line 501 "./lib/parse-datetime.y"
+#line 501 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
/* e.g. 17-JUN-1992. */
- pc->day = (yyvsp[(1) - (3)].textintval).value;
- pc->month = (yyvsp[(2) - (3)].intval);
- pc->year.value = -(yyvsp[(3) - (3)].textintval).value;
- pc->year.digits = (yyvsp[(3) - (3)].textintval).digits;
+ pc->day = (yyvsp[-2].textintval).value;
+ pc->month = (yyvsp[-1].intval);
+ pc->year.value = -(yyvsp[0].textintval).value;
+ pc->year.digits = (yyvsp[0].textintval).digits;
}
+#line 1868 "parse-datetime.c" /* yacc.c:1646 */
break;
case 44:
-/* Line 1792 of yacc.c */
-#line 509 "./lib/parse-datetime.y"
+#line 509 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
/* e.g. JUN-17-1992. */
- pc->month = (yyvsp[(1) - (3)].intval);
- pc->day = -(yyvsp[(2) - (3)].textintval).value;
- pc->year.value = -(yyvsp[(3) - (3)].textintval).value;
- pc->year.digits = (yyvsp[(3) - (3)].textintval).digits;
+ pc->month = (yyvsp[-2].intval);
+ pc->day = -(yyvsp[-1].textintval).value;
+ pc->year.value = -(yyvsp[0].textintval).value;
+ pc->year.digits = (yyvsp[0].textintval).digits;
}
+#line 1880 "parse-datetime.c" /* yacc.c:1646 */
break;
case 45:
-/* Line 1792 of yacc.c */
-#line 517 "./lib/parse-datetime.y"
+#line 517 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
- pc->month = (yyvsp[(1) - (2)].intval);
- pc->day = (yyvsp[(2) - (2)].textintval).value;
+ pc->month = (yyvsp[-1].intval);
+ pc->day = (yyvsp[0].textintval).value;
}
+#line 1889 "parse-datetime.c" /* yacc.c:1646 */
break;
case 46:
-/* Line 1792 of yacc.c */
-#line 522 "./lib/parse-datetime.y"
+#line 522 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
- pc->month = (yyvsp[(1) - (4)].intval);
- pc->day = (yyvsp[(2) - (4)].textintval).value;
- pc->year = (yyvsp[(4) - (4)].textintval);
+ pc->month = (yyvsp[-3].intval);
+ pc->day = (yyvsp[-2].textintval).value;
+ pc->year = (yyvsp[0].textintval);
}
+#line 1899 "parse-datetime.c" /* yacc.c:1646 */
break;
case 47:
-/* Line 1792 of yacc.c */
-#line 528 "./lib/parse-datetime.y"
+#line 528 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
- pc->day = (yyvsp[(1) - (2)].textintval).value;
- pc->month = (yyvsp[(2) - (2)].intval);
+ pc->day = (yyvsp[-1].textintval).value;
+ pc->month = (yyvsp[0].intval);
}
+#line 1908 "parse-datetime.c" /* yacc.c:1646 */
break;
case 48:
-/* Line 1792 of yacc.c */
-#line 533 "./lib/parse-datetime.y"
+#line 533 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
- pc->day = (yyvsp[(1) - (3)].textintval).value;
- pc->month = (yyvsp[(2) - (3)].intval);
- pc->year = (yyvsp[(3) - (3)].textintval);
+ pc->day = (yyvsp[-2].textintval).value;
+ pc->month = (yyvsp[-1].intval);
+ pc->year = (yyvsp[0].textintval);
}
+#line 1918 "parse-datetime.c" /* yacc.c:1646 */
break;
case 50:
-/* Line 1792 of yacc.c */
-#line 543 "./lib/parse-datetime.y"
+#line 543 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
/* ISO 8601 format. YYYY-MM-DD. */
- pc->year = (yyvsp[(1) - (3)].textintval);
- pc->month = -(yyvsp[(2) - (3)].textintval).value;
- pc->day = -(yyvsp[(3) - (3)].textintval).value;
+ pc->year = (yyvsp[-2].textintval);
+ pc->month = -(yyvsp[-1].textintval).value;
+ pc->day = -(yyvsp[0].textintval).value;
}
+#line 1929 "parse-datetime.c" /* yacc.c:1646 */
break;
case 51:
-/* Line 1792 of yacc.c */
-#line 553 "./lib/parse-datetime.y"
- { apply_relative_time (pc, (yyvsp[(1) - (2)].rel), (yyvsp[(2) - (2)].intval)); }
+#line 553 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { apply_relative_time (pc, (yyvsp[-1].rel), (yyvsp[0].intval)); }
+#line 1935 "parse-datetime.c" /* yacc.c:1646 */
break;
case 52:
-/* Line 1792 of yacc.c */
-#line 555 "./lib/parse-datetime.y"
- { apply_relative_time (pc, (yyvsp[(1) - (1)].rel), 1); }
+#line 555 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { apply_relative_time (pc, (yyvsp[0].rel), 1); }
+#line 1941 "parse-datetime.c" /* yacc.c:1646 */
break;
case 53:
-/* Line 1792 of yacc.c */
-#line 557 "./lib/parse-datetime.y"
- { apply_relative_time (pc, (yyvsp[(1) - (1)].rel), 1); }
+#line 557 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { apply_relative_time (pc, (yyvsp[0].rel), 1); }
+#line 1947 "parse-datetime.c" /* yacc.c:1646 */
break;
case 54:
-/* Line 1792 of yacc.c */
-#line 562 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[(1) - (2)].intval); }
+#line 562 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[-1].intval); }
+#line 1953 "parse-datetime.c" /* yacc.c:1646 */
break;
case 55:
-/* Line 1792 of yacc.c */
-#line 564 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[(1) - (2)].textintval).value; }
+#line 564 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[-1].textintval).value; }
+#line 1959 "parse-datetime.c" /* yacc.c:1646 */
break;
case 56:
-/* Line 1792 of yacc.c */
-#line 566 "./lib/parse-datetime.y"
+#line 566 "./lib/parse-datetime.y" /* yacc.c:1646 */
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = 1; }
+#line 1965 "parse-datetime.c" /* yacc.c:1646 */
break;
case 57:
-/* Line 1792 of yacc.c */
-#line 568 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[(1) - (2)].intval); }
+#line 568 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[-1].intval); }
+#line 1971 "parse-datetime.c" /* yacc.c:1646 */
break;
case 58:
-/* Line 1792 of yacc.c */
-#line 570 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[(1) - (2)].textintval).value; }
+#line 570 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[-1].textintval).value; }
+#line 1977 "parse-datetime.c" /* yacc.c:1646 */
break;
case 59:
-/* Line 1792 of yacc.c */
-#line 572 "./lib/parse-datetime.y"
+#line 572 "./lib/parse-datetime.y" /* yacc.c:1646 */
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = 1; }
+#line 1983 "parse-datetime.c" /* yacc.c:1646 */
break;
case 60:
-/* Line 1792 of yacc.c */
-#line 574 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (2)].intval) * (yyvsp[(2) - (2)].intval); }
+#line 574 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[-1].intval) * (yyvsp[0].intval); }
+#line 1989 "parse-datetime.c" /* yacc.c:1646 */
break;
case 61:
-/* Line 1792 of yacc.c */
-#line 576 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (2)].textintval).value * (yyvsp[(2) - (2)].intval); }
+#line 576 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[-1].textintval).value * (yyvsp[0].intval); }
+#line 1995 "parse-datetime.c" /* yacc.c:1646 */
break;
case 62:
-/* Line 1792 of yacc.c */
-#line 578 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (1)].intval); }
+#line 578 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[0].intval); }
+#line 2001 "parse-datetime.c" /* yacc.c:1646 */
break;
case 63:
-/* Line 1792 of yacc.c */
-#line 580 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[(1) - (2)].intval); }
+#line 580 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[-1].intval); }
+#line 2007 "parse-datetime.c" /* yacc.c:1646 */
break;
case 64:
-/* Line 1792 of yacc.c */
-#line 582 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[(1) - (2)].textintval).value; }
+#line 582 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[-1].textintval).value; }
+#line 2013 "parse-datetime.c" /* yacc.c:1646 */
break;
case 65:
-/* Line 1792 of yacc.c */
-#line 584 "./lib/parse-datetime.y"
+#line 584 "./lib/parse-datetime.y" /* yacc.c:1646 */
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = 1; }
+#line 2019 "parse-datetime.c" /* yacc.c:1646 */
break;
case 66:
-/* Line 1792 of yacc.c */
-#line 586 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[(1) - (2)].intval); }
+#line 586 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[-1].intval); }
+#line 2025 "parse-datetime.c" /* yacc.c:1646 */
break;
case 67:
-/* Line 1792 of yacc.c */
-#line 588 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[(1) - (2)].textintval).value; }
+#line 588 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[-1].textintval).value; }
+#line 2031 "parse-datetime.c" /* yacc.c:1646 */
break;
case 68:
-/* Line 1792 of yacc.c */
-#line 590 "./lib/parse-datetime.y"
+#line 590 "./lib/parse-datetime.y" /* yacc.c:1646 */
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = 1; }
+#line 2037 "parse-datetime.c" /* yacc.c:1646 */
break;
case 69:
-/* Line 1792 of yacc.c */
-#line 592 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].intval); }
+#line 592 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].intval); }
+#line 2043 "parse-datetime.c" /* yacc.c:1646 */
break;
case 70:
-/* Line 1792 of yacc.c */
-#line 594 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].textintval).value; }
+#line 594 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].textintval).value; }
+#line 2049 "parse-datetime.c" /* yacc.c:1646 */
break;
case 71:
-/* Line 1792 of yacc.c */
-#line 596 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].timespec).tv_sec; (yyval.rel).ns = (yyvsp[(1) - (2)].timespec).tv_nsec; }
+#line 596 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].timespec).tv_sec; (yyval.rel).ns = (yyvsp[-1].timespec).tv_nsec; }
+#line 2055 "parse-datetime.c" /* yacc.c:1646 */
break;
case 72:
-/* Line 1792 of yacc.c */
-#line 598 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].timespec).tv_sec; (yyval.rel).ns = (yyvsp[(1) - (2)].timespec).tv_nsec; }
+#line 598 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].timespec).tv_sec; (yyval.rel).ns = (yyvsp[-1].timespec).tv_nsec; }
+#line 2061 "parse-datetime.c" /* yacc.c:1646 */
break;
case 73:
-/* Line 1792 of yacc.c */
-#line 600 "./lib/parse-datetime.y"
+#line 600 "./lib/parse-datetime.y" /* yacc.c:1646 */
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 1; }
+#line 2067 "parse-datetime.c" /* yacc.c:1646 */
break;
case 75:
-/* Line 1792 of yacc.c */
-#line 606 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[(1) - (2)].textintval).value; }
+#line 606 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[-1].textintval).value; }
+#line 2073 "parse-datetime.c" /* yacc.c:1646 */
break;
case 76:
-/* Line 1792 of yacc.c */
-#line 608 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[(1) - (2)].textintval).value; }
+#line 608 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[-1].textintval).value; }
+#line 2079 "parse-datetime.c" /* yacc.c:1646 */
break;
case 77:
-/* Line 1792 of yacc.c */
-#line 610 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (2)].textintval).value * (yyvsp[(2) - (2)].intval); }
+#line 610 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[-1].textintval).value * (yyvsp[0].intval); }
+#line 2085 "parse-datetime.c" /* yacc.c:1646 */
break;
case 78:
-/* Line 1792 of yacc.c */
-#line 612 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[(1) - (2)].textintval).value; }
+#line 612 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[-1].textintval).value; }
+#line 2091 "parse-datetime.c" /* yacc.c:1646 */
break;
case 79:
-/* Line 1792 of yacc.c */
-#line 614 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[(1) - (2)].textintval).value; }
+#line 614 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[-1].textintval).value; }
+#line 2097 "parse-datetime.c" /* yacc.c:1646 */
break;
case 80:
-/* Line 1792 of yacc.c */
-#line 616 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].textintval).value; }
+#line 616 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].textintval).value; }
+#line 2103 "parse-datetime.c" /* yacc.c:1646 */
break;
case 81:
-/* Line 1792 of yacc.c */
-#line 621 "./lib/parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (1)].intval); }
+#line 621 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[0].intval); }
+#line 2109 "parse-datetime.c" /* yacc.c:1646 */
break;
case 85:
-/* Line 1792 of yacc.c */
-#line 629 "./lib/parse-datetime.y"
- { (yyval.timespec).tv_sec = (yyvsp[(1) - (1)].textintval).value; (yyval.timespec).tv_nsec = 0; }
+#line 629 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.timespec).tv_sec = (yyvsp[0].textintval).value; (yyval.timespec).tv_nsec = 0; }
+#line 2115 "parse-datetime.c" /* yacc.c:1646 */
break;
case 87:
-/* Line 1792 of yacc.c */
-#line 635 "./lib/parse-datetime.y"
- { (yyval.timespec).tv_sec = (yyvsp[(1) - (1)].textintval).value; (yyval.timespec).tv_nsec = 0; }
+#line 635 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.timespec).tv_sec = (yyvsp[0].textintval).value; (yyval.timespec).tv_nsec = 0; }
+#line 2121 "parse-datetime.c" /* yacc.c:1646 */
break;
case 88:
-/* Line 1792 of yacc.c */
-#line 640 "./lib/parse-datetime.y"
- { digits_to_date_time (pc, (yyvsp[(1) - (1)].textintval)); }
+#line 640 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { digits_to_date_time (pc, (yyvsp[0].textintval)); }
+#line 2127 "parse-datetime.c" /* yacc.c:1646 */
break;
case 89:
-/* Line 1792 of yacc.c */
-#line 645 "./lib/parse-datetime.y"
+#line 645 "./lib/parse-datetime.y" /* yacc.c:1646 */
{
/* Hybrid all-digit and relative offset, so that we accept e.g.,
"YYYYMMDD +N days" as well as "YYYYMMDD N days". */
- digits_to_date_time (pc, (yyvsp[(1) - (2)].textintval));
- apply_relative_time (pc, (yyvsp[(2) - (2)].rel), 1);
+ digits_to_date_time (pc, (yyvsp[-1].textintval));
+ apply_relative_time (pc, (yyvsp[0].rel), 1);
}
+#line 2138 "parse-datetime.c" /* yacc.c:1646 */
break;
case 90:
-/* Line 1792 of yacc.c */
-#line 655 "./lib/parse-datetime.y"
+#line 655 "./lib/parse-datetime.y" /* yacc.c:1646 */
{ (yyval.intval) = -1; }
+#line 2144 "parse-datetime.c" /* yacc.c:1646 */
break;
case 91:
-/* Line 1792 of yacc.c */
-#line 657 "./lib/parse-datetime.y"
- { (yyval.intval) = (yyvsp[(2) - (2)].textintval).value; }
+#line 657 "./lib/parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.intval) = (yyvsp[0].textintval).value; }
+#line 2150 "parse-datetime.c" /* yacc.c:1646 */
break;
-/* Line 1792 of yacc.c */
-#line 2332 "parse-datetime.c"
+#line 2154 "parse-datetime.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -2350,7 +2172,7 @@ yyreduce:
*++yyvsp = yyval;
- /* Now `shift' the result of the reduction. Determine what state
+ /* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
@@ -2365,9 +2187,9 @@ yyreduce:
goto yynewstate;
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
+/*--------------------------------------.
+| yyerrlab -- here on detecting error. |
+`--------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
@@ -2418,20 +2240,20 @@ yyerrlab:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
- error, discard it. */
+ error, discard it. */
if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval, pc);
- yychar = YYEMPTY;
- }
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval, pc);
+ yychar = YYEMPTY;
+ }
}
/* Else will try to reuse lookahead token after shifting the error
@@ -2450,7 +2272,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
- /* Do not reclaim the symbols of the rule which action triggered
+ /* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
@@ -2463,29 +2285,29 @@ yyerrorlab:
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
- YYABORT;
+ YYABORT;
yydestruct ("Error: popping",
- yystos[yystate], yyvsp, pc);
+ yystos[yystate], yyvsp, pc);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
@@ -2536,14 +2358,14 @@ yyreturn:
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, pc);
}
- /* Do not reclaim the symbols of the rule which action triggered
+ /* Do not reclaim the symbols of the rule whose action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp, pc);
+ yystos[*yyssp], yyvsp, pc);
YYPOPSTACK (1);
}
#ifndef yyoverflow
@@ -2554,13 +2376,9 @@ yyreturn:
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
- /* Make sure YYID is used. */
- return YYID (yyresult);
+ return yyresult;
}
-
-
-/* Line 2055 of yacc.c */
-#line 660 "./lib/parse-datetime.y"
+#line 660 "./lib/parse-datetime.y" /* yacc.c:1906 */
static table const meridian_table[] =
@@ -2935,7 +2753,7 @@ lookup_word (parser_control const *pc, char *word)
}
static int
-yylex (YYSTYPE *lvalp, parser_control *pc)
+yylex (union YYSTYPE *lvalp, parser_control *pc)
{
unsigned char c;
size_t count;
@@ -3065,7 +2883,7 @@ yylex (YYSTYPE *lvalp, parser_control *pc)
do
{
- if (p - buff < sizeof buff - 1)
+ if (p < buff + sizeof buff - 1)
*p++ = c;
c = *++pc->input;
}
diff --git a/lib/parse-datetime.h b/lib/parse-datetime.h
index 9c9bb93f..443edb94 100644
--- a/lib/parse-datetime.h
+++ b/lib/parse-datetime.h
@@ -1,6 +1,6 @@
/* Parse a string into an internal time stamp.
- Copyright (C) 1995, 1997-1998, 2003-2004, 2007, 2009-2014 Free Software
+ Copyright (C) 1995, 1997-1998, 2003-2004, 2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
index 0ba0a525..1b1fec75 100644
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -1,7 +1,7 @@
%{
/* Parse a string into an internal time stamp.
- Copyright (C) 1999-2000, 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1031,7 +1031,7 @@ lookup_word (parser_control const *pc, char *word)
}
static int
-yylex (YYSTYPE *lvalp, parser_control *pc)
+yylex (union YYSTYPE *lvalp, parser_control *pc)
{
unsigned char c;
size_t count;
@@ -1161,7 +1161,7 @@ yylex (YYSTYPE *lvalp, parser_control *pc)
do
{
- if (p - buff < sizeof buff - 1)
+ if (p < buff + sizeof buff - 1)
*p++ = c;
c = *++pc->input;
}
diff --git a/lib/pathmax.h b/lib/pathmax.h
index 33fc3553..2f3b64f4 100644
--- a/lib/pathmax.h
+++ b/lib/pathmax.h
@@ -1,5 +1,5 @@
/* Define PATH_MAX somehow. Requires sys/types.h.
- Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2014 Free Software
+ Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/physmem.c b/lib/physmem.c
index d0989aa8..1906cab6 100644
--- a/lib/physmem.c
+++ b/lib/physmem.c
@@ -1,6 +1,6 @@
/* Calculate the size of physical memory.
- Copyright (C) 2000-2001, 2003, 2005-2006, 2009-2014 Free Software
+ Copyright (C) 2000-2001, 2003, 2005-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/physmem.h b/lib/physmem.h
index ab67e0ca..8df242aa 100644
--- a/lib/physmem.h
+++ b/lib/physmem.h
@@ -1,6 +1,6 @@
/* Calculate the size of physical memory.
- Copyright (C) 2000, 2003, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2003, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/pipe-safer.c b/lib/pipe-safer.c
index 70fb40f8..91b0fe77 100644
--- a/lib/pipe-safer.c
+++ b/lib/pipe-safer.c
@@ -1,5 +1,5 @@
/* Invoke pipe, but avoid some glitches.
- Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/pipe.c b/lib/pipe.c
index 4db9041c..a1220af6 100644
--- a/lib/pipe.c
+++ b/lib/pipe.c
@@ -1,5 +1,5 @@
/* Create a pipe.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/posixtm.c b/lib/posixtm.c
index 2fe81ab6..ebb21807 100644
--- a/lib/posixtm.c
+++ b/lib/posixtm.c
@@ -1,6 +1,6 @@
/* Parse dates for touch and date.
- Copyright (C) 1989-1991, 1998, 2000-2014 Free Software Foundation, Inc.
+ Copyright (C) 1989-1991, 1998, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -57,7 +57,7 @@
*/
-static int
+static bool
year (struct tm *tm, const int *digit_pair, size_t n, unsigned int syntax_bits)
{
switch (n)
@@ -70,14 +70,14 @@ year (struct tm *tm, const int *digit_pair, size_t n, unsigned int syntax_bits)
if (digit_pair[0] <= 68)
{
if (syntax_bits & PDS_PRE_2000)
- return 1;
+ return false;
tm->tm_year += 100;
}
break;
case 2:
if (! (syntax_bits & PDS_CENTURY))
- return 1;
+ return false;
tm->tm_year = digit_pair[0] * 100 + digit_pair[1] - 1900;
break;
@@ -90,7 +90,7 @@ year (struct tm *tm, const int *digit_pair, size_t n, unsigned int syntax_bits)
time (&now);
tmp = localtime (&now);
if (! tmp)
- return 1;
+ return false;
tm->tm_year = tmp->tm_year;
}
break;
@@ -99,10 +99,10 @@ year (struct tm *tm, const int *digit_pair, size_t n, unsigned int syntax_bits)
abort ();
}
- return 0;
+ return true;
}
-static int
+static bool
posix_time_parse (struct tm *tm, const char *s, unsigned int syntax_bits)
{
const char *dot = NULL;
@@ -111,25 +111,25 @@ posix_time_parse (struct tm *tm, const char *s, unsigned int syntax_bits)
size_t i;
size_t s_len = strlen (s);
- size_t len = (((syntax_bits & PDS_SECONDS) && (dot = strchr (s, '.')))
- ? (size_t) (dot - s)
- : s_len);
+ size_t len = s_len;
- if (len != 8 && len != 10 && len != 12)
- return 1;
-
- if (dot)
+ if (syntax_bits & PDS_SECONDS)
{
- if (!(syntax_bits & PDS_SECONDS))
- return 1;
-
- if (s_len - len != 3)
- return 1;
+ dot = strchr (s, '.');
+ if (dot)
+ {
+ len = dot - s;
+ if (s_len - len != 3)
+ return false;
+ }
}
+ if (! (8 <= len && len <= 12 && len % 2 == 0))
+ return false;
+
for (i = 0; i < len; i++)
if (!ISDIGIT (s[i]))
- return 1;
+ return false;
len /= 2;
for (i = 0; i < len; i++)
@@ -138,8 +138,8 @@ posix_time_parse (struct tm *tm, const char *s, unsigned int syntax_bits)
p = pair;
if (syntax_bits & PDS_LEADING_YEAR)
{
- if (year (tm, p, len - 4, syntax_bits))
- return 1;
+ if (! year (tm, p, len - 4, syntax_bits))
+ return false;
p += len - 4;
len = 4;
}
@@ -154,28 +154,19 @@ posix_time_parse (struct tm *tm, const char *s, unsigned int syntax_bits)
/* Handle any trailing year. */
if (syntax_bits & PDS_TRAILING_YEAR)
{
- if (year (tm, p, len, syntax_bits))
- return 1;
+ if (! year (tm, p, len, syntax_bits))
+ return false;
}
/* Handle seconds. */
if (!dot)
- {
- tm->tm_sec = 0;
- }
+ tm->tm_sec = 0;
+ else if (ISDIGIT (dot[1]) && ISDIGIT (dot[2]))
+ tm->tm_sec = 10 * (dot[1] - '0') + dot[2] - '0';
else
- {
- int seconds;
-
- ++dot;
- if (!ISDIGIT (dot[0]) || !ISDIGIT (dot[1]))
- return 1;
- seconds = 10 * (dot[0] - '0') + dot[1] - '0';
-
- tm->tm_sec = seconds;
- }
+ return false;
- return 0;
+ return true;
}
/* Parse a POSIX-style date, returning true if successful. */
@@ -188,7 +179,7 @@ posixtime (time_t *p, const char *s, unsigned int syntax_bits)
struct tm const *tm;
time_t t;
- if (posix_time_parse (&tm0, s, syntax_bits))
+ if (! posix_time_parse (&tm0, s, syntax_bits))
return false;
tm1 = tm0;
@@ -207,7 +198,9 @@ posixtime (time_t *p, const char *s, unsigned int syntax_bits)
}
/* Reject dates like "September 31" and times like "25:61".
- Do not reject times that specify "60" as the number of seconds. */
+ However, allow a seconds count of 60 even in time zones that do
+ not support leap seconds, treating it as the following second;
+ POSIX requires this. */
if ((tm0.tm_year ^ tm->tm_year)
| (tm0.tm_mon ^ tm->tm_mon)
| (tm0.tm_mday ^ tm->tm_mday)
diff --git a/lib/posixtm.h b/lib/posixtm.h
index 56680ec4..d063dfd2 100644
--- a/lib/posixtm.h
+++ b/lib/posixtm.h
@@ -1,6 +1,6 @@
/* Parse dates for touch and date.
- Copyright (C) 1998, 2003, 2005, 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2003, 2005, 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/posixver.c b/lib/posixver.c
index a3bff114..0625bc10 100644
--- a/lib/posixver.c
+++ b/lib/posixver.c
@@ -1,6 +1,6 @@
/* Which POSIX version to conform to, for utilities.
- Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/printf-args.c b/lib/printf-args.c
index 39cd0a4f..da17efbd 100644
--- a/lib/printf-args.c
+++ b/lib/printf-args.c
@@ -1,5 +1,5 @@
/* Decomposed printf argument list.
- Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2014 Free Software
+ Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/printf-args.h b/lib/printf-args.h
index 9364eed5..387976cc 100644
--- a/lib/printf-args.h
+++ b/lib/printf-args.h
@@ -1,5 +1,5 @@
/* Decomposed printf argument list.
- Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2014 Free Software
+ Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/printf-frexp.c b/lib/printf-frexp.c
index 39ec0938..5a7301fe 100644
--- a/lib/printf-frexp.c
+++ b/lib/printf-frexp.c
@@ -1,5 +1,5 @@
/* Split a double into fraction and mantissa, for hexadecimal printf.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/printf-frexp.h b/lib/printf-frexp.h
index 2c46eca2..7f21ba22 100644
--- a/lib/printf-frexp.h
+++ b/lib/printf-frexp.h
@@ -1,5 +1,5 @@
/* Split a double into fraction and mantissa, for hexadecimal printf.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/printf-frexpl.c b/lib/printf-frexpl.c
index 00e7a67d..024f5a5d 100644
--- a/lib/printf-frexpl.c
+++ b/lib/printf-frexpl.c
@@ -1,5 +1,5 @@
/* Split a 'long double' into fraction and mantissa, for hexadecimal printf.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/printf-frexpl.h b/lib/printf-frexpl.h
index 29825e86..890fd504 100644
--- a/lib/printf-frexpl.h
+++ b/lib/printf-frexpl.h
@@ -1,5 +1,5 @@
/* Split a 'long double' into fraction and mantissa, for hexadecimal printf.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/printf-parse.c b/lib/printf-parse.c
index 131d0f00..40d0a226 100644
--- a/lib/printf-parse.c
+++ b/lib/printf-parse.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 1999-2000, 2002-2003, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002-2003, 2006-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/printf-parse.h b/lib/printf-parse.h
index 2651195f..fda6704f 100644
--- a/lib/printf-parse.h
+++ b/lib/printf-parse.h
@@ -1,5 +1,5 @@
/* Parse printf format string.
- Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2014 Free Software
+ Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/priv-set.c b/lib/priv-set.c
index 08843606..6ea070ac 100644
--- a/lib/priv-set.c
+++ b/lib/priv-set.c
@@ -1,6 +1,6 @@
/* Query, remove, or restore a Solaris privilege.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/priv-set.h b/lib/priv-set.h
index ff5877c1..b71d4180 100644
--- a/lib/priv-set.h
+++ b/lib/priv-set.h
@@ -1,6 +1,6 @@
/* Query, remove, or restore a Solaris privilege.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/progname.c b/lib/progname.c
index 2919be99..fe93bcaf 100644
--- a/lib/progname.c
+++ b/lib/progname.c
@@ -1,5 +1,5 @@
/* Program name management.
- Copyright (C) 2001-2003, 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003, 2005-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/progname.h b/lib/progname.h
index fa15871d..d1e034f9 100644
--- a/lib/progname.h
+++ b/lib/progname.h
@@ -1,5 +1,5 @@
/* Program name management.
- Copyright (C) 2001-2004, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2006, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/propername.c b/lib/propername.c
index 54a6adaf..293e7e31 100644
--- a/lib/propername.c
+++ b/lib/propername.c
@@ -1,5 +1,5 @@
/* Localization of proper names.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2006.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/propername.h b/lib/propername.h
index 7e3de0fc..9034d35b 100644
--- a/lib/propername.h
+++ b/lib/propername.h
@@ -1,5 +1,5 @@
/* Localization of proper names.
- Copyright (C) 2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2008-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2006.
This program is free software: you can redistribute it and/or modify
@@ -26,12 +26,12 @@
have in common?
A non-ASCII name. This causes trouble in the --version output. The simple
- "solution", unfortunately mutilates the name.
+ "solution" unfortunately mutilates the name.
- $ du --version| grep Granlund
+ $ du --version | grep Granlund
Écrit par Torbjorn Granlund, David MacKenzie, Paul Eggert et Jim Meyering.
- $ ptx --version| grep Pinard
+ $ ptx --version | grep Pinard
Écrit par F. Pinard.
What is desirable, is to print the full name if the output character set
@@ -51,11 +51,11 @@
output will look like this:
<translated name> (<original name in English>)
- To use the 'propername' module is done in three simple steps:
+ To use the 'propername' module requires three simple steps:
1) Add it to the list of gnulib modules to import,
- 2) Change the arguments of version_etc, from
+ 2) Change the arguments of version_etc(),
from "Paul Eggert"
to proper_name ("Paul Eggert")
diff --git a/lib/pthread.in.h b/lib/pthread.in.h
index 9d263953..5825e8cd 100644
--- a/lib/pthread.in.h
+++ b/lib/pthread.in.h
@@ -1,6 +1,6 @@
/* Implement a trivial subset of POSIX 1003.1-2008 pthread.h.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/putenv.c b/lib/putenv.c
index b9f50792..925bb2f4 100644
--- a/lib/putenv.c
+++ b/lib/putenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2014 Free Software
+/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2015 Free Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
diff --git a/lib/qcopy-acl.c b/lib/qcopy-acl.c
index 4e53b633..c4507424 100644
--- a/lib/qcopy-acl.c
+++ b/lib/qcopy-acl.c
@@ -1,6 +1,6 @@
/* copy-acl.c - copy access control list from one file to another file
- Copyright (C) 2002-2003, 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -39,545 +39,13 @@ int
qcopy_acl (const char *src_name, int source_desc, const char *dst_name,
int dest_desc, mode_t mode)
{
-#if USE_ACL && HAVE_ACL_GET_FILE
- /* POSIX 1003.1e (draft 17 -- abandoned) specific version. */
- /* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
-# if !HAVE_ACL_TYPE_EXTENDED
- /* Linux, FreeBSD, IRIX, Tru64 */
-
- acl_t acl;
- int ret;
-
- if (HAVE_ACL_GET_FD && source_desc != -1)
- acl = acl_get_fd (source_desc);
- else
- acl = acl_get_file (src_name, ACL_TYPE_ACCESS);
- if (acl == NULL)
- {
- if (! acl_errno_valid (errno))
- return qset_acl (dst_name, dest_desc, mode);
- else
- return -2;
- }
-
- if (HAVE_ACL_SET_FD && dest_desc != -1)
- ret = acl_set_fd (dest_desc, acl);
- else
- ret = acl_set_file (dst_name, ACL_TYPE_ACCESS, acl);
- if (ret != 0)
- {
- int saved_errno = errno;
-
- if (! acl_errno_valid (errno) && !acl_access_nontrivial (acl))
- {
- acl_free (acl);
- return chmod_or_fchmod (dst_name, dest_desc, mode);
- }
- else
- {
- acl_free (acl);
- chmod_or_fchmod (dst_name, dest_desc, mode);
- errno = saved_errno;
- return -1;
- }
- }
- else
- acl_free (acl);
-
- if (!MODE_INSIDE_ACL || (mode & (S_ISUID | S_ISGID | S_ISVTX)))
- {
- /* We did not call chmod so far, and either the mode and the ACL are
- separate or special bits are to be set which don't fit into ACLs. */
-
- if (chmod_or_fchmod (dst_name, dest_desc, mode) != 0)
- return -1;
- }
-
- if (S_ISDIR (mode))
- {
- acl = acl_get_file (src_name, ACL_TYPE_DEFAULT);
- if (acl == NULL)
- return -2;
-
- if (acl_set_file (dst_name, ACL_TYPE_DEFAULT, acl))
- {
- int saved_errno = errno;
-
- acl_free (acl);
- errno = saved_errno;
- return -1;
- }
- else
- acl_free (acl);
- }
- return 0;
-
-# else /* HAVE_ACL_TYPE_EXTENDED */
- /* Mac OS X */
-
- /* On Mac OS X, acl_get_file (name, ACL_TYPE_ACCESS)
- and acl_get_file (name, ACL_TYPE_DEFAULT)
- always return NULL / EINVAL. You have to use
- acl_get_file (name, ACL_TYPE_EXTENDED)
- or acl_get_fd (open (name, ...))
- to retrieve an ACL.
- On the other hand,
- acl_set_file (name, ACL_TYPE_ACCESS, acl)
- and acl_set_file (name, ACL_TYPE_DEFAULT, acl)
- have the same effect as
- acl_set_file (name, ACL_TYPE_EXTENDED, acl):
- Each of these calls sets the file's ACL. */
-
- acl_t acl;
+ struct permission_context ctx;
int ret;
- if (HAVE_ACL_GET_FD && source_desc != -1)
- acl = acl_get_fd (source_desc);
- else
- acl = acl_get_file (src_name, ACL_TYPE_EXTENDED);
- if (acl == NULL)
- {
- if (!acl_errno_valid (errno))
- return qset_acl (dst_name, dest_desc, mode);
- else
- return -2;
- }
-
- if (HAVE_ACL_SET_FD && dest_desc != -1)
- ret = acl_set_fd (dest_desc, acl);
- else
- ret = acl_set_file (dst_name, ACL_TYPE_EXTENDED, acl);
+ ret = get_permissions (src_name, source_desc, mode, &ctx);
if (ret != 0)
- {
- int saved_errno = errno;
-
- if (!acl_errno_valid (saved_errno) && !acl_extended_nontrivial (acl))
- {
- acl_free (acl);
- return chmod_or_fchmod (dst_name, dest_desc, mode);
- }
- else
- {
- acl_free (acl);
- chmod_or_fchmod (dst_name, dest_desc, mode);
- errno = saved_errno;
- return -1;
- }
- }
- else
- acl_free (acl);
-
- /* Since !MODE_INSIDE_ACL, we have to call chmod explicitly. */
- return chmod_or_fchmod (dst_name, dest_desc, mode);
-
-# endif
-
-#elif USE_ACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
-
- /* Solaris 2.5 through Solaris 10, Cygwin, and contemporaneous versions
- of Unixware. The acl() call returns the access and default ACL both
- at once. */
-# ifdef ACE_GETACL
- int ace_count;
- ace_t *ace_entries;
-# endif
- int count;
- aclent_t *entries;
- int did_chmod;
- int saved_errno;
- int ret;
-
-# ifdef ACE_GETACL
- /* Solaris also has a different variant of ACLs, used in ZFS and NFSv4
- file systems (whereas the other ones are used in UFS file systems).
- There is an API
- pathconf (name, _PC_ACL_ENABLED)
- fpathconf (desc, _PC_ACL_ENABLED)
- that allows to determine which of the two kinds of ACLs is supported
- for the given file. But some file systems may implement this call
- incorrectly, so better not use it.
- When fetching the source ACL, we simply fetch both ACL types.
- When setting the destination ACL, we try either ACL types, assuming
- that the kernel will translate the ACL from one form to the other.
- (See in <http://docs.sun.com/app/docs/doc/819-2241/6n4huc7ia?l=en&a=view>
- the description of ENOTSUP.) */
- for (;;)
- {
- ace_count = (source_desc != -1
- ? facl (source_desc, ACE_GETACLCNT, 0, NULL)
- : acl (src_name, ACE_GETACLCNT, 0, NULL));
-
- if (ace_count < 0)
- {
- if (errno == ENOSYS || errno == EINVAL)
- {
- ace_count = 0;
- ace_entries = NULL;
- break;
- }
- else
- return -2;
- }
-
- if (ace_count == 0)
- {
- ace_entries = NULL;
- break;
- }
-
- ace_entries = (ace_t *) malloc (ace_count * sizeof (ace_t));
- if (ace_entries == NULL)
- {
- errno = ENOMEM;
- return -2;
- }
-
- ret = (source_desc != -1
- ? facl (source_desc, ACE_GETACL, ace_count, ace_entries)
- : acl (src_name, ACE_GETACL, ace_count, ace_entries));
- if (ret < 0)
- {
- free (ace_entries);
- if (errno == ENOSYS || errno == EINVAL)
- {
- ace_count = 0;
- ace_entries = NULL;
- break;
- }
- else
- return -2;
- }
- if (ret == ace_count)
- break;
- /* Huh? The number of ACL entries changed since the last call.
- Repeat. */
- }
-# endif
-
- for (;;)
- {
- count = (source_desc != -1
- ? facl (source_desc, GETACLCNT, 0, NULL)
- : acl (src_name, GETACLCNT, 0, NULL));
-
- if (count < 0)
- {
- if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP)
- {
- count = 0;
- entries = NULL;
- break;
- }
- else
- return -2;
- }
-
- if (count == 0)
- {
- entries = NULL;
- break;
- }
-
- entries = (aclent_t *) malloc (count * sizeof (aclent_t));
- if (entries == NULL)
- {
- errno = ENOMEM;
- return -2;
- }
-
- if ((source_desc != -1
- ? facl (source_desc, GETACL, count, entries)
- : acl (src_name, GETACL, count, entries))
- == count)
- break;
- /* Huh? The number of ACL entries changed since the last call.
- Repeat. */
- }
-
- /* Is there an ACL of either kind? */
-# ifdef ACE_GETACL
- if (ace_count == 0)
-# endif
- if (count == 0)
- return qset_acl (dst_name, dest_desc, mode);
-
- did_chmod = 0; /* set to 1 once the mode bits in 0777 have been set */
- saved_errno = 0; /* the first non-ignorable error code */
-
- if (!MODE_INSIDE_ACL)
- {
- /* On Cygwin, it is necessary to call chmod before acl, because
- chmod can change the contents of the ACL (in ways that don't
- change the allowed accesses, but still visible). */
- if (chmod_or_fchmod (dst_name, dest_desc, mode) != 0)
- saved_errno = errno;
- did_chmod = 1;
- }
-
- /* If both ace_entries and entries are available, try SETACL before
- ACE_SETACL, because SETACL cannot fail with ENOTSUP whereas ACE_SETACL
- can. */
-
- if (count > 0)
- {
- ret = (dest_desc != -1
- ? facl (dest_desc, SETACL, count, entries)
- : acl (dst_name, SETACL, count, entries));
- if (ret < 0 && saved_errno == 0)
- {
- saved_errno = errno;
- if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
- && !acl_nontrivial (count, entries))
- saved_errno = 0;
- }
- else
- did_chmod = 1;
- }
- free (entries);
-
-# ifdef ACE_GETACL
- if (ace_count > 0)
- {
- ret = (dest_desc != -1
- ? facl (dest_desc, ACE_SETACL, ace_count, ace_entries)
- : acl (dst_name, ACE_SETACL, ace_count, ace_entries));
- if (ret < 0 && saved_errno == 0)
- {
- saved_errno = errno;
- if ((errno == ENOSYS || errno == EINVAL || errno == ENOTSUP)
- && !acl_ace_nontrivial (ace_count, ace_entries))
- saved_errno = 0;
- }
- }
- free (ace_entries);
-# endif
-
- if (MODE_INSIDE_ACL
- && did_chmod <= ((mode & (S_ISUID | S_ISGID | S_ISVTX)) ? 1 : 0))
- {
- /* We did not call chmod so far, and either the mode and the ACL are
- separate or special bits are to be set which don't fit into ACLs. */
-
- if (chmod_or_fchmod (dst_name, dest_desc, mode) != 0)
- {
- if (saved_errno == 0)
- saved_errno = errno;
- }
- }
-
- if (saved_errno)
- {
- errno = saved_errno;
- return -1;
- }
- return 0;
-
-#elif USE_ACL && HAVE_GETACL /* HP-UX */
-
- struct acl_entry entries[NACLENTRIES];
- int count;
-# if HAVE_ACLV_H
- struct acl aclv_entries[NACLVENTRIES];
- int aclv_count;
-# endif
- int did_chmod;
- int saved_errno;
- int ret;
-
- count = (source_desc != -1
- ? fgetacl (source_desc, NACLENTRIES, entries)
- : getacl (src_name, NACLENTRIES, entries));
-
- if (count < 0)
- {
- if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
- count = 0;
- else
- return -2;
- }
- else if (count > 0)
- {
- if (count > NACLENTRIES)
- /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
- abort ();
- }
-
-# if HAVE_ACLV_H
- aclv_count = acl ((char *) src_name, ACL_GET, NACLVENTRIES, aclv_entries);
-
- if (aclv_count < 0)
- {
- if (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
- count = 0;
- else
- return -2;
- }
- else if (aclv_count > 0)
- {
- if (aclv_count > NACLVENTRIES)
- /* If NACLVENTRIES cannot be trusted, use dynamic memory allocation. */
- abort ();
- }
-# endif
-
- if (count == 0)
-# if HAVE_ACLV_H
- if (aclv_count == 0)
-# endif
- return qset_acl (dst_name, dest_desc, mode);
-
- did_chmod = 0; /* set to 1 once the mode bits in 0777 have been set */
- saved_errno = 0; /* the first non-ignorable error code */
-
- if (count > 0)
- {
- ret = (dest_desc != -1
- ? fsetacl (dest_desc, count, entries)
- : setacl (dst_name, count, entries));
- if (ret < 0 && saved_errno == 0)
- {
- saved_errno = errno;
- if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
- {
- struct stat source_statbuf;
-
- if ((source_desc != -1
- ? fstat (source_desc, &source_statbuf)
- : stat (src_name, &source_statbuf)) == 0)
- {
- if (!acl_nontrivial (count, entries, &source_statbuf))
- saved_errno = 0;
- }
- else
- saved_errno = errno;
- }
- }
- else
- did_chmod = 1;
- }
-
-# if HAVE_ACLV_H
- if (aclv_count > 0)
- {
- ret = acl ((char *) dst_name, ACL_SET, aclv_count, aclv_entries);
- if (ret < 0 && saved_errno == 0)
- {
- saved_errno = errno;
- if (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
- {
- if (!aclv_nontrivial (aclv_count, aclv_entries))
- saved_errno = 0;
- }
- }
- else
- did_chmod = 1;
- }
-# endif
-
- if (did_chmod <= ((mode & (S_ISUID | S_ISGID | S_ISVTX)) ? 1 : 0))
- {
- /* We did not call chmod so far, and special bits are to be set which
- don't fit into ACLs. */
-
- if (chmod_or_fchmod (dst_name, dest_desc, mode) != 0)
- {
- if (saved_errno == 0)
- saved_errno = errno;
- }
- }
-
- if (saved_errno)
- {
- errno = saved_errno;
- return -1;
- }
- return 0;
-
-#elif USE_ACL && HAVE_ACLX_GET && 0 /* AIX */
-
- /* TODO */
-
-#elif USE_ACL && HAVE_STATACL /* older AIX */
-
- union { struct acl a; char room[4096]; } u;
- int ret;
-
- if ((source_desc != -1
- ? fstatacl (source_desc, STX_NORMAL, &u.a, sizeof (u))
- : statacl (src_name, STX_NORMAL, &u.a, sizeof (u)))
- < 0)
return -2;
-
- ret = (dest_desc != -1
- ? fchacl (dest_desc, &u.a, u.a.acl_len)
- : chacl (dst_name, &u.a, u.a.acl_len));
- if (ret < 0)
- {
- int saved_errno = errno;
-
- chmod_or_fchmod (dst_name, dest_desc, mode);
- errno = saved_errno;
- return -1;
- }
-
- /* No need to call chmod_or_fchmod at this point, since the mode bits
- S_ISUID, S_ISGID, S_ISVTX are also stored in the ACL. */
-
- return 0;
-
-#elif USE_ACL && HAVE_ACLSORT /* NonStop Kernel */
-
- struct acl entries[NACLENTRIES];
- int count;
- int ret;
-
- count = acl ((char *) src_name, ACL_GET, NACLENTRIES, entries);
-
- if (count < 0)
- {
- if (0)
- count = 0;
- else
- return -2;
- }
- else if (count > 0)
- {
- if (count > NACLENTRIES)
- /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
- abort ();
- }
-
- if (count == 0)
- return qset_acl (dst_name, dest_desc, mode);
-
- ret = acl ((char *) dst_name, ACL_SET, count, entries);
- if (ret < 0)
- {
- int saved_errno = errno;
-
- if (0)
- {
- if (!acl_nontrivial (count, entries))
- return chmod_or_fchmod (dst_name, dest_desc, mode);
- }
-
- chmod_or_fchmod (dst_name, dest_desc, mode);
- errno = saved_errno;
- return -1;
- }
-
- if (mode & (S_ISUID | S_ISGID | S_ISVTX))
- {
- /* We did not call chmod so far, and either the mode and the ACL are
- separate or special bits are to be set which don't fit into ACLs. */
-
- return chmod_or_fchmod (dst_name, dest_desc, mode);
- }
- return 0;
-
-#else
-
- return qset_acl (dst_name, dest_desc, mode);
-
-#endif
+ ret = set_permissions (&ctx, dst_name, dest_desc);
+ free_permission_context (&ctx);
+ return ret;
}
diff --git a/lib/qset-acl.c b/lib/qset-acl.c
index 7d9af573..1ebec22f 100644
--- a/lib/qset-acl.c
+++ b/lib/qset-acl.c
@@ -1,6 +1,6 @@
/* qset-acl.c - set access control list equivalent to a mode
- Copyright (C) 2002-2003, 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,26 +21,12 @@
#define ACL_INTERNAL_INLINE _GL_EXTERN_INLINE
+#include <string.h>
#include "acl.h"
#include "acl-internal.h"
-/* If DESC is a valid file descriptor use fchmod to change the
- file's mode to MODE on systems that have fchmod. On systems
- that don't have fchmod and if DESC is invalid, use chmod on
- NAME instead.
- Return 0 if successful. Return -1 and set errno upon failure. */
-
-int
-chmod_or_fchmod (const char *name, int desc, mode_t mode)
-{
- if (HAVE_FCHMOD && desc != -1)
- return fchmod (desc, mode);
- else
- return chmod (name, mode);
-}
-
/* Set the access control lists of a file. If DESC is a valid file
descriptor, use file descriptor operations where available, else use
filename based operations on NAME. If access control lists are not
@@ -52,625 +38,12 @@ chmod_or_fchmod (const char *name, int desc, mode_t mode)
int
qset_acl (char const *name, int desc, mode_t mode)
{
-#if USE_ACL
-# if HAVE_ACL_GET_FILE
- /* POSIX 1003.1e draft 17 (abandoned) specific version. */
- /* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
-# if !HAVE_ACL_TYPE_EXTENDED
- /* Linux, FreeBSD, IRIX, Tru64 */
-
- /* We must also have acl_from_text and acl_delete_def_file.
- (acl_delete_def_file could be emulated with acl_init followed
- by acl_set_file, but acl_set_file with an empty acl is
- unspecified.) */
-
-# ifndef HAVE_ACL_FROM_TEXT
-# error Must have acl_from_text (see POSIX 1003.1e draft 17).
-# endif
-# ifndef HAVE_ACL_DELETE_DEF_FILE
-# error Must have acl_delete_def_file (see POSIX 1003.1e draft 17).
-# endif
-
- acl_t acl;
- int ret;
-
- if (HAVE_ACL_FROM_MODE) /* Linux */
- {
- acl = acl_from_mode (mode);
- if (!acl)
- return -1;
- }
- else /* FreeBSD, IRIX, Tru64 */
- {
- /* If we were to create the ACL using the functions acl_init(),
- acl_create_entry(), acl_set_tag_type(), acl_set_qualifier(),
- acl_get_permset(), acl_clear_perm[s](), acl_add_perm(), we
- would need to create a qualifier. I don't know how to do this.
- So create it using acl_from_text(). */
-
-# if HAVE_ACL_FREE_TEXT /* Tru64 */
- char acl_text[] = "u::---,g::---,o::---,";
-# else /* FreeBSD, IRIX */
- char acl_text[] = "u::---,g::---,o::---";
-# endif
-
- if (mode & S_IRUSR) acl_text[ 3] = 'r';
- if (mode & S_IWUSR) acl_text[ 4] = 'w';
- if (mode & S_IXUSR) acl_text[ 5] = 'x';
- if (mode & S_IRGRP) acl_text[10] = 'r';
- if (mode & S_IWGRP) acl_text[11] = 'w';
- if (mode & S_IXGRP) acl_text[12] = 'x';
- if (mode & S_IROTH) acl_text[17] = 'r';
- if (mode & S_IWOTH) acl_text[18] = 'w';
- if (mode & S_IXOTH) acl_text[19] = 'x';
-
- acl = acl_from_text (acl_text);
- if (!acl)
- return -1;
- }
- if (HAVE_ACL_SET_FD && desc != -1)
- ret = acl_set_fd (desc, acl);
- else
- ret = acl_set_file (name, ACL_TYPE_ACCESS, acl);
- if (ret != 0)
- {
- int saved_errno = errno;
- acl_free (acl);
- if (! acl_errno_valid (errno))
- return chmod_or_fchmod (name, desc, mode);
- errno = saved_errno;
- return -1;
- }
- else
- acl_free (acl);
-
- if (S_ISDIR (mode) && acl_delete_def_file (name))
- return -1;
-
- if (!MODE_INSIDE_ACL || (mode & (S_ISUID | S_ISGID | S_ISVTX)))
- {
- /* We did not call chmod so far, and either the mode and the ACL are
- separate or special bits are to be set which don't fit into ACLs. */
- return chmod_or_fchmod (name, desc, mode);
- }
- return 0;
-
-# else /* HAVE_ACL_TYPE_EXTENDED */
- /* Mac OS X */
-
- /* On Mac OS X, acl_get_file (name, ACL_TYPE_ACCESS)
- and acl_get_file (name, ACL_TYPE_DEFAULT)
- always return NULL / EINVAL. You have to use
- acl_get_file (name, ACL_TYPE_EXTENDED)
- or acl_get_fd (open (name, ...))
- to retrieve an ACL.
- On the other hand,
- acl_set_file (name, ACL_TYPE_ACCESS, acl)
- and acl_set_file (name, ACL_TYPE_DEFAULT, acl)
- have the same effect as
- acl_set_file (name, ACL_TYPE_EXTENDED, acl):
- Each of these calls sets the file's ACL. */
-
- acl_t acl;
+ struct permission_context ctx;
int ret;
- /* Remove the ACL if the file has ACLs. */
- if (HAVE_ACL_GET_FD && desc != -1)
- acl = acl_get_fd (desc);
- else
- acl = acl_get_file (name, ACL_TYPE_EXTENDED);
- if (acl)
- {
- acl_free (acl);
-
- acl = acl_init (0);
- if (acl)
- {
- if (HAVE_ACL_SET_FD && desc != -1)
- ret = acl_set_fd (desc, acl);
- else
- ret = acl_set_file (name, ACL_TYPE_EXTENDED, acl);
- if (ret != 0)
- {
- int saved_errno = errno;
- acl_free (acl);
- if (! acl_errno_valid (saved_errno))
- return chmod_or_fchmod (name, desc, mode);
- errno = saved_errno;
- return -1;
- }
- acl_free (acl);
- }
- }
-
- /* Since !MODE_INSIDE_ACL, we have to call chmod explicitly. */
- return chmod_or_fchmod (name, desc, mode);
-# endif
-
-# elif HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
-
- int done_setacl = 0;
-
-# ifdef ACE_GETACL
- /* Solaris also has a different variant of ACLs, used in ZFS and NFSv4
- file systems (whereas the other ones are used in UFS file systems). */
-
- /* The flags in the ace_t structure changed in a binary incompatible way
- when ACL_NO_TRIVIAL etc. were introduced in <sys/acl.h> version 1.15.
- How to distinguish the two conventions at runtime?
- We fetch the existing ACL. In the old convention, usually three ACEs have
- a_flags = ACE_OWNER / ACE_GROUP / ACE_OTHER, in the range 0x0100..0x0400.
- In the new convention, these values are not used. */
- int convention;
-
- {
- /* Initially, try to read the entries into a stack-allocated buffer.
- Use malloc if it does not fit. */
- enum
- {
- alloc_init = 4000 / sizeof (ace_t), /* >= 3 */
- alloc_max = MIN (INT_MAX, SIZE_MAX / sizeof (ace_t))
- };
- ace_t buf[alloc_init];
- size_t alloc = alloc_init;
- ace_t *entries = buf;
- ace_t *malloced = NULL;
- int count;
-
- for (;;)
- {
- count = (desc != -1
- ? facl (desc, ACE_GETACL, alloc, entries)
- : acl (name, ACE_GETACL, alloc, entries));
- if (count < 0 && errno == ENOSPC)
- {
- /* Increase the size of the buffer. */
- free (malloced);
- if (alloc > alloc_max / 2)
- {
- errno = ENOMEM;
- return -1;
- }
- alloc = 2 * alloc; /* <= alloc_max */
- entries = malloced = (ace_t *) malloc (alloc * sizeof (ace_t));
- if (entries == NULL)
- {
- errno = ENOMEM;
- return -1;
- }
- continue;
- }
- break;
- }
-
- if (count <= 0)
- convention = -1;
- else
- {
- int i;
-
- convention = 0;
- for (i = 0; i < count; i++)
- if (entries[i].a_flags & (OLD_ACE_OWNER | OLD_ACE_GROUP | OLD_ACE_OTHER))
- {
- convention = 1;
- break;
- }
- }
- free (malloced);
- }
-
- if (convention >= 0)
- {
- ace_t entries[6];
- int count;
- int ret;
-
- if (convention)
- {
- /* Running on Solaris 10. */
- entries[0].a_type = OLD_ALLOW;
- entries[0].a_flags = OLD_ACE_OWNER;
- entries[0].a_who = 0; /* irrelevant */
- entries[0].a_access_mask = (mode >> 6) & 7;
- entries[1].a_type = OLD_ALLOW;
- entries[1].a_flags = OLD_ACE_GROUP;
- entries[1].a_who = 0; /* irrelevant */
- entries[1].a_access_mask = (mode >> 3) & 7;
- entries[2].a_type = OLD_ALLOW;
- entries[2].a_flags = OLD_ACE_OTHER;
- entries[2].a_who = 0;
- entries[2].a_access_mask = mode & 7;
- count = 3;
- }
- else
- {
- /* Running on Solaris 10 (newer version) or Solaris 11.
- The details here were found through "/bin/ls -lvd somefiles". */
- entries[0].a_type = NEW_ACE_ACCESS_DENIED_ACE_TYPE;
- entries[0].a_flags = NEW_ACE_OWNER;
- entries[0].a_who = 0; /* irrelevant */
- entries[0].a_access_mask = 0;
- entries[1].a_type = NEW_ACE_ACCESS_ALLOWED_ACE_TYPE;
- entries[1].a_flags = NEW_ACE_OWNER;
- entries[1].a_who = 0; /* irrelevant */
- entries[1].a_access_mask = NEW_ACE_WRITE_NAMED_ATTRS
- | NEW_ACE_WRITE_ATTRIBUTES
- | NEW_ACE_WRITE_ACL
- | NEW_ACE_WRITE_OWNER;
- if (mode & 0400)
- entries[1].a_access_mask |= NEW_ACE_READ_DATA;
- else
- entries[0].a_access_mask |= NEW_ACE_READ_DATA;
- if (mode & 0200)
- entries[1].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
- else
- entries[0].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
- if (mode & 0100)
- entries[1].a_access_mask |= NEW_ACE_EXECUTE;
- else
- entries[0].a_access_mask |= NEW_ACE_EXECUTE;
- entries[2].a_type = NEW_ACE_ACCESS_DENIED_ACE_TYPE;
- entries[2].a_flags = NEW_ACE_GROUP | NEW_ACE_IDENTIFIER_GROUP;
- entries[2].a_who = 0; /* irrelevant */
- entries[2].a_access_mask = 0;
- entries[3].a_type = NEW_ACE_ACCESS_ALLOWED_ACE_TYPE;
- entries[3].a_flags = NEW_ACE_GROUP | NEW_ACE_IDENTIFIER_GROUP;
- entries[3].a_who = 0; /* irrelevant */
- entries[3].a_access_mask = 0;
- if (mode & 0040)
- entries[3].a_access_mask |= NEW_ACE_READ_DATA;
- else
- entries[2].a_access_mask |= NEW_ACE_READ_DATA;
- if (mode & 0020)
- entries[3].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
- else
- entries[2].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
- if (mode & 0010)
- entries[3].a_access_mask |= NEW_ACE_EXECUTE;
- else
- entries[2].a_access_mask |= NEW_ACE_EXECUTE;
- entries[4].a_type = NEW_ACE_ACCESS_DENIED_ACE_TYPE;
- entries[4].a_flags = NEW_ACE_EVERYONE;
- entries[4].a_who = 0;
- entries[4].a_access_mask = NEW_ACE_WRITE_NAMED_ATTRS
- | NEW_ACE_WRITE_ATTRIBUTES
- | NEW_ACE_WRITE_ACL
- | NEW_ACE_WRITE_OWNER;
- entries[5].a_type = NEW_ACE_ACCESS_ALLOWED_ACE_TYPE;
- entries[5].a_flags = NEW_ACE_EVERYONE;
- entries[5].a_who = 0;
- entries[5].a_access_mask = NEW_ACE_READ_NAMED_ATTRS
- | NEW_ACE_READ_ATTRIBUTES
- | NEW_ACE_READ_ACL
- | NEW_ACE_SYNCHRONIZE;
- if (mode & 0004)
- entries[5].a_access_mask |= NEW_ACE_READ_DATA;
- else
- entries[4].a_access_mask |= NEW_ACE_READ_DATA;
- if (mode & 0002)
- entries[5].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
- else
- entries[4].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
- if (mode & 0001)
- entries[5].a_access_mask |= NEW_ACE_EXECUTE;
- else
- entries[4].a_access_mask |= NEW_ACE_EXECUTE;
- count = 6;
- }
- if (desc != -1)
- ret = facl (desc, ACE_SETACL, count, entries);
- else
- ret = acl (name, ACE_SETACL, count, entries);
- if (ret < 0 && errno != EINVAL && errno != ENOTSUP)
- {
- if (errno == ENOSYS)
- return chmod_or_fchmod (name, desc, mode);
- return -1;
- }
- if (ret == 0)
- done_setacl = 1;
- }
-# endif
-
- if (!done_setacl)
- {
- aclent_t entries[3];
- int ret;
-
- entries[0].a_type = USER_OBJ;
- entries[0].a_id = 0; /* irrelevant */
- entries[0].a_perm = (mode >> 6) & 7;
- entries[1].a_type = GROUP_OBJ;
- entries[1].a_id = 0; /* irrelevant */
- entries[1].a_perm = (mode >> 3) & 7;
- entries[2].a_type = OTHER_OBJ;
- entries[2].a_id = 0;
- entries[2].a_perm = mode & 7;
-
- if (desc != -1)
- ret = facl (desc, SETACL,
- sizeof (entries) / sizeof (aclent_t), entries);
- else
- ret = acl (name, SETACL,
- sizeof (entries) / sizeof (aclent_t), entries);
- if (ret < 0)
- {
- if (errno == ENOSYS || errno == EOPNOTSUPP)
- return chmod_or_fchmod (name, desc, mode);
- return -1;
- }
- }
-
- if (!MODE_INSIDE_ACL || (mode & (S_ISUID | S_ISGID | S_ISVTX)))
- {
- /* We did not call chmod so far, so the special bits have not yet
- been set. */
- return chmod_or_fchmod (name, desc, mode);
- }
- return 0;
-
-# elif HAVE_GETACL /* HP-UX */
-
- struct stat statbuf;
- int ret;
-
- if (desc != -1)
- ret = fstat (desc, &statbuf);
- else
- ret = stat (name, &statbuf);
- if (ret < 0)
- return -1;
-
- {
- struct acl_entry entries[3];
-
- entries[0].uid = statbuf.st_uid;
- entries[0].gid = ACL_NSGROUP;
- entries[0].mode = (mode >> 6) & 7;
- entries[1].uid = ACL_NSUSER;
- entries[1].gid = statbuf.st_gid;
- entries[1].mode = (mode >> 3) & 7;
- entries[2].uid = ACL_NSUSER;
- entries[2].gid = ACL_NSGROUP;
- entries[2].mode = mode & 7;
-
- if (desc != -1)
- ret = fsetacl (desc, sizeof (entries) / sizeof (struct acl_entry), entries);
- else
- ret = setacl (name, sizeof (entries) / sizeof (struct acl_entry), entries);
- }
- if (ret < 0)
- {
- if (!(errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP))
- return -1;
-
-# if HAVE_ACLV_H /* HP-UX >= 11.11 */
- {
- struct acl entries[4];
-
- entries[0].a_type = USER_OBJ;
- entries[0].a_id = 0; /* irrelevant */
- entries[0].a_perm = (mode >> 6) & 7;
- entries[1].a_type = GROUP_OBJ;
- entries[1].a_id = 0; /* irrelevant */
- entries[1].a_perm = (mode >> 3) & 7;
- entries[2].a_type = CLASS_OBJ;
- entries[2].a_id = 0;
- entries[2].a_perm = (mode >> 3) & 7;
- entries[3].a_type = OTHER_OBJ;
- entries[3].a_id = 0;
- entries[3].a_perm = mode & 7;
-
- ret = aclsort (sizeof (entries) / sizeof (struct acl), 1, entries);
- if (ret > 0)
- abort ();
- if (ret < 0)
- {
- if (0)
- return chmod_or_fchmod (name, desc, mode);
- return -1;
- }
-
- ret = acl ((char *) name, ACL_SET,
- sizeof (entries) / sizeof (struct acl), entries);
- if (ret < 0)
- {
- if (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
- return chmod_or_fchmod (name, desc, mode);
- return -1;
- }
- }
-# else
- return chmod_or_fchmod (name, desc, mode);
-# endif
- }
-
- if (mode & (S_ISUID | S_ISGID | S_ISVTX))
- {
- /* We did not call chmod so far, so the special bits have not yet
- been set. */
- return chmod_or_fchmod (name, desc, mode);
- }
- return 0;
-
-# elif HAVE_ACLX_GET && defined ACL_AIX_WIP /* AIX */
-
- acl_type_list_t types;
- size_t types_size = sizeof (types);
- acl_type_t type;
-
- if (aclx_gettypes (name, &types, &types_size) < 0
- || types.num_entries == 0)
- return chmod_or_fchmod (name, desc, mode);
-
- /* XXX Do we need to clear all types of ACLs for the given file, or is it
- sufficient to clear the first one? */
- type = types.entries[0];
- if (type.u64 == ACL_AIXC)
- {
- union { struct acl a; char room[128]; } u;
- int ret;
-
- u.a.acl_len = (char *) &u.a.acl_ext[0] - (char *) &u.a; /* no entries */
- u.a.acl_mode = mode & ~(S_IXACL | 0777);
- u.a.u_access = (mode >> 6) & 7;
- u.a.g_access = (mode >> 3) & 7;
- u.a.o_access = mode & 7;
-
- if (desc != -1)
- ret = aclx_fput (desc, SET_ACL | SET_MODE_S_BITS,
- type, &u.a, u.a.acl_len, mode);
- else
- ret = aclx_put (name, SET_ACL | SET_MODE_S_BITS,
- type, &u.a, u.a.acl_len, mode);
- if (!(ret < 0 && errno == ENOSYS))
- return ret;
- }
- else if (type.u64 == ACL_NFS4)
- {
- union { nfs4_acl_int_t a; char room[128]; } u;
- nfs4_ace_int_t *ace;
- int ret;
-
- u.a.aclVersion = NFS4_ACL_INT_STRUCT_VERSION;
- u.a.aclEntryN = 0;
- ace = &u.a.aclEntry[0];
- {
- ace->flags = ACE4_ID_SPECIAL;
- ace->aceWho.special_whoid = ACE4_WHO_OWNER;
- ace->aceType = ACE4_ACCESS_ALLOWED_ACE_TYPE;
- ace->aceFlags = 0;
- ace->aceMask =
- (mode & 0400 ? ACE4_READ_DATA | ACE4_LIST_DIRECTORY : 0)
- | (mode & 0200
- ? ACE4_WRITE_DATA | ACE4_ADD_FILE | ACE4_APPEND_DATA
- | ACE4_ADD_SUBDIRECTORY
- : 0)
- | (mode & 0100 ? ACE4_EXECUTE : 0);
- ace->aceWhoString[0] = '\0';
- ace->entryLen = (char *) &ace->aceWhoString[4] - (char *) ace;
- ace = (nfs4_ace_int_t *) (char *) &ace->aceWhoString[4];
- u.a.aclEntryN++;
- }
- {
- ace->flags = ACE4_ID_SPECIAL;
- ace->aceWho.special_whoid = ACE4_WHO_GROUP;
- ace->aceType = ACE4_ACCESS_ALLOWED_ACE_TYPE;
- ace->aceFlags = 0;
- ace->aceMask =
- (mode & 0040 ? ACE4_READ_DATA | ACE4_LIST_DIRECTORY : 0)
- | (mode & 0020
- ? ACE4_WRITE_DATA | ACE4_ADD_FILE | ACE4_APPEND_DATA
- | ACE4_ADD_SUBDIRECTORY
- : 0)
- | (mode & 0010 ? ACE4_EXECUTE : 0);
- ace->aceWhoString[0] = '\0';
- ace->entryLen = (char *) &ace->aceWhoString[4] - (char *) ace;
- ace = (nfs4_ace_int_t *) (char *) &ace->aceWhoString[4];
- u.a.aclEntryN++;
- }
- {
- ace->flags = ACE4_ID_SPECIAL;
- ace->aceWho.special_whoid = ACE4_WHO_EVERYONE;
- ace->aceType = ACE4_ACCESS_ALLOWED_ACE_TYPE;
- ace->aceFlags = 0;
- ace->aceMask =
- (mode & 0004 ? ACE4_READ_DATA | ACE4_LIST_DIRECTORY : 0)
- | (mode & 0002
- ? ACE4_WRITE_DATA | ACE4_ADD_FILE | ACE4_APPEND_DATA
- | ACE4_ADD_SUBDIRECTORY
- : 0)
- | (mode & 0001 ? ACE4_EXECUTE : 0);
- ace->aceWhoString[0] = '\0';
- ace->entryLen = (char *) &ace->aceWhoString[4] - (char *) ace;
- ace = (nfs4_ace_int_t *) (char *) &ace->aceWhoString[4];
- u.a.aclEntryN++;
- }
- u.a.aclLength = (char *) ace - (char *) &u.a;
-
- if (desc != -1)
- ret = aclx_fput (desc, SET_ACL | SET_MODE_S_BITS,
- type, &u.a, u.a.aclLength, mode);
- else
- ret = aclx_put (name, SET_ACL | SET_MODE_S_BITS,
- type, &u.a, u.a.aclLength, mode);
- if (!(ret < 0 && errno == ENOSYS))
- return ret;
- }
-
- return chmod_or_fchmod (name, desc, mode);
-
-# elif HAVE_STATACL /* older AIX */
-
- union { struct acl a; char room[128]; } u;
- int ret;
-
- u.a.acl_len = (char *) &u.a.acl_ext[0] - (char *) &u.a; /* no entries */
- u.a.acl_mode = mode & ~(S_IXACL | 0777);
- u.a.u_access = (mode >> 6) & 7;
- u.a.g_access = (mode >> 3) & 7;
- u.a.o_access = mode & 7;
-
- if (desc != -1)
- ret = fchacl (desc, &u.a, u.a.acl_len);
- else
- ret = chacl (name, &u.a, u.a.acl_len);
-
- if (ret < 0 && errno == ENOSYS)
- return chmod_or_fchmod (name, desc, mode);
-
+ memset (&ctx, 0, sizeof ctx);
+ ctx.mode = mode;
+ ret = set_permissions (&ctx, name, desc);
+ free_permission_context (&ctx);
return ret;
-
-# elif HAVE_ACLSORT /* NonStop Kernel */
-
- struct acl entries[4];
- int ret;
-
- entries[0].a_type = USER_OBJ;
- entries[0].a_id = 0; /* irrelevant */
- entries[0].a_perm = (mode >> 6) & 7;
- entries[1].a_type = GROUP_OBJ;
- entries[1].a_id = 0; /* irrelevant */
- entries[1].a_perm = (mode >> 3) & 7;
- entries[2].a_type = CLASS_OBJ;
- entries[2].a_id = 0;
- entries[2].a_perm = (mode >> 3) & 7;
- entries[3].a_type = OTHER_OBJ;
- entries[3].a_id = 0;
- entries[3].a_perm = mode & 7;
-
- ret = aclsort (sizeof (entries) / sizeof (struct acl), 1, entries);
- if (ret > 0)
- abort ();
- if (ret < 0)
- {
- if (0)
- return chmod_or_fchmod (name, desc, mode);
- return -1;
- }
-
- ret = acl ((char *) name, ACL_SET,
- sizeof (entries) / sizeof (struct acl), entries);
- if (ret < 0)
- {
- if (0)
- return chmod_or_fchmod (name, desc, mode);
- return -1;
- }
-
- if (mode & (S_ISUID | S_ISGID | S_ISVTX))
- {
- /* We did not call chmod so far, so the special bits have not yet
- been set. */
- return chmod_or_fchmod (name, desc, mode);
- }
- return 0;
-
-# else /* Unknown flavor of ACLs */
- return chmod_or_fchmod (name, desc, mode);
-# endif
-#else /* !USE_ACL */
- return chmod_or_fchmod (name, desc, mode);
-#endif
}
diff --git a/lib/quote.h b/lib/quote.h
index fb338a77..28c05fdd 100644
--- a/lib/quote.h
+++ b/lib/quote.h
@@ -1,6 +1,6 @@
/* quote.h - prototypes for quote.c
- Copyright (C) 1998-2001, 2003, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2001, 2003, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/quotearg.c b/lib/quotearg.c
index bef7b98b..9f916592 100644
--- a/lib/quotearg.c
+++ b/lib/quotearg.c
@@ -1,6 +1,6 @@
/* quotearg.c - quote arguments for output
- Copyright (C) 1998-2002, 2004-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2002, 2004-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/quotearg.h b/lib/quotearg.h
index da29d7b5..d0ccd8be 100644
--- a/lib/quotearg.h
+++ b/lib/quotearg.h
@@ -1,6 +1,6 @@
/* quotearg.h - quote arguments for output
- Copyright (C) 1998-2002, 2004, 2006, 2008-2014 Free Software Foundation,
+ Copyright (C) 1998-2002, 2004, 2006, 2008-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/raise.c b/lib/raise.c
index cf58a7e9..d6ba2a17 100644
--- a/lib/raise.c
+++ b/lib/raise.c
@@ -1,6 +1,6 @@
/* Provide a non-threads replacement for the POSIX raise function.
- Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/rand-isaac.c b/lib/rand-isaac.c
index c03242f6..b698ea80 100644
--- a/lib/rand-isaac.c
+++ b/lib/rand-isaac.c
@@ -1,6 +1,6 @@
/* Bob Jenkins's cryptographic random number generators, ISAAC and ISAAC64.
- Copyright (C) 1999-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2015 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999 Colin Plumb.
This program is free software: you can redistribute it and/or modify
@@ -35,6 +35,18 @@
#include "rand-isaac.h"
#include <limits.h>
+#include <string.h>
+
+/* If the platform supports unaligned access,
+ then don't have -fsanitize=undefined warn about it. */
+#undef ATTRIBUTE_NO_WARN_SANITIZE_UNDEFINED
+#if !_STRING_ARCH_unaligned \
+ || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)
+# define ATTRIBUTE_NO_WARN_SANITIZE_UNDEFINED /* empty */
+#else
+# define ATTRIBUTE_NO_WARN_SANITIZE_UNDEFINED \
+ __attribute__ ((__no_sanitize_undefined__))
+#endif
/* The minimum of two sizes A and B. */
static inline size_t
@@ -81,7 +93,7 @@ ind (isaac_word const *m, isaac_word x)
}
/* Use and update *S to generate random data to fill RESULT. */
-void
+void ATTRIBUTE_NO_WARN_SANITIZE_UNDEFINED
isaac_refill (struct isaac_state *s, isaac_word result[ISAAC_WORDS])
{
/* Caches of S->a and S->b. */
@@ -96,7 +108,7 @@ isaac_refill (struct isaac_state *s, isaac_word result[ISAAC_WORDS])
/* The central step. S->m is the whole state array, while M is a
pointer to the current word. OFF is the offset from M to the
- word ISAAC_WORDS/2 words away in the SM array, i.e. +/-
+ word ISAAC_WORDS/2 words away in the SM array, i.e., +/-
ISAAC_WORDS/2. A and B are state variables, and R the result.
This updates A, B, M[I], and R[I]. */
#define ISAAC_STEP(i, off, mix) \
diff --git a/lib/rand-isaac.h b/lib/rand-isaac.h
index a34a0a73..5f0c8646 100644
--- a/lib/rand-isaac.h
+++ b/lib/rand-isaac.h
@@ -1,6 +1,6 @@
/* Bob Jenkins's cryptographic random number generators, ISAAC and ISAAC64.
- Copyright (C) 1999-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2015 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999 Colin Plumb.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/randint.c b/lib/randint.c
index 1e5e0a0c..240fd240 100644
--- a/lib/randint.c
+++ b/lib/randint.c
@@ -1,6 +1,6 @@
/* Generate random integers.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/randint.h b/lib/randint.h
index 151edfdc..d6728c2e 100644
--- a/lib/randint.h
+++ b/lib/randint.h
@@ -1,6 +1,6 @@
/* Generate random integers.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/randperm.c b/lib/randperm.c
index 1be13511..41ea4c1a 100644
--- a/lib/randperm.c
+++ b/lib/randperm.c
@@ -1,6 +1,6 @@
/* Generate random permutations.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/randread.c b/lib/randread.c
index a073cab2..5efbd4fe 100644
--- a/lib/randread.c
+++ b/lib/randread.c
@@ -1,6 +1,6 @@
/* Generate buffers of random data.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -125,7 +125,7 @@ randread_error (void const *file_name)
{
if (file_name)
error (exit_failure, errno,
- _(errno == 0 ? "%s: end of file" : "%s: read error"),
+ errno == 0 ? _("%s: end of file") : _("%s: read error"),
quotearg_colon (file_name));
abort ();
}
diff --git a/lib/randread.h b/lib/randread.h
index 7223c9d2..c6ffc79c 100644
--- a/lib/randread.h
+++ b/lib/randread.h
@@ -1,6 +1,6 @@
/* Generate buffers of random data.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/read-file.c b/lib/read-file.c
index 45f66900..f17c5994 100644
--- a/lib/read-file.c
+++ b/lib/read-file.c
@@ -1,5 +1,5 @@
/* read-file.c -- read file contents into a string
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
Written by Simon Josefsson and Bruno Haible.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/read-file.h b/lib/read-file.h
index f458b482..b869c5ce 100644
--- a/lib/read-file.h
+++ b/lib/read-file.h
@@ -1,5 +1,5 @@
/* read-file.h -- read file contents into a string
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/read.c b/lib/read.c
index d125b51a..3d8eefa8 100644
--- a/lib/read.c
+++ b/lib/read.c
@@ -1,5 +1,5 @@
/* POSIX compatible read() function.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/readdir.c b/lib/readdir.c
index b74aebe0..8646aac4 100644
--- a/lib/readdir.c
+++ b/lib/readdir.c
@@ -1,5 +1,5 @@
/* Read the next entry of a directory.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/readlink.c b/lib/readlink.c
index 4c496395..965c3e25 100644
--- a/lib/readlink.c
+++ b/lib/readlink.c
@@ -1,5 +1,5 @@
/* Stub for readlink().
- Copyright (C) 2003-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/readlinkat.c b/lib/readlinkat.c
index c8a60500..c91cf0e8 100644
--- a/lib/readlinkat.c
+++ b/lib/readlinkat.c
@@ -1,5 +1,5 @@
/* Read a symlink relative to an open directory.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,7 +18,37 @@
#include <config.h>
+#include <errno.h>
#include <unistd.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#if HAVE_READLINKAT
+
+# undef readlinkat
+
+ssize_t
+rpl_readlinkat (int fd, char const *file, char *buf, size_t len)
+{
+# if READLINK_TRAILING_SLASH_BUG
+ size_t file_len = strlen (file);
+ if (file_len && file[file_len - 1] == '/')
+ {
+ /* Even if FILE without the slash is a symlink to a directory,
+ both lstat() and stat() must resolve the trailing slash to
+ the directory rather than the symlink. We can therefore
+ safely use stat() to distinguish between EINVAL and
+ ENOTDIR/ENOENT, avoiding extra overhead of rpl_lstat(). */
+ struct stat st;
+ if (stat (file, &st) == 0)
+ errno = EINVAL;
+ return -1;
+ }
+# endif /* READLINK_TRAILING_SLASH_BUG */
+ return readlinkat (fd, file, buf, len);
+}
+
+#else
/* Gnulib provides a readlink stub for mingw; use it for distinction
between EINVAL and ENOENT, rather than always failing with ENOSYS. */
@@ -34,14 +64,16 @@
then readlink/restore_cwd. If either the save_cwd or the restore_cwd
fails, then give a diagnostic and exit nonzero. */
-#define AT_FUNC_NAME readlinkat
-#define AT_FUNC_F1 readlink
-#define AT_FUNC_POST_FILE_PARAM_DECLS , char *buf, size_t len
-#define AT_FUNC_POST_FILE_ARGS , buf, len
-#define AT_FUNC_RESULT ssize_t
-#include "at-func.c"
-#undef AT_FUNC_NAME
-#undef AT_FUNC_F1
-#undef AT_FUNC_POST_FILE_PARAM_DECLS
-#undef AT_FUNC_POST_FILE_ARGS
-#undef AT_FUNC_RESULT
+# define AT_FUNC_NAME readlinkat
+# define AT_FUNC_F1 readlink
+# define AT_FUNC_POST_FILE_PARAM_DECLS , char *buf, size_t len
+# define AT_FUNC_POST_FILE_ARGS , buf, len
+# define AT_FUNC_RESULT ssize_t
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+# undef AT_FUNC_RESULT
+
+#endif
diff --git a/lib/readtokens.c b/lib/readtokens.c
index fbed2ca7..c46adccb 100644
--- a/lib/readtokens.c
+++ b/lib/readtokens.c
@@ -1,6 +1,6 @@
/* readtokens.c -- Functions for reading tokens from an input stream.
- Copyright (C) 1990-1991, 1999-2004, 2006, 2009-2014 Free Software
+ Copyright (C) 1990-1991, 1999-2004, 2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/readtokens.h b/lib/readtokens.h
index e03d3311..ca283af3 100644
--- a/lib/readtokens.h
+++ b/lib/readtokens.h
@@ -1,6 +1,6 @@
/* readtokens.h -- Functions for reading tokens from an input stream.
- Copyright (C) 1990-1991, 1999, 2001-2004, 2009-2014 Free Software
+ Copyright (C) 1990-1991, 1999, 2001-2004, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/readtokens0.c b/lib/readtokens0.c
index 3ced091e..d9ede92b 100644
--- a/lib/readtokens0.c
+++ b/lib/readtokens0.c
@@ -1,6 +1,6 @@
/* readtokens0.c -- Read NUL-separated tokens from an input stream.
- Copyright (C) 2004, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/readtokens0.h b/lib/readtokens0.h
index cb51f9f9..b60912de 100644
--- a/lib/readtokens0.h
+++ b/lib/readtokens0.h
@@ -1,6 +1,6 @@
/* readtokens0.h -- read NUL-separated tokens from an input stream.
- Copyright (C) 2004, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/readutmp.c b/lib/readutmp.c
index a90290b6..10050037 100644
--- a/lib/readutmp.c
+++ b/lib/readutmp.c
@@ -1,6 +1,6 @@
/* GNU's read utmp module.
- Copyright (C) 1992-2001, 2003-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1992-2001, 2003-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -97,7 +97,7 @@ read_utmp (char const *file, size_t *n_entries, STRUCT_UTMP **utmp_buf,
Solaris' utmpname returns 1 upon success -- which is contrary
to what the GNU libc version does. In addition, older GNU libc
versions are actually void. */
- UTMP_NAME_FUNCTION (file);
+ UTMP_NAME_FUNCTION ((char *) file);
SET_UTMP_ENT ();
diff --git a/lib/readutmp.h b/lib/readutmp.h
index 0c5623c2..481eead2 100644
--- a/lib/readutmp.h
+++ b/lib/readutmp.h
@@ -1,6 +1,6 @@
/* Declarations for GNU's read utmp module.
- Copyright (C) 1992-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1992-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -47,6 +47,8 @@
# define END_UTMP_ENT endutxent
# ifdef HAVE_UTMPXNAME
# define UTMP_NAME_FUNCTION utmpxname
+# elif defined UTXDB_ACTIVE
+# define UTMP_NAME_FUNCTION(x) setutxdb (UTXDB_ACTIVE, x)
# endif
# if HAVE_STRUCT_UTMPX_UT_EXIT_E_TERMINATION
diff --git a/lib/realloc.c b/lib/realloc.c
index 8dfcfbe5..068b081f 100644
--- a/lib/realloc.c
+++ b/lib/realloc.c
@@ -1,6 +1,6 @@
/* realloc() function that is glibc compatible.
- Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2014 Free Software
+ Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/ref-add.sin b/lib/ref-add.sin
index 0e140229..6cbe5b54 100644
--- a/lib/ref-add.sin
+++ b/lib/ref-add.sin
@@ -1,6 +1,6 @@
# Add this package to a list of references stored in a text file.
#
-# Copyright (C) 2000, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2009-2015 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/lib/ref-del.sin b/lib/ref-del.sin
index 2dbcf7b2..f50cf0aa 100644
--- a/lib/ref-del.sin
+++ b/lib/ref-del.sin
@@ -1,6 +1,6 @@
# Remove this package from a list of references stored in a text file.
#
-# Copyright (C) 2000, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2009-2015 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/lib/regcomp.c b/lib/regcomp.c
index a9640922..fc042fba 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
diff --git a/lib/regex.c b/lib/regex.c
index 95beb6fb..6d0ae882 100644
--- a/lib/regex.c
+++ b/lib/regex.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
diff --git a/lib/regex.h b/lib/regex.h
index 70f2126c..0f0f3699 100644
--- a/lib/regex.h
+++ b/lib/regex.h
@@ -1,6 +1,6 @@
/* Definitions for data structures and routines for the regular
expression library.
- Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2014 Free Software
+ Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2015 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index 3186b793..07352078 100644
--- a/lib/regex_internal.c
+++ b/lib/regex_internal.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -679,7 +679,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
pstr->valid_len - offset);
pstr->valid_len -= offset;
pstr->valid_raw_len -= offset;
-#if DEBUG
+#if defined DEBUG && DEBUG
assert (pstr->valid_len > 0);
#endif
}
@@ -938,7 +938,7 @@ re_string_context_at (const re_string_t *input, Idx idx, int eflags)
Idx wc_idx = idx;
while(input->wcs[wc_idx] == WEOF)
{
-#ifdef DEBUG
+#if defined DEBUG && DEBUG
/* It must not happen. */
assert (REG_VALID_INDEX (wc_idx));
#endif
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index a35ccb72..2612912f 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
diff --git a/lib/regexec.c b/lib/regexec.c
index fc05e925..48a4a762 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
diff --git a/lib/remove.c b/lib/remove.c
index 15d762dd..bdba7de4 100644
--- a/lib/remove.c
+++ b/lib/remove.c
@@ -1,5 +1,5 @@
/* Remove a file or directory.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/rename.c b/lib/rename.c
index 608f8387..43be743d 100644
--- a/lib/rename.c
+++ b/lib/rename.c
@@ -1,6 +1,6 @@
/* Work around rename bugs in some systems.
- Copyright (C) 2001-2003, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003, 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/rewinddir.c b/lib/rewinddir.c
index d201ffa0..8e3b4dd9 100644
--- a/lib/rewinddir.c
+++ b/lib/rewinddir.c
@@ -1,5 +1,5 @@
/* Restart reading the entries of a directory from the beginning.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/rmdir.c b/lib/rmdir.c
index ec7a586f..ae21d541 100644
--- a/lib/rmdir.c
+++ b/lib/rmdir.c
@@ -1,6 +1,6 @@
/* Work around rmdir bugs.
- Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/root-dev-ino.c b/lib/root-dev-ino.c
index 3a4ec67c..86629323 100644
--- a/lib/root-dev-ino.c
+++ b/lib/root-dev-ino.c
@@ -1,5 +1,5 @@
/* root-dev-ino.c -- get the device and inode numbers for '/'.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/root-dev-ino.h b/lib/root-dev-ino.h
index 60232083..e6bf35e3 100644
--- a/lib/root-dev-ino.h
+++ b/lib/root-dev-ino.h
@@ -1,6 +1,6 @@
/* Root device and inode number checking.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/root-uid.h b/lib/root-uid.h
index 39e3c995..d263f4da 100644
--- a/lib/root-uid.h
+++ b/lib/root-uid.h
@@ -1,6 +1,6 @@
/* The user ID that always has appropriate privileges in the POSIX sense.
- Copyright 2012-2014 Free Software Foundation, Inc.
+ Copyright 2012-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/rpmatch.c b/lib/rpmatch.c
index 44810820..b2416047 100644
--- a/lib/rpmatch.c
+++ b/lib/rpmatch.c
@@ -1,7 +1,7 @@
/* Determine whether string value is affirmation or negative response
according to current locale's data.
- Copyright (C) 1996, 1998, 2000, 2002-2003, 2006-2014 Free Software
+ Copyright (C) 1996, 1998, 2000, 2002-2003, 2006-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/safe-read.c b/lib/safe-read.c
index c9b8828a..dbb63380 100644
--- a/lib/safe-read.c
+++ b/lib/safe-read.c
@@ -1,6 +1,6 @@
/* An interface to read and write that retries after interrupts.
- Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2014 Free Software
+ Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/safe-read.h b/lib/safe-read.h
index aba8bdb3..b5d408ac 100644
--- a/lib/safe-read.h
+++ b/lib/safe-read.h
@@ -1,5 +1,5 @@
/* An interface to read() that retries after interrupts.
- Copyright (C) 2002, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/safe-write.c b/lib/safe-write.c
index bf72dd4d..4c178f52 100644
--- a/lib/safe-write.c
+++ b/lib/safe-write.c
@@ -1,5 +1,5 @@
/* An interface to write that retries after interrupts.
- Copyright (C) 2002, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/safe-write.h b/lib/safe-write.h
index ae186572..86a32b2a 100644
--- a/lib/safe-write.h
+++ b/lib/safe-write.h
@@ -1,5 +1,5 @@
/* An interface to write() that retries after interrupts.
- Copyright (C) 2002, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/same-inode.h b/lib/same-inode.h
index 584f6065..ecc3049d 100644
--- a/lib/same-inode.h
+++ b/lib/same-inode.h
@@ -1,6 +1,6 @@
/* Determine whether two stat buffers refer to the same file.
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/same.c b/lib/same.c
index 5c00e8a3..515d81a8 100644
--- a/lib/same.c
+++ b/lib/same.c
@@ -1,6 +1,6 @@
/* Determine whether two file names refer to the same file.
- Copyright (C) 1997-2000, 2002-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-2000, 2002-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/same.h b/lib/same.h
index 5f5c0059..ee313c58 100644
--- a/lib/same.h
+++ b/lib/same.h
@@ -1,6 +1,6 @@
/* Determine whether two file names refer to the same file.
- Copyright (C) 1997-2000, 2003-2004, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-2000, 2003-2004, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/save-cwd.c b/lib/save-cwd.c
index 7aafacd4..159d8a89 100644
--- a/lib/save-cwd.c
+++ b/lib/save-cwd.c
@@ -1,6 +1,6 @@
/* save-cwd.c -- Save and restore current working directory.
- Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/save-cwd.h b/lib/save-cwd.h
index 6b84e460..890f7fba 100644
--- a/lib/save-cwd.h
+++ b/lib/save-cwd.h
@@ -1,6 +1,6 @@
/* Save and restore current working directory.
- Copyright (C) 1995, 1997-1998, 2003, 2009-2014 Free Software Foundation,
+ Copyright (C) 1995, 1997-1998, 2003, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/savedir.c b/lib/savedir.c
index 111d84be..61b0fa3c 100644
--- a/lib/savedir.c
+++ b/lib/savedir.c
@@ -1,6 +1,6 @@
/* savedir.c -- save the list of files in a directory in a string
- Copyright (C) 1990, 1997-2001, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1990, 1997-2001, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -161,7 +161,8 @@ streamsavedir (DIR *dirp, enum savedir_option option)
{
size_t i;
- qsort (entries, entries_used, sizeof *entries, cmp);
+ if (entries_used)
+ qsort (entries, entries_used, sizeof *entries, cmp);
name_space = xmalloc (used + 1);
used = 0;
for (i = 0; i < entries_used; i++)
diff --git a/lib/savedir.h b/lib/savedir.h
index aff4ad99..70588aa8 100644
--- a/lib/savedir.h
+++ b/lib/savedir.h
@@ -1,6 +1,6 @@
/* Save the list of files in a directory in a string.
- Copyright (C) 1997, 1999, 2001, 2003, 2005, 2009-2014 Free Software
+ Copyright (C) 1997, 1999, 2001, 2003, 2005, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/savewd.c b/lib/savewd.c
index 88c5feff..16f56a8e 100644
--- a/lib/savewd.c
+++ b/lib/savewd.c
@@ -1,6 +1,6 @@
/* Save and restore the working directory, possibly using a child process.
- Copyright (C) 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,6 @@
#include "savewd.h"
-#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
@@ -33,6 +32,7 @@
#include <sys/wait.h>
#include <unistd.h>
+#include "assure.h"
#include "dosname.h"
#include "fcntl-safer.h"
@@ -88,7 +88,7 @@ savewd_save (struct savewd *wd)
break;
default:
- assert (false);
+ assure (false);
}
return false;
@@ -144,11 +144,11 @@ savewd_chdir (struct savewd *wd, char const *dir, int options,
break;
case FORKING_STATE:
- assert (wd->val.child == 0);
+ assure (wd->val.child == 0);
break;
default:
- assert (false);
+ assure (false);
}
}
}
@@ -205,7 +205,7 @@ savewd_restore (struct savewd *wd, int status)
{
int child_status;
while (waitpid (child, &child_status, 0) < 0)
- assert (errno == EINTR);
+ assure (errno == EINTR);
wd->val.child = -1;
if (! WIFEXITED (child_status))
raise (WTERMSIG (child_status));
@@ -215,7 +215,7 @@ savewd_restore (struct savewd *wd, int status)
break;
default:
- assert (false);
+ assure (false);
}
return 0;
@@ -236,11 +236,11 @@ savewd_finish (struct savewd *wd)
break;
case FORKING_STATE:
- assert (wd->val.child < 0);
+ assure (wd->val.child < 0);
break;
default:
- assert (false);
+ assure (false);
}
wd->state = FINAL_STATE;
diff --git a/lib/savewd.h b/lib/savewd.h
index cd0817b7..bb442b33 100644
--- a/lib/savewd.h
+++ b/lib/savewd.h
@@ -1,6 +1,6 @@
/* Save and restore the working directory, possibly using a subprocess.
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -125,7 +125,7 @@ int savewd_chdir (struct savewd *wd, char const *dir, int options,
int savewd_restore (struct savewd *wd, int status);
/* Return WD's error number, or 0 if WD is not in an error state. */
-SAVEWD_INLINE int
+SAVEWD_INLINE int _GL_ATTRIBUTE_PURE
savewd_errno (struct savewd const *wd)
{
return (wd->state == ERROR_STATE ? wd->val.errnum : 0);
diff --git a/lib/sched.in.h b/lib/sched.in.h
index edebf810..92d6a4ff 100644
--- a/lib/sched.in.h
+++ b/lib/sched.in.h
@@ -1,5 +1,5 @@
/* Replacement <sched.h> for platforms that lack it.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -35,6 +35,13 @@
and Mac OS X 10.5. */
#include <sys/types.h>
+#ifdef __KLIBC__
+
+/* On OS/2 kLIBC, struct sched_param is in spawn.h */
+# include <spawn.h>
+
+#endif
+
#if !@HAVE_STRUCT_SCHED_PARAM@
# if !GNULIB_defined_struct_sched_param
diff --git a/lib/se-selinux.in.h b/lib/se-selinux.in.h
index 5eb92a20..5d8f9504 100644
--- a/lib/se-selinux.in.h
+++ b/lib/se-selinux.in.h
@@ -1,5 +1,5 @@
/* Replacement <selinux/selinux.h> for platforms that lack it.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/secure_getenv.c b/lib/secure_getenv.c
index 32819e6d..31aad1fd 100644
--- a/lib/secure_getenv.c
+++ b/lib/secure_getenv.c
@@ -1,6 +1,6 @@
/* Look up an environment variable more securely.
- Copyright 2013-2014 Free Software Foundation, Inc.
+ Copyright 2013-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
diff --git a/lib/select.c b/lib/select.c
index 81af82cd..90193152 100644
--- a/lib/select.c
+++ b/lib/select.c
@@ -1,7 +1,7 @@
/* Emulation for select(2)
Contributed by Paolo Bonzini.
- Copyright 2008-2014 Free Software Foundation, Inc.
+ Copyright 2008-2015 Free Software Foundation, Inc.
This file is part of gnulib.
diff --git a/lib/selinux-at.c b/lib/selinux-at.c
index d2032c07..fbbbf5d3 100644
--- a/lib/selinux-at.c
+++ b/lib/selinux-at.c
@@ -1,5 +1,5 @@
/* openat-style fd-relative functions for SE Linux
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/selinux-at.h b/lib/selinux-at.h
index e65687e8..93340eec 100644
--- a/lib/selinux-at.h
+++ b/lib/selinux-at.h
@@ -1,5 +1,5 @@
/* Prototypes for openat-style fd-relative SELinux functions
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/set-acl.c b/lib/set-acl.c
index 9807f107..da31750e 100644
--- a/lib/set-acl.c
+++ b/lib/set-acl.c
@@ -1,6 +1,6 @@
/* set-acl.c - set access control list equivalent to a mode
- Copyright (C) 2002-2003, 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/set-permissions.c b/lib/set-permissions.c
new file mode 100644
index 00000000..8569a20a
--- /dev/null
+++ b/lib/set-permissions.c
@@ -0,0 +1,833 @@
+/* set-permissions.c - set permissions of a file
+
+ Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible. */
+
+#include <config.h>
+
+#include "acl.h"
+
+#include "acl-internal.h"
+
+#if USE_ACL
+# if ! defined HAVE_ACL_FROM_MODE && defined HAVE_ACL_FROM_TEXT /* FreeBSD, IRIX, Tru64 */
+static acl_t
+acl_from_mode (mode_t mode)
+{
+# if HAVE_ACL_FREE_TEXT /* Tru64 */
+ char acl_text[] = "u::---,g::---,o::---,";
+# else /* FreeBSD, IRIX */
+ char acl_text[] = "u::---,g::---,o::---";
+# endif
+
+ if (mode & S_IRUSR) acl_text[ 3] = 'r';
+ if (mode & S_IWUSR) acl_text[ 4] = 'w';
+ if (mode & S_IXUSR) acl_text[ 5] = 'x';
+ if (mode & S_IRGRP) acl_text[10] = 'r';
+ if (mode & S_IWGRP) acl_text[11] = 'w';
+ if (mode & S_IXGRP) acl_text[12] = 'x';
+ if (mode & S_IROTH) acl_text[17] = 'r';
+ if (mode & S_IWOTH) acl_text[18] = 'w';
+ if (mode & S_IXOTH) acl_text[19] = 'x';
+
+ return acl_from_text (acl_text);
+}
+# endif
+
+# if HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
+static int
+set_acls_from_mode (const char *name, int desc, mode_t mode, bool *must_chmod)
+{
+# ifdef ACE_GETACL
+ /* Solaris also has a different variant of ACLs, used in ZFS and NFSv4
+ file systems (whereas the other ones are used in UFS file systems). */
+
+ /* The flags in the ace_t structure changed in a binary incompatible way
+ when ACL_NO_TRIVIAL etc. were introduced in <sys/acl.h> version 1.15.
+ How to distinguish the two conventions at runtime?
+ We fetch the existing ACL. In the old convention, usually three ACEs have
+ a_flags = ACE_OWNER / ACE_GROUP / ACE_OTHER, in the range 0x0100..0x0400.
+ In the new convention, these values are not used. */
+ int convention;
+
+ {
+ /* Initially, try to read the entries into a stack-allocated buffer.
+ Use malloc if it does not fit. */
+ enum
+ {
+ alloc_init = 4000 / sizeof (ace_t), /* >= 3 */
+ alloc_max = MIN (INT_MAX, SIZE_MAX / sizeof (ace_t))
+ };
+ ace_t buf[alloc_init];
+ size_t alloc = alloc_init;
+ ace_t *entries = buf;
+ ace_t *malloced = NULL;
+ int count;
+
+ for (;;)
+ {
+ count = (desc != -1
+ ? facl (desc, ACE_GETACL, alloc, entries)
+ : acl (name, ACE_GETACL, alloc, entries));
+ if (count < 0 && errno == ENOSPC)
+ {
+ /* Increase the size of the buffer. */
+ free (malloced);
+ if (alloc > alloc_max / 2)
+ {
+ errno = ENOMEM;
+ return -1;
+ }
+ alloc = 2 * alloc; /* <= alloc_max */
+ entries = malloced = (ace_t *) malloc (alloc * sizeof (ace_t));
+ if (entries == NULL)
+ {
+ errno = ENOMEM;
+ return -1;
+ }
+ continue;
+ }
+ break;
+ }
+
+ if (count <= 0)
+ convention = -1;
+ else
+ {
+ int i;
+
+ convention = 0;
+ for (i = 0; i < count; i++)
+ if (entries[i].a_flags & (OLD_ACE_OWNER | OLD_ACE_GROUP | OLD_ACE_OTHER))
+ {
+ convention = 1;
+ break;
+ }
+ }
+ free (malloced);
+ }
+
+ if (convention >= 0)
+ {
+ ace_t entries[6];
+ int count;
+ int ret;
+
+ if (convention)
+ {
+ /* Running on Solaris 10. */
+ entries[0].a_type = OLD_ALLOW;
+ entries[0].a_flags = OLD_ACE_OWNER;
+ entries[0].a_who = 0; /* irrelevant */
+ entries[0].a_access_mask = (mode >> 6) & 7;
+ entries[1].a_type = OLD_ALLOW;
+ entries[1].a_flags = OLD_ACE_GROUP;
+ entries[1].a_who = 0; /* irrelevant */
+ entries[1].a_access_mask = (mode >> 3) & 7;
+ entries[2].a_type = OLD_ALLOW;
+ entries[2].a_flags = OLD_ACE_OTHER;
+ entries[2].a_who = 0;
+ entries[2].a_access_mask = mode & 7;
+ count = 3;
+ }
+ else
+ {
+ /* Running on Solaris 10 (newer version) or Solaris 11.
+ The details here were found through "/bin/ls -lvd somefiles". */
+ entries[0].a_type = NEW_ACE_ACCESS_DENIED_ACE_TYPE;
+ entries[0].a_flags = NEW_ACE_OWNER;
+ entries[0].a_who = 0; /* irrelevant */
+ entries[0].a_access_mask = 0;
+ entries[1].a_type = NEW_ACE_ACCESS_ALLOWED_ACE_TYPE;
+ entries[1].a_flags = NEW_ACE_OWNER;
+ entries[1].a_who = 0; /* irrelevant */
+ entries[1].a_access_mask = NEW_ACE_WRITE_NAMED_ATTRS
+ | NEW_ACE_WRITE_ATTRIBUTES
+ | NEW_ACE_WRITE_ACL
+ | NEW_ACE_WRITE_OWNER;
+ if (mode & 0400)
+ entries[1].a_access_mask |= NEW_ACE_READ_DATA;
+ else
+ entries[0].a_access_mask |= NEW_ACE_READ_DATA;
+ if (mode & 0200)
+ entries[1].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
+ else
+ entries[0].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
+ if (mode & 0100)
+ entries[1].a_access_mask |= NEW_ACE_EXECUTE;
+ else
+ entries[0].a_access_mask |= NEW_ACE_EXECUTE;
+ entries[2].a_type = NEW_ACE_ACCESS_DENIED_ACE_TYPE;
+ entries[2].a_flags = NEW_ACE_GROUP | NEW_ACE_IDENTIFIER_GROUP;
+ entries[2].a_who = 0; /* irrelevant */
+ entries[2].a_access_mask = 0;
+ entries[3].a_type = NEW_ACE_ACCESS_ALLOWED_ACE_TYPE;
+ entries[3].a_flags = NEW_ACE_GROUP | NEW_ACE_IDENTIFIER_GROUP;
+ entries[3].a_who = 0; /* irrelevant */
+ entries[3].a_access_mask = 0;
+ if (mode & 0040)
+ entries[3].a_access_mask |= NEW_ACE_READ_DATA;
+ else
+ entries[2].a_access_mask |= NEW_ACE_READ_DATA;
+ if (mode & 0020)
+ entries[3].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
+ else
+ entries[2].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
+ if (mode & 0010)
+ entries[3].a_access_mask |= NEW_ACE_EXECUTE;
+ else
+ entries[2].a_access_mask |= NEW_ACE_EXECUTE;
+ entries[4].a_type = NEW_ACE_ACCESS_DENIED_ACE_TYPE;
+ entries[4].a_flags = NEW_ACE_EVERYONE;
+ entries[4].a_who = 0;
+ entries[4].a_access_mask = NEW_ACE_WRITE_NAMED_ATTRS
+ | NEW_ACE_WRITE_ATTRIBUTES
+ | NEW_ACE_WRITE_ACL
+ | NEW_ACE_WRITE_OWNER;
+ entries[5].a_type = NEW_ACE_ACCESS_ALLOWED_ACE_TYPE;
+ entries[5].a_flags = NEW_ACE_EVERYONE;
+ entries[5].a_who = 0;
+ entries[5].a_access_mask = NEW_ACE_READ_NAMED_ATTRS
+ | NEW_ACE_READ_ATTRIBUTES
+ | NEW_ACE_READ_ACL
+ | NEW_ACE_SYNCHRONIZE;
+ if (mode & 0004)
+ entries[5].a_access_mask |= NEW_ACE_READ_DATA;
+ else
+ entries[4].a_access_mask |= NEW_ACE_READ_DATA;
+ if (mode & 0002)
+ entries[5].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
+ else
+ entries[4].a_access_mask |= NEW_ACE_WRITE_DATA | NEW_ACE_APPEND_DATA;
+ if (mode & 0001)
+ entries[5].a_access_mask |= NEW_ACE_EXECUTE;
+ else
+ entries[4].a_access_mask |= NEW_ACE_EXECUTE;
+ count = 6;
+ }
+ if (desc != -1)
+ ret = facl (desc, ACE_SETACL, count, entries);
+ else
+ ret = acl (name, ACE_SETACL, count, entries);
+ if (ret < 0 && errno != EINVAL && errno != ENOTSUP)
+ {
+ if (errno == ENOSYS)
+ {
+ *must_chmod = true;
+ return 0;
+ }
+ return -1;
+ }
+ if (ret == 0)
+ return 0;
+ }
+# endif
+
+ {
+ aclent_t entries[3];
+ int ret;
+
+ entries[0].a_type = USER_OBJ;
+ entries[0].a_id = 0; /* irrelevant */
+ entries[0].a_perm = (mode >> 6) & 7;
+ entries[1].a_type = GROUP_OBJ;
+ entries[1].a_id = 0; /* irrelevant */
+ entries[1].a_perm = (mode >> 3) & 7;
+ entries[2].a_type = OTHER_OBJ;
+ entries[2].a_id = 0;
+ entries[2].a_perm = mode & 7;
+
+ if (desc != -1)
+ ret = facl (desc, SETACL,
+ sizeof (entries) / sizeof (aclent_t), entries);
+ else
+ ret = acl (name, SETACL,
+ sizeof (entries) / sizeof (aclent_t), entries);
+ if (ret < 0)
+ {
+ if (errno == ENOSYS || errno == EOPNOTSUPP)
+ {
+ *must_chmod = true;
+ return 0;
+ }
+ return -1;
+ }
+ }
+}
+
+#elif HAVE_GETACL /* HP-UX */
+static int
+context_acl_from_mode (struct permission_context *ctx, const char *name, int desc)
+{
+ struct stat statbuf;
+ int ret;
+
+ if (desc != -1)
+ ret = fstat (desc, &statbuf);
+ else
+ ret = stat (name, &statbuf);
+ if (ret < 0)
+ return -1;
+
+ ctx->entries[0].uid = statbuf.st_uid;
+ ctx->entries[0].gid = ACL_NSGROUP;
+ ctx->entries[0].mode = (mode >> 6) & 7;
+ ctx->entries[1].uid = ACL_NSUSER;
+ ctx->entries[1].gid = statbuf.st_gid;
+ ctx->entries[1].mode = (mode >> 3) & 7;
+ ctx->entries[2].uid = ACL_NSUSER;
+ ctx->entries[2].gid = ACL_NSGROUP;
+ ctx->entries[2].mode = mode & 7;
+ ctx->count = 3;
+ return 0;
+}
+
+# if HAVE_ACLV_H /* HP-UX >= 11.11 */
+static int
+context_aclv_from_mode (struct permission_context *ctx)
+{
+ int ret;
+
+ ctx->aclv_entries[0].a_type = USER_OBJ;
+ ctx->aclv_entries[0].a_id = 0; /* irrelevant */
+ ctx->aclv_entries[0].a_perm = (mode >> 6) & 7;
+ ctx->aclv_entries[1].a_type = GROUP_OBJ;
+ ctx->aclv_entries[1].a_id = 0; /* irrelevant */
+ ctx->aclv_entries[1].a_perm = (mode >> 3) & 7;
+ ctx->aclv_entries[2].a_type = CLASS_OBJ;
+ ctx->aclv_entries[2].a_id = 0;
+ ctx->aclv_entries[2].a_perm = (mode >> 3) & 7;
+ ctx->aclv_entries[3].a_type = OTHER_OBJ;
+ ctx->aclv_entries[3].a_id = 0;
+ ctx->aclv_entries[3].a_perm = mode & 7;
+ ctx->aclv_count = 4;
+
+ ret = aclsort (sizeof (entries) / sizeof (struct acl), 1, entries);
+ if (ret > 0)
+ abort ();
+ return ret;
+}
+#endif
+
+# elif HAVE_ACLX_GET && defined ACL_AIX_WIP /* AIX */
+static int
+set_acls_from_mode (const char *name, int desc, mode_t mode, bool *must_chmod)
+{
+ acl_type_list_t types;
+ size_t types_size = sizeof (types);
+ acl_type_t type;
+
+ if (aclx_gettypes (name, &types, &types_size) < 0
+ || types.num_entries == 0)
+ {
+ *must_chmod = true;
+ return 0;
+ }
+
+ /* XXX Do we need to clear all types of ACLs for the given file, or is it
+ sufficient to clear the first one? */
+ type = types.entries[0];
+ if (type.u64 == ACL_AIXC)
+ {
+ union { struct acl a; char room[128]; } u;
+ int ret;
+
+ u.a.acl_len = (char *) &u.a.acl_ext[0] - (char *) &u.a; /* no entries */
+ u.a.acl_mode = mode & ~(S_IXACL | 0777);
+ u.a.u_access = (mode >> 6) & 7;
+ u.a.g_access = (mode >> 3) & 7;
+ u.a.o_access = mode & 7;
+
+ if (desc != -1)
+ ret = aclx_fput (desc, SET_ACL | SET_MODE_S_BITS,
+ type, &u.a, u.a.acl_len, mode);
+ else
+ ret = aclx_put (name, SET_ACL | SET_MODE_S_BITS,
+ type, &u.a, u.a.acl_len, mode);
+ if (!(ret < 0 && errno == ENOSYS))
+ return ret;
+ }
+ else if (type.u64 == ACL_NFS4)
+ {
+ union { nfs4_acl_int_t a; char room[128]; } u;
+ nfs4_ace_int_t *ace;
+ int ret;
+
+ u.a.aclVersion = NFS4_ACL_INT_STRUCT_VERSION;
+ u.a.aclEntryN = 0;
+ ace = &u.a.aclEntry[0];
+ {
+ ace->flags = ACE4_ID_SPECIAL;
+ ace->aceWho.special_whoid = ACE4_WHO_OWNER;
+ ace->aceType = ACE4_ACCESS_ALLOWED_ACE_TYPE;
+ ace->aceFlags = 0;
+ ace->aceMask =
+ (mode & 0400 ? ACE4_READ_DATA | ACE4_LIST_DIRECTORY : 0)
+ | (mode & 0200
+ ? ACE4_WRITE_DATA | ACE4_ADD_FILE | ACE4_APPEND_DATA
+ | ACE4_ADD_SUBDIRECTORY
+ : 0)
+ | (mode & 0100 ? ACE4_EXECUTE : 0);
+ ace->aceWhoString[0] = '\0';
+ ace->entryLen = (char *) &ace->aceWhoString[4] - (char *) ace;
+ ace = (nfs4_ace_int_t *) (char *) &ace->aceWhoString[4];
+ u.a.aclEntryN++;
+ }
+ {
+ ace->flags = ACE4_ID_SPECIAL;
+ ace->aceWho.special_whoid = ACE4_WHO_GROUP;
+ ace->aceType = ACE4_ACCESS_ALLOWED_ACE_TYPE;
+ ace->aceFlags = 0;
+ ace->aceMask =
+ (mode & 0040 ? ACE4_READ_DATA | ACE4_LIST_DIRECTORY : 0)
+ | (mode & 0020
+ ? ACE4_WRITE_DATA | ACE4_ADD_FILE | ACE4_APPEND_DATA
+ | ACE4_ADD_SUBDIRECTORY
+ : 0)
+ | (mode & 0010 ? ACE4_EXECUTE : 0);
+ ace->aceWhoString[0] = '\0';
+ ace->entryLen = (char *) &ace->aceWhoString[4] - (char *) ace;
+ ace = (nfs4_ace_int_t *) (char *) &ace->aceWhoString[4];
+ u.a.aclEntryN++;
+ }
+ {
+ ace->flags = ACE4_ID_SPECIAL;
+ ace->aceWho.special_whoid = ACE4_WHO_EVERYONE;
+ ace->aceType = ACE4_ACCESS_ALLOWED_ACE_TYPE;
+ ace->aceFlags = 0;
+ ace->aceMask =
+ (mode & 0004 ? ACE4_READ_DATA | ACE4_LIST_DIRECTORY : 0)
+ | (mode & 0002
+ ? ACE4_WRITE_DATA | ACE4_ADD_FILE | ACE4_APPEND_DATA
+ | ACE4_ADD_SUBDIRECTORY
+ : 0)
+ | (mode & 0001 ? ACE4_EXECUTE : 0);
+ ace->aceWhoString[0] = '\0';
+ ace->entryLen = (char *) &ace->aceWhoString[4] - (char *) ace;
+ ace = (nfs4_ace_int_t *) (char *) &ace->aceWhoString[4];
+ u.a.aclEntryN++;
+ }
+ u.a.aclLength = (char *) ace - (char *) &u.a;
+
+ if (desc != -1)
+ ret = aclx_fput (desc, SET_ACL | SET_MODE_S_BITS,
+ type, &u.a, u.a.aclLength, mode);
+ else
+ ret = aclx_put (name, SET_ACL | SET_MODE_S_BITS,
+ type, &u.a, u.a.aclLength, mode);
+ if (!(ret < 0 && errno == ENOSYS))
+ return ret;
+ }
+
+ *must_chmod = true;
+ return 0;
+}
+
+# elif HAVE_STATACL /* older AIX */
+static int
+context_acl_from_mode (struct permission_context *ctx)
+{
+ ctx->u.a.acl_len = (char *) &ctx->u.a.acl_ext[0] - (char *) &ctx->u.a; /* no entries */
+ ctx->u.a.acl_mode = ctx->mode & ~(S_IXACL | 0777);
+ ctx->u.a.u_access = (ctx->mode >> 6) & 7;
+ ctx->u.a.g_access = (ctx->mode >> 3) & 7;
+ ctx->u.a.o_access = ctx->mode & 7;
+ ctx->have_u = true;
+ return 0;
+}
+
+# elif HAVE_ACLSORT /* NonStop Kernel */
+static int
+context_acl_from_mode (struct permission_context *ctx)
+{
+ int ret;
+
+ ctx->entries[0].a_type = USER_OBJ;
+ ctx->entries[0].a_id = 0; /* irrelevant */
+ ctx->entries[0].a_perm = (mode >> 6) & 7;
+ ctx->entries[1].a_type = GROUP_OBJ;
+ ctx->entries[1].a_id = 0; /* irrelevant */
+ ctx->entries[1].a_perm = (mode >> 3) & 7;
+ ctx->entries[2].a_type = CLASS_OBJ;
+ ctx->entries[2].a_id = 0;
+ ctx->entries[2].a_perm = (mode >> 3) & 7;
+ ctx->entries[3].a_type = OTHER_OBJ;
+ ctx->entries[3].a_id = 0;
+ ctx->entries[3].a_perm = mode & 7;
+ ctx->count = 4;
+
+ ret = aclsort (sizeof (entries) / sizeof (struct acl), 1, entries);
+ if (ret > 0)
+ abort ();
+ return ret;
+}
+# endif
+
+static int
+set_acls (struct permission_context *ctx, const char *name, int desc,
+ int from_mode, bool *must_chmod, bool *acls_set)
+{
+ int ret = 0;
+
+#if HAVE_ACL_GET_FILE
+ /* POSIX 1003.1e (draft 17 -- abandoned) specific version. */
+ /* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
+# if !HAVE_ACL_TYPE_EXTENDED
+ /* Linux, FreeBSD, IRIX, Tru64 */
+
+# ifndef HAVE_ACL_FROM_TEXT
+# error Must have acl_from_text (see POSIX 1003.1e draft 17).
+# endif
+# ifndef HAVE_ACL_DELETE_DEF_FILE
+# error Must have acl_delete_def_file (see POSIX 1003.1e draft 17).
+# endif
+
+ if (! ctx->acls_not_supported)
+ {
+ if (ret == 0 && from_mode)
+ {
+ if (ctx->acl)
+ acl_free (ctx->acl);
+ ctx->acl = acl_from_mode (ctx->mode);
+ if (ctx->acl == NULL)
+ ret = -1;
+ }
+
+ if (ret == 0 && ctx->acl)
+ {
+ if (HAVE_ACL_SET_FD && desc != -1)
+ ret = acl_set_fd (desc, ctx->acl);
+ else
+ ret = acl_set_file (name, ACL_TYPE_ACCESS, ctx->acl);
+ if (ret != 0)
+ {
+ if (! acl_errno_valid (errno))
+ {
+ ctx->acls_not_supported = true;
+ if (from_mode || acl_access_nontrivial (ctx->acl) == 0)
+ ret = 0;
+ }
+ }
+ else
+ {
+ *acls_set = true;
+ if (S_ISDIR(ctx->mode))
+ {
+ if (! from_mode && ctx->default_acl)
+ ret = acl_set_file (name, ACL_TYPE_DEFAULT,
+ ctx->default_acl);
+ else
+ ret = acl_delete_def_file (name);
+ }
+ }
+ }
+ }
+
+# else /* HAVE_ACL_TYPE_EXTENDED */
+ /* Mac OS X */
+
+ /* On Mac OS X, acl_get_file (name, ACL_TYPE_ACCESS)
+ and acl_get_file (name, ACL_TYPE_DEFAULT)
+ always return NULL / EINVAL. You have to use
+ acl_get_file (name, ACL_TYPE_EXTENDED)
+ or acl_get_fd (open (name, ...))
+ to retrieve an ACL.
+ On the other hand,
+ acl_set_file (name, ACL_TYPE_ACCESS, acl)
+ and acl_set_file (name, ACL_TYPE_DEFAULT, acl)
+ have the same effect as
+ acl_set_file (name, ACL_TYPE_EXTENDED, acl):
+ Each of these calls sets the file's ACL. */
+
+ if (ctx->acl == NULL)
+ {
+ acl_t acl;
+
+ /* Remove ACLs if the file has ACLs. */
+ if (HAVE_ACL_GET_FD && desc != -1)
+ acl = acl_get_fd (desc);
+ else
+ acl = acl_get_file (name, ACL_TYPE_EXTENDED);
+ if (acl)
+ {
+ acl_free (acl);
+
+ acl = acl_init (0);
+ if (acl)
+ {
+ if (HAVE_ACL_SET_FD && desc != -1)
+ ret = acl_set_fd (desc, acl);
+ else
+ ret = acl_set_file (name, ACL_TYPE_EXTENDED, acl);
+ acl_free (acl);
+ }
+ else
+ ret = -1;
+ }
+ }
+ else
+ {
+ if (HAVE_ACL_SET_FD && desc != -1)
+ ret = acl_set_fd (desc, ctx->acl);
+ else
+ ret = acl_set_file (name, ACL_TYPE_EXTENDED, ctx->acl);
+ if (ret != 0)
+ {
+ if (! acl_errno_valid (errno)
+ && ! acl_extended_nontrivial (ctx->acl))
+ ret = 0;
+ }
+ }
+ *acls_set = true;
+
+# endif
+
+# elif defined GETACL /* Solaris, Cygwin, not HP-UX */
+
+ /* Solaris 2.5 through Solaris 10, Cygwin, and contemporaneous versions
+ of Unixware. The acl() call returns the access and default ACL both
+ at once. */
+
+ /* If both ace_entries and entries are available, try SETACL before
+ ACE_SETACL, because SETACL cannot fail with ENOTSUP whereas ACE_SETACL
+ can. */
+
+ if (from_mode)
+ return set_acls_from_mode (name, desc, ctx->mode, must_chmod);
+
+ if (ret == 0 && ctx->count)
+ {
+ if (desc != -1)
+ ret = facl (desc, SETACL, ctx->count, ctx->entries);
+ else
+ ret = acl (name, SETACL, ctx->count, ctx->entries);
+ if (ret < 0)
+ {
+ if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
+ && acl_nontrivial (ctx->count, ctx->entries) == 0)
+ ret = 0;
+ }
+ else
+ *acls_set = true;
+ }
+
+# ifdef ACE_GETACL
+ if (ret == 0 && ctx->ace_count)
+ {
+ if (desc != -1)
+ ret = facl (desc, ACE_SETACL, ctx->ace_count, ctx->ace_entries);
+ else
+ ret = acl (name, ACE_SETACL, ctx->ace_count, ctx->ace_entries);
+ if (ret < 0)
+ {
+ if ((errno == ENOSYS || errno == EINVAL || errno == ENOTSUP)
+ && acl_ace_nontrivial (ctx->ace_count, ctx->ace_entries) == 0)
+ ret = 0;
+ }
+ else
+ *acls_set = true;
+ }
+# endif
+
+#elif HAVE_GETACL /* HP-UX */
+
+ if (from_mode)
+ ret = context_acl_from_mode (ctx, name, desc);
+
+ if (ret == 0 && ctx->count > 0)
+ {
+ if (desc != -1)
+ ret = fsetacl (desc, ctx->count, ctx->entries);
+ else
+ ret = setacl (name, ctx->count, ctx->entries);
+ if (ret < 0)
+ {
+ if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
+ && (from_mode || !acl_nontrivial (ctx->count, ctx->entries, &source_statbuf)))
+ ret = 0;
+ }
+ else
+ *acls_set = true;
+ }
+
+# if HAVE_ACLV_H
+ if (from_mode)
+ ret = context_aclv_from_mode (ctx);
+
+ if (ret == 0 && ctx->aclv_count > 0)
+ {
+ ret = acl ((char *) name, ACL_SET, ctx->aclv_count, ctx->aclv_entries);
+ if (ret < 0)
+ {
+ if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
+ && (from_mode || !aclv_nontrivial (ctx->aclv_count, ctx->aclv_entries)))
+ ret = 0;
+ }
+ else
+ *acls_set = true;
+ }
+# endif
+
+# elif HAVE_ACLX_GET && ACL_AIX_WIP /* AIX */
+
+ /* TODO: Implement setting ACLs once get_permissions() reads them. */
+
+ if (from_mode)
+ ret = set_acls_from_mode (name, desc, mode, must_chmod);
+
+# elif HAVE_STATACL /* older AIX */
+
+ if (from_mode)
+ ret = context_acl_from_mode (ctx);
+
+ if (ret == 0 && ctx->have_u)
+ {
+ if (desc != -1)
+ ret = fchacl (desc, &ctx->u.a, ctx->u.a.acl_len);
+ else
+ ret = chacl ((char *) name, &ctx->u.a, ctx->u.a.acl_len);
+ if (ret < 0)
+ {
+ if (errno == ENOSYS && from_mode)
+ ret = 0;
+ }
+ else
+ *acls_set = true;
+ }
+
+# elif HAVE_ACLSORT /* NonStop Kernel */
+
+ if (from_mode)
+ ret = context_acl_from_mode (ctx);
+
+ if (ret == 0 && ctx->count)
+ {
+ ret = acl ((char *) name, ACL_SET, ctx->count, ctx->entries);
+ if (ret != 0)
+ {
+ if (!acl_nontrivial (ctx->count, ctx->entries))
+ ret = 0;
+ }
+ else
+ *acls_set = true;
+ }
+
+# else /* No ACLs */
+
+ /* Nothing to do. */
+
+#endif
+
+ return ret;
+}
+#endif
+
+/* If DESC is a valid file descriptor use fchmod to change the
+ file's mode to MODE on systems that have fchmod. On systems
+ that don't have fchmod and if DESC is invalid, use chmod on
+ NAME instead.
+ Return 0 if successful. Return -1 and set errno upon failure. */
+
+int
+chmod_or_fchmod (const char *name, int desc, mode_t mode)
+{
+ if (HAVE_FCHMOD && desc != -1)
+ return fchmod (desc, mode);
+ else
+ return chmod (name, mode);
+}
+
+/* Set the permissions in CTX on a file. If DESC is a valid file descriptor,
+ use file descriptor operations, else use filename based operations on NAME.
+ If access control lists are not available, fchmod the target file to the
+ mode in CTX. Also sets the non-permission bits of the destination file
+ (S_ISUID, S_ISGID, S_ISVTX) to those from the mode in CTX if any are set.
+ Return 0 if successful. Return -1 and set errno upon failure. */
+
+int
+set_permissions (struct permission_context *ctx, const char *name, int desc)
+{
+ bool acls_set _GL_UNUSED = false;
+ bool early_chmod;
+ bool must_chmod = false;
+ int ret = 0;
+
+#if USE_ACL
+# if HAVE_STATACL
+ /* older AIX */
+ /* There is no need to call chmod_or_fchmod, since the mode
+ bits S_ISUID, S_ISGID, S_ISVTX are also stored in the ACL. */
+
+ early_chmod = false;
+# else
+ /* All other platforms */
+ /* On Cygwin, it is necessary to call chmod before acl, because
+ chmod can change the contents of the ACL (in ways that don't
+ change the allowed accesses, but still visible). */
+
+ early_chmod = (! MODE_INSIDE_ACL || (ctx->mode & (S_ISUID | S_ISGID | S_ISVTX)));
+# endif
+#else
+ /* No ACLs */
+
+ early_chmod = true;
+#endif
+
+ if (early_chmod)
+ {
+ ret = chmod_or_fchmod (name, desc, ctx->mode);
+ if (ret != 0)
+ return -1;
+ }
+
+#if USE_ACL
+ ret = set_acls (ctx, name, desc, false, &must_chmod, &acls_set);
+ if (! acls_set)
+ {
+ int saved_errno = ret ? errno : 0;
+
+ /* If we can't set an acl which we expect to be able to set, try setting
+ the permissions to ctx->mode. Due to possible inherited permissions,
+ we cannot simply chmod. */
+
+ ret = set_acls (ctx, name, desc, true, &must_chmod, &acls_set);
+ if (! acls_set)
+ must_chmod = true;
+
+ if (saved_errno)
+ {
+ errno = saved_errno;
+ ret = -1;
+ }
+ }
+#endif
+
+ if (must_chmod && ! early_chmod)
+ {
+ int saved_errno = ret ? errno : 0;
+
+ ret = chmod_or_fchmod (name, desc, ctx->mode);
+
+ if (saved_errno)
+ {
+ errno = saved_errno;
+ ret = -1;
+ }
+ }
+
+ return ret;
+}
diff --git a/lib/setenv.c b/lib/setenv.c
index 06791a90..6b16fd58 100644
--- a/lib/setenv.c
+++ b/lib/setenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995-2003, 2005-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995-2003, 2005-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/settime.c b/lib/settime.c
index 135c9a38..3e671c93 100644
--- a/lib/settime.c
+++ b/lib/settime.c
@@ -1,6 +1,6 @@
/* settime -- set the system clock
- Copyright (C) 2002, 2004-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sha1.c b/lib/sha1.c
index 0ea35b08..4411ceec 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -1,7 +1,7 @@
/* sha1.c - Functions to compute SHA1 message digest of files or
memory blocks according to the NIST specification FIPS-180-1.
- Copyright (C) 2000-2001, 2003-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2001, 2003-2006, 2008-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
diff --git a/lib/sha1.h b/lib/sha1.h
index 4fd7d668..b9074165 100644
--- a/lib/sha1.h
+++ b/lib/sha1.h
@@ -1,6 +1,6 @@
/* Declarations of functions and data types used for SHA1 sum
library functions.
- Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2014 Free Software
+ Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
diff --git a/lib/sha256.c b/lib/sha256.c
index a07e4f9f..9ac81732 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -1,7 +1,7 @@
/* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or
memory blocks according to the NIST specification FIPS-180-2.
- Copyright (C) 2005-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sha256.h b/lib/sha256.h
index 92c0b955..dae84f55 100644
--- a/lib/sha256.h
+++ b/lib/sha256.h
@@ -1,6 +1,6 @@
/* Declarations of functions and data types used for SHA256 and SHA224 sum
library functions.
- Copyright (C) 2005-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sha512.c b/lib/sha512.c
index 5d3a1725..f48e74bd 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -1,7 +1,7 @@
/* sha512.c - Functions to compute SHA512 and SHA384 message digest of files or
memory blocks according to the NIST specification FIPS-180-2.
- Copyright (C) 2005-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sha512.h b/lib/sha512.h
index 17aeea6c..d540887d 100644
--- a/lib/sha512.h
+++ b/lib/sha512.h
@@ -1,6 +1,6 @@
/* Declarations of functions and data types used for SHA512 and SHA384 sum
library functions.
- Copyright (C) 2005-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sig-handler.h b/lib/sig-handler.h
index f4fe7eca..c814ed6d 100644
--- a/lib/sig-handler.h
+++ b/lib/sig-handler.h
@@ -1,6 +1,6 @@
/* Convenience declarations when working with <signal.h>.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ typedef void (*sa_handler_t) (int);
/* Return the handler of a signal, as a sa_handler_t value regardless
of its true type. The resulting function can be compared to
special values like SIG_IGN but it is not portable to call it. */
-SIG_HANDLER_INLINE sa_handler_t
+SIG_HANDLER_INLINE sa_handler_t _GL_ATTRIBUTE_PURE
get_handler (struct sigaction const *a)
{
#ifdef SA_SIGINFO
diff --git a/lib/sig2str.c b/lib/sig2str.c
index 119006af..58154daa 100644
--- a/lib/sig2str.c
+++ b/lib/sig2str.c
@@ -1,6 +1,6 @@
/* sig2str.c -- convert between signal names and numbers
- Copyright (C) 2002, 2004, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sig2str.h b/lib/sig2str.h
index fc90b720..ac2f67a1 100644
--- a/lib/sig2str.h
+++ b/lib/sig2str.h
@@ -1,6 +1,6 @@
/* sig2str.h -- convert between signal names and numbers
- Copyright (C) 2002, 2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sigaction.c b/lib/sigaction.c
index c56ca460..9b2a0894 100644
--- a/lib/sigaction.c
+++ b/lib/sigaction.c
@@ -1,5 +1,5 @@
/* POSIX compatible signal blocking.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
Written by Eric Blake <ebb9@byu.net>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/siglist.h b/lib/siglist.h
index 7b682ff3..6cf38a2b 100644
--- a/lib/siglist.h
+++ b/lib/siglist.h
@@ -1,5 +1,5 @@
/* Canonical list of all signal names.
- Copyright (C) 1996-1999, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-1999, 2008-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/signal.in.h b/lib/signal.in.h
index 925e16f2..265b72ab 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <signal.h>.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -55,11 +55,13 @@
#ifndef _@GUARD_PREFIX@_SIGNAL_H
#define _@GUARD_PREFIX@_SIGNAL_H
-/* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6 declare
- pthread_sigmask in <pthread.h>, not in <signal.h>.
+/* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6, Android
+ declare pthread_sigmask in <pthread.h>, not in <signal.h>.
But avoid namespace pollution on glibc systems.*/
#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
- && ((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ || defined __sun) \
+ && ((defined __APPLE__ && defined __MACH__) \
+ || defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ \
+ || defined __sun || defined __ANDROID__) \
&& ! defined __GLIBC__
# include <pthread.h>
#endif
diff --git a/lib/signbitd.c b/lib/signbitd.c
index 26f30d59..289b477b 100644
--- a/lib/signbitd.c
+++ b/lib/signbitd.c
@@ -1,5 +1,5 @@
/* signbit() macro: Determine the sign bit of a floating-point number.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/signbitf.c b/lib/signbitf.c
index 191deb91..d771fcc7 100644
--- a/lib/signbitf.c
+++ b/lib/signbitf.c
@@ -1,5 +1,5 @@
/* signbit() macro: Determine the sign bit of a floating-point number.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/signbitl.c b/lib/signbitl.c
index 9da26c6c..404304ec 100644
--- a/lib/signbitl.c
+++ b/lib/signbitl.c
@@ -1,5 +1,5 @@
/* signbit() macro: Determine the sign bit of a floating-point number.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sigprocmask.c b/lib/sigprocmask.c
index 506a51fe..e29b0126 100644
--- a/lib/sigprocmask.c
+++ b/lib/sigprocmask.c
@@ -1,5 +1,5 @@
/* POSIX compatible signal blocking.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2006.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/size_max.h b/lib/size_max.h
index 461ff1ca..5a0568e5 100644
--- a/lib/size_max.h
+++ b/lib/size_max.h
@@ -1,5 +1,5 @@
/* size_max.h -- declare SIZE_MAX through system headers
- Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/smack.h b/lib/smack.h
index e1e8a842..71dab6cc 100644
--- a/lib/smack.h
+++ b/lib/smack.h
@@ -1,5 +1,5 @@
/* Include and determine availability of smack routines
- Copyright (C) 2013-2014 Free Software Foundation, Inc.
+ Copyright (C) 2013-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/snprintf.c b/lib/snprintf.c
index ea1321c4..11500cad 100644
--- a/lib/snprintf.c
+++ b/lib/snprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 2004, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006-2015 Free Software Foundation, Inc.
Written by Simon Josefsson and Paul Eggert.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/sockets.c b/lib/sockets.c
index 962c5785..0b60562c 100644
--- a/lib/sockets.c
+++ b/lib/sockets.c
@@ -1,6 +1,6 @@
/* sockets.c --- wrappers for Windows socket functions
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sockets.h b/lib/sockets.h
index 0bee1ddf..c863dfbe 100644
--- a/lib/sockets.h
+++ b/lib/sockets.h
@@ -1,6 +1,6 @@
/* sockets.h - wrappers for Windows socket functions
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/stat-size.h b/lib/stat-size.h
index 42482fa6..c4011ce1 100644
--- a/lib/stat-size.h
+++ b/lib/stat-size.h
@@ -1,5 +1,5 @@
/* macros useful in interpreting size-related values in struct stat.
- Copyright (C) 1989, 1991-2014 Free Software Foundation, Inc.
+ Copyright (C) 1989, 1991-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/stat-time.h b/lib/stat-time.h
index b3df6eb8..b67d1798 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -1,6 +1,6 @@
/* stat-related time functions.
- Copyright (C) 2005, 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -54,7 +54,7 @@ _GL_INLINE_HEADER_BEGIN
#endif
/* Return the nanosecond component of *ST's access time. */
-_GL_STAT_TIME_INLINE long int
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
get_stat_atime_ns (struct stat const *st)
{
# if defined STAT_TIMESPEC
@@ -67,7 +67,7 @@ get_stat_atime_ns (struct stat const *st)
}
/* Return the nanosecond component of *ST's status change time. */
-_GL_STAT_TIME_INLINE long int
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
get_stat_ctime_ns (struct stat const *st)
{
# if defined STAT_TIMESPEC
@@ -80,7 +80,7 @@ get_stat_ctime_ns (struct stat const *st)
}
/* Return the nanosecond component of *ST's data modification time. */
-_GL_STAT_TIME_INLINE long int
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
get_stat_mtime_ns (struct stat const *st)
{
# if defined STAT_TIMESPEC
@@ -93,7 +93,7 @@ get_stat_mtime_ns (struct stat const *st)
}
/* Return the nanosecond component of *ST's birth time. */
-_GL_STAT_TIME_INLINE long int
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
get_stat_birthtime_ns (struct stat const *st)
{
# if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
@@ -108,7 +108,7 @@ get_stat_birthtime_ns (struct stat const *st)
}
/* Return *ST's access time. */
-_GL_STAT_TIME_INLINE struct timespec
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
get_stat_atime (struct stat const *st)
{
#ifdef STAT_TIMESPEC
@@ -122,7 +122,7 @@ get_stat_atime (struct stat const *st)
}
/* Return *ST's status change time. */
-_GL_STAT_TIME_INLINE struct timespec
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
get_stat_ctime (struct stat const *st)
{
#ifdef STAT_TIMESPEC
@@ -136,7 +136,7 @@ get_stat_ctime (struct stat const *st)
}
/* Return *ST's data modification time. */
-_GL_STAT_TIME_INLINE struct timespec
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
get_stat_mtime (struct stat const *st)
{
#ifdef STAT_TIMESPEC
@@ -151,7 +151,7 @@ get_stat_mtime (struct stat const *st)
/* Return *ST's birth time, if available; otherwise return a value
with tv_sec and tv_nsec both equal to -1. */
-_GL_STAT_TIME_INLINE struct timespec
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
get_stat_birthtime (struct stat const *st)
{
struct timespec t;
diff --git a/lib/stat.c b/lib/stat.c
index 35f4b0b1..2209826f 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -1,5 +1,5 @@
/* Work around platform bugs in stat.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h
index dcaab55b..a990050b 100644
--- a/lib/stdalign.in.h
+++ b/lib/stdalign.in.h
@@ -1,6 +1,6 @@
/* A substitute for ISO C11 <stdalign.h>.
- Copyright 2011-2014 Free Software Foundation, Inc.
+ Copyright 2011-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -95,7 +95,10 @@
#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
# if defined __cplusplus && 201103 <= __cplusplus
# define _Alignas(a) alignas (a)
-# elif (__GNUC__ || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \
+# elif ((defined __APPLE__ && defined __MACH__ \
+ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
+ : __GNUC__) \
+ || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \
|| __ICC || 0x5110 <= __SUNPRO_C)
# define _Alignas(a) __attribute__ ((__aligned__ (a)))
# elif 1300 <= _MSC_VER
diff --git a/lib/stdarg.in.h b/lib/stdarg.in.h
index 5b37dd36..5239f51a 100644
--- a/lib/stdarg.in.h
+++ b/lib/stdarg.in.h
@@ -1,5 +1,5 @@
/* Substitute for and wrapper around <stdarg.h>.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h
index 651e8dff..64a17618 100644
--- a/lib/stdbool.in.h
+++ b/lib/stdbool.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2003, 2006-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2003, 2006-2015 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/stddef.in.h b/lib/stddef.in.h
index f5c0e056..698307bc 100644
--- a/lib/stddef.in.h
+++ b/lib/stddef.in.h
@@ -1,6 +1,6 @@
/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -39,7 +39,6 @@
# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
# ifdef __need_wint_t
-# undef _@GUARD_PREFIX@_STDDEF_H
# define _GL_STDDEF_WINT_T
# endif
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
@@ -54,33 +53,56 @@
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
-# ifndef _@GUARD_PREFIX@_STDDEF_H
-# define _@GUARD_PREFIX@_STDDEF_H
-
/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
-#if @REPLACE_NULL@
-# undef NULL
-# ifdef __cplusplus
+# if (@REPLACE_NULL@ \
+ && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T))
+# undef NULL
+# ifdef __cplusplus
/* ISO C++ says that the macro NULL must expand to an integer constant
expression, hence '((void *) 0)' is not allowed in C++. */
-# if __GNUG__ >= 3
+# if __GNUG__ >= 3
/* GNU C++ has a __null macro that behaves like an integer ('int' or
'long') but has the same size as a pointer. Use that, to avoid
warnings. */
-# define NULL __null
-# else
-# define NULL 0L
+# define NULL __null
+# else
+# define NULL 0L
+# endif
+# else
+# define NULL ((void *) 0)
+# endif
# endif
-# else
-# define NULL ((void *) 0)
-# endif
-#endif
+
+# ifndef _@GUARD_PREFIX@_STDDEF_H
+# define _@GUARD_PREFIX@_STDDEF_H
/* Some platforms lack wchar_t. */
#if !@HAVE_WCHAR_T@
# define wchar_t int
#endif
+/* Some platforms lack max_align_t. */
+#if !@HAVE_MAX_ALIGN_T@
+/* On the x86, the maximum storage alignment of double, long, etc. is 4,
+ but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8,
+ and the C11 standard allows this. Work around this problem by
+ using __alignof__ (which returns 8 for double) rather than _Alignof
+ (which returns 4), and align each union member accordingly. */
+# ifdef __GNUC__
+# define _GL_STDDEF_ALIGNAS(type) \
+ __attribute__ ((__aligned__ (__alignof__ (type))))
+# else
+# define _GL_STDDEF_ALIGNAS(type) /* */
+# endif
+typedef union
+{
+ char *__p _GL_STDDEF_ALIGNAS (char *);
+ double __d _GL_STDDEF_ALIGNAS (double);
+ long double __ld _GL_STDDEF_ALIGNAS (long double);
+ long int __i _GL_STDDEF_ALIGNAS (long int);
+} max_align_t;
+#endif
+
# endif /* _@GUARD_PREFIX@_STDDEF_H */
# endif /* _@GUARD_PREFIX@_STDDEF_H */
#endif /* __need_XXX */
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index 247f0d89..378de2ec 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2002, 2004-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2015 Free Software Foundation, Inc.
Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
This file is part of gnulib.
diff --git a/lib/stdio--.h b/lib/stdio--.h
index 83ddf5aa..558cbb2c 100644
--- a/lib/stdio--.h
+++ b/lib/stdio--.h
@@ -1,6 +1,6 @@
/* Like stdio.h, but redefine some names to avoid glitches.
- Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
index 299fe475..502d891b 100644
--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -1,5 +1,5 @@
/* Implementation details of FILE streams.
- Copyright (C) 2007-2008, 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008, 2010-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,8 @@
#include <errno.h> /* For detecting Plan9. */
-#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
+#if defined __sferror || defined __DragonFly__ || defined __ANDROID__
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
# if defined __DragonFly__ /* DragonFly */
/* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
@@ -66,7 +67,7 @@
/* More fields, not relevant here. */
};
# define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
-# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin */
+# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin, Android */
# define fp_ub fp_->_ub
# endif
diff --git a/lib/stdio-safer.h b/lib/stdio-safer.h
index 96c861fe..0545907b 100644
--- a/lib/stdio-safer.h
+++ b/lib/stdio-safer.h
@@ -1,6 +1,6 @@
/* Invoke stdio functions, but avoid some glitches.
- Copyright (C) 2001, 2003, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 1e1fe84c..ec438742 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <stdio.h>.
- Copyright (C) 2004, 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2007-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -84,8 +84,13 @@
except that it indicates to GCC that the supported format string directives
are the ones of the system printf(), rather than the ones standardized by
ISO C99 and POSIX. */
-#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
+#if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
+# define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
+ _GL_ATTRIBUTE_FORMAT_PRINTF (formatstring_parameter, first_argument)
+#else
+# define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
_GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
+#endif
/* _GL_ATTRIBUTE_FORMAT_SCANF
indicates to GCC that the function takes a format string and arguments,
@@ -718,11 +723,10 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
so any use of gets warrants an unconditional warning; besides, C11
removed it. */
#undef gets
-#if HAVE_RAW_DECL_GETS
+#if HAVE_RAW_DECL_GETS && !defined __cplusplus
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
-
#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
struct obstack;
/* Grow an obstack with formatted output. Return the number of
diff --git a/lib/stdlib--.h b/lib/stdlib--.h
index 29be0654..7bd917b6 100644
--- a/lib/stdlib--.h
+++ b/lib/stdlib--.h
@@ -1,6 +1,6 @@
/* Like stdlib.h, but redefine some names to avoid glitches.
- Copyright (C) 2005-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/stdlib-safer.h b/lib/stdlib-safer.h
index 6816a366..c5b79310 100644
--- a/lib/stdlib-safer.h
+++ b/lib/stdlib-safer.h
@@ -1,6 +1,6 @@
/* Invoke stdlib.h functions, but avoid some glitches.
- Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 46e10dba..428a1191 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <stdlib.h>.
- Copyright (C) 1995, 2001-2004, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2001-2004, 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -520,6 +520,29 @@ _GL_CXXALIAS_SYS (putenv, int, (char *string));
_GL_CXXALIASWARN (putenv);
#endif
+#if @GNULIB_QSORT_R@
+# if @REPLACE_QSORT_R@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef qsort_r
+# define qsort_r rpl_qsort_r
+# endif
+_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
+ int (*compare) (void const *, void const *,
+ void *),
+ void *arg) _GL_ARG_NONNULL ((1, 4)));
+_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
+ int (*compare) (void const *, void const *,
+ void *),
+ void *arg));
+# else
+_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
+ int (*compare) (void const *, void const *,
+ void *),
+ void *arg));
+# endif
+_GL_CXXALIASWARN (qsort_r);
+#endif
+
#if @GNULIB_RANDOM_R@
# if !@HAVE_RANDOM_R@
diff --git a/lib/stpcpy.c b/lib/stpcpy.c
index 880a7061..559d2f23 100644
--- a/lib/stpcpy.c
+++ b/lib/stpcpy.c
@@ -1,5 +1,5 @@
/* stpcpy.c -- copy a string and return pointer to end of new string
- Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2014 Free Software
+ Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2015 Free Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
diff --git a/lib/stpncpy.c b/lib/stpncpy.c
index 37018e8b..e72ea479 100644
--- a/lib/stpncpy.c
+++ b/lib/stpncpy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995-1997, 2002-2003, 2005-2007, 2009-2014 Free Software
+/* Copyright (C) 1993, 1995-1997, 2002-2003, 2005-2007, 2009-2015 Free Software
* Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
diff --git a/lib/str-kmp.h b/lib/str-kmp.h
index b25d07f8..66fcead4 100644
--- a/lib/str-kmp.h
+++ b/lib/str-kmp.h
@@ -1,6 +1,6 @@
/* Substring search in a NUL terminated string of UNIT elements,
using the Knuth-Morris-Pratt algorithm.
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2005.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/str-two-way.h b/lib/str-two-way.h
index 49ee7469..6e10c8e3 100644
--- a/lib/str-two-way.h
+++ b/lib/str-two-way.h
@@ -1,5 +1,5 @@
/* Byte-wise substring search, using the Two-Way algorithm.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Eric Blake <ebb9@byu.net>, 2008.
diff --git a/lib/strdup.c b/lib/strdup.c
index 14cb1266..4fdd0bd9 100644
--- a/lib/strdup.c
+++ b/lib/strdup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2014 Free Software
+/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2015 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/streq.h b/lib/streq.h
index 0e62fb93..6107fc6b 100644
--- a/lib/streq.h
+++ b/lib/streq.h
@@ -1,5 +1,5 @@
/* Optimized string comparison.
- Copyright (C) 2001-2002, 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
diff --git a/lib/strerror-override.c b/lib/strerror-override.c
index 255d9333..2bb4d745 100644
--- a/lib/strerror-override.c
+++ b/lib/strerror-override.c
@@ -1,6 +1,6 @@
/* strerror-override.c --- POSIX compatible system error routine
- Copyright (C) 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2010-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/strerror-override.h b/lib/strerror-override.h
index e98c1c16..7af36dfd 100644
--- a/lib/strerror-override.h
+++ b/lib/strerror-override.h
@@ -1,6 +1,6 @@
/* strerror-override.h --- POSIX compatible system error routine
- Copyright (C) 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2010-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/strerror.c b/lib/strerror.c
index e54f0cc9..adba738b 100644
--- a/lib/strerror.c
+++ b/lib/strerror.c
@@ -1,6 +1,6 @@
/* strerror.c --- POSIX compatible system error routine
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/strftime.c b/lib/strftime.c
index 857cca56..2426aae7 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2001, 2003-2007, 2009-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
diff --git a/lib/strftime.h b/lib/strftime.h
index be016ea8..3967afc4 100644
--- a/lib/strftime.h
+++ b/lib/strftime.h
@@ -1,6 +1,6 @@
/* declarations for strftime.c
- Copyright (C) 2002, 2004, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/striconv.c b/lib/striconv.c
index 2495d81c..6f7dad8e 100644
--- a/lib/striconv.c
+++ b/lib/striconv.c
@@ -1,5 +1,5 @@
/* Charset conversion.
- Copyright (C) 2001-2007, 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2007, 2010-2015 Free Software Foundation, Inc.
Written by Bruno Haible and Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/striconv.h b/lib/striconv.h
index 5747731e..33cc212c 100644
--- a/lib/striconv.h
+++ b/lib/striconv.h
@@ -1,5 +1,5 @@
/* Charset conversion.
- Copyright (C) 2001-2004, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2006-2007, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible and Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/string.in.h b/lib/string.in.h
index 90621420..2abd6bc0 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <string.h>.
- Copyright (C) 1995-1996, 2001-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-1996, 2001-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,16 +15,32 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
-#ifndef _@GUARD_PREFIX@_STRING_H
-
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
+#if defined _GL_ALREADY_INCLUDING_STRING_H
+/* Special invocation convention:
+ - On OS X/NetBSD we have a sequence of nested includes
+ <string.h> -> <strings.h> -> "string.h"
+ In this situation system _chk variants due to -D_FORTIFY_SOURCE
+ might be used after any replacements defined here. */
+
+#@INCLUDE_NEXT@ @NEXT_STRING_H@
+
+#else
+/* Normal invocation convention. */
+
+#ifndef _@GUARD_PREFIX@_STRING_H
+
+#define _GL_ALREADY_INCLUDING_STRING_H
+
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STRING_H@
+#undef _GL_ALREADY_INCLUDING_STRING_H
+
#ifndef _@GUARD_PREFIX@_STRING_H
#define _@GUARD_PREFIX@_STRING_H
@@ -1027,3 +1043,4 @@ _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
#endif /* _@GUARD_PREFIX@_STRING_H */
#endif /* _@GUARD_PREFIX@_STRING_H */
+#endif
diff --git a/lib/strintcmp.c b/lib/strintcmp.c
index 98665017..ea665a59 100644
--- a/lib/strintcmp.c
+++ b/lib/strintcmp.c
@@ -1,6 +1,6 @@
/* Compare integer strings.
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/stripslash.c b/lib/stripslash.c
index 6f802d4c..12359cf7 100644
--- a/lib/stripslash.c
+++ b/lib/stripslash.c
@@ -1,6 +1,6 @@
/* stripslash.c -- remove redundant trailing slashes from a file name
- Copyright (C) 1990, 2001, 2003-2006, 2009-2014 Free Software Foundation,
+ Copyright (C) 1990, 2001, 2003-2006, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/strncat.c b/lib/strncat.c
index 71be4d65..994e07d5 100644
--- a/lib/strncat.c
+++ b/lib/strncat.c
@@ -1,5 +1,5 @@
/* Concatenate strings.
- Copyright (C) 1999, 2002, 2006, 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2010-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/strndup.c b/lib/strndup.c
index cc1a4843..793d5990 100644
--- a/lib/strndup.c
+++ b/lib/strndup.c
@@ -1,6 +1,6 @@
/* A replacement function, for systems that lack strndup.
- Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2014 Free Software
+ Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
diff --git a/lib/strnlen.c b/lib/strnlen.c
index ddccebc6..79e250c4 100644
--- a/lib/strnlen.c
+++ b/lib/strnlen.c
@@ -1,5 +1,5 @@
/* Find the length of STRING, but scan at most MAXLEN characters.
- Copyright (C) 2005-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007, 2009-2015 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/strnlen1.c b/lib/strnlen1.c
index 363776a9..48272a88 100644
--- a/lib/strnlen1.c
+++ b/lib/strnlen1.c
@@ -1,5 +1,5 @@
/* Find the length of STRING + 1, but scan at most MAXLEN bytes.
- Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/strnlen1.h b/lib/strnlen1.h
index b2f956f5..794e436e 100644
--- a/lib/strnlen1.h
+++ b/lib/strnlen1.h
@@ -1,5 +1,5 @@
/* Find the length of STRING + 1, but scan at most MAXLEN bytes.
- Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/strnumcmp-in.h b/lib/strnumcmp-in.h
index 436f0a6c..b3f63a76 100644
--- a/lib/strnumcmp-in.h
+++ b/lib/strnumcmp-in.h
@@ -1,6 +1,6 @@
/* Compare numeric strings. This is an internal include file.
- Copyright (C) 1988-2014 Free Software Foundation, Inc.
+ Copyright (C) 1988-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/strnumcmp.c b/lib/strnumcmp.c
index 1a9bccfe..f1a33f41 100644
--- a/lib/strnumcmp.c
+++ b/lib/strnumcmp.c
@@ -1,6 +1,6 @@
/* Compare numeric strings.
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/strpbrk.c b/lib/strpbrk.c
index 46e58d3b..0e360f92 100644
--- a/lib/strpbrk.c
+++ b/lib/strpbrk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1994, 2000, 2002-2003, 2006, 2009-2014 Free Software
+/* Copyright (C) 1991, 1994, 2000, 2002-2003, 2006, 2009-2015 Free Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
diff --git a/lib/strsignal.c b/lib/strsignal.c
index 77ba0630..06f2b20c 100644
--- a/lib/strsignal.c
+++ b/lib/strsignal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1994-2002, 2005, 2008-2014 Free Software Foundation,
+/* Copyright (C) 1991, 1994-2002, 2005, 2008-2015 Free Software Foundation,
Inc.
This file is part of the GNU C Library.
diff --git a/lib/strstr.c b/lib/strstr.c
index d5b9d784..fbc11a2d 100644
--- a/lib/strstr.c
+++ b/lib/strstr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2014 Free Software
+/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2015 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/strtod.c b/lib/strtod.c
index e554a84f..9fd0170f 100644
--- a/lib/strtod.c
+++ b/lib/strtod.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1992, 1997, 1999, 2003, 2006, 2008-2014 Free Software
+/* Copyright (C) 1991-1992, 1997, 1999, 2003, 2006, 2008-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/strtoimax.c b/lib/strtoimax.c
index 2c33d585..8ff65cee 100644
--- a/lib/strtoimax.c
+++ b/lib/strtoimax.c
@@ -1,6 +1,6 @@
/* Convert string representation of a number into an intmax_t value.
- Copyright (C) 1999, 2001-2004, 2006, 2009-2014 Free Software Foundation,
+ Copyright (C) 1999, 2001-2004, 2006, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/strtol.c b/lib/strtol.c
index 2e015dc5..1bc14398 100644
--- a/lib/strtol.c
+++ b/lib/strtol.c
@@ -1,6 +1,6 @@
/* Convert string representation of a number into an integer value.
- Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2014 Free Software
+ Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2015 Free Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
diff --git a/lib/strtoll.c b/lib/strtoll.c
index 47dfaa06..d7123491 100644
--- a/lib/strtoll.c
+++ b/lib/strtoll.c
@@ -1,5 +1,5 @@
/* Function to parse a 'long long int' from text.
- Copyright (C) 1995-1997, 1999, 2001, 2009-2014 Free Software Foundation,
+ Copyright (C) 1995-1997, 1999, 2001, 2009-2015 Free Software Foundation,
Inc.
This file is part of the GNU C Library.
diff --git a/lib/strtoul.c b/lib/strtoul.c
index 4c5ceaff..20517777 100644
--- a/lib/strtoul.c
+++ b/lib/strtoul.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1997, 2009-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1997, 2009-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/strtoull.c b/lib/strtoull.c
index 30e6e027..5cd2554c 100644
--- a/lib/strtoull.c
+++ b/lib/strtoull.c
@@ -1,5 +1,5 @@
/* Function to parse an 'unsigned long long int' from text.
- Copyright (C) 1995-1997, 1999, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-1997, 1999, 2009-2015 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
Library. Bugs can be reported to bug-glibc@gnu.org.
diff --git a/lib/symlink.c b/lib/symlink.c
index 0e3fae25..14356c30 100644
--- a/lib/symlink.c
+++ b/lib/symlink.c
@@ -1,5 +1,5 @@
/* Stub for symlink().
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sys_ioctl.in.h b/lib/sys_ioctl.in.h
index c13e3172..d3758ac7 100644
--- a/lib/sys_ioctl.in.h
+++ b/lib/sys_ioctl.in.h
@@ -1,5 +1,5 @@
/* Substitute for and wrapper around <sys/ioctl.h>.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sys_resource.in.h b/lib/sys_resource.in.h
index 7a17e32d..9dc2a0bb 100644
--- a/lib/sys_resource.in.h
+++ b/lib/sys_resource.in.h
@@ -1,5 +1,5 @@
/* Substitute for <sys/resource.h>.
- Copyright (C) 2012-2014 Free Software Foundation, Inc.
+ Copyright (C) 2012-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index a876b9ca..fd7a2917 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -1,5 +1,5 @@
/* Substitute for <sys/select.h>.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,8 +24,8 @@
On Cygwin, <sys/time.h> includes <sys/select.h>.
Simply delegate to the system's header in this case. */
#if (@HAVE_SYS_SELECT_H@ \
+ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H \
&& ((defined __osf__ && defined _SYS_TYPES_H_ \
- && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \
&& defined _OSF_SOURCE) \
|| (defined __sun && defined _SYS_TYPES_H \
&& (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
@@ -36,12 +36,13 @@
#elif (@HAVE_SYS_SELECT_H@ \
&& (defined _CYGWIN_SYS_TIME_H \
- || (defined __osf__ && defined _SYS_TIME_H_ \
- && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \
- && defined _OSF_SOURCE) \
- || (defined __sun && defined _SYS_TIME_H \
- && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
- || defined __EXTENSIONS__))))
+ || (!defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \
+ && ((defined __osf__ && defined _SYS_TIME_H_ \
+ && defined _OSF_SOURCE) \
+ || (defined __sun && defined _SYS_TIME_H \
+ && (! (defined _XOPEN_SOURCE \
+ || defined _POSIX_C_SOURCE) \
+ || defined __EXTENSIONS__))))))
# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H
# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index 3cdc0d11..aa58933b 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -1,6 +1,6 @@
/* Provide a sys/socket header file for systems lacking it (read: MinGW)
and for systems where it is incomplete.
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index b47a7ff0..9f5e8536 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -1,5 +1,5 @@
/* Provide a more complete sys/stat header file.
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
index 30057ad4..c556c5db 100644
--- a/lib/sys_time.in.h
+++ b/lib/sys_time.in.h
@@ -1,6 +1,6 @@
/* Provide a more complete sys/time.h.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h
index deb5d67d..814bc179 100644
--- a/lib/sys_types.in.h
+++ b/lib/sys_types.in.h
@@ -1,6 +1,6 @@
/* Provide a more complete sys/types.h.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sys_uio.in.h b/lib/sys_uio.in.h
index 0b403bc1..dbe7bde2 100644
--- a/lib/sys_uio.in.h
+++ b/lib/sys_uio.in.h
@@ -1,5 +1,5 @@
/* Substitute for <sys/uio.h>.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sys_utsname.in.h b/lib/sys_utsname.in.h
index f9e9d9d9..1fbef050 100644
--- a/lib/sys_utsname.in.h
+++ b/lib/sys_utsname.in.h
@@ -1,5 +1,5 @@
/* Substitute for <sys/utsname.h>.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/sys_wait.in.h b/lib/sys_wait.in.h
index 6412af4d..87d2282b 100644
--- a/lib/sys_wait.in.h
+++ b/lib/sys_wait.in.h
@@ -1,5 +1,5 @@
/* A POSIX-like <sys/wait.h>.
- Copyright (C) 2001-2003, 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003, 2005-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/tempname.c b/lib/tempname.c
index 183dae8c..1920274c 100644
--- a/lib/tempname.c
+++ b/lib/tempname.c
@@ -1,6 +1,6 @@
/* tempname.c - generate the name of a temporary file.
- Copyright (C) 1991-2003, 2005-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1991-2003, 2005-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -64,6 +64,7 @@
# define struct_stat64 struct stat64
#else
# define struct_stat64 struct stat
+# define __try_tempname try_tempname
# define __gen_tempname gen_tempname
# define __getpid getpid
# define __gettimeofday gettimeofday
@@ -184,30 +185,15 @@ check_x_suffix (char const *s, size_t len)
static const char letters[] =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
-/* Generate a temporary file name based on TMPL. TMPL must match the
- rules for mk[s]temp (i.e. end in at least X_SUFFIX_LEN "X"s,
- possibly with a suffix).
- The name constructed does not exist at the time of the call to
- this function. TMPL is overwritten with the result.
-
- KIND may be one of:
- __GT_NOCREATE: simply verify that the name does not exist
- at the time of the call.
- __GT_FILE: create the file using open(O_CREAT|O_EXCL)
- and return a read-write fd. The file is mode 0600.
- __GT_DIR: create a directory, which will be mode 0700.
-
- We use a clever algorithm to get hard-to-predict names. */
int
-gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
- size_t x_suffix_len)
+try_tempname_len (char *tmpl, int suffixlen, void *args,
+ int (*tryfunc) (char *, void *), size_t x_suffix_len)
{
size_t len;
char *XXXXXX;
unsigned int count;
int fd = -1;
int save_errno = errno;
- struct_stat64 st;
struct randint_source *rand_src;
/* A lower bound on the number of temporary files to attempt to
@@ -251,45 +237,7 @@ gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
for (i = 0; i < x_suffix_len; i++)
XXXXXX[i] = letters[randint_genmax (rand_src, sizeof letters - 2)];
- switch (kind)
- {
- case __GT_FILE:
- fd = __open (tmpl,
- (flags & ~O_ACCMODE)
- | O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
- break;
-
- case __GT_DIR:
- fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
- break;
-
- case __GT_NOCREATE:
- /* This case is backward from the other three. This function
- succeeds if __xstat fails because the name does not exist.
- Note the continue to bypass the common logic at the bottom
- of the loop. */
- if (__lxstat64 (_STAT_VER, tmpl, &st) < 0)
- {
- if (errno == ENOENT)
- {
- __set_errno (save_errno);
- fd = 0;
- goto done;
- }
- else
- {
- /* Give up now. */
- fd = -1;
- goto done;
- }
- }
- continue;
-
- default:
- assert (! "invalid KIND in __gen_tempname");
- abort ();
- }
-
+ fd = tryfunc (tmpl, args);
if (fd >= 0)
{
__set_errno (save_errno);
@@ -317,8 +265,81 @@ gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
return fd;
}
+static int
+try_file (char *tmpl, void *flags)
+{
+ int *openflags = flags;
+ return __open (tmpl,
+ (*openflags & ~O_ACCMODE)
+ | O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+}
+
+static int
+try_dir (char *tmpl, void *flags _GL_UNUSED)
+{
+ return __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
+}
+
+static int
+try_nocreate (char *tmpl, void *flags _GL_UNUSED)
+{
+ struct_stat64 st;
+
+ if (__lxstat64 (_STAT_VER, tmpl, &st) == 0)
+ __set_errno (EEXIST);
+ return errno == ENOENT ? 0 : -1;
+}
+
+/* Generate a temporary file name based on TMPL. TMPL must match the
+ rules for mk[s]temp (i.e., end in at least X_SUFFIX_LEN "X"s,
+ possibly with a suffix).
+ The name constructed does not exist at the time of the call to
+ this function. TMPL is overwritten with the result.
+
+ KIND may be one of:
+ __GT_NOCREATE: simply verify that the name does not exist
+ at the time of the call.
+ __GT_FILE: create the file using open(O_CREAT|O_EXCL)
+ and return a read-write fd. The file is mode 0600.
+ __GT_DIR: create a directory, which will be mode 0700.
+
+ We use a clever algorithm to get hard-to-predict names. */
+int
+gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
+ size_t x_suffix_len)
+{
+ int (*tryfunc) (char *, void *);
+
+ switch (kind)
+ {
+ case __GT_FILE:
+ tryfunc = try_file;
+ break;
+
+ case __GT_DIR:
+ tryfunc = try_dir;
+ break;
+
+ case __GT_NOCREATE:
+ tryfunc = try_nocreate;
+ break;
+
+ default:
+ assert (! "invalid KIND in __gen_tempname");
+ abort ();
+ }
+ return try_tempname_len (tmpl, suffixlen, &flags, tryfunc, x_suffix_len);
+}
+
int
__gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
{
return gen_tempname_len (tmpl, suffixlen, flags, kind, 6);
}
+
+int
+__try_tempname (char *tmpl, int suffixlen, void *args,
+ int (*tryfunc) (char *, void *))
+{
+ return try_tempname_len (tmpl, suffixlen, args, tryfunc, 6);
+}
diff --git a/lib/tempname.h b/lib/tempname.h
index 696aff25..6029b9fe 100644
--- a/lib/tempname.h
+++ b/lib/tempname.h
@@ -1,6 +1,6 @@
/* Create a temporary file or directory.
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -32,6 +32,10 @@
# define GT_NOCREATE 2
# endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Generate a temporary file name based on TMPL. TMPL must match the
rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix).
The name constructed does not exist at the time of the call to
@@ -49,4 +53,18 @@ extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind);
extern int gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
size_t x_suffix_len);
+/* Similar to gen_tempname, but TRYFUNC is called for each temporary
+ name to try. If TRYFUNC returns a non-negative number, TRY_GEN_TEMPNAME
+ returns with this value. Otherwise, if errno is set to EEXIST, another
+ name is tried, or else TRY_GEN_TEMPNAME returns -1. */
+extern int try_tempname (char *tmpl, int suffixlen, void *args,
+ int (*tryfunc) (char *, void *));
+extern int try_tempname_len (char *tmpl, int suffixlen, void *args,
+ int (*tryfunc) (char *, void *),
+ size_t x_suffix_len);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GL_TEMPNAME_H */
diff --git a/lib/termios.in.h b/lib/termios.in.h
index 1299bb73..9e8a2812 100644
--- a/lib/termios.in.h
+++ b/lib/termios.in.h
@@ -1,5 +1,5 @@
/* Substitute for and wrapper around <termios.h>.
- Copyright (C) 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2010-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/time.in.h b/lib/time.in.h
index 81abdf46..1a6b746c 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -1,6 +1,6 @@
/* A more-standard <time.h>.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -55,6 +55,8 @@
# include <sys/time.h>
# elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
# include <pthread.h>
+# elif @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
+# include <unistd.h>
# else
# ifdef __cplusplus
diff --git a/lib/time_r.c b/lib/time_r.c
index a848d544..0b512de9 100644
--- a/lib/time_r.c
+++ b/lib/time_r.c
@@ -1,6 +1,6 @@
/* Reentrant time functions like localtime_r.
- Copyright (C) 2003, 2006-2007, 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2007, 2010-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/timespec.h b/lib/timespec.h
index 872cbb76..9ec495a0 100644
--- a/lib/timespec.h
+++ b/lib/timespec.h
@@ -1,6 +1,6 @@
/* timespec -- System time interface
- Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2014 Free Software
+ Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -74,7 +74,7 @@ make_timespec (time_t s, long int ns)
The (int) cast avoids a gcc -Wconversion warning. */
-_GL_TIMESPEC_INLINE int
+_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE
timespec_cmp (struct timespec a, struct timespec b)
{
return (a.tv_sec < b.tv_sec ? -1
@@ -84,7 +84,7 @@ timespec_cmp (struct timespec a, struct timespec b)
/* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be
nonnegative. */
-_GL_TIMESPEC_INLINE int
+_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE
timespec_sign (struct timespec a)
{
return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec;
diff --git a/lib/trim.c b/lib/trim.c
index 742de9be..369b20fe 100644
--- a/lib/trim.c
+++ b/lib/trim.c
@@ -1,5 +1,5 @@
/* Removes leading and/or trailing whitespaces
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/trim.h b/lib/trim.h
index e4dc938b..8a38a9fb 100644
--- a/lib/trim.h
+++ b/lib/trim.h
@@ -1,5 +1,5 @@
/* Removes leading and/or trailing whitespaces
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/u64.h b/lib/u64.h
index ee3bfcd8..0e569d02 100644
--- a/lib/u64.h
+++ b/lib/u64.h
@@ -1,6 +1,6 @@
/* uint64_t-like operations that work even on hosts lacking uint64_t
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/uname.c b/lib/uname.c
index c1d85196..422467c4 100644
--- a/lib/uname.c
+++ b/lib/uname.c
@@ -1,5 +1,5 @@
/* uname replacement.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/unicodeio.c b/lib/unicodeio.c
index 9df8b79f..6f969d23 100644
--- a/lib/unicodeio.c
+++ b/lib/unicodeio.c
@@ -1,6 +1,6 @@
/* Unicode character output to streams with locale dependent encoding.
- Copyright (C) 2000-2003, 2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2003, 2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/unicodeio.h b/lib/unicodeio.h
index 1706cf64..d6e7fed5 100644
--- a/lib/unicodeio.h
+++ b/lib/unicodeio.h
@@ -1,6 +1,6 @@
/* Unicode character output to streams with locale dependent encoding.
- Copyright (C) 2000-2003, 2005, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2003, 2005, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/unistd--.h b/lib/unistd--.h
index 9d0e54d1..ada1f6b7 100644
--- a/lib/unistd--.h
+++ b/lib/unistd--.h
@@ -1,6 +1,6 @@
/* Like unistd.h, but redefine some names to avoid glitches.
- Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/unistd-safer.h b/lib/unistd-safer.h
index 4b0ca6ab..d4251b3e 100644
--- a/lib/unistd-safer.h
+++ b/lib/unistd-safer.h
@@ -1,6 +1,6 @@
/* Invoke unistd-like functions, but avoid some glitches.
- Copyright (C) 2001, 2003, 2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2005, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 622b2287..958fea2a 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -1,5 +1,5 @@
/* Substitute for and wrapper around <unistd.h>.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -401,6 +401,12 @@ _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
/* Set of environment variables and values. An array of strings of the form
"VARIABLE=VALUE", terminated with a NULL. */
# if defined __APPLE__ && defined __MACH__
+# include <TargetConditionals.h>
+# if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
+# define _GL_USE_CRT_EXTERNS
+# endif
+# endif
+# ifdef _GL_USE_CRT_EXTERNS
# include <crt_externs.h>
# define environ (*_NSGetEnviron ())
# else
@@ -1287,13 +1293,24 @@ _GL_WARN_ON_USE (readlink, "readlink is unportable - "
#if @GNULIB_READLINKAT@
-# if !@HAVE_READLINKAT@
+# if @REPLACE_READLINKAT@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# define readlinkat rpl_readlinkat
+# endif
+_GL_FUNCDECL_RPL (readlinkat, ssize_t,
+ (int fd, char const *file, char *buf, size_t len)
+ _GL_ARG_NONNULL ((2, 3)));
+_GL_CXXALIAS_RPL (readlinkat, ssize_t,
+ (int fd, char const *file, char *buf, size_t len));
+# else
+# if !@HAVE_READLINKAT@
_GL_FUNCDECL_SYS (readlinkat, ssize_t,
(int fd, char const *file, char *buf, size_t len)
_GL_ARG_NONNULL ((2, 3)));
-# endif
+# endif
_GL_CXXALIAS_SYS (readlinkat, ssize_t,
(int fd, char const *file, char *buf, size_t len));
+# endif
_GL_CXXALIASWARN (readlinkat);
#elif defined GNULIB_POSIXCHECK
# undef readlinkat
@@ -1407,13 +1424,25 @@ _GL_WARN_ON_USE (symlink, "symlink is not portable - "
#if @GNULIB_SYMLINKAT@
-# if !@HAVE_SYMLINKAT@
+# if @REPLACE_SYMLINKAT@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef symlinkat
+# define symlinkat rpl_symlinkat
+# endif
+_GL_FUNCDECL_RPL (symlinkat, int,
+ (char const *contents, int fd, char const *file)
+ _GL_ARG_NONNULL ((1, 3)));
+_GL_CXXALIAS_RPL (symlinkat, int,
+ (char const *contents, int fd, char const *file));
+# else
+# if !@HAVE_SYMLINKAT@
_GL_FUNCDECL_SYS (symlinkat, int,
(char const *contents, int fd, char const *file)
_GL_ARG_NONNULL ((1, 3)));
-# endif
+# endif
_GL_CXXALIAS_SYS (symlinkat, int,
(char const *contents, int fd, char const *file));
+# endif
_GL_CXXALIASWARN (symlinkat);
#elif defined GNULIB_POSIXCHECK
# undef symlinkat
diff --git a/lib/unistr.in.h b/lib/unistr.in.h
index 222c9595..be158be1 100644
--- a/lib/unistr.in.h
+++ b/lib/unistr.in.h
@@ -1,5 +1,5 @@
/* Elementary Unicode string functions.
- Copyright (C) 2001-2002, 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2005-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
diff --git a/lib/unistr/u8-mbtoucr.c b/lib/unistr/u8-mbtoucr.c
index b11543a5..9cc15002 100644
--- a/lib/unistr/u8-mbtoucr.c
+++ b/lib/unistr/u8-mbtoucr.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-8 string, returning an error code.
- Copyright (C) 1999-2002, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2002, 2006-2007, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-uctomb-aux.c b/lib/unistr/u8-uctomb-aux.c
index 8fdd88b5..65445be1 100644
--- a/lib/unistr/u8-uctomb-aux.c
+++ b/lib/unistr/u8-uctomb-aux.c
@@ -1,5 +1,5 @@
/* Conversion UCS-4 to UTF-8.
- Copyright (C) 2002, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-uctomb.c b/lib/unistr/u8-uctomb.c
index df9b227e..a8250f42 100644
--- a/lib/unistr/u8-uctomb.c
+++ b/lib/unistr/u8-uctomb.c
@@ -1,5 +1,5 @@
/* Store a character in UTF-8 string.
- Copyright (C) 2002, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unitypes.in.h b/lib/unitypes.in.h
index bc302c24..d3c47ae6 100644
--- a/lib/unitypes.in.h
+++ b/lib/unitypes.in.h
@@ -1,5 +1,5 @@
/* Elementary types and macros for the GNU UniString library.
- Copyright (C) 2002, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
diff --git a/lib/uniwidth.in.h b/lib/uniwidth.in.h
index b2fd218e..7694bebf 100644
--- a/lib/uniwidth.in.h
+++ b/lib/uniwidth.in.h
@@ -1,5 +1,5 @@
/* Display width functions.
- Copyright (C) 2001-2002, 2005, 2007, 2009-2014 Free Software Foundation,
+ Copyright (C) 2001-2002, 2005, 2007, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/uniwidth/cjk.h b/lib/uniwidth/cjk.h
index 71ea0cb7..cdd9a555 100644
--- a/lib/uniwidth/cjk.h
+++ b/lib/uniwidth/cjk.h
@@ -1,5 +1,5 @@
/* Test for CJK encoding.
- Copyright (C) 2001-2002, 2005-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2005-2007, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/uniwidth/width.c b/lib/uniwidth/width.c
index 2c070c3e..c7e03b2a 100644
--- a/lib/uniwidth/width.c
+++ b/lib/uniwidth/width.c
@@ -1,5 +1,5 @@
/* Determine display width of Unicode character.
- Copyright (C) 2001-2002, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2006-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
* - Zero width characters; generated from
* "grep '^[^;]*;ZERO WIDTH ' UnicodeData.txt"
*/
-static const unsigned char nonspacing_table_data[27*64] = {
+static const unsigned char nonspacing_table_data[36*64] = {
/* 0x0000-0x01ff */
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0x0000-0x003f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x0040-0x007f */
@@ -61,7 +61,7 @@ static const unsigned char nonspacing_table_data[27*64] = {
0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xbf, /* 0x0580-0x05bf */
0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x05c0-0x05ff */
/* 0x0600-0x07ff */
- 0x0f, 0x00, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, /* 0x0600-0x063f */
+ 0x3f, 0x00, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, /* 0x0600-0x063f */
0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, /* 0x0640-0x067f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0680-0x06bf */
0x00, 0x00, 0xc0, 0xbf, 0x9f, 0x3d, 0x00, 0x00, /* 0x06c0-0x06ff */
@@ -73,7 +73,7 @@ static const unsigned char nonspacing_table_data[27*64] = {
0x00, 0x00, 0xc0, 0xfb, 0xef, 0x3e, 0x00, 0x00, /* 0x0800-0x083f */
0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, /* 0x0840-0x087f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0880-0x08bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08c0-0x08ff */
+ 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, /* 0x08c0-0x08ff */
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, /* 0x0900-0x093f */
0xfe, 0x21, 0xfe, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0940-0x097f */
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0980-0x09bf */
@@ -88,11 +88,11 @@ static const unsigned char nonspacing_table_data[27*64] = {
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0b80-0x0bbf */
0x01, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0bc0-0x0bff */
/* 0x0c00-0x0dff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, /* 0x0c00-0x0c3f */
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, /* 0x0c00-0x0c3f */
0xc1, 0x3d, 0x60, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0c40-0x0c7f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0c80-0x0cbf */
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0c80-0x0cbf */
0x00, 0x30, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0cc0-0x0cff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d00-0x0d3f */
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d00-0x0d3f */
0x1e, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0d40-0x0d7f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d80-0x0dbf */
0x00, 0x04, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0dc0-0x0dff */
@@ -133,7 +133,7 @@ static const unsigned char nonspacing_table_data[27*64] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x3f, /* 0x1780-0x17bf */
0x40, 0xfe, 0x0f, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x17c0-0x17ff */
/* 0x1800-0x19ff */
- 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1800-0x183f */
+ 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1800-0x183f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1840-0x187f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, /* 0x1880-0x18bf */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18c0-0x18ff */
@@ -142,26 +142,26 @@ static const unsigned char nonspacing_table_data[27*64] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1980-0x19bf */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x19c0-0x19ff */
/* 0x1a00-0x1bff */
- 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, /* 0x1a00-0x1a3f */
+ 0x00, 0x00, 0x80, 0x09, 0x00, 0x00, 0x00, 0x00, /* 0x1a00-0x1a3f */
0x00, 0x00, 0x40, 0x7f, 0xe5, 0x1f, 0xf8, 0x9f, /* 0x1a40-0x1a7f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1a80-0x1abf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, /* 0x1a80-0x1abf */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ac0-0x1aff */
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x17, /* 0x1b00-0x1b3f */
0x04, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00, /* 0x1b40-0x1b7f */
- 0x03, 0x00, 0x00, 0x00, 0x3c, 0x03, 0x00, 0x00, /* 0x1b80-0x1bbf */
+ 0x03, 0x00, 0x00, 0x00, 0x3c, 0x3b, 0x00, 0x00, /* 0x1b80-0x1bbf */
0x00, 0x00, 0x00, 0x00, 0x40, 0xa3, 0x03, 0x00, /* 0x1bc0-0x1bff */
/* 0x1c00-0x1dff */
0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xcf, 0x00, /* 0x1c00-0x1c3f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c40-0x1c7f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c80-0x1cbf */
- 0x00, 0x00, 0xf7, 0xff, 0xfd, 0x21, 0x00, 0x00, /* 0x1cc0-0x1cff */
+ 0x00, 0x00, 0xf7, 0xff, 0xfd, 0x21, 0x10, 0x03, /* 0x1cc0-0x1cff */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d00-0x1d3f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d40-0x1d7f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d80-0x1dbf */
- 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xf0, /* 0x1dc0-0x1dff */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, /* 0x1dc0-0x1dff */
/* 0x2000-0x21ff */
0x00, 0xf8, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, /* 0x2000-0x203f */
- 0x00, 0x00, 0x00, 0x00, 0x1f, 0xfc, 0x00, 0x00, /* 0x2040-0x207f */
+ 0x00, 0x00, 0x00, 0x00, 0xdf, 0xff, 0x00, 0x00, /* 0x2040-0x207f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2080-0x20bf */
0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, /* 0x20c0-0x20ff */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2100-0x213f */
@@ -178,7 +178,7 @@ static const unsigned char nonspacing_table_data[27*64] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2d80-0x2dbf */
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* 0x2dc0-0x2dff */
/* 0x3000-0x31ff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, /* 0x3000-0x303f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, /* 0x3000-0x303f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3040-0x307f */
0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, /* 0x3080-0x30bf */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30c0-0x30ff */
@@ -188,8 +188,8 @@ static const unsigned char nonspacing_table_data[27*64] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x31c0-0x31ff */
/* 0xa600-0xa7ff */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa600-0xa63f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x30, /* 0xa640-0xa67f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa680-0xa6bf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xf7, 0x3f, /* 0xa640-0xa67f */
+ 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, /* 0xa680-0xa6bf */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, /* 0xa6c0-0xa6ff */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa700-0xa73f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa740-0xa77f */
@@ -203,12 +203,12 @@ static const unsigned char nonspacing_table_data[27*64] = {
0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, /* 0xa900-0xa93f */
0x80, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa940-0xa97f */
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x13, /* 0xa980-0xa9bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa9c0-0xa9ff */
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, /* 0xa9c0-0xa9ff */
/* 0xaa00-0xabff */
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x66, 0x00, /* 0xaa00-0xaa3f */
- 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xaa40-0xaa7f */
+ 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0xaa40-0xaa7f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0xc1, /* 0xaa80-0xaabf */
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xaac0-0xaaff */
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x30, 0x40, 0x00, /* 0xaac0-0xaaff */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab00-0xab3f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab40-0xab7f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab80-0xabbf */
@@ -223,7 +223,7 @@ static const unsigned char nonspacing_table_data[27*64] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb80-0xfbbf */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfbc0-0xfbff */
/* 0xfe00-0xffff */
- 0xff, 0xff, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, /* 0xfe00-0xfe3f */
+ 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, /* 0xfe00-0xfe3f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe40-0xfe7f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe80-0xfebf */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0xfec0-0xfeff */
@@ -240,24 +240,87 @@ static const unsigned char nonspacing_table_data[27*64] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10140-0x1017f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10180-0x101bf */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, /* 0x101c0-0x101ff */
+ /* 0x10200-0x103ff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10200-0x1023f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10240-0x1027f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10280-0x102bf */
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, /* 0x102c0-0x102ff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10300-0x1033f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, /* 0x10340-0x1037f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10380-0x103bf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x103c0-0x103ff */
/* 0x10a00-0x10bff */
0x6e, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, /* 0x10a00-0x10a3f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a40-0x10a7f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a80-0x10abf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10ac0-0x10aff */
+ 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, /* 0x10ac0-0x10aff */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b00-0x10b3f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b40-0x10b7f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b80-0x10bbf */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10bc0-0x10bff */
/* 0x11000-0x111ff */
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0x11000-0x1103f */
- 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11040-0x1107f */
+ 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x11040-0x1107f */
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x26, /* 0x11080-0x110bf */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x110c0-0x110ff */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11100-0x1113f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11140-0x1117f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11180-0x111bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x111c0-0x111ff */
+ 0x07, 0x00, 0x00, 0x00, 0x80, 0xef, 0x1f, 0x00, /* 0x11100-0x1113f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, /* 0x11140-0x1117f */
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x7f, /* 0x11180-0x111bf */
+ 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x111c0-0x111ff */
+ /* 0x11200-0x113ff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xd3, 0x00, /* 0x11200-0x1123f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11240-0x1127f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11280-0x112bf */
+ 0x00, 0x00, 0x00, 0x80, 0xf8, 0x07, 0x00, 0x00, /* 0x112c0-0x112ff */
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x11300-0x1133f */
+ 0x01, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x1f, 0x00, /* 0x11340-0x1137f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11380-0x113bf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x113c0-0x113ff */
+ /* 0x11400-0x115ff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11400-0x1143f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11440-0x1147f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x85, /* 0x11480-0x114bf */
+ 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x114c0-0x114ff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11500-0x1153f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11540-0x1157f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xb0, /* 0x11580-0x115bf */
+ 0x01, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, /* 0x115c0-0x115ff */
+ /* 0x11600-0x117ff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xa7, /* 0x11600-0x1163f */
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11640-0x1167f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0xbf, 0x00, /* 0x11680-0x116bf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x116c0-0x116ff */
+ 0x00, 0x00, 0x00, 0xe0, 0xbc, 0x0f, 0x00, 0x00, /* 0x11700-0x1173f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11740-0x1177f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11780-0x117bf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x117c0-0x117ff */
+ /* 0x16a00-0x16bff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a00-0x16a3f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a40-0x16a7f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a80-0x16abf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, /* 0x16ac0-0x16aff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, /* 0x16b00-0x16b3f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16b40-0x16b7f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16b80-0x16bbf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16bc0-0x16bff */
+ /* 0x16e00-0x16fff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16e00-0x16e3f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16e40-0x16e7f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16e80-0x16ebf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16ec0-0x16eff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16f00-0x16f3f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16f40-0x16f7f */
+ 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16f80-0x16fbf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16fc0-0x16fff */
+ /* 0x1bc00-0x1bdff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bc00-0x1bc3f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bc40-0x1bc7f */
+ 0x00, 0x00, 0x00, 0x60, 0x0f, 0x00, 0x00, 0x00, /* 0x1bc80-0x1bcbf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bcc0-0x1bcff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bd00-0x1bd3f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bd40-0x1bd7f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bd80-0x1bdbf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bdc0-0x1bdff */
/* 0x1d000-0x1d1ff */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d000-0x1d03f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d040-0x1d07f */
@@ -275,9 +338,27 @@ static const unsigned char nonspacing_table_data[27*64] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d300-0x1d33f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d340-0x1d37f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d380-0x1d3bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x1d3c0-0x1d3ff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d3c0-0x1d3ff */
+ /* 0x1da00-0x1dbff */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xf8, /* 0x1da00-0x1da3f */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x20, 0x00, /* 0x1da40-0x1da7f */
+ 0x10, 0x00, 0x00, 0xf8, 0xfe, 0xff, 0x00, 0x00, /* 0x1da80-0x1dabf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1dac0-0x1daff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db00-0x1db3f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db40-0x1db7f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db80-0x1dbbf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1dbc0-0x1dbff */
+ /* 0x1e800-0x1e9ff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e800-0x1e83f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e840-0x1e87f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e880-0x1e8bf */
+ 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e8c0-0x1e8ff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e900-0x1e93f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e940-0x1e97f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e980-0x1e9bf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x1e9c0-0x1e9ff */
};
-static const signed char nonspacing_table_ind[240] = {
+static const signed char nonspacing_table_ind[248] = {
0, 1, 2, 3, 4, 5, 6, 7, /* 0x0000-0x0fff */
8, 9, -1, 10, 11, 12, 13, -1, /* 0x1000-0x1fff */
14, -1, -1, -1, -1, -1, 15, -1, /* 0x2000-0x2fff */
@@ -294,20 +375,21 @@ static const signed char nonspacing_table_ind[240] = {
-1, -1, -1, -1, -1, -1, -1, -1, /* 0xd000-0xdfff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0xe000-0xefff */
-1, -1, -1, -1, -1, 20, -1, 21, /* 0xf000-0xffff */
- 22, -1, -1, -1, -1, 23, -1, -1, /* 0x10000-0x10fff */
- 24, -1, -1, -1, -1, -1, -1, -1, /* 0x11000-0x11fff */
+ 22, 23, -1, -1, -1, 24, -1, -1, /* 0x10000-0x10fff */
+ 25, 26, 27, 28, -1, -1, -1, -1, /* 0x11000-0x11fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x12000-0x12fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x13000-0x13fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x14000-0x14fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x15000-0x15fff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x16000-0x16fff */
+ -1, -1, -1, -1, -1, 29, -1, 30, /* 0x16000-0x16fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x17000-0x17fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x18000-0x18fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x19000-0x19fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x1a000-0x1afff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1b000-0x1bfff */
+ -1, -1, -1, -1, -1, -1, 31, -1, /* 0x1b000-0x1bfff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x1c000-0x1cfff */
- 25, 26, -1, -1, -1, -1, -1, -1 /* 0x1d000-0x1dfff */
+ 32, 33, -1, -1, -1, 34, -1, -1, /* 0x1d000-0x1dfff */
+ -1, -1, -1, -1, 35, -1, -1, -1 /* 0x1e000-0x1efff */
};
/* Determine number of column positions required for UC. */
@@ -315,7 +397,7 @@ int
uc_width (ucs4_t uc, const char *encoding)
{
/* Test for non-spacing or control character. */
- if ((uc >> 9) < 240)
+ if ((uc >> 9) < 248)
{
int ind = nonspacing_table_ind[uc >> 9];
if (ind >= 0)
diff --git a/lib/unlink.c b/lib/unlink.c
index a234be4a..e006273a 100644
--- a/lib/unlink.c
+++ b/lib/unlink.c
@@ -1,6 +1,6 @@
/* Work around unlink bugs.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/unlinkat.c b/lib/unlinkat.c
index fff8310e..af35256f 100644
--- a/lib/unlinkat.c
+++ b/lib/unlinkat.c
@@ -1,6 +1,6 @@
/* Work around unlinkat bugs on Solaris 9 and Hurd.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -35,9 +35,12 @@
# undef unlinkat
-/* unlinkat without AT_REMOVEDIR does not honor trailing / on Solaris
- 9. Solve it in a similar manner to unlink. Hurd has the same
- issue. */
+/* unlinkat without AT_REMOVEDIR does not honor trailing / on Solaris 9.
+ Hurd has the same issue.
+
+ unlinkat without AT_REMOVEDIR erroneously ignores ".." on Darwin 14.
+
+ Solve these in a similar manner to unlink. */
int
rpl_unlinkat (int fd, char const *name, int flag)
@@ -78,7 +81,17 @@ rpl_unlinkat (int fd, char const *name, int flag)
}
}
if (!result)
- result = unlinkat (fd, name, flag);
+ {
+# if UNLINK_PARENT_BUG
+ if (len >= 2 && name[len - 1] == '.' && name[len - 2] == '.'
+ && (len == 2 || ISSLASH (name[len - 3])))
+ {
+ errno = EISDIR; /* could also use EPERM */
+ return -1;
+ }
+# endif
+ result = unlinkat (fd, name, flag);
+ }
return result;
}
diff --git a/lib/unlocked-io.h b/lib/unlocked-io.h
index 4b0f3ff0..06ffac61 100644
--- a/lib/unlocked-io.h
+++ b/lib/unlocked-io.h
@@ -1,6 +1,6 @@
/* Prefer faster, non-thread-safe stdio functions if available.
- Copyright (C) 2001-2004, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/unsetenv.c b/lib/unsetenv.c
index 53721fc4..87f41d59 100644
--- a/lib/unsetenv.c
+++ b/lib/unsetenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995-2002, 2005-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995-2002, 2005-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/userspec.c b/lib/userspec.c
index 1be9266e..84632c37 100644
--- a/lib/userspec.c
+++ b/lib/userspec.c
@@ -1,5 +1,5 @@
/* userspec.c -- Parse a user and group string.
- Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2014 Free Software
+ Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -234,7 +234,7 @@ parse_with_separator (char const *spec, char const *separator,
free (u);
free (gname);
- return _(error_msg);
+ return error_msg ? _(error_msg) : NULL;
}
/* Extract from SPEC, which has the form "[user][:.][group]",
diff --git a/lib/utimecmp.c b/lib/utimecmp.c
index 49ea5f86..b91fe499 100644
--- a/lib/utimecmp.c
+++ b/lib/utimecmp.c
@@ -1,6 +1,6 @@
/* utimecmp.c -- compare file time stamps
- Copyright (C) 2004-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/utimecmp.h b/lib/utimecmp.h
index 81c16e27..f297a173 100644
--- a/lib/utimecmp.h
+++ b/lib/utimecmp.h
@@ -1,6 +1,6 @@
/* utimecmp.h -- compare file time stamps
- Copyright (C) 2004, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/utimens.c b/lib/utimens.c
index dd3ec668..7386dcf2 100644
--- a/lib/utimens.c
+++ b/lib/utimens.c
@@ -1,6 +1,6 @@
/* Set file access and modification times.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -24,7 +24,6 @@
#define _GL_UTIMENS_INLINE _GL_EXTERN_INLINE
#include "utimens.h"
-#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
@@ -87,7 +86,6 @@ validate_timespec (struct timespec timespec[2])
{
int result = 0;
int utime_omit_count = 0;
- assert (timespec);
if ((timespec[0].tv_nsec != UTIME_NOW
&& timespec[0].tv_nsec != UTIME_OMIT
&& ! (0 <= timespec[0].tv_nsec
diff --git a/lib/utimens.h b/lib/utimens.h
index faaf3c70..cbd06cc7 100644
--- a/lib/utimens.h
+++ b/lib/utimens.h
@@ -1,6 +1,6 @@
/* Set file access and modification times.
- Copyright 2012-2014 Free Software Foundation, Inc.
+ Copyright 2012-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
diff --git a/lib/utimensat.c b/lib/utimensat.c
index 185cb14c..59839d40 100644
--- a/lib/utimensat.c
+++ b/lib/utimensat.c
@@ -1,5 +1,5 @@
/* Set the access and modification time of a file relative to directory fd.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index b7c8709e..88332f0b 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -1,5 +1,5 @@
/* vsprintf with automatic memory allocation.
- Copyright (C) 1999, 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1886,7 +1886,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
else
{
do
- result[length++] = (unsigned char) *cp++;
+ result[length++] = *cp++;
while (--n > 0);
}
}
@@ -1957,15 +1957,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
abort ();
arg = a.arg[dp->width_arg_index].a.a_int;
+ width = arg;
if (arg < 0)
{
/* "A negative field width is taken as a '-' flag
followed by a positive field width." */
flags |= FLAG_LEFT;
- width = (unsigned int) (-arg);
+ width = -width;
}
- else
- width = arg;
}
else
{
@@ -2073,8 +2072,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
characters = 0;
}
- if (has_width && width > characters
- && !(dp->flags & FLAG_LEFT))
+ if (characters < width && !(dp->flags & FLAG_LEFT))
{
size_t n = width - characters;
ENSURE_ALLOCATION (xsum (length, n));
@@ -2127,8 +2125,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
# endif
- if (has_width && width > characters
- && (dp->flags & FLAG_LEFT))
+ if (characters < width && (dp->flags & FLAG_LEFT))
{
size_t n = width - characters;
ENSURE_ALLOCATION (xsum (length, n));
@@ -2201,8 +2198,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
characters = 0;
}
- if (has_width && width > characters
- && !(dp->flags & FLAG_LEFT))
+ if (characters < width && !(dp->flags & FLAG_LEFT))
{
size_t n = width - characters;
ENSURE_ALLOCATION (xsum (length, n));
@@ -2255,8 +2251,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
# endif
- if (has_width && width > characters
- && (dp->flags & FLAG_LEFT))
+ if (characters < width && (dp->flags & FLAG_LEFT))
{
size_t n = width - characters;
ENSURE_ALLOCATION (xsum (length, n));
@@ -2329,8 +2324,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
characters = 0;
}
- if (has_width && width > characters
- && !(dp->flags & FLAG_LEFT))
+ if (characters < width && !(dp->flags & FLAG_LEFT))
{
size_t n = width - characters;
ENSURE_ALLOCATION (xsum (length, n));
@@ -2383,8 +2377,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
# endif
- if (has_width && width > characters
- && (dp->flags & FLAG_LEFT))
+ if (characters < width && (dp->flags & FLAG_LEFT))
{
size_t n = width - characters;
ENSURE_ALLOCATION (xsum (length, n));
@@ -2435,15 +2428,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
abort ();
arg = a.arg[dp->width_arg_index].a.a_int;
+ width = arg;
if (arg < 0)
{
/* "A negative field width is taken as a '-' flag
followed by a positive field width." */
flags |= FLAG_LEFT;
- width = (unsigned int) (-arg);
+ width = -width;
}
- else
- width = arg;
}
else
{
@@ -2573,8 +2565,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
characters = 0;
}
- if (has_width && width > characters
- && !(dp->flags & FLAG_LEFT))
+ if (characters < width && !(dp->flags & FLAG_LEFT))
{
size_t n = width - characters;
ENSURE_ALLOCATION (xsum (length, n));
@@ -2635,8 +2626,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
}
- if (has_width && width > characters
- && (dp->flags & FLAG_LEFT))
+ if (characters < width && (dp->flags & FLAG_LEFT))
{
size_t n = width - characters;
ENSURE_ALLOCATION (xsum (length, n));
@@ -2827,8 +2817,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
/* w doesn't matter. */
w = 0;
- if (has_width && width > w
- && !(dp->flags & FLAG_LEFT))
+ if (w < width && !(dp->flags & FLAG_LEFT))
{
size_t n = width - w;
ENSURE_ALLOCATION (xsum (length, n));
@@ -2911,8 +2900,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
length += tmpdst_len;
# endif
- if (has_width && width > w
- && (dp->flags & FLAG_LEFT))
+ if (w < width && (dp->flags & FLAG_LEFT))
{
size_t n = width - w;
ENSURE_ALLOCATION (xsum (length, n));
@@ -2939,17 +2927,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
arg_type type = a.arg[dp->arg_index].type;
int flags = dp->flags;
- int has_width;
size_t width;
int has_precision;
size_t precision;
size_t tmp_length;
+ size_t count;
DCHAR_T tmpbuf[700];
DCHAR_T *tmp;
DCHAR_T *pad_ptr;
DCHAR_T *p;
- has_width = 0;
width = 0;
if (dp->width_start != dp->width_end)
{
@@ -2960,15 +2947,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
abort ();
arg = a.arg[dp->width_arg_index].a.a_int;
+ width = arg;
if (arg < 0)
{
/* "A negative field width is taken as a '-' flag
followed by a positive field width." */
flags |= FLAG_LEFT;
- width = (unsigned int) (-arg);
+ width = -width;
}
- else
- width = arg;
}
else
{
@@ -2978,7 +2964,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
width = xsum (xtimes (width, 10), *digitp++ - '0');
while (digitp != dp->width_end);
}
- has_width = 1;
}
has_precision = 0;
@@ -3354,11 +3339,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
abort ();
# endif
}
+
/* The generated string now extends from tmp to p, with the
zero padding insertion point being at pad_ptr. */
- if (has_width && p - tmp < width)
+ count = p - tmp;
+
+ if (count < width)
{
- size_t pad = width - (p - tmp);
+ size_t pad = width - count;
DCHAR_T *end = p + pad;
if (flags & FLAG_LEFT)
@@ -3391,28 +3379,26 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
p = end;
}
- {
- size_t count = p - tmp;
+ count = p - tmp;
- if (count >= tmp_length)
- /* tmp_length was incorrectly calculated - fix the
- code above! */
- abort ();
+ if (count >= tmp_length)
+ /* tmp_length was incorrectly calculated - fix the
+ code above! */
+ abort ();
- /* Make room for the result. */
- if (count >= allocated - length)
- {
- size_t n = xsum (length, count);
+ /* Make room for the result. */
+ if (count >= allocated - length)
+ {
+ size_t n = xsum (length, count);
- ENSURE_ALLOCATION (n);
- }
+ ENSURE_ALLOCATION (n);
+ }
- /* Append the result. */
- memcpy (result + length, tmp, count * sizeof (DCHAR_T));
- if (tmp != tmpbuf)
- free (tmp);
- length += count;
- }
+ /* Append the result. */
+ memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+ if (tmp != tmpbuf)
+ free (tmp);
+ length += count;
}
#endif
#if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
@@ -3446,8 +3432,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
arg_type type = a.arg[dp->arg_index].type;
# endif
int flags = dp->flags;
- int has_width;
size_t width;
+ size_t count;
int has_precision;
size_t precision;
size_t tmp_length;
@@ -3456,7 +3442,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
DCHAR_T *pad_ptr;
DCHAR_T *p;
- has_width = 0;
width = 0;
if (dp->width_start != dp->width_end)
{
@@ -3467,15 +3452,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
abort ();
arg = a.arg[dp->width_arg_index].a.a_int;
+ width = arg;
if (arg < 0)
{
/* "A negative field width is taken as a '-' flag
followed by a positive field width." */
flags |= FLAG_LEFT;
- width = (unsigned int) (-arg);
+ width = -width;
}
- else
- width = arg;
}
else
{
@@ -3485,7 +3469,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
width = xsum (xtimes (width, 10), *digitp++ - '0');
while (digitp != dp->width_end);
}
- has_width = 1;
}
has_precision = 0;
@@ -3925,9 +3908,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
digits without trailing zeroes. */
if (exponent >= 0)
{
- size_t count = exponent + 1;
+ size_t ecount = exponent + 1;
/* Note: count <= precision = ndigits. */
- for (; count > 0; count--)
+ for (; ecount > 0; ecount--)
*p++ = digits[--ndigits];
if ((flags & FLAG_ALT) || ndigits > nzeroes)
{
@@ -3941,10 +3924,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
else
{
- size_t count = -exponent - 1;
+ size_t ecount = -exponent - 1;
*p++ = '0';
*p++ = decimal_point_char ();
- for (; count > 0; count--)
+ for (; ecount > 0; ecount--)
*p++ = '0';
while (ndigits > nzeroes)
{
@@ -4395,9 +4378,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
digits without trailing zeroes. */
if (exponent >= 0)
{
- size_t count = exponent + 1;
- /* Note: count <= precision = ndigits. */
- for (; count > 0; count--)
+ size_t ecount = exponent + 1;
+ /* Note: ecount <= precision = ndigits. */
+ for (; ecount > 0; ecount--)
*p++ = digits[--ndigits];
if ((flags & FLAG_ALT) || ndigits > nzeroes)
{
@@ -4411,10 +4394,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
else
{
- size_t count = -exponent - 1;
+ size_t ecount = -exponent - 1;
*p++ = '0';
*p++ = decimal_point_char ();
- for (; count > 0; count--)
+ for (; ecount > 0; ecount--)
*p++ = '0';
while (ndigits > nzeroes)
{
@@ -4542,9 +4525,11 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
/* The generated string now extends from tmp to p, with the
zero padding insertion point being at pad_ptr. */
- if (has_width && p - tmp < width)
+ count = p - tmp;
+
+ if (count < width)
{
- size_t pad = width - (p - tmp);
+ size_t pad = width - count;
DCHAR_T *end = p + pad;
if (flags & FLAG_LEFT)
@@ -4577,36 +4562,36 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
p = end;
}
- {
- size_t count = p - tmp;
+ count = p - tmp;
- if (count >= tmp_length)
- /* tmp_length was incorrectly calculated - fix the
- code above! */
- abort ();
+ if (count >= tmp_length)
+ /* tmp_length was incorrectly calculated - fix the
+ code above! */
+ abort ();
- /* Make room for the result. */
- if (count >= allocated - length)
- {
- size_t n = xsum (length, count);
+ /* Make room for the result. */
+ if (count >= allocated - length)
+ {
+ size_t n = xsum (length, count);
- ENSURE_ALLOCATION (n);
- }
+ ENSURE_ALLOCATION (n);
+ }
- /* Append the result. */
- memcpy (result + length, tmp, count * sizeof (DCHAR_T));
- if (tmp != tmpbuf)
- free (tmp);
- length += count;
- }
+ /* Append the result. */
+ memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+ if (tmp != tmpbuf)
+ free (tmp);
+ length += count;
}
#endif
else
{
arg_type type = a.arg[dp->arg_index].type;
int flags = dp->flags;
-#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
int has_width;
+#endif
+#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
size_t width;
#endif
#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || NEED_PRINTF_UNBOUNDED_PRECISION
@@ -4635,8 +4620,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
TCHAR_T *tmp;
#endif
-#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
has_width = 0;
+#endif
+#if !USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
width = 0;
if (dp->width_start != dp->width_end)
{
@@ -4647,15 +4634,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
abort ();
arg = a.arg[dp->width_arg_index].a.a_int;
+ width = arg;
if (arg < 0)
{
/* "A negative field width is taken as a '-' flag
followed by a positive field width." */
flags |= FLAG_LEFT;
- width = (unsigned int) (-arg);
+ width = -width;
}
- else
- width = arg;
}
else
{
@@ -4665,7 +4651,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
width = xsum (xtimes (width, 10), *digitp++ - '0');
while (digitp != dp->width_end);
}
+#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
has_width = 1;
+#endif
}
#endif
@@ -4805,7 +4793,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
const FCHAR_T *mp = dp->width_start;
do
- *fbp++ = (unsigned char) *mp++;
+ *fbp++ = *mp++;
while (--n > 0);
}
}
@@ -4826,7 +4814,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
const FCHAR_T *mp = dp->precision_start;
do
- *fbp++ = (unsigned char) *mp++;
+ *fbp++ = *mp++;
while (--n > 0);
}
}
@@ -5153,7 +5141,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
size_t tmp_length =
MAX_ROOM_NEEDED (&a, dp->arg_index,
dp->conversion, type, flags,
- has_width ? width : 0,
+ width,
has_precision,
precision, pad_ourselves);
@@ -5191,18 +5179,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
/* SNPRINTF or sprintf failed. Save and use the errno
that it has set, if any. */
int saved_errno = errno;
+ if (saved_errno == 0)
+ {
+ if (dp->conversion == 'c' || dp->conversion == 's')
+ saved_errno = EILSEQ;
+ else
+ saved_errno = EINVAL;
+ }
if (!(result == resultbuf || result == NULL))
free (result);
if (buf_malloced != NULL)
free (buf_malloced);
CLEANUP ();
- errno =
- (saved_errno != 0
- ? saved_errno
- : (dp->conversion == 'c' || dp->conversion == 's'
- ? EILSEQ
- : EINVAL));
+
+ errno = saved_errno;
return NULL;
}
@@ -5391,7 +5382,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
tmpsrc += count;
tmpdst += count;
for (n = count; n > 0; n--)
- *--tmpdst = (unsigned char) *--tmpsrc;
+ *--tmpdst = *--tmpsrc;
}
}
#endif
diff --git a/lib/vasnprintf.h b/lib/vasnprintf.h
index daa946dc..3494eef3 100644
--- a/lib/vasnprintf.h
+++ b/lib/vasnprintf.h
@@ -1,5 +1,5 @@
/* vsprintf with automatic memory allocation.
- Copyright (C) 2002-2004, 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2004, 2007-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/vasprintf.c b/lib/vasprintf.c
index eed90374..5dd4abd4 100644
--- a/lib/vasprintf.c
+++ b/lib/vasprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 1999, 2002, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/verify.h b/lib/verify.h
index a25e5146..60eba498 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -1,6 +1,6 @@
/* Compile-time assert-like macros.
- Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/verror.c b/lib/verror.c
index 9388f622..81a2ffcb 100644
--- a/lib/verror.c
+++ b/lib/verror.c
@@ -1,5 +1,5 @@
/* va_list error handler for noninteractive utilities
- Copyright (C) 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/verror.h b/lib/verror.h
index c6292bc6..5aaa63cf 100644
--- a/lib/verror.h
+++ b/lib/verror.h
@@ -1,5 +1,5 @@
/* Declaration for va_list error-reporting function
- Copyright (C) 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/version-etc-fsf.c b/lib/version-etc-fsf.c
index b37dd605..ad78d0d7 100644
--- a/lib/version-etc-fsf.c
+++ b/lib/version-etc-fsf.c
@@ -1,5 +1,5 @@
/* Variable with FSF copyright information, for version-etc.
- Copyright (C) 1999-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/version-etc.c b/lib/version-etc.c
index 04f5b620..a93b008d 100644
--- a/lib/version-etc.c
+++ b/lib/version-etc.c
@@ -1,5 +1,5 @@
/* Print --version and bug-reporting information in a consistent format.
- Copyright (C) 1999-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@
# define PACKAGE PACKAGE_TARNAME
#endif
-enum { COPYRIGHT_YEAR = 2014 };
+enum { COPYRIGHT_YEAR = 2015 };
/* The three functions below display the --version information the
standard way.
diff --git a/lib/version-etc.h b/lib/version-etc.h
index 8e1b2ccf..408581e3 100644
--- a/lib/version-etc.h
+++ b/lib/version-etc.h
@@ -1,5 +1,5 @@
/* Print --version and bug-reporting information in a consistent format.
- Copyright (C) 1999, 2003, 2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2005, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/vfprintf.c b/lib/vfprintf.c
index b49caaee..c5bcfeb1 100644
--- a/lib/vfprintf.c
+++ b/lib/vfprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to a stream.
- Copyright (C) 2004, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/vprintf.c b/lib/vprintf.c
index d97f5c8a..9f80aba2 100644
--- a/lib/vprintf.c
+++ b/lib/vprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to a stream.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/w32sock.h b/lib/w32sock.h
index b921b1bc..dace9cf7 100644
--- a/lib/w32sock.h
+++ b/lib/w32sock.h
@@ -1,6 +1,6 @@
/* w32sock.h --- internal auxiliary functions for Windows socket functions
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 473285fb..684299f7 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -1,6 +1,6 @@
/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,9 +30,14 @@
#endif
@PRAGMA_COLUMNS@
-#if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
+#if (((defined __need_mbstate_t || defined __need_wint_t) \
+ && !defined __MINGW32__) \
+ || (defined __hpux \
+ && ((defined _INTTYPES_INCLUDED && !defined strtoimax) \
+ || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \
+ || defined _GL_ALREADY_INCLUDING_WCHAR_H)
/* Special invocation convention:
- - Inside glibc and uClibc header files.
+ - Inside glibc and uClibc header files, but not MinGW.
- On HP-UX 11.00 we have a sequence of nested includes
<wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
diff --git a/lib/wcrtomb.c b/lib/wcrtomb.c
index 1d340cd9..b38d2e0d 100644
--- a/lib/wcrtomb.c
+++ b/lib/wcrtomb.c
@@ -1,5 +1,5 @@
/* Convert wide character to multibyte character.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/wcswidth-impl.h b/lib/wcswidth-impl.h
index b71f9976..7cd5bc93 100644
--- a/lib/wcswidth-impl.h
+++ b/lib/wcswidth-impl.h
@@ -1,5 +1,5 @@
/* Determine number of screen columns needed for a size-bounded wide string.
- Copyright (C) 1999, 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2011-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 1999.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/wcswidth.c b/lib/wcswidth.c
index 656dc6c4..36cb6e1a 100644
--- a/lib/wcswidth.c
+++ b/lib/wcswidth.c
@@ -1,5 +1,5 @@
/* Determine number of screen columns needed for a size-bounded wide string.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/wctype.in.h b/lib/wctype.in.h
index ab066539..9050b7e5 100644
--- a/lib/wctype.in.h
+++ b/lib/wctype.in.h
@@ -1,6 +1,6 @@
/* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/wcwidth.c b/lib/wcwidth.c
index d7837bb1..d2b71189 100644
--- a/lib/wcwidth.c
+++ b/lib/wcwidth.c
@@ -1,5 +1,5 @@
/* Determine the number of screen columns needed for a character.
- Copyright (C) 2006-2007, 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2007, 2010-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/write-any-file.c b/lib/write-any-file.c
index 1cd0b791..fcf4f86e 100644
--- a/lib/write-any-file.c
+++ b/lib/write-any-file.c
@@ -1,6 +1,6 @@
/* Determine whether we can write any file.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/write.c b/lib/write.c
index ff31dbb6..ed2d3b7b 100644
--- a/lib/write.c
+++ b/lib/write.c
@@ -1,5 +1,5 @@
/* POSIX compatible write() function.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xalloc-die.c b/lib/xalloc-die.c
index 7bdd2a31..3cea6386 100644
--- a/lib/xalloc-die.c
+++ b/lib/xalloc-die.c
@@ -1,6 +1,6 @@
/* Report a memory allocation failure and exit.
- Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2014 Free Software
+ Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h
index f3329228..f0e9778f 100644
--- a/lib/xalloc-oversized.h
+++ b/lib/xalloc-oversized.h
@@ -1,6 +1,6 @@
/* xalloc-oversized.h -- memory allocation size checking
- Copyright (C) 1990-2000, 2003-2004, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 1990-2000, 2003-2004, 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xalloc.h b/lib/xalloc.h
index 3f6b5b80..81ef680a 100644
--- a/lib/xalloc.h
+++ b/lib/xalloc.h
@@ -1,6 +1,6 @@
/* xalloc.h -- malloc with out-of-memory checking
- Copyright (C) 1990-2000, 2003-2004, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 1990-2000, 2003-2004, 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -41,7 +41,8 @@ extern "C" {
# define _GL_ATTRIBUTE_MALLOC
#endif
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if ! defined __clang__ && \
+ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
#else
# define _GL_ATTRIBUTE_ALLOC_SIZE(args)
@@ -258,5 +259,6 @@ xmemdup (T const *p, size_t s)
#endif
+_GL_INLINE_HEADER_END
#endif /* !XALLOC_H_ */
diff --git a/lib/xasprintf.c b/lib/xasprintf.c
index 4e0b5b16..f8eef978 100644
--- a/lib/xasprintf.c
+++ b/lib/xasprintf.c
@@ -1,5 +1,5 @@
/* vasprintf and asprintf with out-of-memory checking.
- Copyright (C) 1999, 2002-2004, 2006, 2009-2014 Free Software Foundation,
+ Copyright (C) 1999, 2002-2004, 2006, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xdectoimax.c b/lib/xdectoimax.c
new file mode 100644
index 00000000..d4bb18fa
--- /dev/null
+++ b/lib/xdectoimax.c
@@ -0,0 +1,6 @@
+#define __xdectoint xdectoimax
+#define __xnumtoint xnumtoimax
+#define __xdectoint_t intmax_t
+#define __xstrtol xstrtoimax
+#define __xdectoint_signed 1
+#include "xdectoint.c"
diff --git a/lib/xdectoint.c b/lib/xdectoint.c
new file mode 100644
index 00000000..47200e4f
--- /dev/null
+++ b/lib/xdectoint.c
@@ -0,0 +1,86 @@
+/* Convert decimal strings with bounds checking and exit on error.
+
+ Copyright (C) 2014-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include "xdectoint.h"
+
+#include <errno.h>
+#include <inttypes.h>
+#include <stdlib.h>
+
+#include "error.h"
+#include "quote.h"
+#include "xstrtol.h"
+
+/* Parse numeric string N_STR of base BASE, and return the value.
+ Exit on parse error or if MIN or MAX are exceeded.
+ Strings can have multiplicative SUFFIXES if specified.
+ ERR is printed along with N_STR on error. */
+
+__xdectoint_t
+__xnumtoint (const char *n_str, int base, __xdectoint_t min, __xdectoint_t max,
+ const char *suffixes, const char *err, int err_exit)
+{
+ strtol_error s_err;
+
+ __xdectoint_t tnum;
+ s_err = __xstrtol (n_str, NULL, base, &tnum, suffixes);
+
+ if (s_err == LONGINT_OK)
+ {
+ if (tnum < min || max < tnum)
+ {
+ s_err = LONGINT_OVERFLOW;
+ /* Use have the INT range as a heuristic to distinguish
+ type overflow rather than other min/max limits. */
+ if (tnum > INT_MAX/2)
+ errno = EOVERFLOW;
+#if __xdectoint_signed
+ else if (tnum < INT_MIN/2)
+ errno = EOVERFLOW;
+#endif
+ else
+ errno = ERANGE;
+ }
+ }
+ else if (s_err == LONGINT_OVERFLOW)
+ errno = EOVERFLOW;
+ else if (s_err == LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW)
+ errno = 0; /* Don't show ERANGE errors for invalid numbers. */
+
+ if (s_err != LONGINT_OK)
+ {
+ /* EINVAL error message is redundant in this context. */
+ error (err_exit ? err_exit : EXIT_FAILURE, errno == EINVAL ? 0 : errno,
+ "%s: %s", err, quote (n_str));
+ }
+
+ return tnum;
+}
+
+/* Parse decimal string N_STR, and return the value.
+ Exit on parse error or if MIN or MAX are exceeded.
+ Strings can have multiplicative SUFFIXES if specified.
+ ERR is printed along with N_STR on error. */
+
+__xdectoint_t
+__xdectoint (const char *n_str, __xdectoint_t min, __xdectoint_t max,
+ const char *suffixes, const char *err, int err_exit)
+{
+ return __xnumtoint (n_str, 10, min, max, suffixes, err, err_exit);
+}
diff --git a/lib/xdectoint.h b/lib/xdectoint.h
new file mode 100644
index 00000000..f15ea521
--- /dev/null
+++ b/lib/xdectoint.h
@@ -0,0 +1,36 @@
+/* Convert decimal strings with bounds checking and exit on error.
+
+ Copyright (C) 2014-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef XDECTOINT_H_
+# define XDECTOINT_H_ 1
+
+# include <inttypes.h>
+
+# define _DECLARE_XDECTOINT(name, type) \
+ type name (const char *n_str, type min, type max, \
+ const char *suffixes, const char *err, int err_exit);
+# define _DECLARE_XNUMTOINT(name, type) \
+ type name (const char *n_str, int base, type min, type max, \
+ const char *suffixes, const char *err, int err_exit);
+
+_DECLARE_XDECTOINT (xdectoimax, intmax_t)
+_DECLARE_XDECTOINT (xdectoumax, uintmax_t)
+
+_DECLARE_XNUMTOINT (xnumtoimax, intmax_t)
+_DECLARE_XNUMTOINT (xnumtoumax, uintmax_t)
+
+#endif /* not XDECTOINT_H_ */
diff --git a/lib/xdectoumax.c b/lib/xdectoumax.c
new file mode 100644
index 00000000..412ddf96
--- /dev/null
+++ b/lib/xdectoumax.c
@@ -0,0 +1,6 @@
+#define __xdectoint xdectoumax
+#define __xnumtoint xnumtoumax
+#define __xdectoint_t uintmax_t
+#define __xstrtol xstrtoumax
+#define __xdectoint_signed 0
+#include "xdectoint.c"
diff --git a/lib/xfreopen.c b/lib/xfreopen.c
index abc8221b..73dfe396 100644
--- a/lib/xfreopen.c
+++ b/lib/xfreopen.c
@@ -1,5 +1,5 @@
/* a wrapper for freopen
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xfts.c b/lib/xfts.c
index bcc82d05..367eb3d9 100644
--- a/lib/xfts.c
+++ b/lib/xfts.c
@@ -1,6 +1,6 @@
/* xfts.c -- a wrapper for fts_open
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xgetcwd.c b/lib/xgetcwd.c
index e91e8e55..cbaf4d8d 100644
--- a/lib/xgetcwd.c
+++ b/lib/xgetcwd.c
@@ -1,6 +1,6 @@
/* xgetcwd.c -- return current directory with unlimited length
- Copyright (C) 2001, 2003-2004, 2006-2007, 2009-2014 Free Software
+ Copyright (C) 2001, 2003-2004, 2006-2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xgetcwd.h b/lib/xgetcwd.h
index 9630d6c7..9c472349 100644
--- a/lib/xgetcwd.h
+++ b/lib/xgetcwd.h
@@ -1,5 +1,5 @@
/* prototype for xgetcwd
- Copyright (C) 1995, 2001, 2003, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2001, 2003, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xgetgroups.c b/lib/xgetgroups.c
index 7f9d86a4..1cc8b033 100644
--- a/lib/xgetgroups.c
+++ b/lib/xgetgroups.c
@@ -1,6 +1,6 @@
/* xgetgroups.c -- return a list of the groups a user or current process is in
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xgethostname.c b/lib/xgethostname.c
index 0f7b178f..24592ac2 100644
--- a/lib/xgethostname.c
+++ b/lib/xgethostname.c
@@ -1,6 +1,6 @@
/* xgethostname.c -- return current hostname with unlimited length
- Copyright (C) 1992, 1996, 2000-2001, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1992, 1996, 2000-2001, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xmalloc.c b/lib/xmalloc.c
index 264d44af..e246559f 100644
--- a/lib/xmalloc.c
+++ b/lib/xmalloc.c
@@ -1,6 +1,6 @@
/* xmalloc.c -- malloc with out of memory checking
- Copyright (C) 1990-2000, 2002-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 1990-2000, 2002-2006, 2008-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xmemcoll.c b/lib/xmemcoll.c
index 39b8ce8e..4de10c69 100644
--- a/lib/xmemcoll.c
+++ b/lib/xmemcoll.c
@@ -1,6 +1,6 @@
/* Locale-specific memory comparison.
- Copyright (C) 2002-2004, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2004, 2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xnanosleep.c b/lib/xnanosleep.c
index 3b2b43ba..c66f2167 100644
--- a/lib/xnanosleep.c
+++ b/lib/xnanosleep.c
@@ -1,6 +1,6 @@
/* xnanosleep.c -- a more convenient interface to nanosleep
- Copyright (C) 2002-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xprintf.c b/lib/xprintf.c
index 52f8d5cd..68b4a37f 100644
--- a/lib/xprintf.c
+++ b/lib/xprintf.c
@@ -1,5 +1,5 @@
/* printf wrappers that fail immediately for non-file-related errors
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xprintf.h b/lib/xprintf.h
index 96fbcfa1..aba83ca4 100644
--- a/lib/xprintf.h
+++ b/lib/xprintf.h
@@ -1,5 +1,5 @@
/* printf wrappers that fail immediately for non-file-related errors
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xreadlink.c b/lib/xreadlink.c
index 2f3b8a10..5082d0b0 100644
--- a/lib/xreadlink.c
+++ b/lib/xreadlink.c
@@ -1,6 +1,6 @@
/* xreadlink.c -- readlink wrapper to return the link name in malloc'd storage
- Copyright (C) 2001, 2003-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xreadlink.h b/lib/xreadlink.h
index af80ca43..a970eb9b 100644
--- a/lib/xreadlink.h
+++ b/lib/xreadlink.h
@@ -1,6 +1,6 @@
/* Reading symbolic links without size limitation.
- Copyright (C) 2001, 2003-2004, 2007, 2009-2014 Free Software Foundation,
+ Copyright (C) 2001, 2003-2004, 2007, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xsize.h b/lib/xsize.h
index fd12c670..b2a786a8 100644
--- a/lib/xsize.h
+++ b/lib/xsize.h
@@ -1,6 +1,6 @@
/* xsize.h -- Checked size_t computations.
- Copyright (C) 2003, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2008-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xstriconv.c b/lib/xstriconv.c
index be1ef2df..d5e19515 100644
--- a/lib/xstriconv.c
+++ b/lib/xstriconv.c
@@ -1,5 +1,5 @@
/* Charset conversion with out-of-memory checking.
- Copyright (C) 2001-2004, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2006, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xstriconv.h b/lib/xstriconv.h
index 75f8f832..6319989f 100644
--- a/lib/xstriconv.h
+++ b/lib/xstriconv.h
@@ -1,5 +1,5 @@
/* Charset conversion with out-of-memory checking.
- Copyright (C) 2001-2004, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2006-2007, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible and Simon Josefsson.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xstrndup.c b/lib/xstrndup.c
index d2259c82..51831d8c 100644
--- a/lib/xstrndup.c
+++ b/lib/xstrndup.c
@@ -1,6 +1,6 @@
/* Duplicate a bounded initial segment of a string, with out-of-memory
checking.
- Copyright (C) 2003, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2007, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xstrndup.h b/lib/xstrndup.h
index 6a409f7a..d510bf37 100644
--- a/lib/xstrndup.h
+++ b/lib/xstrndup.h
@@ -1,6 +1,6 @@
/* Duplicate a bounded initial segment of a string, with out-of-memory
checking.
- Copyright (C) 2003, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xstrtod.c b/lib/xstrtod.c
index 7caa615d..6941a35a 100644
--- a/lib/xstrtod.c
+++ b/lib/xstrtod.c
@@ -1,6 +1,6 @@
/* error-checking interface to strtod-like functions
- Copyright (C) 1996, 1999-2000, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1996, 1999-2000, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xstrtod.h b/lib/xstrtod.h
index 1fb8d7b7..2dcdafa8 100644
--- a/lib/xstrtod.h
+++ b/lib/xstrtod.h
@@ -1,6 +1,6 @@
/* Error-checking interface to strtod-like functions.
- Copyright (C) 1996, 1998, 2003-2004, 2006, 2009-2014 Free Software
+ Copyright (C) 1996, 1998, 2003-2004, 2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xstrtol-error.c b/lib/xstrtol-error.c
index 9629dabb..6a2ebea0 100644
--- a/lib/xstrtol-error.c
+++ b/lib/xstrtol-error.c
@@ -1,6 +1,6 @@
/* A more useful interface to strtol.
- Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2014 Free Software
+ Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xstrtol.c b/lib/xstrtol.c
index f6d535a7..bd3ffeb2 100644
--- a/lib/xstrtol.c
+++ b/lib/xstrtol.c
@@ -1,6 +1,6 @@
/* A more useful interface to strtol.
- Copyright (C) 1995-1996, 1998-2001, 2003-2007, 2009-2014 Free Software
+ Copyright (C) 1995-1996, 1998-2001, 2003-2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -34,13 +34,13 @@
need stderr defined if assertion checking is enabled. */
#include <stdio.h>
-#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
+#include "assure.h"
#include "intprops.h"
/* xstrtoll.c and xstrtoull.c, which include this file, require that
@@ -93,10 +93,12 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
__strtol_t tmp;
strtol_error err = LONGINT_OK;
- assert (0 <= strtol_base && strtol_base <= 36);
+ assure (0 <= strtol_base && strtol_base <= 36);
p = (ptr ? ptr : &t_ptr);
+ errno = 0;
+
if (! TYPE_SIGNED (__strtol_t))
{
const char *q = s;
@@ -107,7 +109,6 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
return LONGINT_INVALID;
}
- errno = 0;
tmp = __strtol (s, p, strtol_base);
if (*p == s)
diff --git a/lib/xstrtol.h b/lib/xstrtol.h
index fe54f6af..19202dcd 100644
--- a/lib/xstrtol.h
+++ b/lib/xstrtol.h
@@ -1,6 +1,6 @@
/* A more useful interface to strtol.
- Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2014 Free Software
+ Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xtime.h b/lib/xtime.h
index 574e0dbf..d10ea779 100644
--- a/lib/xtime.h
+++ b/lib/xtime.h
@@ -1,6 +1,6 @@
/* xtime -- extended-resolution integer time stamps
- Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xvasprintf.c b/lib/xvasprintf.c
index 7a4029e7..441ab598 100644
--- a/lib/xvasprintf.c
+++ b/lib/xvasprintf.c
@@ -1,5 +1,5 @@
/* vasprintf and asprintf with out-of-memory checking.
- Copyright (C) 1999, 2002-2004, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-2004, 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/xvasprintf.h b/lib/xvasprintf.h
index 407a5e0d..3b7f5ad8 100644
--- a/lib/xvasprintf.h
+++ b/lib/xvasprintf.h
@@ -1,5 +1,5 @@
/* vasprintf and asprintf with out-of-memory checking.
- Copyright (C) 2002-2004, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2004, 2006-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/yesno.c b/lib/yesno.c
index ddb34454..331a4083 100644
--- a/lib/yesno.c
+++ b/lib/yesno.c
@@ -1,6 +1,6 @@
/* yesno.c -- read a yes/no response from stdin
- Copyright (C) 1990, 1998, 2001, 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 1990, 1998, 2001, 2003-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -42,7 +42,10 @@ yesno (void)
yes = false;
else
{
- response[response_len - 1] = '\0';
+ /* Remove EOL if present as that's not part of the matched response,
+ and not matched by $ for example. */
+ if (response[response_len - 1] == '\n')
+ response[response_len - 1] = '\0';
yes = (0 < rpmatch (response));
}
diff --git a/lib/yesno.h b/lib/yesno.h
index 3a6d8c9f..d247d8ad 100644
--- a/lib/yesno.h
+++ b/lib/yesno.h
@@ -1,5 +1,5 @@
/* declare yesno
- Copyright (C) 2004, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by