mirror of
https://sourceware.org/git/glibc.git
synced 2025-06-06 11:41:02 +03:00
Update to 2.1.x development version
1997-02-15 02:41 Miles Bader <miles@gnu.ai.mit.edu> * argp/argp-help.c: Gettextize sources. * argp/argp-parse.c: Likewise. 1997-02-13 22:32 Ulrich Drepper <drepper@cygnus.com> * features.h (__GLIBC_MINOR__): Bump to 1. * xlocale.h: New file. Wrapper around locale/xlocale.h. * Makefile (distribute): Add xlocale.h. * locale/Makefile (routines): Add ctype_l. * locale/ctype-extn.c: Update copyright. De-ANSI-declfy. Add __isblank_l, __toascii_l and __isascii_l. * ctype/ctype.h: Add definitions and declarations for *_l functions. * locale/Makefile (headers): Add xlocale.h. (routines): Add newlocale, duplocale, and freelocale. * locale/localeinfo.h (MAX_USAGE_COUNT): New macro. (struct locale_data): Add new fields mmaped and usage_count. Correct various declarations. * locale/C-collate.c: Define value for new fields mmaped and usage_count. * locale/C-ctype.c: Likewise. * locale/C-messages.c: Likewise. * locale/C-monetary.c: Likewise. * locale/C-numeric.c: Likewise. * locale/C-time.c: Likewise. * locale/loadlocale.c (_nl_load_locale): Initialize mmaped and usage_count fields. * locale/locale.h: Don't define locale_t here (moved to xlocale.h). Correct prototypes for __newlocale and __freelocale. Add prototype for __duplocale. * locale/findlocale.c (copy): Remove function. Use __strdup instead. (_nl_remove_locale): New function. * locale/nl_langinfo.c: Don't declare locale_data objects as const. * locale/setlocale.c: Likewise. * locale/weight.h: Change for use with locale objects. * locale/xlocale.h: New file. Define __locale_t type. * locale/newlocale.c: New file. Create new locale object. * locale/freelocale.c: New file. Destroy locale object. * locale/duplocale.c: New file. Create copy of locale object. * stdlib/Makefile (routines): Add strfmon_l. * stdlib/monetary.h [__USE_GNU]: Declare __strfmon_l. * stdlib/strfmon.c: Add support for use in extended locale model. * stdlib/strfmon_l.c: New file. * string/Makefile (routines): Add strcoll_l and strxfrm_l. * string/strcoll.c: Change for use in extended locale model. * string/strxfrm.c: Likewise. * string/strcoll_l.c: New file. Implement __strcoll_l function. * string/strxfrm_l.c: New file. Implement __strxfrm_l function. * wcsmbs/Makefile (routines): Add wcscoll_l and wcsxfrm_l. * wcsmbs/wchar.h [__USE_GNU]: Declare wcscoll_l and wcsxfrm_l. * wcsmbs/wcscoll.c: Change for use in extended locale model. * wcsmbs/wcscoll_l.c: New file. Implement __wcscoll_l function. * wcsmbs/wcsxfrm_l.c: New file. Implement __wcsxfrm_l function. * wctype/Makefile (routines): Add wcextra, wcfuncs_l, iswctype_l, and towctrans_l. * wctype/cname-lookup.h: Prepare for use in extended locale model. * wctype/iswctype_l.c: New file. Implement character classification functions for use with locale objects. * wctype/wctype.h: Declare functions for use with locale objects. * wctype/towctrans_l.c: New file. Implement __towctrans_l function for use with locale objects. * wctype/wcfuncs_l.c: New file. Implement wide character classification functions for use with locale objects. * wctype/wcextra.c: New file. Implement real functions for non-standard classification functions. * elf/ldd.bash.in: Don't use --data-relocs and --function-relocs parameters to ld.so. Use environment variables. * elf/ldd.sh.in: Likewise. * elf/rtld.c: Remove handling of --data-relocs and --function-relocs options. Instead read environment variables. * elf/link.h (receiver_fct): Add new argument to take error code. * elf/dl-error.c (_dl_signal_error): Call receiver function with another argument. * elf/dl-object.c (_dl_new_object): Create new object with list of names in l_libname member. * elf/dl-load.c (_dl_map_object_from_fd): Add name which was used to find to object to the list in the link_map variable. (_dl_map_object): Use _dl_does_name_match_p to compare with all available names of the object. Optimize handling of LD_LIBRARY_PATH a bit. * elf/rtld.c: Initialize l_libname member of _dl_rtld_map. * elf/dl-lookup.c (_dl_elf_hash): Optimize function. * elf/Makefile (routines): Add dl-version. * elf/link.h (hash_name_pair): New type. Group pointer to string and its hash value. (struct link_map): Change l_libname member to be a list of names, not a single pointer to a name. Add new members l_nversions and l_versions. (_dl_does_name_match_p): New function to test for all names of an object. Add prototypes for new lookup and versioning functions. * elf/dl-lookup.c (do_lookup): Add new argument and handle case when versioned symbol is requested. (_dl_lookup_symbol): Call do_lookup with another argument. (_dl_lookup_symbol_skip): Likewise. (_dl_lookup_versioned_symbol): New function. Handle lookup of versioned symbol. (_dl_lookup_versioned_symbol_skip): Likewise, similar to _dl_lookup_symbol_skip. * elf/dl-reloc.c (RESOLVE): Call _dl_lookup_versioned_symbol or _dl_lookup_symbol depending on availability of version information. * elf/dl-runtime.c (RESOLVE): Likewise. (fixup): Call elf_machine_relplt with additional argument to point to versioning information if available. * elf/do-rel.h (elf_dynamic_do_rel): Likewise. * elf/dl-open.c (_dl_open): Call _dl_check_map_versions to check for correct versions. * elf/dl-version.c: New file. Check library versions and extract version information for easier access. * elf/dlfcn.h [__USE_GNU]: Add prototype for dlvsym. * elf/dlvsym.c: New file. Implementation of function similar to dlsym, but looks for versioned symbol. * elf/elf.h: Add types and macros for versioning. * elf/rtld.c (dl_main): Check availability of needed versions. * sysdeps/alpha/dl-machine.h (elf_machine_rela): Add additional argument for version information. Call RESOLVE with additional argument. * sysdeps/i386/dl-machine.h: Likewise. * sysdeps/m68k/dl-machine.h: Likewise. * sysdeps/mips/dl-machine.h: Likewise. * elf/dlerror.c: Change comment to align with guidelines. * elf/dlopen.c: Likewise. * elf/dlsym.c: Likewise. * locale/programs/localedef.c: Implement --quiet option. * locale/programs/charset.h: Declare be_quiet variable. * locale/programs/locfile.h: Likewise. * locale/programs/charmap.c: Don't print warnings if quiet option was given. * locale/programs/ld-collate.c: Likewise. * locale/programs/ld-ctype.c: Likewise. * locale/programs/ld-messages.c: Likewise. * locale/programs/ld-monetary.c: Likewise. * locale/programs/ld-numeric.c: Likewise. * locale/programs/ld-time.c: Likewise. * locale/programs/locfile.c: Likewise. * Makefile (subdirs): Add argp. * catgets/catgets.c (catopen): Little code improvement. * posix/execl.c: Remove restriction to 1024 arguments. * posix/execle.c: Likewise. * posix/execlp.c: Likewise. * posix/getopt.c [_LIBC]: Define global objects with __ prefix and make regular names weak aliases. * posix/getopt1.c: Likewise. * posix/getopt.h [_LIBC]: Provide prototypes and declarations for __ protected forms. * posix/unistd.h: Add prototype for __sleep. * sysdeps/mach/sleep.c: Make sleep weak alias of __sleep. * sysdeps/posix/sleep.c: Likewise. * sysdeps/stub/sleep.c: Likewise. * sysdeps/unix/sysv/linux/sleep.c: Likewise. * ctype/ctype-info.c: Update copyright. * ctype/ctype.c: Likewise. * ctype/test_ctype.c: Likewise. * dirent/alphasort.c: Likewise. * dirent/list.c: Likewise. * gmon/bb_exit_func.c: Likewise. * grp/fgetgrent.c: Likewise. * grp/getgrent.c: Likewise. * grp/getgrent_r.c: Likewise. * grp/getgrgid.c: Likewise. * grp/getgrgid_r.c: Likewise. * grp/getgrnam.c: Likewise. * grp/getgrnam_r.c: Likewise. * hurd/alloc-fd.c: Likewise. * hurd/catch-exc.c: Likewise. * hurd/ctty-input.c: Likewise. * hurd/ctty-output.c: Likewise. * hurd/dtable.c: Likewise. * hurd/fchroot.c: Likewise. * hurd/fd-close.c: Likewise. * hurd/fd-read.c: Likewise. * hurd/fd-write.c: Likewise. * hurd/fopenport.c: Likewise. * hurd/get-host.c: Likewise. * hurd/getdport.c: Likewise. * hurd/getuids.c: Likewise. * hurd/getumask.c: Likewise. * hurd/hurd-raise.c: Likewise. * hurd/hurd.h: Likewise. * hurd/hurdauth.c: Likewise. * hurd/hurdexec.c: Likewise. * hurd/hurdhost.h: Likewise. * hurd/hurdid.c: Likewise. * hurd/hurdinit.c: Likewise. * hurd/hurdioctl.c: Likewise. * hurd/hurdkill.c: Likewise. * hurd/hurdlookup.c: Likewise. * hurd/hurdmsg.c: Likewise. * hurd/hurdpid.c: Likewise. * hurd/hurdports.c: Likewise. * hurd/hurdprio.c: Likewise. * hurd/hurdrlimit.c: Likewise. * hurd/hurdsock.c: Likewise. * hurd/hurdstartup.c: Likewise. * hurd/hurdstartup.h: Likewise. * hurd/intern-fd.c: Likewise. * hurd/intr-msg.c: Likewise. * hurd/intr-rpc.defs: Likewise. * hurd/intr-rpc.h: Likewise. * hurd/msgportdemux.c: Likewise. * hurd/new-fd.c: Likewise. * hurd/openport.c: Likewise. * hurd/pid2task.c: Likewise. * hurd/port-cleanup.c: Likewise. * hurd/port2fd.c: Likewise. * hurd/ports-get.c: Likewise. * hurd/ports-set.c: Likewise. * hurd/privports.c: Likewise. * hurd/report-wait.c: Likewise. * hurd/set-host.c: Likewise. * hurd/setauth.c: Likewise. * hurd/setuids.c: Likewise. * hurd/siginfo.c: Likewise. * hurd/sigunwind.c: Likewise. * hurd/task2pid.c: Likewise. * hurd/thread-cancel.c: Likewise. * hurd/thread-self.c: Likewise. * hurd/vpprintf.c: Likewise. * hurd/hurd/fd.h: Likewise. * hurd/hurd/id.h: Likewise. * hurd/hurd/ioctl.h: Likewise. * hurd/hurd/lookup.h: Likewise. * hurd/hurd/port.h: Likewise. * hurd/hurd/resource.h: Likewise. * hurd/hurd/threadvar.h: Likewise. * hurd/hurd/userlink.h: Likewise. * inet/ether_aton.c: Likewise. * inet/ether_aton_r.c: Likewise. * inet/ether_ntoa.c: Likewise. * inet/ether_ntoa_r.c: Likewise. * inet/gethstbyad.c: Likewise. * inet/gethstbyad_r.c: Likewise. * inet/gethstent.c: Likewise. * inet/getnetbyad.c: Likewise. * inet/getnetbyad_r.c: Likewise. * inet/getnetbynm.c: Likewise. * inet/getnetbynm_r.c: Likewise. * inet/getnetent.c: Likewise. * inet/getnetent_r.c: Likewise. * inet/getproto.c: Likewise. * inet/getproto_r.c: Likewise. * inet/getprtent.c: Likewise. * inet/getprtent_r.c: Likewise. * inet/getprtname.c: Likewise. * inet/getrpcbyname.c: Likewise. * inet/getrpcbyname_r.c: Likewise. * inet/getrpcbynumber.c: Likewise. * inet/getrpcbynumber_r.c: Likewise. * inet/getrpcent.c: Likewise. * inet/getrpcent_r.c: Likewise. * inet/getservent.c: Likewise. * inet/getservent_r.c: Likewise. * inet/getsrvbynm.c: Likewise. * inet/getsrvbynm_r.c: Likewise. * inet/getsrvbypt.c: Likewise. * inet/getsrvbypt_r.c: Likewise. * inet/herrno.c: Likewise. * inet/netgroup.h: Likewise. * ient/netinet/ether.h: Likewise. * intl/bindtextdom.c: Likewise. * intl/dcgettext.c: Likewise. * intl/dgettext.c: Likewise. * intl/gettext.c: Likewise. * intl/gettext.h: Likewise. * intl/gettextP.h: Likewise. * intl/hash-string.h: Likewise. * intl/loadmsgcat.c: Likewise. * intl/localealias.c: Likewise. * intl/textdomain.c: Likewise. * io/creat.c: Likewise. * io/getdirname.c: Likewise. * io/lockf.c: Likewise. * io/pwd.c: Likewise. * io/test-utime.c: Likewise. * locale/categories.def: Likewise. * locale/codeset_name.c: Likewise. * locale/lc-collate.c: Likewise. * locale/lc-ctype.c: Likewise. * locale/lc-messages.c: Likewise. * locale/lc-monetary.c: Likewise. * locale/lc-numeric.c: Likewise. * locale/lc-time.c: Likewise. * locale/loadlocale.c: Likewise. * locale/localeconv.c: Likewise. * locale/nl_langinfo.c: Likewise. * locale/setlocale.c: Likewise. * locale/strlen-hash.h: Likewise. * locale/programs/charmap-kw.gperf: Likewise. * locale/programs/charmap-kw.h: Likewise. * locale/programs/charset.c: Likewise. * locale/programs/ld-ctype.c: Likewise. * locale/programs/ld-messages.c: Likewise. * locale/programs/ld-monetary.c: Likewise. * locale/programs/linereader.h: Likewise. * locale/programs/locale-spec.c: Likewise. * locale/programs/locales.h: Likewise. * locale/programs/locfile-kw.gperf: Likewise. * locale/programs/locfile-kw.h: Likewise. * locale/programs/locfile-token.h: Likewise. * locale/programs/simple-hash.h: Likewise. * locale/programs/stringtrans.c: Likewise. * locale/programs/stringtrans.h: Likewise. * login/logout.c: Likewise. * mach/bootprivport.c: Likewise. * mach/devstream.c: Likewise. * mach/hello.c: Likewise. * mach/mach.h: Likewise. * mach/mach_init.c: Likewise. * mach/mach_init.h: Likewise. * mach/mig-alloc.c: Likewise. * mach/mig-dealloc.c: Likewise. * mach/mutex-init.c: Likewise. * mach/mutex-solid.c: Likewise. * mach/setup-thread.c: Likewise. * mach/spin-lock.h: Likewise. * mach/spin-solid.c: Likewise. * mach/mach/mig_support.h: Likewise. * md5-crypt/md5-crypt.c: Likewise. * misc/nlist.h: Likewise. * nss/nss_files/files-ether.c: Likewise. * posix/confstr.c: Likewise. * posix/execl.c: Likewise. * posix/execle.c: Likewise. * posix/execlp.c: Likewise. * posix/execv.c: Likewise. * posix/execvp.c: Likewise. * posix/fnmatch.c: Likewise. * posix/getopt.c: Likewise. * posix/getopt.h: Likewise. * posix/getopt1.c: Likewise. * posix/id.c: Likewise. * posix/regex.c: Likewise. * posix/setpgrp.c: Likewise. * posix/unistd.h: Likewise. * posix/wordexp.c: Likewise. * pwd/fgetpwent.c: Likewise. * pwd/getpwent.c: Likewise. * pwd/getpwent_r.c: Likewise. * pwd/getpwnam.c: Likewise. * pwd/getpwnam_r.c: Likewise. * pwd/getpwuid.c: Likewise. * pwd/getpwuid_r.c: Likewise. * pwd/putpwent.c: Likewise. * resolv/gethnamaddr.c: Likewise. * resolv/res_hconf.c: Likewise. * resolv/res_hconf.h: Likewise. * setjmp/longjmp.c: Likewise. * setjmp/sigjmp.c: Likewise. * setjmp/tst-setjmp.c: Likewise. * stdio/clearerr.c: Likewise. * stdio/ferror.c: Likewise. * stdio/fgetc.c: Likewise. * stdio/fgetpos.c: Likewise. * stdio/fgets.c: Likewise. * stdio/fileno.c: Likewise. * stdio/fmemopen.c: Likewise. * stdio/fopen.c: Likewise. * stdio/fopncook.c: Likewise. * stdio/fputc.c: Likewise. * stdio/fputs.c: Likewise. * stdio/fread.c: Likewise. * stdio/freopen.c: Likewise. * stdio/fseek.c: Likewise. * stdio/fsetpos.c: Likewise. * stdio/ftell.c: Likewise. * stdio/fwrite.c: Likewise. * stdio/getchar.c: Likewise. * stdio/getdelim.c: Likewise. * stdio/gets.c: Likewise. * stdio/glue.c: Likewise. * stdio/internals.c: Likewise. * stdio/linewrap.c: Likewise. * stdio/linewrap.h: Likewise. * stdio/memstream.c: Likewise. * stdio/newstream.c: Likewise. * stdio/putchar.c: Likewise. * stdio/puts.c: Likewise. * stdio/rewind.c: Likewise. * stdio/setbuf.c: Likewise. * stdio/setbuffer.c: Likewise. * stdio/setlinebuf.c: Likewise. * stdio/setvbuf.c: Likewise. * stdio/ungetc.c: Likewise. * stdio/vasprintf.c: Likewise. * stdio/vscanf.c: Likewise. * stdio/vsnprintf.c: Likewise. * stdio/vsprintf.c: Likewise. * stdio/vsscanf.c: Likewise. * stdio-common/asprintf.c: Likewise. * stdio-common/dprintf.c: Likewise. * stdio-common/errnobug.c: Likewise. * stdio-common/fprintf.c: Likewise. * stdio-common/getline.c: Likewise. * stdio-common/getw.c: Likewise. * stdio-common/perror.c: Likewise. * stdio-common/psignal.c: Likewise. * stdio-common/putw.c: Likewise. * stdio-common/reg-printf.c: Likewise. * stdio-common/scanf.c: Likewise. * stdio-common/snprintf.c: Likewise. * stdio-common/sprintf.c: Likewise. * stdio-common/tempnam.c: Likewise. * stdio-common/test_rdwr.c: Likewise. * stdio-common/tst-fileno.c: Likewise. * stdio-common/tst-printf.c: Likewise. * stdio-common/tstgetln.c: Likewise. * stdio-common/vprintf.c: Likewise. * stdlib/drand48.c: Likewise. * stdlib/drand48_r.c: Likewise. * stdlib/erand48.c: Likewise. * stdlib/erand48_r.c: Likewise. * stdlib/exit.h: Likewise. * stdlib/strtoq.c: Likewise. * stdlib/strtoul.c: Likewise. * stdlib/strtouq.c: Likewise. * stdlib/test-canon.c: Likewise. * stdlib/testdiv.c: Likewise. * stdlib/testrand.c: Likewise. * string/argz-append.c: Likewise. * string/argz-count.c: Likewise. * string/argz-create.c: Likewise. * string/argz-ctsep.c: Likewise. * string/argz-delete.c: Likewise. * string/argz-extract.c: Likewise. * string/argz-insert.c: Likewise. * string/argz-next.c: Likewise. * string/argz-stringify.c: Likewise. * string/basename.c: Likewise. * string/envz.c: Likewise. * string/memfrob.c: Likewise. * string/strcoll.c: Likewise. * string/strdup.c: Likewise. * string/string.h: Likewise. * string/strndup.c: Likewise. * string/strnlen.c: Likewise. * string/strsignal.c: Likewise. * string/strxfrm.c: Likewise. * string/test-ffs.c: Likewise. * string/testcopy.c: Likewise. * sysdeps/generic/enbl-secure.c: Likewise. * sysdeps/generic/memcopy.h: Likewise. * sysdeps/generic/stpncpy.c: Likewise. * sysdeps/generic/strcasecmp.c: Likewise. * sysdeps/generic/strcat.c: Likewise. * sysdeps/generic/strchr.c: Likewise. * sysdeps/generic/strcpy.c: Likewise. * sysdeps/generic/strcspn.c: Likewise. * sysdeps/generic/strlen.c: Likewise. * sysdeps/generic/strncase.c: Likewise. * sysdeps/generic/strncat.c: Likewise. * sysdeps/generic/strncpy.c: Likewise. * sysdeps/generic/strpbrk.c: Likewise. * sysdeps/generic/strsep.c: Likewise. * sysdeps/generic/strspn.c: Likewise. * sysdeps/generic/strstr.c: Likewise. * sysdeps/generic/strtok.c: Likewise. * sysdeps/generic/strtok_r.c: Likewise. * sysdeps/mach/sleep.c: Likewise. * sysdeps/posix/sleep.c: Likewise. * sysdeps/stub/sleep.c: Likewise. * time/date.c: Likewise. * time/test_time.c: Likewise. * wcsmbs/wmemcpy.c: Likewise. * wctye/test_wctype.c: Likewise. * wctye/towctrans.c: Likewise. * wctye/wcfuncs.c: Likewise. * wctye/wctrans.c: Likewise. 1997-02-13 22:15 Miles Bader <miles@gnu.ai.mit.edu> * argp/Makefile: New file. * argp/argp.h: Likewise. * argp/argp-ba.c: Likewise. * argp/argp-fmtstream.c: Likewise. * argp/argp-fmtstream.h: Likewise. * argp/argp-fs-xinl.c: Likewise. * argp/argp-help.c: Likewise. * argp/argp-namefrob.h: Likewise. * argp/argp-parse.c: Likewise. * argp/argp-pv.c: Likewise. * argp/argp-pvh.c: Likewise. * argp/argp-test.c: Likewise. * argp/argp-xinl.c: Likewise. * libio/_G_config.h: Make sure wint_t is also defined for old gcc 1997-02-09 04:35 Ulrich Drepper <drepper@cygnus.com> * stdio-common/_itoa.h: Update copyright.
This commit is contained in:
parent
7434ccadbb
commit
c84142e8fe
513
ChangeLog
513
ChangeLog
@ -1,3 +1,502 @@
|
|||||||
|
1997-02-15 02:41 Miles Bader <miles@gnu.ai.mit.edu>
|
||||||
|
|
||||||
|
* argp/argp-help.c: Gettextize sources.
|
||||||
|
* argp/argp-parse.c: Likewise.
|
||||||
|
|
||||||
|
1997-02-13 22:32 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* features.h (__GLIBC_MINOR__): Bump to 1.
|
||||||
|
|
||||||
|
* xlocale.h: New file. Wrapper around locale/xlocale.h.
|
||||||
|
* Makefile (distribute): Add xlocale.h.
|
||||||
|
* locale/Makefile (routines): Add ctype_l.
|
||||||
|
* locale/ctype-extn.c: Update copyright. De-ANSI-declfy.
|
||||||
|
Add __isblank_l, __toascii_l and __isascii_l.
|
||||||
|
* ctype/ctype.h: Add definitions and declarations for *_l functions.
|
||||||
|
* locale/Makefile (headers): Add xlocale.h.
|
||||||
|
(routines): Add newlocale, duplocale, and freelocale.
|
||||||
|
* locale/localeinfo.h (MAX_USAGE_COUNT): New macro.
|
||||||
|
(struct locale_data): Add new fields mmaped and usage_count.
|
||||||
|
Correct various declarations.
|
||||||
|
* locale/C-collate.c: Define value for new fields mmaped and
|
||||||
|
usage_count.
|
||||||
|
* locale/C-ctype.c: Likewise.
|
||||||
|
* locale/C-messages.c: Likewise.
|
||||||
|
* locale/C-monetary.c: Likewise.
|
||||||
|
* locale/C-numeric.c: Likewise.
|
||||||
|
* locale/C-time.c: Likewise.
|
||||||
|
* locale/loadlocale.c (_nl_load_locale): Initialize mmaped and
|
||||||
|
usage_count fields.
|
||||||
|
* locale/locale.h: Don't define locale_t here (moved to xlocale.h).
|
||||||
|
Correct prototypes for __newlocale and __freelocale.
|
||||||
|
Add prototype for __duplocale.
|
||||||
|
* locale/findlocale.c (copy): Remove function. Use __strdup instead.
|
||||||
|
(_nl_remove_locale): New function.
|
||||||
|
* locale/nl_langinfo.c: Don't declare locale_data objects as const.
|
||||||
|
* locale/setlocale.c: Likewise.
|
||||||
|
* locale/weight.h: Change for use with locale objects.
|
||||||
|
* locale/xlocale.h: New file. Define __locale_t type.
|
||||||
|
* locale/newlocale.c: New file. Create new locale object.
|
||||||
|
* locale/freelocale.c: New file. Destroy locale object.
|
||||||
|
* locale/duplocale.c: New file. Create copy of locale object.
|
||||||
|
* stdlib/Makefile (routines): Add strfmon_l.
|
||||||
|
* stdlib/monetary.h [__USE_GNU]: Declare __strfmon_l.
|
||||||
|
* stdlib/strfmon.c: Add support for use in extended locale model.
|
||||||
|
* stdlib/strfmon_l.c: New file.
|
||||||
|
* string/Makefile (routines): Add strcoll_l and strxfrm_l.
|
||||||
|
* string/strcoll.c: Change for use in extended locale model.
|
||||||
|
* string/strxfrm.c: Likewise.
|
||||||
|
* string/strcoll_l.c: New file. Implement __strcoll_l function.
|
||||||
|
* string/strxfrm_l.c: New file. Implement __strxfrm_l function.
|
||||||
|
* wcsmbs/Makefile (routines): Add wcscoll_l and wcsxfrm_l.
|
||||||
|
* wcsmbs/wchar.h [__USE_GNU]: Declare wcscoll_l and wcsxfrm_l.
|
||||||
|
* wcsmbs/wcscoll.c: Change for use in extended locale model.
|
||||||
|
* wcsmbs/wcscoll_l.c: New file. Implement __wcscoll_l function.
|
||||||
|
* wcsmbs/wcsxfrm_l.c: New file. Implement __wcsxfrm_l function.
|
||||||
|
* wctype/Makefile (routines): Add wcextra, wcfuncs_l, iswctype_l,
|
||||||
|
and towctrans_l.
|
||||||
|
* wctype/cname-lookup.h: Prepare for use in extended locale model.
|
||||||
|
* wctype/iswctype_l.c: New file. Implement character classification
|
||||||
|
functions for use with locale objects.
|
||||||
|
* wctype/wctype.h: Declare functions for use with locale objects.
|
||||||
|
* wctype/towctrans_l.c: New file. Implement __towctrans_l function
|
||||||
|
for use with locale objects.
|
||||||
|
* wctype/wcfuncs_l.c: New file. Implement wide character
|
||||||
|
classification functions for use with locale objects.
|
||||||
|
* wctype/wcextra.c: New file. Implement real functions for
|
||||||
|
non-standard classification functions.
|
||||||
|
|
||||||
|
* elf/ldd.bash.in: Don't use --data-relocs and --function-relocs
|
||||||
|
parameters to ld.so. Use environment variables.
|
||||||
|
* elf/ldd.sh.in: Likewise.
|
||||||
|
* elf/rtld.c: Remove handling of --data-relocs and --function-relocs
|
||||||
|
options. Instead read environment variables.
|
||||||
|
|
||||||
|
* elf/link.h (receiver_fct): Add new argument to take error code.
|
||||||
|
* elf/dl-error.c (_dl_signal_error): Call receiver function with
|
||||||
|
another argument.
|
||||||
|
|
||||||
|
* elf/dl-object.c (_dl_new_object): Create new object with list of
|
||||||
|
names in l_libname member.
|
||||||
|
* elf/dl-load.c (_dl_map_object_from_fd): Add name which was used to
|
||||||
|
find to object to the list in the link_map variable.
|
||||||
|
(_dl_map_object): Use _dl_does_name_match_p to compare with all
|
||||||
|
available names of the object.
|
||||||
|
Optimize handling of LD_LIBRARY_PATH a bit.
|
||||||
|
* elf/rtld.c: Initialize l_libname member of _dl_rtld_map.
|
||||||
|
|
||||||
|
* elf/dl-lookup.c (_dl_elf_hash): Optimize function.
|
||||||
|
|
||||||
|
* elf/Makefile (routines): Add dl-version.
|
||||||
|
* elf/link.h (hash_name_pair): New type. Group pointer to string
|
||||||
|
and its hash value.
|
||||||
|
(struct link_map): Change l_libname member to be a list of names,
|
||||||
|
not a single pointer to a name.
|
||||||
|
Add new members l_nversions and l_versions.
|
||||||
|
(_dl_does_name_match_p): New function to test for all names of an
|
||||||
|
object.
|
||||||
|
Add prototypes for new lookup and versioning functions.
|
||||||
|
* elf/dl-lookup.c (do_lookup): Add new argument and handle case
|
||||||
|
when versioned symbol is requested.
|
||||||
|
(_dl_lookup_symbol): Call do_lookup with another argument.
|
||||||
|
(_dl_lookup_symbol_skip): Likewise.
|
||||||
|
(_dl_lookup_versioned_symbol): New function. Handle lookup of
|
||||||
|
versioned symbol.
|
||||||
|
(_dl_lookup_versioned_symbol_skip): Likewise, similar to
|
||||||
|
_dl_lookup_symbol_skip.
|
||||||
|
* elf/dl-reloc.c (RESOLVE): Call _dl_lookup_versioned_symbol or
|
||||||
|
_dl_lookup_symbol depending on availability of version information.
|
||||||
|
* elf/dl-runtime.c (RESOLVE): Likewise.
|
||||||
|
(fixup): Call elf_machine_relplt with additional argument to point
|
||||||
|
to versioning information if available.
|
||||||
|
* elf/do-rel.h (elf_dynamic_do_rel): Likewise.
|
||||||
|
* elf/dl-open.c (_dl_open): Call _dl_check_map_versions to check
|
||||||
|
for correct versions.
|
||||||
|
* elf/dl-version.c: New file. Check library versions and extract
|
||||||
|
version information for easier access.
|
||||||
|
* elf/dlfcn.h [__USE_GNU]: Add prototype for dlvsym.
|
||||||
|
* elf/dlvsym.c: New file. Implementation of function similar to
|
||||||
|
dlsym, but looks for versioned symbol.
|
||||||
|
* elf/elf.h: Add types and macros for versioning.
|
||||||
|
* elf/rtld.c (dl_main): Check availability of needed versions.
|
||||||
|
* sysdeps/alpha/dl-machine.h (elf_machine_rela): Add additional
|
||||||
|
argument for version information. Call RESOLVE with additional
|
||||||
|
argument.
|
||||||
|
* sysdeps/i386/dl-machine.h: Likewise.
|
||||||
|
* sysdeps/m68k/dl-machine.h: Likewise.
|
||||||
|
* sysdeps/mips/dl-machine.h: Likewise.
|
||||||
|
|
||||||
|
* elf/dlerror.c: Change comment to align with guidelines.
|
||||||
|
* elf/dlopen.c: Likewise.
|
||||||
|
* elf/dlsym.c: Likewise.
|
||||||
|
|
||||||
|
* locale/programs/localedef.c: Implement --quiet option.
|
||||||
|
* locale/programs/charset.h: Declare be_quiet variable.
|
||||||
|
* locale/programs/locfile.h: Likewise.
|
||||||
|
* locale/programs/charmap.c: Don't print warnings if quiet option
|
||||||
|
was given.
|
||||||
|
* locale/programs/ld-collate.c: Likewise.
|
||||||
|
* locale/programs/ld-ctype.c: Likewise.
|
||||||
|
* locale/programs/ld-messages.c: Likewise.
|
||||||
|
* locale/programs/ld-monetary.c: Likewise.
|
||||||
|
* locale/programs/ld-numeric.c: Likewise.
|
||||||
|
* locale/programs/ld-time.c: Likewise.
|
||||||
|
* locale/programs/locfile.c: Likewise.
|
||||||
|
|
||||||
|
* Makefile (subdirs): Add argp.
|
||||||
|
|
||||||
|
* catgets/catgets.c (catopen): Little code improvement.
|
||||||
|
|
||||||
|
* posix/execl.c: Remove restriction to 1024 arguments.
|
||||||
|
* posix/execle.c: Likewise.
|
||||||
|
* posix/execlp.c: Likewise.
|
||||||
|
|
||||||
|
* posix/getopt.c [_LIBC]: Define global objects with __ prefix
|
||||||
|
and make regular names weak aliases.
|
||||||
|
* posix/getopt1.c: Likewise.
|
||||||
|
* posix/getopt.h [_LIBC]: Provide prototypes and declarations for
|
||||||
|
__ protected forms.
|
||||||
|
|
||||||
|
* posix/unistd.h: Add prototype for __sleep.
|
||||||
|
* sysdeps/mach/sleep.c: Make sleep weak alias of __sleep.
|
||||||
|
* sysdeps/posix/sleep.c: Likewise.
|
||||||
|
* sysdeps/stub/sleep.c: Likewise.
|
||||||
|
* sysdeps/unix/sysv/linux/sleep.c: Likewise.
|
||||||
|
|
||||||
|
* ctype/ctype-info.c: Update copyright.
|
||||||
|
* ctype/ctype.c: Likewise.
|
||||||
|
* ctype/test_ctype.c: Likewise.
|
||||||
|
* dirent/alphasort.c: Likewise.
|
||||||
|
* dirent/list.c: Likewise.
|
||||||
|
* gmon/bb_exit_func.c: Likewise.
|
||||||
|
* grp/fgetgrent.c: Likewise.
|
||||||
|
* grp/getgrent.c: Likewise.
|
||||||
|
* grp/getgrent_r.c: Likewise.
|
||||||
|
* grp/getgrgid.c: Likewise.
|
||||||
|
* grp/getgrgid_r.c: Likewise.
|
||||||
|
* grp/getgrnam.c: Likewise.
|
||||||
|
* grp/getgrnam_r.c: Likewise.
|
||||||
|
* hurd/alloc-fd.c: Likewise.
|
||||||
|
* hurd/catch-exc.c: Likewise.
|
||||||
|
* hurd/ctty-input.c: Likewise.
|
||||||
|
* hurd/ctty-output.c: Likewise.
|
||||||
|
* hurd/dtable.c: Likewise.
|
||||||
|
* hurd/fchroot.c: Likewise.
|
||||||
|
* hurd/fd-close.c: Likewise.
|
||||||
|
* hurd/fd-read.c: Likewise.
|
||||||
|
* hurd/fd-write.c: Likewise.
|
||||||
|
* hurd/fopenport.c: Likewise.
|
||||||
|
* hurd/get-host.c: Likewise.
|
||||||
|
* hurd/getdport.c: Likewise.
|
||||||
|
* hurd/getuids.c: Likewise.
|
||||||
|
* hurd/getumask.c: Likewise.
|
||||||
|
* hurd/hurd-raise.c: Likewise.
|
||||||
|
* hurd/hurd.h: Likewise.
|
||||||
|
* hurd/hurdauth.c: Likewise.
|
||||||
|
* hurd/hurdexec.c: Likewise.
|
||||||
|
* hurd/hurdhost.h: Likewise.
|
||||||
|
* hurd/hurdid.c: Likewise.
|
||||||
|
* hurd/hurdinit.c: Likewise.
|
||||||
|
* hurd/hurdioctl.c: Likewise.
|
||||||
|
* hurd/hurdkill.c: Likewise.
|
||||||
|
* hurd/hurdlookup.c: Likewise.
|
||||||
|
* hurd/hurdmsg.c: Likewise.
|
||||||
|
* hurd/hurdpid.c: Likewise.
|
||||||
|
* hurd/hurdports.c: Likewise.
|
||||||
|
* hurd/hurdprio.c: Likewise.
|
||||||
|
* hurd/hurdrlimit.c: Likewise.
|
||||||
|
* hurd/hurdsock.c: Likewise.
|
||||||
|
* hurd/hurdstartup.c: Likewise.
|
||||||
|
* hurd/hurdstartup.h: Likewise.
|
||||||
|
* hurd/intern-fd.c: Likewise.
|
||||||
|
* hurd/intr-msg.c: Likewise.
|
||||||
|
* hurd/intr-rpc.defs: Likewise.
|
||||||
|
* hurd/intr-rpc.h: Likewise.
|
||||||
|
* hurd/msgportdemux.c: Likewise.
|
||||||
|
* hurd/new-fd.c: Likewise.
|
||||||
|
* hurd/openport.c: Likewise.
|
||||||
|
* hurd/pid2task.c: Likewise.
|
||||||
|
* hurd/port-cleanup.c: Likewise.
|
||||||
|
* hurd/port2fd.c: Likewise.
|
||||||
|
* hurd/ports-get.c: Likewise.
|
||||||
|
* hurd/ports-set.c: Likewise.
|
||||||
|
* hurd/privports.c: Likewise.
|
||||||
|
* hurd/report-wait.c: Likewise.
|
||||||
|
* hurd/set-host.c: Likewise.
|
||||||
|
* hurd/setauth.c: Likewise.
|
||||||
|
* hurd/setuids.c: Likewise.
|
||||||
|
* hurd/siginfo.c: Likewise.
|
||||||
|
* hurd/sigunwind.c: Likewise.
|
||||||
|
* hurd/task2pid.c: Likewise.
|
||||||
|
* hurd/thread-cancel.c: Likewise.
|
||||||
|
* hurd/thread-self.c: Likewise.
|
||||||
|
* hurd/vpprintf.c: Likewise.
|
||||||
|
* hurd/hurd/fd.h: Likewise.
|
||||||
|
* hurd/hurd/id.h: Likewise.
|
||||||
|
* hurd/hurd/ioctl.h: Likewise.
|
||||||
|
* hurd/hurd/lookup.h: Likewise.
|
||||||
|
* hurd/hurd/port.h: Likewise.
|
||||||
|
* hurd/hurd/resource.h: Likewise.
|
||||||
|
* hurd/hurd/threadvar.h: Likewise.
|
||||||
|
* hurd/hurd/userlink.h: Likewise.
|
||||||
|
* inet/ether_aton.c: Likewise.
|
||||||
|
* inet/ether_aton_r.c: Likewise.
|
||||||
|
* inet/ether_ntoa.c: Likewise.
|
||||||
|
* inet/ether_ntoa_r.c: Likewise.
|
||||||
|
* inet/gethstbyad.c: Likewise.
|
||||||
|
* inet/gethstbyad_r.c: Likewise.
|
||||||
|
* inet/gethstent.c: Likewise.
|
||||||
|
* inet/getnetbyad.c: Likewise.
|
||||||
|
* inet/getnetbyad_r.c: Likewise.
|
||||||
|
* inet/getnetbynm.c: Likewise.
|
||||||
|
* inet/getnetbynm_r.c: Likewise.
|
||||||
|
* inet/getnetent.c: Likewise.
|
||||||
|
* inet/getnetent_r.c: Likewise.
|
||||||
|
* inet/getproto.c: Likewise.
|
||||||
|
* inet/getproto_r.c: Likewise.
|
||||||
|
* inet/getprtent.c: Likewise.
|
||||||
|
* inet/getprtent_r.c: Likewise.
|
||||||
|
* inet/getprtname.c: Likewise.
|
||||||
|
* inet/getrpcbyname.c: Likewise.
|
||||||
|
* inet/getrpcbyname_r.c: Likewise.
|
||||||
|
* inet/getrpcbynumber.c: Likewise.
|
||||||
|
* inet/getrpcbynumber_r.c: Likewise.
|
||||||
|
* inet/getrpcent.c: Likewise.
|
||||||
|
* inet/getrpcent_r.c: Likewise.
|
||||||
|
* inet/getservent.c: Likewise.
|
||||||
|
* inet/getservent_r.c: Likewise.
|
||||||
|
* inet/getsrvbynm.c: Likewise.
|
||||||
|
* inet/getsrvbynm_r.c: Likewise.
|
||||||
|
* inet/getsrvbypt.c: Likewise.
|
||||||
|
* inet/getsrvbypt_r.c: Likewise.
|
||||||
|
* inet/herrno.c: Likewise.
|
||||||
|
* inet/netgroup.h: Likewise.
|
||||||
|
* ient/netinet/ether.h: Likewise.
|
||||||
|
* intl/bindtextdom.c: Likewise.
|
||||||
|
* intl/dcgettext.c: Likewise.
|
||||||
|
* intl/dgettext.c: Likewise.
|
||||||
|
* intl/gettext.c: Likewise.
|
||||||
|
* intl/gettext.h: Likewise.
|
||||||
|
* intl/gettextP.h: Likewise.
|
||||||
|
* intl/hash-string.h: Likewise.
|
||||||
|
* intl/loadmsgcat.c: Likewise.
|
||||||
|
* intl/localealias.c: Likewise.
|
||||||
|
* intl/textdomain.c: Likewise.
|
||||||
|
* io/creat.c: Likewise.
|
||||||
|
* io/getdirname.c: Likewise.
|
||||||
|
* io/lockf.c: Likewise.
|
||||||
|
* io/pwd.c: Likewise.
|
||||||
|
* io/test-utime.c: Likewise.
|
||||||
|
* locale/categories.def: Likewise.
|
||||||
|
* locale/codeset_name.c: Likewise.
|
||||||
|
* locale/lc-collate.c: Likewise.
|
||||||
|
* locale/lc-ctype.c: Likewise.
|
||||||
|
* locale/lc-messages.c: Likewise.
|
||||||
|
* locale/lc-monetary.c: Likewise.
|
||||||
|
* locale/lc-numeric.c: Likewise.
|
||||||
|
* locale/lc-time.c: Likewise.
|
||||||
|
* locale/loadlocale.c: Likewise.
|
||||||
|
* locale/localeconv.c: Likewise.
|
||||||
|
* locale/nl_langinfo.c: Likewise.
|
||||||
|
* locale/setlocale.c: Likewise.
|
||||||
|
* locale/strlen-hash.h: Likewise.
|
||||||
|
* locale/programs/charmap-kw.gperf: Likewise.
|
||||||
|
* locale/programs/charmap-kw.h: Likewise.
|
||||||
|
* locale/programs/charset.c: Likewise.
|
||||||
|
* locale/programs/ld-ctype.c: Likewise.
|
||||||
|
* locale/programs/ld-messages.c: Likewise.
|
||||||
|
* locale/programs/ld-monetary.c: Likewise.
|
||||||
|
* locale/programs/linereader.h: Likewise.
|
||||||
|
* locale/programs/locale-spec.c: Likewise.
|
||||||
|
* locale/programs/locales.h: Likewise.
|
||||||
|
* locale/programs/locfile-kw.gperf: Likewise.
|
||||||
|
* locale/programs/locfile-kw.h: Likewise.
|
||||||
|
* locale/programs/locfile-token.h: Likewise.
|
||||||
|
* locale/programs/simple-hash.h: Likewise.
|
||||||
|
* locale/programs/stringtrans.c: Likewise.
|
||||||
|
* locale/programs/stringtrans.h: Likewise.
|
||||||
|
* login/logout.c: Likewise.
|
||||||
|
* mach/bootprivport.c: Likewise.
|
||||||
|
* mach/devstream.c: Likewise.
|
||||||
|
* mach/hello.c: Likewise.
|
||||||
|
* mach/mach.h: Likewise.
|
||||||
|
* mach/mach_init.c: Likewise.
|
||||||
|
* mach/mach_init.h: Likewise.
|
||||||
|
* mach/mig-alloc.c: Likewise.
|
||||||
|
* mach/mig-dealloc.c: Likewise.
|
||||||
|
* mach/mutex-init.c: Likewise.
|
||||||
|
* mach/mutex-solid.c: Likewise.
|
||||||
|
* mach/setup-thread.c: Likewise.
|
||||||
|
* mach/spin-lock.h: Likewise.
|
||||||
|
* mach/spin-solid.c: Likewise.
|
||||||
|
* mach/mach/mig_support.h: Likewise.
|
||||||
|
* md5-crypt/md5-crypt.c: Likewise.
|
||||||
|
* misc/nlist.h: Likewise.
|
||||||
|
* nss/nss_files/files-ether.c: Likewise.
|
||||||
|
* posix/confstr.c: Likewise.
|
||||||
|
* posix/execl.c: Likewise.
|
||||||
|
* posix/execle.c: Likewise.
|
||||||
|
* posix/execlp.c: Likewise.
|
||||||
|
* posix/execv.c: Likewise.
|
||||||
|
* posix/execvp.c: Likewise.
|
||||||
|
* posix/fnmatch.c: Likewise.
|
||||||
|
* posix/getopt.c: Likewise.
|
||||||
|
* posix/getopt.h: Likewise.
|
||||||
|
* posix/getopt1.c: Likewise.
|
||||||
|
* posix/id.c: Likewise.
|
||||||
|
* posix/regex.c: Likewise.
|
||||||
|
* posix/setpgrp.c: Likewise.
|
||||||
|
* posix/unistd.h: Likewise.
|
||||||
|
* posix/wordexp.c: Likewise.
|
||||||
|
* pwd/fgetpwent.c: Likewise.
|
||||||
|
* pwd/getpwent.c: Likewise.
|
||||||
|
* pwd/getpwent_r.c: Likewise.
|
||||||
|
* pwd/getpwnam.c: Likewise.
|
||||||
|
* pwd/getpwnam_r.c: Likewise.
|
||||||
|
* pwd/getpwuid.c: Likewise.
|
||||||
|
* pwd/getpwuid_r.c: Likewise.
|
||||||
|
* pwd/putpwent.c: Likewise.
|
||||||
|
* resolv/gethnamaddr.c: Likewise.
|
||||||
|
* resolv/res_hconf.c: Likewise.
|
||||||
|
* resolv/res_hconf.h: Likewise.
|
||||||
|
* setjmp/longjmp.c: Likewise.
|
||||||
|
* setjmp/sigjmp.c: Likewise.
|
||||||
|
* setjmp/tst-setjmp.c: Likewise.
|
||||||
|
* stdio/clearerr.c: Likewise.
|
||||||
|
* stdio/ferror.c: Likewise.
|
||||||
|
* stdio/fgetc.c: Likewise.
|
||||||
|
* stdio/fgetpos.c: Likewise.
|
||||||
|
* stdio/fgets.c: Likewise.
|
||||||
|
* stdio/fileno.c: Likewise.
|
||||||
|
* stdio/fmemopen.c: Likewise.
|
||||||
|
* stdio/fopen.c: Likewise.
|
||||||
|
* stdio/fopncook.c: Likewise.
|
||||||
|
* stdio/fputc.c: Likewise.
|
||||||
|
* stdio/fputs.c: Likewise.
|
||||||
|
* stdio/fread.c: Likewise.
|
||||||
|
* stdio/freopen.c: Likewise.
|
||||||
|
* stdio/fseek.c: Likewise.
|
||||||
|
* stdio/fsetpos.c: Likewise.
|
||||||
|
* stdio/ftell.c: Likewise.
|
||||||
|
* stdio/fwrite.c: Likewise.
|
||||||
|
* stdio/getchar.c: Likewise.
|
||||||
|
* stdio/getdelim.c: Likewise.
|
||||||
|
* stdio/gets.c: Likewise.
|
||||||
|
* stdio/glue.c: Likewise.
|
||||||
|
* stdio/internals.c: Likewise.
|
||||||
|
* stdio/linewrap.c: Likewise.
|
||||||
|
* stdio/linewrap.h: Likewise.
|
||||||
|
* stdio/memstream.c: Likewise.
|
||||||
|
* stdio/newstream.c: Likewise.
|
||||||
|
* stdio/putchar.c: Likewise.
|
||||||
|
* stdio/puts.c: Likewise.
|
||||||
|
* stdio/rewind.c: Likewise.
|
||||||
|
* stdio/setbuf.c: Likewise.
|
||||||
|
* stdio/setbuffer.c: Likewise.
|
||||||
|
* stdio/setlinebuf.c: Likewise.
|
||||||
|
* stdio/setvbuf.c: Likewise.
|
||||||
|
* stdio/ungetc.c: Likewise.
|
||||||
|
* stdio/vasprintf.c: Likewise.
|
||||||
|
* stdio/vscanf.c: Likewise.
|
||||||
|
* stdio/vsnprintf.c: Likewise.
|
||||||
|
* stdio/vsprintf.c: Likewise.
|
||||||
|
* stdio/vsscanf.c: Likewise.
|
||||||
|
* stdio-common/asprintf.c: Likewise.
|
||||||
|
* stdio-common/dprintf.c: Likewise.
|
||||||
|
* stdio-common/errnobug.c: Likewise.
|
||||||
|
* stdio-common/fprintf.c: Likewise.
|
||||||
|
* stdio-common/getline.c: Likewise.
|
||||||
|
* stdio-common/getw.c: Likewise.
|
||||||
|
* stdio-common/perror.c: Likewise.
|
||||||
|
* stdio-common/psignal.c: Likewise.
|
||||||
|
* stdio-common/putw.c: Likewise.
|
||||||
|
* stdio-common/reg-printf.c: Likewise.
|
||||||
|
* stdio-common/scanf.c: Likewise.
|
||||||
|
* stdio-common/snprintf.c: Likewise.
|
||||||
|
* stdio-common/sprintf.c: Likewise.
|
||||||
|
* stdio-common/tempnam.c: Likewise.
|
||||||
|
* stdio-common/test_rdwr.c: Likewise.
|
||||||
|
* stdio-common/tst-fileno.c: Likewise.
|
||||||
|
* stdio-common/tst-printf.c: Likewise.
|
||||||
|
* stdio-common/tstgetln.c: Likewise.
|
||||||
|
* stdio-common/vprintf.c: Likewise.
|
||||||
|
* stdlib/drand48.c: Likewise.
|
||||||
|
* stdlib/drand48_r.c: Likewise.
|
||||||
|
* stdlib/erand48.c: Likewise.
|
||||||
|
* stdlib/erand48_r.c: Likewise.
|
||||||
|
* stdlib/exit.h: Likewise.
|
||||||
|
* stdlib/strtoq.c: Likewise.
|
||||||
|
* stdlib/strtoul.c: Likewise.
|
||||||
|
* stdlib/strtouq.c: Likewise.
|
||||||
|
* stdlib/test-canon.c: Likewise.
|
||||||
|
* stdlib/testdiv.c: Likewise.
|
||||||
|
* stdlib/testrand.c: Likewise.
|
||||||
|
* string/argz-append.c: Likewise.
|
||||||
|
* string/argz-count.c: Likewise.
|
||||||
|
* string/argz-create.c: Likewise.
|
||||||
|
* string/argz-ctsep.c: Likewise.
|
||||||
|
* string/argz-delete.c: Likewise.
|
||||||
|
* string/argz-extract.c: Likewise.
|
||||||
|
* string/argz-insert.c: Likewise.
|
||||||
|
* string/argz-next.c: Likewise.
|
||||||
|
* string/argz-stringify.c: Likewise.
|
||||||
|
* string/basename.c: Likewise.
|
||||||
|
* string/envz.c: Likewise.
|
||||||
|
* string/memfrob.c: Likewise.
|
||||||
|
* string/strcoll.c: Likewise.
|
||||||
|
* string/strdup.c: Likewise.
|
||||||
|
* string/string.h: Likewise.
|
||||||
|
* string/strndup.c: Likewise.
|
||||||
|
* string/strnlen.c: Likewise.
|
||||||
|
* string/strsignal.c: Likewise.
|
||||||
|
* string/strxfrm.c: Likewise.
|
||||||
|
* string/test-ffs.c: Likewise.
|
||||||
|
* string/testcopy.c: Likewise.
|
||||||
|
* sysdeps/generic/enbl-secure.c: Likewise.
|
||||||
|
* sysdeps/generic/memcopy.h: Likewise.
|
||||||
|
* sysdeps/generic/stpncpy.c: Likewise.
|
||||||
|
* sysdeps/generic/strcasecmp.c: Likewise.
|
||||||
|
* sysdeps/generic/strcat.c: Likewise.
|
||||||
|
* sysdeps/generic/strchr.c: Likewise.
|
||||||
|
* sysdeps/generic/strcpy.c: Likewise.
|
||||||
|
* sysdeps/generic/strcspn.c: Likewise.
|
||||||
|
* sysdeps/generic/strlen.c: Likewise.
|
||||||
|
* sysdeps/generic/strncase.c: Likewise.
|
||||||
|
* sysdeps/generic/strncat.c: Likewise.
|
||||||
|
* sysdeps/generic/strncpy.c: Likewise.
|
||||||
|
* sysdeps/generic/strpbrk.c: Likewise.
|
||||||
|
* sysdeps/generic/strsep.c: Likewise.
|
||||||
|
* sysdeps/generic/strspn.c: Likewise.
|
||||||
|
* sysdeps/generic/strstr.c: Likewise.
|
||||||
|
* sysdeps/generic/strtok.c: Likewise.
|
||||||
|
* sysdeps/generic/strtok_r.c: Likewise.
|
||||||
|
* sysdeps/mach/sleep.c: Likewise.
|
||||||
|
* sysdeps/posix/sleep.c: Likewise.
|
||||||
|
* sysdeps/stub/sleep.c: Likewise.
|
||||||
|
* time/date.c: Likewise.
|
||||||
|
* time/test_time.c: Likewise.
|
||||||
|
* wcsmbs/wmemcpy.c: Likewise.
|
||||||
|
* wctye/test_wctype.c: Likewise.
|
||||||
|
* wctye/towctrans.c: Likewise.
|
||||||
|
* wctye/wcfuncs.c: Likewise.
|
||||||
|
* wctye/wctrans.c: Likewise.
|
||||||
|
|
||||||
|
1997-02-13 22:15 Miles Bader <miles@gnu.ai.mit.edu>
|
||||||
|
|
||||||
|
* argp/Makefile: New file.
|
||||||
|
* argp/argp.h: Likewise.
|
||||||
|
* argp/argp-ba.c: Likewise.
|
||||||
|
* argp/argp-fmtstream.c: Likewise.
|
||||||
|
* argp/argp-fmtstream.h: Likewise.
|
||||||
|
* argp/argp-fs-xinl.c: Likewise.
|
||||||
|
* argp/argp-help.c: Likewise.
|
||||||
|
* argp/argp-namefrob.h: Likewise.
|
||||||
|
* argp/argp-parse.c: Likewise.
|
||||||
|
* argp/argp-pv.c: Likewise.
|
||||||
|
* argp/argp-pvh.c: Likewise.
|
||||||
|
* argp/argp-test.c: Likewise.
|
||||||
|
* argp/argp-xinl.c: Likewise.
|
||||||
|
|
||||||
1997-02-13 11:44 Andreas Jaeger <aj@arthur.pfalz.de>
|
1997-02-13 11:44 Andreas Jaeger <aj@arthur.pfalz.de>
|
||||||
|
|
||||||
* stdlib/qsort.c: Add prototype for _quicksort.
|
* stdlib/qsort.c: Add prototype for _quicksort.
|
||||||
@ -14,14 +513,11 @@
|
|||||||
|
|
||||||
1997-02-13 17:55 Ulrich Drepper <drepper@cygnus.com>
|
1997-02-13 17:55 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
* libio/_G_config.h: Make sure win_t is also defined for old gcc
|
* libio/_G_config.h: Make sure wint_t is also defined for old gcc
|
||||||
versions. Reported by Andreas Jaeger.
|
versions. Reported by Andreas Jaeger.
|
||||||
|
|
||||||
1997-02-13 11:44 Andreas Jaeger <aj@arthur.pfalz.de>
|
1997-02-13 11:44 Andreas Jaeger <aj@arthur.pfalz.de>
|
||||||
|
|
||||||
* db/btree/bt_split.c (bt_psplit): Fix typo in change of
|
|
||||||
1997-02-12.
|
|
||||||
|
|
||||||
* time/tzfile.c (__tzfile_read): Change comment to follow
|
* time/tzfile.c (__tzfile_read): Change comment to follow
|
||||||
change of 1997-02-12.
|
change of 1997-02-12.
|
||||||
|
|
||||||
@ -78,15 +574,14 @@
|
|||||||
of $(object-suffixes).
|
of $(object-suffixes).
|
||||||
* sysdeps/unix/make-syscalls.sh: Likewise. Fix comment.
|
* sysdeps/unix/make-syscalls.sh: Likewise. Fix comment.
|
||||||
|
|
||||||
1997-02-11 05:27 Ulrich Drepper <drepper@cygnus.com>
|
|
||||||
|
|
||||||
* locale/weight.h (collate_rules): It's an u_int32_t array.
|
|
||||||
(get_weight): Compute initial SLOT value correctly.
|
|
||||||
|
|
||||||
1997-02-10 17:45 Ulrich Drepper <drepper@cygnus.com>
|
1997-02-10 17:45 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
* string/argz-ctsep.c: Initialize *LEN when successful.
|
* string/argz-ctsep.c: Initialize *LEN when successful.
|
||||||
|
|
||||||
|
1997-02-09 04:35 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* stdio-common/_itoa.h: Update copyright.
|
||||||
|
|
||||||
1997-02-09 02:59 Ulrich Drepper <drepper@cygnus.com>
|
1997-02-09 02:59 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
* version.h (VERSION): Bump to 2.0.2.
|
* version.h (VERSION): Bump to 2.0.2.
|
||||||
|
4
Makefile
4
Makefile
@ -54,7 +54,7 @@ endif
|
|||||||
subdirs = csu assert ctype db locale intl catgets math setjmp signal stdlib \
|
subdirs = csu assert ctype db locale intl catgets math setjmp signal stdlib \
|
||||||
stdio-common $(stdio) malloc string wcsmbs time dirent grp pwd \
|
stdio-common $(stdio) malloc string wcsmbs time dirent grp pwd \
|
||||||
posix io termios resource misc login socket sysvipc gmon gnulib \
|
posix io termios resource misc login socket sysvipc gmon gnulib \
|
||||||
wctype manual shadow md5-crypt nss $(sysdep-subdirs) po \
|
wctype manual shadow md5-crypt nss $(sysdep-subdirs) po argp \
|
||||||
$(add-ons) elf
|
$(add-ons) elf
|
||||||
export subdirs := $(subdirs) # Benign, useless in GNU make before 3.63.
|
export subdirs := $(subdirs) # Benign, useless in GNU make before 3.63.
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ distribute := README INSTALL FAQ NOTES NEWS PROJECTS \
|
|||||||
autolock.sh rellns-sh munch-tmpl.c munch.awk interp.c \
|
autolock.sh rellns-sh munch-tmpl.c munch.awk interp.c \
|
||||||
sysdep.h set-hooks.h libc-symbols.h version.h shlib-versions \
|
sysdep.h set-hooks.h libc-symbols.h version.h shlib-versions \
|
||||||
rpm/Makefile rpm/template rpm/rpmrc nsswitch.h netgroup.h \
|
rpm/Makefile rpm/template rpm/rpmrc nsswitch.h netgroup.h \
|
||||||
mcheck.h glibcbug.in
|
mcheck.h glibcbug.in xlocale.h
|
||||||
|
|
||||||
distribute := $(strip $(distribute))
|
distribute := $(strip $(distribute))
|
||||||
generated := $(generated) stubs.h version-info.h
|
generated := $(generated) stubs.h version-info.h
|
||||||
|
13
NEWS
13
NEWS
@ -1,4 +1,4 @@
|
|||||||
GNU C Library NEWS -- history of user-visible changes. 26 January 1997
|
GNU C Library NEWS -- history of user-visible changes. 1997-02-13
|
||||||
|
|
||||||
Copyright (C) 1992, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
Copyright (C) 1992, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||||
See the end for copying conditions.
|
See the end for copying conditions.
|
||||||
@ -7,6 +7,17 @@ Please send GNU C library bug reports using the `glibcbug' script to
|
|||||||
<bugs@gnu.ai.mit.edu>. Questions and suggestions should be send to
|
<bugs@gnu.ai.mit.edu>. Questions and suggestions should be send to
|
||||||
<bug-glibc@prep.ai.mit.edu>.
|
<bug-glibc@prep.ai.mit.edu>.
|
||||||
|
|
||||||
|
Version 2.1
|
||||||
|
|
||||||
|
* An additional locale model to support C++ Standard Library locale
|
||||||
|
model an probably more was implemented by Ulrich Drepper.
|
||||||
|
|
||||||
|
* Eric Youngdale and Ulrich Drepper implement versioning of objects on
|
||||||
|
symbol level.
|
||||||
|
|
||||||
|
* Miles Bader provided the `argp' function family to support hierachical
|
||||||
|
command line argument parsing, layered on top of getopt.
|
||||||
|
|
||||||
Version 2.0.2
|
Version 2.0.2
|
||||||
|
|
||||||
* more bug fixes
|
* more bug fixes
|
||||||
|
31
argp/Makefile
Normal file
31
argp/Makefile
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# Copyright (C) 1997 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
|
||||||
|
# modify it under the terms of the GNU Library General Public License as
|
||||||
|
# published by the Free Software Foundation; either version 2 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
|
||||||
|
# The GNU C Library 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
|
||||||
|
# Library General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU Library General Public
|
||||||
|
# License along with the GNU C Library; see the file COPYING.LIB. If
|
||||||
|
# not, write to the Free Software Foundation, Inc.,
|
||||||
|
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
#
|
||||||
|
# Makefile for argp.
|
||||||
|
#
|
||||||
|
subdir := argp
|
||||||
|
|
||||||
|
headers = argp.h
|
||||||
|
distribute = argp-fmtstream.h argp-namefrob.h
|
||||||
|
routines = $(addprefix argp-, ba fmtstream fs-xinl help parse pv \
|
||||||
|
pvh xinl)
|
||||||
|
|
||||||
|
tests = argp-test
|
||||||
|
|
||||||
|
include ../Rules
|
26
argp/argp-ba.c
Normal file
26
argp/argp-ba.c
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/* Default definition for ARGP_PROGRAM_BUG_ADDRESS.
|
||||||
|
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
/* If set by the user program, it should point to string that is the
|
||||||
|
bug-reporting address for the program. It will be printed by argp_help if
|
||||||
|
the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help
|
||||||
|
messages), embedded in a sentence that says something like `Report bugs to
|
||||||
|
ADDR.'. */
|
||||||
|
char *argp_program_bug_address = 0;
|
374
argp/argp-fmtstream.c
Normal file
374
argp/argp-fmtstream.c
Normal file
@ -0,0 +1,374 @@
|
|||||||
|
/* Word-wrapping and line-truncating streams
|
||||||
|
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
/* This package emulates glibc `line_wrap_stream' semantics for systems that
|
||||||
|
don't have that. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include "argp-fmtstream.h"
|
||||||
|
#include "argp-namefrob.h"
|
||||||
|
|
||||||
|
#ifndef ARGP_FMTSTREAM_USE_LINEWRAP
|
||||||
|
|
||||||
|
#ifndef isblank
|
||||||
|
#define isblank(ch) ((ch)==' ' || (ch)=='\t')
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define INIT_BUF_SIZE 200
|
||||||
|
#define PRINTF_SIZE_GUESS 150
|
||||||
|
|
||||||
|
/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines
|
||||||
|
written on it with LMARGIN spaces and limits them to RMARGIN columns
|
||||||
|
total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by
|
||||||
|
replacing the whitespace before them with a newline and WMARGIN spaces.
|
||||||
|
Otherwise, chars beyond RMARGIN are simply dropped until a newline.
|
||||||
|
Returns NULL if there was an error. */
|
||||||
|
argp_fmtstream_t
|
||||||
|
__argp_make_fmtstream (FILE *stream,
|
||||||
|
size_t lmargin, size_t rmargin, ssize_t wmargin)
|
||||||
|
{
|
||||||
|
argp_fmtstream_t fs = malloc (sizeof (struct argp_fmtstream));
|
||||||
|
if (fs)
|
||||||
|
{
|
||||||
|
fs->stream = stream;
|
||||||
|
|
||||||
|
fs->lmargin = lmargin;
|
||||||
|
fs->rmargin = rmargin;
|
||||||
|
fs->wmargin = wmargin;
|
||||||
|
fs->point_col = 0;
|
||||||
|
fs->point_offs = 0;
|
||||||
|
|
||||||
|
fs->buf = malloc (INIT_BUF_SIZE);
|
||||||
|
if (! fs->buf)
|
||||||
|
{
|
||||||
|
free (fs);
|
||||||
|
fs = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fs->p = fs->buf;
|
||||||
|
fs->end = fs->buf + INIT_BUF_SIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
#ifdef weak_alias
|
||||||
|
weak_alias (__argp_make_fmtstream, argp_make_fmtstream)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Flush FS to its stream, and free it (but don't close the stream). */
|
||||||
|
void
|
||||||
|
__argp_fmtstream_free (argp_fmtstream_t fs)
|
||||||
|
{
|
||||||
|
__argp_fmtstream_update (fs);
|
||||||
|
if (fs->p > fs->buf)
|
||||||
|
fwrite (fs->buf, 1, fs->p - fs->buf, fs->stream);
|
||||||
|
free (fs->buf);
|
||||||
|
free (fs);
|
||||||
|
}
|
||||||
|
#ifdef weak_alias
|
||||||
|
weak_alias (__argp_fmtstream_free, argp_fmtstream_free)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Process FS's buffer so that line wrapping is done from POINT_OFFS to the
|
||||||
|
end of its buffer. This code is mostly from glibc stdio/linewrap.c. */
|
||||||
|
void
|
||||||
|
__argp_fmtstream_update (argp_fmtstream_t fs)
|
||||||
|
{
|
||||||
|
char *buf, *nl;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
/* Scan the buffer for newlines. */
|
||||||
|
buf = fs->buf + fs->point_offs;
|
||||||
|
while (buf < fs->p)
|
||||||
|
{
|
||||||
|
size_t r;
|
||||||
|
|
||||||
|
if (fs->point_col == 0 && fs->lmargin != 0)
|
||||||
|
{
|
||||||
|
/* We are starting a new line. Print spaces to the left margin. */
|
||||||
|
const size_t pad = fs->lmargin;
|
||||||
|
if (fs->p + pad < fs->end)
|
||||||
|
{
|
||||||
|
/* We can fit in them in the buffer by moving the
|
||||||
|
buffer text up and filling in the beginning. */
|
||||||
|
memmove (buf + pad, buf, fs->p - buf);
|
||||||
|
fs->p += pad; /* Compensate for bigger buffer. */
|
||||||
|
memset (buf, ' ', pad); /* Fill in the spaces. */
|
||||||
|
buf += pad; /* Don't bother searching them. */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* No buffer space for spaces. Must flush. */
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < pad; i++)
|
||||||
|
putc (' ', fs->stream);
|
||||||
|
}
|
||||||
|
fs->point_col = pad;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = fs->p - buf;
|
||||||
|
nl = memchr (buf, '\n', len);
|
||||||
|
|
||||||
|
if (fs->point_col < 0)
|
||||||
|
fs->point_col = 0;
|
||||||
|
|
||||||
|
if (!nl)
|
||||||
|
{
|
||||||
|
/* The buffer ends in a partial line. */
|
||||||
|
|
||||||
|
if (fs->point_col + len < fs->rmargin)
|
||||||
|
{
|
||||||
|
/* The remaining buffer text is a partial line and fits
|
||||||
|
within the maximum line width. Advance point for the
|
||||||
|
characters to be written and stop scanning. */
|
||||||
|
fs->point_col += len;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* Set the end-of-line pointer for the code below to
|
||||||
|
the end of the buffer. */
|
||||||
|
nl = fs->p;
|
||||||
|
}
|
||||||
|
else if (fs->point_col + (nl - buf) < fs->rmargin)
|
||||||
|
{
|
||||||
|
/* The buffer contains a full line that fits within the maximum
|
||||||
|
line width. Reset point and scan the next line. */
|
||||||
|
fs->point_col = 0;
|
||||||
|
buf = nl + 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This line is too long. */
|
||||||
|
r = fs->rmargin - 1;
|
||||||
|
|
||||||
|
if (fs->wmargin < 0)
|
||||||
|
{
|
||||||
|
/* Truncate the line by overwriting the excess with the
|
||||||
|
newline and anything after it in the buffer. */
|
||||||
|
if (nl < fs->p)
|
||||||
|
{
|
||||||
|
memmove (buf + (r - fs->point_col), nl, fs->p - nl);
|
||||||
|
fs->p -= buf + (r - fs->point_col) - nl;
|
||||||
|
/* Reset point for the next line and start scanning it. */
|
||||||
|
fs->point_col = 0;
|
||||||
|
buf += r + 1; /* Skip full line plus \n. */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The buffer ends with a partial line that is beyond the
|
||||||
|
maximum line width. Advance point for the characters
|
||||||
|
written, and discard those past the max from the buffer. */
|
||||||
|
fs->point_col += len;
|
||||||
|
fs->p -= fs->point_col - r;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Do word wrap. Go to the column just past the maximum line
|
||||||
|
width and scan back for the beginning of the word there.
|
||||||
|
Then insert a line break. */
|
||||||
|
|
||||||
|
char *p, *nextline;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
p = buf + (r + 1 - fs->point_col);
|
||||||
|
while (p >= buf && !isblank (*p))
|
||||||
|
--p;
|
||||||
|
nextline = p + 1; /* This will begin the next line. */
|
||||||
|
|
||||||
|
if (nextline > buf)
|
||||||
|
{
|
||||||
|
/* Swallow separating blanks. */
|
||||||
|
if (p > buf)
|
||||||
|
do
|
||||||
|
--p;
|
||||||
|
while (p > buf && isblank (*p));
|
||||||
|
nl = p + 1; /* The newline will replace the first blank. */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* A single word that is greater than the maximum line width.
|
||||||
|
Oh well. Put it on an overlong line by itself. */
|
||||||
|
p = buf + (r + 1 - fs->point_col);
|
||||||
|
/* Find the end of the long word. */
|
||||||
|
do
|
||||||
|
++p;
|
||||||
|
while (p < nl && !isblank (*p));
|
||||||
|
if (p == nl)
|
||||||
|
{
|
||||||
|
/* It already ends a line. No fussing required. */
|
||||||
|
fs->point_col = 0;
|
||||||
|
buf = nl + 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* We will move the newline to replace the first blank. */
|
||||||
|
nl = p;
|
||||||
|
/* Swallow separating blanks. */
|
||||||
|
do
|
||||||
|
++p;
|
||||||
|
while (isblank (*p));
|
||||||
|
/* The next line will start here. */
|
||||||
|
nextline = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextline - (nl + 1) < fs->wmargin)
|
||||||
|
/* The margin needs more blanks than we removed. */
|
||||||
|
if (fs->end - fs->p > fs->wmargin + 1)
|
||||||
|
/* Make some space for them. */
|
||||||
|
{
|
||||||
|
size_t mv = fs->p - nextline;
|
||||||
|
memmove (nl + 1 + fs->wmargin, nextline, mv);
|
||||||
|
nextline = nl + 1 + fs->wmargin;
|
||||||
|
len = nextline + mv - buf;
|
||||||
|
*nl++ = '\n';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* Output the first line so we can use the space. */
|
||||||
|
{
|
||||||
|
if (nl > fs->buf)
|
||||||
|
fwrite (fs->buf, 1, nl - fs->buf, fs->stream);
|
||||||
|
putc ('\n', fs->stream);
|
||||||
|
len += buf - fs->buf;
|
||||||
|
nl = buf = fs->buf;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* We can fit the newline and blanks in before
|
||||||
|
the next word. */
|
||||||
|
*nl++ = '\n';
|
||||||
|
|
||||||
|
if (nextline - nl >= fs->wmargin)
|
||||||
|
/* Add blanks up to the wrap margin column. */
|
||||||
|
for (i = 0; i < fs->wmargin; ++i)
|
||||||
|
*nl++ = ' ';
|
||||||
|
else
|
||||||
|
for (i = 0; i < fs->wmargin; ++i)
|
||||||
|
putc (' ', fs->stream);
|
||||||
|
|
||||||
|
/* Copy the tail of the original buffer into the current buffer
|
||||||
|
position. */
|
||||||
|
if (nl != nextline)
|
||||||
|
memmove (nl, nextline, buf + len - nextline);
|
||||||
|
len -= nextline - buf;
|
||||||
|
|
||||||
|
/* Continue the scan on the remaining lines in the buffer. */
|
||||||
|
buf = nl;
|
||||||
|
|
||||||
|
/* Restore bufp to include all the remaining text. */
|
||||||
|
fs->p = nl + len;
|
||||||
|
|
||||||
|
/* Reset the counter of what has been output this line. If wmargin
|
||||||
|
is 0, we want to avoid the lmargin getting added, so we set
|
||||||
|
point_col to a magic value of -1 in that case. */
|
||||||
|
fs->point_col = fs->wmargin ? fs->wmargin : -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remember that we've scanned as far as the end of the buffer. */
|
||||||
|
fs->point_offs = fs->p - fs->buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ensure that FS has space for AMOUNT more bytes in its buffer, either by
|
||||||
|
growing the buffer, or by flushing it. True is returned iff we succeed. */
|
||||||
|
int
|
||||||
|
__argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount)
|
||||||
|
{
|
||||||
|
if (fs->end - fs->p < amount)
|
||||||
|
{
|
||||||
|
ssize_t wrote;
|
||||||
|
|
||||||
|
/* Flush FS's buffer. */
|
||||||
|
__argp_fmtstream_update (fs);
|
||||||
|
|
||||||
|
wrote = fwrite (fs->buf, 1, fs->p - fs->buf, fs->stream);
|
||||||
|
if (wrote == fs->p - fs->buf)
|
||||||
|
{
|
||||||
|
fs->p = fs->buf;
|
||||||
|
fs->point_offs = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fs->p -= wrote;
|
||||||
|
fs->point_offs -= wrote;
|
||||||
|
memmove (fs->buf, fs->buf + wrote, fs->p - fs->buf);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs->end - fs->buf < amount)
|
||||||
|
/* Gotta grow the buffer. */
|
||||||
|
{
|
||||||
|
size_t new_size = fs->end - fs->buf + amount;
|
||||||
|
char *new_buf = realloc (fs->buf, new_size);
|
||||||
|
|
||||||
|
if (! new_buf)
|
||||||
|
{
|
||||||
|
__set_errno (ENOMEM);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs->buf = new_buf;
|
||||||
|
fs->end = new_buf + new_size;
|
||||||
|
fs->p = fs->buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssize_t
|
||||||
|
__argp_fmtstream_printf (struct argp_fmtstream *fs, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
size_t out;
|
||||||
|
size_t size_guess = PRINTF_SIZE_GUESS; /* How much space to reserve. */
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
if (! __argp_fmtstream_ensure (fs, size_guess))
|
||||||
|
return -1;
|
||||||
|
size_guess += size_guess;
|
||||||
|
|
||||||
|
va_start (args, fmt);
|
||||||
|
out = __vsnprintf (fs->p, fs->end - fs->p, fmt, args);
|
||||||
|
va_end (args);
|
||||||
|
}
|
||||||
|
while (out == -1);
|
||||||
|
|
||||||
|
fs->p += out;
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
#ifdef weak_alias
|
||||||
|
weak_alias (__argp_fmtstream_printf, argp_fmtstream_printf)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !ARGP_FMTSTREAM_USE_LINEWRAP */
|
297
argp/argp-fmtstream.h
Normal file
297
argp/argp-fmtstream.h
Normal file
@ -0,0 +1,297 @@
|
|||||||
|
/* Word-wrapping and line-truncating streams.
|
||||||
|
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
/* This package emulates glibc `line_wrap_stream' semantics for systems that
|
||||||
|
don't have that. If the system does have it, it is just a wrapper for
|
||||||
|
that. This header file is only used internally while compiling argp, and
|
||||||
|
shouldn't be installed. */
|
||||||
|
|
||||||
|
#ifndef __ARGP_FMTSTREAM_H__
|
||||||
|
#define __ARGP_FMTSTREAM_H__
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#if (_LIBC - 0 && !defined (USE_IN_LIBIO)) \
|
||||||
|
|| (defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H))
|
||||||
|
/* line_wrap_stream is available, so use that. */
|
||||||
|
#define ARGP_FMTSTREAM_USE_LINEWRAP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ARGP_FMTSTREAM_USE_LINEWRAP
|
||||||
|
/* Just be a simple wrapper for line_wrap_stream; the semantics are
|
||||||
|
*slightly* different, as line_wrap_stream doesn't actually make a new
|
||||||
|
object, it just modifies the given stream (reversibly) to do
|
||||||
|
line-wrapping. Since we control who uses this code, it doesn't matter. */
|
||||||
|
|
||||||
|
#include <linewrap.h>
|
||||||
|
|
||||||
|
typedef FILE *argp_fmtstream_t;
|
||||||
|
|
||||||
|
#define argp_make_fmtstream line_wrap_stream
|
||||||
|
#define __argp_make_fmtstream line_wrap_stream
|
||||||
|
#define argp_fmtstream_free line_unwrap_stream
|
||||||
|
#define __argp_fmtstream_free line_unwrap_stream
|
||||||
|
|
||||||
|
#define __argp_fmtstream_putc(fs,ch) putc(ch,fs)
|
||||||
|
#define argp_fmtstream_putc(fs,ch) putc(ch,fs)
|
||||||
|
#define __argp_fmtstream_puts(fs,str) fputs(str,fs)
|
||||||
|
#define argp_fmtstream_puts(fs,str) fputs(str,fs)
|
||||||
|
#define __argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs)
|
||||||
|
#define argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs)
|
||||||
|
#define __argp_fmtstream_printf fprintf
|
||||||
|
#define argp_fmtstream_printf fprintf
|
||||||
|
|
||||||
|
#define __argp_fmtstream_lmargin line_wrap_lmargin
|
||||||
|
#define argp_fmtstream_lmargin line_wrap_lmargin
|
||||||
|
#define __argp_fmtstream_set_lmargin line_wrap_set_lmargin
|
||||||
|
#define argp_fmtstream_set_lmargin line_wrap_set_lmargin
|
||||||
|
#define __argp_fmtstream_rmargin line_wrap_rmargin
|
||||||
|
#define argp_fmtstream_rmargin line_wrap_rmargin
|
||||||
|
#define __argp_fmtstream_set_rmargin line_wrap_set_rmargin
|
||||||
|
#define argp_fmtstream_set_rmargin line_wrap_set_rmargin
|
||||||
|
#define __argp_fmtstream_wmargin line_wrap_wmargin
|
||||||
|
#define argp_fmtstream_wmargin line_wrap_wmargin
|
||||||
|
#define __argp_fmtstream_set_wmargin line_wrap_set_wmargin
|
||||||
|
#define argp_fmtstream_set_wmargin line_wrap_set_wmargin
|
||||||
|
#define __argp_fmtstream_point line_wrap_point
|
||||||
|
#define argp_fmtstream_point line_wrap_point
|
||||||
|
|
||||||
|
#else /* !ARGP_FMTSTREAM_USE_LINEWRAP */
|
||||||
|
/* Guess we have to define our own version. */
|
||||||
|
|
||||||
|
#ifndef __const
|
||||||
|
#define __const const
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct argp_fmtstream
|
||||||
|
{
|
||||||
|
FILE *stream; /* The stream we're outputting to. */
|
||||||
|
|
||||||
|
size_t lmargin, rmargin; /* Left and right margins. */
|
||||||
|
ssize_t wmargin; /* Margin to wrap to, or -1 to truncate. */
|
||||||
|
|
||||||
|
/* Point in buffer to which we've processed for wrapping, but not output. */
|
||||||
|
size_t point_offs;
|
||||||
|
/* Output column at POINT_OFFS, or -1 meaning 0 but don't add lmargin. */
|
||||||
|
ssize_t point_col;
|
||||||
|
|
||||||
|
char *buf; /* Output buffer. */
|
||||||
|
char *p; /* Current end of text in BUF. */
|
||||||
|
char *end; /* Absolute end of BUF. */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct argp_fmtstream *argp_fmtstream_t;
|
||||||
|
|
||||||
|
/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines
|
||||||
|
written on it with LMARGIN spaces and limits them to RMARGIN columns
|
||||||
|
total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by
|
||||||
|
replacing the whitespace before them with a newline and WMARGIN spaces.
|
||||||
|
Otherwise, chars beyond RMARGIN are simply dropped until a newline.
|
||||||
|
Returns NULL if there was an error. */
|
||||||
|
extern argp_fmtstream_t __argp_make_fmtstream (FILE *__stream,
|
||||||
|
size_t __lmargin,
|
||||||
|
size_t __rmargin,
|
||||||
|
ssize_t __wmargin);
|
||||||
|
extern argp_fmtstream_t argp_make_fmtstream (FILE *__stream,
|
||||||
|
size_t __lmargin,
|
||||||
|
size_t __rmargin,
|
||||||
|
ssize_t __wmargin);
|
||||||
|
|
||||||
|
/* Flush __FS to its stream, and free it (but don't close the stream). */
|
||||||
|
extern void __argp_fmtstream_free (argp_fmtstream_t __fs);
|
||||||
|
extern void argp_fmtstream_free (argp_fmtstream_t __fs);
|
||||||
|
|
||||||
|
extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs,
|
||||||
|
__const char *__fmt, ...)
|
||||||
|
__attribute__ ((__format__ (printf, 2, 3)));
|
||||||
|
extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs,
|
||||||
|
__const char *__fmt, ...)
|
||||||
|
__attribute__ ((__format__ (printf, 2, 3)));
|
||||||
|
|
||||||
|
extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
|
||||||
|
extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
|
||||||
|
|
||||||
|
extern int __argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str);
|
||||||
|
extern int argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str);
|
||||||
|
|
||||||
|
extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs,
|
||||||
|
__const char *__str, size_t __len);
|
||||||
|
extern size_t argp_fmtstream_write (argp_fmtstream_t __fs,
|
||||||
|
__const char *__str, size_t __len);
|
||||||
|
|
||||||
|
/* Access macros for various bits of state. */
|
||||||
|
#define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin)
|
||||||
|
#define argp_fmtstream_rmargin(__fs) ((__fs)->rmargin)
|
||||||
|
#define argp_fmtstream_wmargin(__fs) ((__fs)->wmargin)
|
||||||
|
#define __argp_fmtstream_lmargin argp_fmtstream_lmargin
|
||||||
|
#define __argp_fmtstream_rmargin argp_fmtstream_rmargin
|
||||||
|
#define __argp_fmtstream_wmargin argp_fmtstream_wmargin
|
||||||
|
|
||||||
|
/* Set __FS's left margin to LMARGIN and return the old value. */
|
||||||
|
extern size_t argp_fmtstream_set_lmargin (argp_fmtstream_t __fs,
|
||||||
|
size_t __lmargin);
|
||||||
|
extern size_t __argp_fmtstream_set_lmargin (argp_fmtstream_t __fs,
|
||||||
|
size_t __lmargin);
|
||||||
|
|
||||||
|
/* Set __FS's right margin to __RMARGIN and return the old value. */
|
||||||
|
extern size_t argp_fmtstream_set_rmargin (argp_fmtstream_t __fs,
|
||||||
|
size_t __rmargin);
|
||||||
|
extern size_t __argp_fmtstream_set_rmargin (argp_fmtstream_t __fs,
|
||||||
|
size_t __rmargin);
|
||||||
|
|
||||||
|
/* Set __FS's wrap margin to __WMARGIN and return the old value. */
|
||||||
|
extern size_t argp_fmtstream_set_wmargin (argp_fmtstream_t __fs,
|
||||||
|
size_t __wmargin);
|
||||||
|
extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs,
|
||||||
|
size_t __wmargin);
|
||||||
|
|
||||||
|
/* Return the column number of the current output point in __FS. */
|
||||||
|
extern size_t argp_fmtstream_point (argp_fmtstream_t __fs);
|
||||||
|
extern size_t __argp_fmtstream_point (argp_fmtstream_t __fs);
|
||||||
|
|
||||||
|
/* Internal routines. */
|
||||||
|
extern void _argp_fmtstream_update (argp_fmtstream_t __fs);
|
||||||
|
extern void __argp_fmtstream_update (argp_fmtstream_t __fs);
|
||||||
|
extern int _argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
|
||||||
|
extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
|
||||||
|
|
||||||
|
#ifdef __OPTIMIZE__
|
||||||
|
/* Inline versions of above routines. */
|
||||||
|
|
||||||
|
#if !_LIBC
|
||||||
|
#define __argp_fmtstream_putc argp_fmtstream_putc
|
||||||
|
#define __argp_fmtstream_puts argp_fmtstream_puts
|
||||||
|
#define __argp_fmtstream_write argp_fmtstream_write
|
||||||
|
#define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin
|
||||||
|
#define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin
|
||||||
|
#define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin
|
||||||
|
#define __argp_fmtstream_point argp_fmtstream_point
|
||||||
|
#define __argp_fmtstream_update _argp_fmtstream_update
|
||||||
|
#define __argp_fmtstream_ensure _argp_fmtstream_ensure
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ARGP_FS_EI
|
||||||
|
#define ARGP_FS_EI extern inline
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ARGP_FS_EI size_t
|
||||||
|
__argp_fmtstream_write (argp_fmtstream_t __fs,
|
||||||
|
__const char *__str, size_t __len)
|
||||||
|
{
|
||||||
|
if (__fs->p + __len <= __fs->end || __argp_fmtstream_ensure (__fs, __len))
|
||||||
|
{
|
||||||
|
memcpy (__fs->p, __str, __len);
|
||||||
|
__fs->p += __len;
|
||||||
|
return __len;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ARGP_FS_EI int
|
||||||
|
__argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str)
|
||||||
|
{
|
||||||
|
size_t __len = strlen (__str);
|
||||||
|
if (__len)
|
||||||
|
{
|
||||||
|
size_t __wrote = __argp_fmtstream_write (__fs, __str, __len);
|
||||||
|
return __wrote == __len ? 0 : -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ARGP_FS_EI int
|
||||||
|
__argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch)
|
||||||
|
{
|
||||||
|
if (__fs->p < __fs->end || __argp_fmtstream_ensure (__fs, 1))
|
||||||
|
return *__fs->p++ = __ch;
|
||||||
|
else
|
||||||
|
return EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set __FS's left margin to __LMARGIN and return the old value. */
|
||||||
|
ARGP_FS_EI size_t
|
||||||
|
__argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin)
|
||||||
|
{
|
||||||
|
size_t __old;
|
||||||
|
if (__fs->p - __fs->buf > __fs->point_offs)
|
||||||
|
__argp_fmtstream_update (__fs);
|
||||||
|
__old = __fs->lmargin;
|
||||||
|
__fs->lmargin = __lmargin;
|
||||||
|
return __old;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set __FS's right margin to __RMARGIN and return the old value. */
|
||||||
|
ARGP_FS_EI size_t
|
||||||
|
__argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, size_t __rmargin)
|
||||||
|
{
|
||||||
|
size_t __old;
|
||||||
|
if (__fs->p - __fs->buf > __fs->point_offs)
|
||||||
|
__argp_fmtstream_update (__fs);
|
||||||
|
__old = __fs->rmargin;
|
||||||
|
__fs->rmargin = __rmargin;
|
||||||
|
return __old;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set FS's wrap margin to __WMARGIN and return the old value. */
|
||||||
|
ARGP_FS_EI size_t
|
||||||
|
__argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, size_t __wmargin)
|
||||||
|
{
|
||||||
|
size_t __old;
|
||||||
|
if (__fs->p - __fs->buf > __fs->point_offs)
|
||||||
|
__argp_fmtstream_update (__fs);
|
||||||
|
__old = __fs->wmargin;
|
||||||
|
__fs->wmargin = __wmargin;
|
||||||
|
return __old;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return the column number of the current output point in __FS. */
|
||||||
|
ARGP_FS_EI size_t
|
||||||
|
__argp_fmtstream_point (argp_fmtstream_t __fs)
|
||||||
|
{
|
||||||
|
if (__fs->p - __fs->buf > __fs->point_offs)
|
||||||
|
__argp_fmtstream_update (__fs);
|
||||||
|
return __fs->point_col >= 0 ? __fs->point_col : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !_LIBC
|
||||||
|
#undef __argp_fmtstream_putc
|
||||||
|
#undef __argp_fmtstream_puts
|
||||||
|
#undef __argp_fmtstream_write
|
||||||
|
#undef __argp_fmtstream_set_lmargin
|
||||||
|
#undef __argp_fmtstream_set_rmargin
|
||||||
|
#undef __argp_fmtstream_set_wmargin
|
||||||
|
#undef __argp_fmtstream_point
|
||||||
|
#undef __argp_fmtstream_update
|
||||||
|
#undef __argp_fmtstream_ensure
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __OPTIMIZE__ */
|
||||||
|
|
||||||
|
#endif /* ARGP_FMTSTREAM_USE_LINEWRAP */
|
||||||
|
|
||||||
|
#endif /* __ARGP_FMTSTREAM_H__ */
|
41
argp/argp-fs-xinl.c
Normal file
41
argp/argp-fs-xinl.c
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/* Real definitions for extern inline functions in argp-fmtstream.h
|
||||||
|
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ARGP_FS_EI
|
||||||
|
#undef __OPTIMIZE__
|
||||||
|
#define __OPTIMIZE__
|
||||||
|
#include "argp-fmtstream.h"
|
||||||
|
|
||||||
|
/* Add weak aliases. */
|
||||||
|
#if _LIBC - 0 && !defined (ARGP_FMTSTREAM_USE_LINEWRAP) && defined (weak_alias)
|
||||||
|
|
||||||
|
weak_alias (__argp_fmtstream_putc, argp_fmtstream_putc)
|
||||||
|
weak_alias (__argp_fmtstream_puts, argp_fmtstream_puts)
|
||||||
|
weak_alias (__argp_fmtstream_write, argp_fmtstream_write)
|
||||||
|
weak_alias (__argp_fmtstream_set_lmargin, argp_fmtstream_set_lmargin)
|
||||||
|
weak_alias (__argp_fmtstream_set_rmargin, argp_fmtstream_set_rmargin)
|
||||||
|
weak_alias (__argp_fmtstream_set_wmargin, argp_fmtstream_set_wmargin)
|
||||||
|
weak_alias (__argp_fmtstream_point, argp_fmtstream_point)
|
||||||
|
|
||||||
|
#endif
|
1376
argp/argp-help.c
Normal file
1376
argp/argp-help.c
Normal file
File diff suppressed because it is too large
Load Diff
90
argp/argp-namefrob.h
Normal file
90
argp/argp-namefrob.h
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
/* Name frobnication for compiling argp outside of glibc
|
||||||
|
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#if !_LIBC
|
||||||
|
/* This code is written for inclusion in gnu-libc, and uses names in the
|
||||||
|
namespace reserved for libc. If we're not compiling in libc, define those
|
||||||
|
names to be the normal ones instead. */
|
||||||
|
|
||||||
|
/* argp-parse functions */
|
||||||
|
#undef __argp_parse
|
||||||
|
#define __argp_parse argp_parse
|
||||||
|
#undef __option_is_end
|
||||||
|
#define __option_is_end _option_is_end
|
||||||
|
#undef __option_is_short
|
||||||
|
#define __option_is_short _option_is_short
|
||||||
|
|
||||||
|
/* argp-help functions */
|
||||||
|
#undef __argp_help
|
||||||
|
#define __argp_help argp_help
|
||||||
|
#undef __argp_error
|
||||||
|
#define __argp_error argp_error
|
||||||
|
#undef __argp_failure
|
||||||
|
#define __argp_failure argp_failure
|
||||||
|
#undef __argp_state_help
|
||||||
|
#define __argp_state_help argp_state_help
|
||||||
|
#undef __argp_usage
|
||||||
|
#define __argp_usage argp_usage
|
||||||
|
|
||||||
|
/* argp-fmtstream functions */
|
||||||
|
#undef __argp_make_fmtstream
|
||||||
|
#define __argp_make_fmtstream argp_make_fmtstream
|
||||||
|
#undef __argp_fmtstream_free
|
||||||
|
#define __argp_fmtstream_free argp_fmtstream_free
|
||||||
|
#undef __argp_fmtstream_putc
|
||||||
|
#define __argp_fmtstream_putc argp_fmtstream_putc
|
||||||
|
#undef __argp_fmtstream_puts
|
||||||
|
#define __argp_fmtstream_puts argp_fmtstream_puts
|
||||||
|
#undef __argp_fmtstream_write
|
||||||
|
#define __argp_fmtstream_write argp_fmtstream_write
|
||||||
|
#undef __argp_fmtstream_printf
|
||||||
|
#define __argp_fmtstream_printf argp_fmtstream_printf
|
||||||
|
#undef __argp_fmtstream_set_lmargin
|
||||||
|
#define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin
|
||||||
|
#undef __argp_fmtstream_set_rmargin
|
||||||
|
#define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin
|
||||||
|
#undef __argp_fmtstream_set_wmargin
|
||||||
|
#define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin
|
||||||
|
#undef __argp_fmtstream_point
|
||||||
|
#define __argp_fmtstream_point argp_fmtstream_point
|
||||||
|
#undef __argp_fmtstream_update
|
||||||
|
#define __argp_fmtstream_update _argp_fmtstream_update
|
||||||
|
#undef __argp_fmtstream_ensure
|
||||||
|
#define __argp_fmtstream_ensure _argp_fmtstream_ensure
|
||||||
|
#undef __argp_fmtstream_lmargin
|
||||||
|
#define __argp_fmtstream_lmargin argp_fmtstream_lmargin
|
||||||
|
#undef __argp_fmtstream_rmargin
|
||||||
|
#define __argp_fmtstream_rmargin argp_fmtstream_rmargin
|
||||||
|
#undef __argp_fmtstream_wmargin
|
||||||
|
#define __argp_fmtstream_wmargin argp_fmtstream_wmargin
|
||||||
|
|
||||||
|
/* normal libc functions we call */
|
||||||
|
#undef __sleep
|
||||||
|
#define __sleep sleep
|
||||||
|
#undef __strcasecmp
|
||||||
|
#define __strcasecmp strcasecmp
|
||||||
|
#undef __vsnprintf
|
||||||
|
#define __vsnprintf vsnprintf
|
||||||
|
|
||||||
|
#endif /* !_LIBC */
|
||||||
|
|
||||||
|
#ifndef __set_errno
|
||||||
|
#define __set_errno(e) (errno = (e))
|
||||||
|
#endif
|
850
argp/argp-parse.c
Normal file
850
argp/argp-parse.c
Normal file
@ -0,0 +1,850 @@
|
|||||||
|
/* Hierarchial argument parsing, layered over getopt
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
|
||||||
|
#ifndef _
|
||||||
|
/* This is for other GNU distributions with internationalized messages.
|
||||||
|
When compiling libc, the _ macro is predefined. */
|
||||||
|
#ifdef HAVE_LIBINTL_H
|
||||||
|
# include <libintl.h>
|
||||||
|
# define _(msgid) gettext (msgid)
|
||||||
|
#else
|
||||||
|
# define _(msgid) (msgid)
|
||||||
|
# define gettext(msgid) (msgid)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _LIBC - 0
|
||||||
|
#include <libc-lock.h>
|
||||||
|
#else
|
||||||
|
#ifdef HAVE_CTHREADS_H
|
||||||
|
#include <cthreads.h>
|
||||||
|
#endif
|
||||||
|
#endif /* _LIBC */
|
||||||
|
|
||||||
|
#include "argp.h"
|
||||||
|
#include "argp-namefrob.h"
|
||||||
|
|
||||||
|
/* Getopt return values. */
|
||||||
|
#define KEY_END (-1) /* The end of the options. */
|
||||||
|
#define KEY_ARG 1 /* A non-option argument. */
|
||||||
|
#define KEY_ERR '?' /* An error parsing the options. */
|
||||||
|
|
||||||
|
/* The meta-argument used to prevent any further arguments being interpreted
|
||||||
|
as options. */
|
||||||
|
#define QUOTE "--"
|
||||||
|
|
||||||
|
/* The number of bits we steal in a long-option value for our own use. */
|
||||||
|
#define GROUP_BITS CHAR_BIT
|
||||||
|
|
||||||
|
/* The number of bits available for the user value. */
|
||||||
|
#define USER_BITS ((sizeof ((struct option *)0)->val * CHAR_BIT) - GROUP_BITS)
|
||||||
|
#define USER_MASK ((1 << USER_BITS) - 1)
|
||||||
|
|
||||||
|
/* EZ alias for ARGP_ERR_UNKNOWN. */
|
||||||
|
#define EBADKEY ARGP_ERR_UNKNOWN
|
||||||
|
|
||||||
|
/* Default options. */
|
||||||
|
|
||||||
|
/* When argp is given the --HANG switch, _ARGP_HANG is set and argp will sleep
|
||||||
|
for one second intervals, decrementing _ARGP_HANG until it's zero. Thus
|
||||||
|
you can force the program to continue by attaching a debugger and setting
|
||||||
|
it to 0 yourself. */
|
||||||
|
volatile int _argp_hang = 0;
|
||||||
|
|
||||||
|
#define OPT_PROGNAME -2
|
||||||
|
#define OPT_USAGE -3
|
||||||
|
#define OPT_HANG -4
|
||||||
|
|
||||||
|
static const struct argp_option argp_default_options[] =
|
||||||
|
{
|
||||||
|
{"help", '?', 0, 0, "Give this help list", -1},
|
||||||
|
{"usage", OPT_USAGE, 0, 0, "Give a short usage message"},
|
||||||
|
{"program-name",OPT_PROGNAME,"NAME", OPTION_HIDDEN, "Set the program name"},
|
||||||
|
{"HANG", OPT_HANG, "SECS", OPTION_ARG_OPTIONAL | OPTION_HIDDEN,
|
||||||
|
"Hang for SECS seconds (default 3600)"},
|
||||||
|
{0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
static error_t
|
||||||
|
argp_default_parser (int key, char *arg, struct argp_state *state)
|
||||||
|
{
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case '?':
|
||||||
|
__argp_state_help (state, state->out_stream, ARGP_HELP_STD_HELP);
|
||||||
|
break;
|
||||||
|
case OPT_USAGE:
|
||||||
|
__argp_state_help (state, state->out_stream,
|
||||||
|
ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OPT_PROGNAME: /* Set the program name. */
|
||||||
|
program_invocation_name = arg;
|
||||||
|
|
||||||
|
/* [Note that some systems only have PROGRAM_INVOCATION_SHORT_NAME (aka
|
||||||
|
__PROGNAME), in which case, PROGRAM_INVOCATION_NAME is just defined
|
||||||
|
to be that, so we have to be a bit careful here.] */
|
||||||
|
arg = strrchr (arg, '/');
|
||||||
|
if (arg)
|
||||||
|
program_invocation_short_name = arg + 1;
|
||||||
|
else
|
||||||
|
program_invocation_short_name = program_invocation_name;
|
||||||
|
|
||||||
|
if ((state->flags & (ARGP_PARSE_ARGV0 | ARGP_NO_ERRS))
|
||||||
|
== ARGP_PARSE_ARGV0)
|
||||||
|
state->argv[0] = program_invocation_name; /* Update what getopt uses too. */
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OPT_HANG:
|
||||||
|
_argp_hang = atoi (arg ? arg : "3600");
|
||||||
|
while (_argp_hang-- > 0)
|
||||||
|
__sleep (1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return EBADKEY;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct argp argp_default_argp =
|
||||||
|
{argp_default_options, &argp_default_parser};
|
||||||
|
|
||||||
|
|
||||||
|
static const struct argp_option argp_version_options[] =
|
||||||
|
{
|
||||||
|
{"version", 'V', 0, 0, "Print program version", -1},
|
||||||
|
{0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
static error_t
|
||||||
|
argp_version_parser (int key, char *arg, struct argp_state *state)
|
||||||
|
{
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case 'V':
|
||||||
|
if (argp_program_version_hook)
|
||||||
|
(*argp_program_version_hook) (state->out_stream, state);
|
||||||
|
else if (argp_program_version)
|
||||||
|
fprintf (state->out_stream, "%s\n", argp_program_version);
|
||||||
|
else
|
||||||
|
__argp_error (state, _("No version known!?"));
|
||||||
|
if (! (state->flags & ARGP_NO_EXIT))
|
||||||
|
exit (0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return EBADKEY;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct argp argp_version_argp =
|
||||||
|
{argp_version_options, &argp_version_parser};
|
||||||
|
|
||||||
|
/* Returns the offset into the getopt long options array LONG_OPTIONS of a
|
||||||
|
long option with called NAME, or -1 if none is found. Passing NULL as
|
||||||
|
NAME will return the number of options. */
|
||||||
|
static int
|
||||||
|
find_long_option (struct option *long_options, const char *name)
|
||||||
|
{
|
||||||
|
struct option *l = long_options;
|
||||||
|
while (l->name != NULL)
|
||||||
|
if (name != NULL && strcmp (l->name, name) == 0)
|
||||||
|
return l - long_options;
|
||||||
|
else
|
||||||
|
l++;
|
||||||
|
if (name == NULL)
|
||||||
|
return l - long_options;
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If we can, we regulate access to getopt, which is non-reentrant, with a
|
||||||
|
mutex. Since the case we're trying to guard against is two different
|
||||||
|
threads interfering, and it's possible that someone might want to call
|
||||||
|
argp_parse recursively (they're careful), we use a recursive lock if
|
||||||
|
possible. */
|
||||||
|
|
||||||
|
#if _LIBC - 0
|
||||||
|
|
||||||
|
__libc_lock_define_initialized_recursive (static, getopt_lock)
|
||||||
|
#define LOCK_GETOPT __libc_lock_lock_recursive (getopt_lock)
|
||||||
|
#define UNLOCK_GETOPT __libc_lock_unlock_recursive (getopt_lock)
|
||||||
|
|
||||||
|
#else /* !_LIBC */
|
||||||
|
#ifdef HAVE_CTHREADS_H
|
||||||
|
|
||||||
|
static struct mutex getopt_lock = MUTEX_INITIALIZER;
|
||||||
|
#define LOCK_GETOPT mutex_lock (&getopt_lock)
|
||||||
|
#define UNLOCK_GETOPT mutex_unlock (&getopt_lock)
|
||||||
|
|
||||||
|
#else /* !HAVE_CTHREADS_H */
|
||||||
|
|
||||||
|
#define LOCK_GETOPT (void)0
|
||||||
|
#define UNLOCK_GETOPT (void)0
|
||||||
|
|
||||||
|
#endif /* HAVE_CTHREADS_H */
|
||||||
|
#endif /* _LIBC */
|
||||||
|
|
||||||
|
/* This hack to allow programs that know what's going on to call argp
|
||||||
|
recursively. If someday argp is changed not to use the non-reentrant
|
||||||
|
getopt interface, we can get rid of this shit. XXX */
|
||||||
|
void
|
||||||
|
_argp_unlock_xxx (void)
|
||||||
|
{
|
||||||
|
UNLOCK_GETOPT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The state of a `group' during parsing. Each group corresponds to a
|
||||||
|
particular argp structure from the tree of such descending from the top
|
||||||
|
level argp passed to argp_parse. */
|
||||||
|
struct group
|
||||||
|
{
|
||||||
|
/* This group's parsing function. */
|
||||||
|
argp_parser_t parser;
|
||||||
|
|
||||||
|
/* Points to the point in SHORT_OPTS corresponding to the end of the short
|
||||||
|
options for this group. We use it to determine from which group a
|
||||||
|
particular short options is from. */
|
||||||
|
char *short_end;
|
||||||
|
|
||||||
|
/* The number of non-option args sucessfully handled by this parser. */
|
||||||
|
unsigned args_processed;
|
||||||
|
|
||||||
|
/* This group's parser's parent's group. */
|
||||||
|
struct group *parent;
|
||||||
|
unsigned parent_index; /* And the our position in the parent. */
|
||||||
|
|
||||||
|
/* These fields are swapped into and out of the state structure when
|
||||||
|
calling this group's parser. */
|
||||||
|
void *input, **child_inputs;
|
||||||
|
void *hook;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Call GROUP's parser with KEY and ARG, swapping any group-specific info
|
||||||
|
from STATE before calling, and back into state afterwards. If GROUP has
|
||||||
|
no parser, EBADKEY is returned. */
|
||||||
|
static error_t
|
||||||
|
group_parse (struct group *group, struct argp_state *state, int key, char *arg)
|
||||||
|
{
|
||||||
|
if (group->parser)
|
||||||
|
{
|
||||||
|
error_t err;
|
||||||
|
state->hook = group->hook;
|
||||||
|
state->input = group->input;
|
||||||
|
state->child_inputs = group->child_inputs;
|
||||||
|
state->arg_num = group->args_processed;
|
||||||
|
err = (*group->parser)(key, arg, state);
|
||||||
|
group->hook = state->hook;
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return EBADKEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct parser
|
||||||
|
{
|
||||||
|
const struct argp *argp;
|
||||||
|
|
||||||
|
/* SHORT_OPTS is the getopt short options string for the union of all the
|
||||||
|
groups of options. */
|
||||||
|
char *short_opts;
|
||||||
|
/* LONG_OPTS is the array of getop long option structures for the union of
|
||||||
|
all the groups of options. */
|
||||||
|
struct option *long_opts;
|
||||||
|
|
||||||
|
/* States of the various parsing groups. */
|
||||||
|
struct group *groups;
|
||||||
|
/* The end of the GROUPS array. */
|
||||||
|
struct group *egroup;
|
||||||
|
/* An vector containing storage for the CHILD_INPUTS field in all groups. */
|
||||||
|
void **child_inputs;
|
||||||
|
|
||||||
|
/* True if we think using getopt is still useful; if false, then
|
||||||
|
remaining arguments are just passed verbatim with ARGP_KEY_ARG. This is
|
||||||
|
cleared whenever getopt returns KEY_END, but may be set again if the user
|
||||||
|
moves the next argument pointer backwards. */
|
||||||
|
int try_getopt;
|
||||||
|
|
||||||
|
/* State block supplied to parsing routines. */
|
||||||
|
struct argp_state state;
|
||||||
|
|
||||||
|
/* Memory used by this parser. */
|
||||||
|
void *storage;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The next usable entries in the various parser tables being filled in by
|
||||||
|
convert_options. */
|
||||||
|
struct parser_convert_state
|
||||||
|
{
|
||||||
|
struct parser *parser;
|
||||||
|
char *short_end;
|
||||||
|
struct option *long_end;
|
||||||
|
void **child_inputs_end;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Converts all options in ARGP (which is put in GROUP) and ancestors
|
||||||
|
into getopt options stored in SHORT_OPTS and LONG_OPTS; SHORT_END and
|
||||||
|
CVT->LONG_END are the points at which new options are added. Returns the
|
||||||
|
next unused group entry. CVT holds state used during the conversion. */
|
||||||
|
static struct group *
|
||||||
|
convert_options (const struct argp *argp,
|
||||||
|
struct group *parent, unsigned parent_index,
|
||||||
|
struct group *group, struct parser_convert_state *cvt)
|
||||||
|
{
|
||||||
|
/* REAL is the most recent non-alias value of OPT. */
|
||||||
|
const struct argp_option *real = argp->options;
|
||||||
|
const struct argp_child *children = argp->children;
|
||||||
|
|
||||||
|
if (real || argp->parser)
|
||||||
|
{
|
||||||
|
const struct argp_option *opt;
|
||||||
|
|
||||||
|
if (real)
|
||||||
|
for (opt = real; !__option_is_end (opt); opt++)
|
||||||
|
{
|
||||||
|
if (! (opt->flags & OPTION_ALIAS))
|
||||||
|
/* OPT isn't an alias, so we can use values from it. */
|
||||||
|
real = opt;
|
||||||
|
|
||||||
|
if (! (real->flags & OPTION_DOC))
|
||||||
|
/* A real option (not just documentation). */
|
||||||
|
{
|
||||||
|
if (__option_is_short (opt))
|
||||||
|
/* OPT can be used as a short option. */
|
||||||
|
{
|
||||||
|
*cvt->short_end++ = opt->key;
|
||||||
|
if (real->arg)
|
||||||
|
{
|
||||||
|
*cvt->short_end++ = ':';
|
||||||
|
if (real->flags & OPTION_ARG_OPTIONAL)
|
||||||
|
*cvt->short_end++ = ':';
|
||||||
|
}
|
||||||
|
*cvt->short_end = '\0'; /* keep 0 terminated */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opt->name
|
||||||
|
&& find_long_option (cvt->parser->long_opts, opt->name) < 0)
|
||||||
|
/* OPT can be used as a long option. */
|
||||||
|
{
|
||||||
|
cvt->long_end->name = opt->name;
|
||||||
|
cvt->long_end->has_arg =
|
||||||
|
(real->arg
|
||||||
|
? (real->flags & OPTION_ARG_OPTIONAL
|
||||||
|
? optional_argument
|
||||||
|
: required_argument)
|
||||||
|
: no_argument);
|
||||||
|
cvt->long_end->flag = 0;
|
||||||
|
/* we add a disambiguating code to all the user's
|
||||||
|
values (which is removed before we actually call
|
||||||
|
the function to parse the value); this means that
|
||||||
|
the user loses use of the high 8 bits in all his
|
||||||
|
values (the sign of the lower bits is preserved
|
||||||
|
however)... */
|
||||||
|
cvt->long_end->val =
|
||||||
|
((opt->key | real->key) & USER_MASK)
|
||||||
|
+ (((group - cvt->parser->groups) + 1) << USER_BITS);
|
||||||
|
|
||||||
|
/* Keep the LONG_OPTS list terminated. */
|
||||||
|
(++cvt->long_end)->name = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
group->parser = argp->parser;
|
||||||
|
group->short_end = cvt->short_end;
|
||||||
|
group->args_processed = 0;
|
||||||
|
group->parent = parent;
|
||||||
|
group->parent_index = parent_index;
|
||||||
|
group->input = 0;
|
||||||
|
group->hook = 0;
|
||||||
|
group->child_inputs = 0;
|
||||||
|
|
||||||
|
if (children)
|
||||||
|
/* Assign GROUP's CHILD_INPUTS field some space from
|
||||||
|
CVT->child_inputs_end.*/
|
||||||
|
{
|
||||||
|
unsigned num_children = 0;
|
||||||
|
while (children[num_children].argp)
|
||||||
|
num_children++;
|
||||||
|
group->child_inputs = cvt->child_inputs_end;
|
||||||
|
cvt->child_inputs_end += num_children;
|
||||||
|
}
|
||||||
|
|
||||||
|
parent = group++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
parent = 0;
|
||||||
|
|
||||||
|
if (children)
|
||||||
|
{
|
||||||
|
unsigned index = 0;
|
||||||
|
while (children->argp)
|
||||||
|
group =
|
||||||
|
convert_options (children++->argp, parent, index++, group, cvt);
|
||||||
|
}
|
||||||
|
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find the merged set of getopt options, with keys appropiately prefixed. */
|
||||||
|
static void
|
||||||
|
parser_convert (struct parser *parser, const struct argp *argp, int flags)
|
||||||
|
{
|
||||||
|
struct parser_convert_state cvt;
|
||||||
|
|
||||||
|
cvt.parser = parser;
|
||||||
|
cvt.short_end = parser->short_opts;
|
||||||
|
cvt.long_end = parser->long_opts;
|
||||||
|
cvt.child_inputs_end = parser->child_inputs;
|
||||||
|
|
||||||
|
if (flags & ARGP_IN_ORDER)
|
||||||
|
*cvt.short_end++ = '-';
|
||||||
|
else if (flags & ARGP_NO_ARGS)
|
||||||
|
*cvt.short_end++ = '+';
|
||||||
|
*cvt.short_end = '\0';
|
||||||
|
|
||||||
|
cvt.long_end->name = NULL;
|
||||||
|
|
||||||
|
parser->argp = argp;
|
||||||
|
|
||||||
|
if (argp)
|
||||||
|
parser->egroup = convert_options (argp, 0, 0, parser->groups, &cvt);
|
||||||
|
else
|
||||||
|
parser->egroup = parser->groups; /* No parsers at all! */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lengths of various parser fields which we will allocated. */
|
||||||
|
struct parser_sizes
|
||||||
|
{
|
||||||
|
size_t short_len; /* Getopt short options string. */
|
||||||
|
size_t long_len; /* Getopt long options vector. */
|
||||||
|
size_t num_groups; /* Group structures we allocate. */
|
||||||
|
size_t num_child_inputs; /* Child input slots. */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* For ARGP, increments the NUM_GROUPS field in SZS by the total number of
|
||||||
|
argp structures descended from it, and the SHORT_LEN & LONG_LEN fields by
|
||||||
|
the maximum lengths of the resulting merged getopt short options string and
|
||||||
|
long-options array, respectively. */
|
||||||
|
static void
|
||||||
|
calc_sizes (const struct argp *argp, struct parser_sizes *szs)
|
||||||
|
{
|
||||||
|
const struct argp_child *child = argp->children;
|
||||||
|
const struct argp_option *opt = argp->options;
|
||||||
|
|
||||||
|
if (opt || argp->parser)
|
||||||
|
{
|
||||||
|
szs->num_groups++;
|
||||||
|
if (opt)
|
||||||
|
{
|
||||||
|
int num_opts = 0;
|
||||||
|
while (!__option_is_end (opt++))
|
||||||
|
num_opts++;
|
||||||
|
szs->short_len += num_opts * 3; /* opt + up to 2 `:'s */
|
||||||
|
szs->long_len += num_opts;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (child)
|
||||||
|
while (child->argp)
|
||||||
|
{
|
||||||
|
calc_sizes ((child++)->argp, szs);
|
||||||
|
szs->num_child_inputs++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initializes PARSER to parse ARGP in a manner described by FLAGS. */
|
||||||
|
static error_t
|
||||||
|
parser_init (struct parser *parser, const struct argp *argp,
|
||||||
|
int argc, char **argv, int flags, void *input)
|
||||||
|
{
|
||||||
|
error_t err = 0;
|
||||||
|
struct group *group;
|
||||||
|
struct parser_sizes szs;
|
||||||
|
|
||||||
|
szs.short_len = (flags & ARGP_NO_ARGS) ? 0 : 1;
|
||||||
|
szs.long_len = 0;
|
||||||
|
szs.num_groups = 0;
|
||||||
|
szs.num_child_inputs = 0;
|
||||||
|
|
||||||
|
if (argp)
|
||||||
|
calc_sizes (argp, &szs);
|
||||||
|
|
||||||
|
/* Lengths of the various bits of storage used by PARSER. */
|
||||||
|
#define GLEN (szs.num_groups + 1) * sizeof (struct group)
|
||||||
|
#define CLEN (szs.num_child_inputs * sizeof (void *))
|
||||||
|
#define LLEN ((szs.long_len + 1) * sizeof (struct option))
|
||||||
|
#define SLEN (szs.short_len + 1)
|
||||||
|
|
||||||
|
parser->storage = malloc (GLEN + CLEN + LLEN + SLEN);
|
||||||
|
if (! parser->storage)
|
||||||
|
return ENOMEM;
|
||||||
|
|
||||||
|
parser->groups = parser->storage;
|
||||||
|
parser->child_inputs = parser->storage + GLEN;
|
||||||
|
parser->long_opts = parser->storage + GLEN + CLEN;
|
||||||
|
parser->short_opts = parser->storage + GLEN + CLEN + LLEN;
|
||||||
|
|
||||||
|
memset (parser->child_inputs, 0, szs.num_child_inputs * sizeof (void *));
|
||||||
|
parser_convert (parser, argp, flags);
|
||||||
|
|
||||||
|
parser->try_getopt = 1;
|
||||||
|
|
||||||
|
memset (&parser->state, 0, sizeof (struct argp_state));
|
||||||
|
parser->state.argp = parser->argp;
|
||||||
|
parser->state.argc = argc;
|
||||||
|
parser->state.argv = argv;
|
||||||
|
parser->state.err_stream = stderr;
|
||||||
|
parser->state.out_stream = stdout;
|
||||||
|
parser->state.next = 0; /* Tell getopt to initialize. */
|
||||||
|
|
||||||
|
/* Call each parser for the first time, giving it a chance to propagate
|
||||||
|
values to child parsers. */
|
||||||
|
if (parser->groups < parser->egroup)
|
||||||
|
parser->groups->input = input;
|
||||||
|
for (group = parser->groups;
|
||||||
|
group < parser->egroup && (!err || err == EBADKEY);
|
||||||
|
group++)
|
||||||
|
{
|
||||||
|
if (group->parent)
|
||||||
|
/* If a child parser, get the initial input value from the parent. */
|
||||||
|
group->input = group->parent->child_inputs[group->parent_index];
|
||||||
|
err = group_parse (group, &parser->state, ARGP_KEY_INIT, 0);
|
||||||
|
}
|
||||||
|
if (err == EBADKEY)
|
||||||
|
err = 0; /* Some parser didn't understand. */
|
||||||
|
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
if (parser->state.argv == argv && argv[0])
|
||||||
|
/* There's an argv[0]; use it for messages. */
|
||||||
|
parser->state.name = argv[0];
|
||||||
|
else
|
||||||
|
parser->state.name = program_invocation_name;
|
||||||
|
|
||||||
|
/* Getopt is (currently) non-reentrant. */
|
||||||
|
LOCK_GETOPT;
|
||||||
|
|
||||||
|
if (parser->state.flags & ARGP_NO_ERRS)
|
||||||
|
{
|
||||||
|
opterr = 0;
|
||||||
|
if (parser->state.flags & ARGP_PARSE_ARGV0)
|
||||||
|
/* getopt always skips ARGV[0], so we have to fake it out. As long
|
||||||
|
as OPTERR is 0, then it shouldn't actually try to access it. */
|
||||||
|
parser->state.argv--, parser->state.argc++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
opterr = 1; /* Print error messages. */
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Free any storage consumed by PARSER (but not PARSER itself). */
|
||||||
|
static error_t
|
||||||
|
parser_finalize (struct parser *parser,
|
||||||
|
error_t err, int arg_ebadkey, int *end_index)
|
||||||
|
{
|
||||||
|
struct group *group;
|
||||||
|
|
||||||
|
UNLOCK_GETOPT;
|
||||||
|
|
||||||
|
if (err == EBADKEY && arg_ebadkey)
|
||||||
|
/* Suppress errors generated by unparsed arguments. */
|
||||||
|
err = 0;
|
||||||
|
|
||||||
|
if (! err)
|
||||||
|
if (parser->state.next == parser->state.argc)
|
||||||
|
/* We successfully parsed all arguments! Call all the parsers again,
|
||||||
|
just a few more times... */
|
||||||
|
{
|
||||||
|
for (group = parser->groups;
|
||||||
|
group < parser->egroup && (!err || err==EBADKEY);
|
||||||
|
group++)
|
||||||
|
if (group->args_processed == 0)
|
||||||
|
err = group_parse (group, &parser->state, ARGP_KEY_NO_ARGS, 0);
|
||||||
|
for (group = parser->groups;
|
||||||
|
group < parser->egroup && (!err || err==EBADKEY);
|
||||||
|
group++)
|
||||||
|
err = group_parse (group, &parser->state, ARGP_KEY_END, 0);
|
||||||
|
|
||||||
|
if (err == EBADKEY)
|
||||||
|
err = 0; /* Some parser didn't understand. */
|
||||||
|
}
|
||||||
|
else if (end_index)
|
||||||
|
/* Return any remaining arguments to the user. */
|
||||||
|
*end_index = parser->state.next;
|
||||||
|
else
|
||||||
|
/* No way to return the remaining arguments, they must be bogus. */
|
||||||
|
{
|
||||||
|
if (!(parser->state.flags & ARGP_NO_ERRS) && parser->state.err_stream)
|
||||||
|
fprintf (parser->state.err_stream,
|
||||||
|
_("%s: Too many arguments\n"), parser->state.name);
|
||||||
|
err = EBADKEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Okay, we're all done, with either an error or success. We only call the
|
||||||
|
parsers once more, to indicate which one. */
|
||||||
|
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
/* Maybe print an error message. */
|
||||||
|
if (err == EBADKEY)
|
||||||
|
/* An appropriate message describing what the error was should have
|
||||||
|
been printed earlier. */
|
||||||
|
__argp_state_help (&parser->state, parser->state.err_stream,
|
||||||
|
ARGP_HELP_STD_ERR);
|
||||||
|
|
||||||
|
/* Since we didn't exit, give each parser an error indication. */
|
||||||
|
for (group = parser->groups; group < parser->egroup; group++)
|
||||||
|
group_parse (group, &parser->state, ARGP_KEY_ERROR, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* Do final cleanup, including propagating back values from parsers. */
|
||||||
|
{
|
||||||
|
/* We pass over the groups in reverse order so that child groups are
|
||||||
|
given a chance to do there processing before passing back a value to
|
||||||
|
the parent. */
|
||||||
|
for (group = parser->egroup - 1
|
||||||
|
; group >= parser->groups && (!err || err == EBADKEY)
|
||||||
|
; group--)
|
||||||
|
err = group_parse (group, &parser->state, ARGP_KEY_SUCCESS, 0);
|
||||||
|
if (err == EBADKEY)
|
||||||
|
err = 0; /* Some parser didn't understand. */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err == EBADKEY)
|
||||||
|
err = EINVAL;
|
||||||
|
|
||||||
|
free (parser->storage);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Call the user parsers to parse the non-option argument VAL, at the current
|
||||||
|
position, returning any error. */
|
||||||
|
static error_t
|
||||||
|
parser_parse_arg (struct parser *parser, char *val)
|
||||||
|
{
|
||||||
|
int index = parser->state.next;
|
||||||
|
error_t err = EBADKEY;
|
||||||
|
struct group *group;
|
||||||
|
|
||||||
|
for (group = parser->groups
|
||||||
|
; group < parser->egroup && err == EBADKEY
|
||||||
|
; group++)
|
||||||
|
err = group_parse (group, &parser->state, ARGP_KEY_ARG, val);
|
||||||
|
|
||||||
|
if (!err)
|
||||||
|
if (parser->state.next >= index)
|
||||||
|
/* Remember that we successfully processed a non-option
|
||||||
|
argument -- but only if the user hasn't gotten tricky and set
|
||||||
|
the clock back. */
|
||||||
|
(--group)->args_processed++;
|
||||||
|
else
|
||||||
|
/* The user wants to reparse some args, give getopt another try. */
|
||||||
|
parser->try_getopt = 1;
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Call the user parsers to parse the option OPT, with argument VAL, at the
|
||||||
|
current position, returning any error. */
|
||||||
|
static error_t
|
||||||
|
parser_parse_opt (struct parser *parser, int opt, char *val)
|
||||||
|
{
|
||||||
|
/* The group key encoded in the high bits; 0 for short opts or
|
||||||
|
group_number + 1 for long opts. */
|
||||||
|
int group_key = opt >> USER_BITS;
|
||||||
|
|
||||||
|
if (group_key == 0)
|
||||||
|
/* A short option. By comparing OPT's position in SHORT_OPTS to the
|
||||||
|
various starting positions in each group's SHORT_END field, we can
|
||||||
|
determine which group OPT came from. */
|
||||||
|
{
|
||||||
|
struct group *group;
|
||||||
|
char *short_index = strchr (parser->short_opts, opt);
|
||||||
|
|
||||||
|
if (short_index)
|
||||||
|
for (group = parser->groups; group < parser->egroup; group++)
|
||||||
|
if (group->short_end > short_index)
|
||||||
|
return group_parse (group, &parser->state, opt, optarg);
|
||||||
|
|
||||||
|
return EBADKEY; /* until otherwise asserted */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* A long option. We use shifts instead of masking for extracting
|
||||||
|
the user value in order to preserve the sign. */
|
||||||
|
return
|
||||||
|
group_parse (&parser->groups[group_key - 1], &parser->state,
|
||||||
|
(opt << GROUP_BITS) >> GROUP_BITS, optarg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Parse the next argument in PARSER (as indicated by PARSER->state.next).
|
||||||
|
Any error from the parsers is returned, and *ARGP_EBADKEY indicates
|
||||||
|
whether a value of EBADKEY is due to an unrecognized argument (which is
|
||||||
|
generally not fatal). */
|
||||||
|
static error_t
|
||||||
|
parser_parse_next (struct parser *parser, int *arg_ebadkey)
|
||||||
|
{
|
||||||
|
int opt;
|
||||||
|
error_t err = 0;
|
||||||
|
|
||||||
|
if (parser->state.quoted && parser->state.next < parser->state.quoted)
|
||||||
|
/* The next argument pointer has been moved to before the quoted
|
||||||
|
region, so pretend we never saw the quoting `--', and give getopt
|
||||||
|
another chance. If the user hasn't removed it, getopt will just
|
||||||
|
process it again. */
|
||||||
|
parser->state.quoted = 0;
|
||||||
|
|
||||||
|
if (parser->try_getopt && !parser->state.quoted)
|
||||||
|
/* Give getopt a chance to parse this. */
|
||||||
|
{
|
||||||
|
optind = parser->state.next; /* Put it back in OPTIND for getopt. */
|
||||||
|
optopt = KEY_END; /* Distinguish KEY_ERR from a real option. */
|
||||||
|
if (parser->state.flags & ARGP_LONG_ONLY)
|
||||||
|
opt = getopt_long_only (parser->state.argc, parser->state.argv,
|
||||||
|
parser->short_opts, parser->long_opts, 0);
|
||||||
|
else
|
||||||
|
opt = getopt_long (parser->state.argc, parser->state.argv,
|
||||||
|
parser->short_opts, parser->long_opts, 0);
|
||||||
|
parser->state.next = optind; /* And see what getopt did. */
|
||||||
|
|
||||||
|
if (opt == KEY_END)
|
||||||
|
/* Getopt says there are no more options, so stop using
|
||||||
|
getopt; we'll continue if necessary on our own. */
|
||||||
|
{
|
||||||
|
parser->try_getopt = 0;
|
||||||
|
if (parser->state.next > 1
|
||||||
|
&& strcmp (parser->state.argv[parser->state.next - 1], QUOTE)
|
||||||
|
== 0)
|
||||||
|
/* Not only is this the end of the options, but it's a
|
||||||
|
`quoted' region, which may have args that *look* like
|
||||||
|
options, so we definitely shouldn't try to use getopt past
|
||||||
|
here, whatever happens. */
|
||||||
|
parser->state.quoted = parser->state.next;
|
||||||
|
}
|
||||||
|
else if (opt == KEY_ERR && optopt != KEY_END)
|
||||||
|
/* KEY_ERR can have the same value as a valid user short
|
||||||
|
option, but in the case of a real error, getopt sets OPTOPT
|
||||||
|
to the offending character, which can never be KEY_END. */
|
||||||
|
{
|
||||||
|
*arg_ebadkey = 0;
|
||||||
|
return EBADKEY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
opt = KEY_END;
|
||||||
|
|
||||||
|
if (opt == KEY_END)
|
||||||
|
/* We're past what getopt considers the options. */
|
||||||
|
if (parser->state.next >= parser->state.argc
|
||||||
|
|| (parser->state.flags & ARGP_NO_ARGS))
|
||||||
|
/* Indicate that we're done. */
|
||||||
|
{
|
||||||
|
*arg_ebadkey = 1;
|
||||||
|
return EBADKEY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* A non-option arg. */
|
||||||
|
err =
|
||||||
|
parser_parse_arg (parser, parser->state.argv[parser->state.next++]);
|
||||||
|
else if (opt == KEY_ARG)
|
||||||
|
/* A non-option argument; try each parser in turn. */
|
||||||
|
err = parser_parse_arg (parser, optarg);
|
||||||
|
else
|
||||||
|
err = parser_parse_opt (parser, opt, optarg);
|
||||||
|
|
||||||
|
if (err == EBADKEY)
|
||||||
|
{
|
||||||
|
*arg_ebadkey = (opt == KEY_END || opt == KEY_ARG);
|
||||||
|
parser->state.next--; /* Put back the unused argument. */
|
||||||
|
}
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Parse the options strings in ARGC & ARGV according to the argp in ARGP.
|
||||||
|
FLAGS is one of the ARGP_ flags above. If END_INDEX is non-NULL, the
|
||||||
|
index in ARGV of the first unparsed option is returned in it. If an
|
||||||
|
unknown option is present, EINVAL is returned; if some parser routine
|
||||||
|
returned a non-zero value, it is returned; otherwise 0 is returned. */
|
||||||
|
error_t
|
||||||
|
__argp_parse (const struct argp *argp, int argc, char **argv, unsigned flags,
|
||||||
|
int *end_index, void *input)
|
||||||
|
{
|
||||||
|
error_t err;
|
||||||
|
struct parser parser;
|
||||||
|
|
||||||
|
/* If true, then err == EBADKEY is a result of a non-option argument failing
|
||||||
|
to be parsed (which in some cases isn't actually an error). */
|
||||||
|
int arg_ebadkey = 0;
|
||||||
|
|
||||||
|
if (! (flags & ARGP_NO_HELP))
|
||||||
|
/* Add our own options. */
|
||||||
|
{
|
||||||
|
struct argp_child *child = alloca (4 * sizeof (struct argp_child));
|
||||||
|
struct argp *top_argp = alloca (sizeof (struct argp));
|
||||||
|
|
||||||
|
/* TOP_ARGP has no options, it just serves to group the user & default
|
||||||
|
argps. */
|
||||||
|
memset (top_argp, 0, sizeof (*top_argp));
|
||||||
|
top_argp->children = child;
|
||||||
|
|
||||||
|
memset (child, 0, 4 * sizeof (struct argp_child));
|
||||||
|
|
||||||
|
if (argp)
|
||||||
|
(child++)->argp = argp;
|
||||||
|
(child++)->argp = &argp_default_argp;
|
||||||
|
if (argp_program_version || argp_program_version_hook)
|
||||||
|
(child++)->argp = &argp_version_argp;
|
||||||
|
child->argp = 0;
|
||||||
|
|
||||||
|
argp = top_argp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Construct a parser for these arguments. */
|
||||||
|
err = parser_init (&parser, argp, argc, argv, flags, input);
|
||||||
|
|
||||||
|
if (! err)
|
||||||
|
/* Parse! */
|
||||||
|
{
|
||||||
|
while (! err)
|
||||||
|
err = parser_parse_next (&parser, &arg_ebadkey);
|
||||||
|
err = parser_finalize (&parser, err, arg_ebadkey, end_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
#ifdef weak_alias
|
||||||
|
weak_alias (__argp_parse, argp_parse)
|
||||||
|
#endif
|
25
argp/argp-pv.c
Normal file
25
argp/argp-pv.c
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/* Default definition for ARGP_PROGRAM_VERSION.
|
||||||
|
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
/* If set by the user program to a non-zero value, then a default option
|
||||||
|
--version is added (unless the ARGP_NO_HELP flag is used), which will
|
||||||
|
print this this string followed by a newline and exit (unless the
|
||||||
|
ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */
|
||||||
|
char *argp_program_version = 0;
|
32
argp/argp-pvh.c
Normal file
32
argp/argp-pvh.c
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/* Default definition for ARGP_PROGRAM_VERSION_HOOK.
|
||||||
|
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "argp.h"
|
||||||
|
|
||||||
|
/* If set by the user program to a non-zero value, then a default option
|
||||||
|
--version is added (unless the ARGP_NO_HELP flag is used), which calls
|
||||||
|
this function with a stream to print the version to and a pointer to the
|
||||||
|
current parsing state, and then exits (unless the ARGP_NO_EXIT flag is
|
||||||
|
used). This variable takes precedent over ARGP_PROGRAM_VERSION. */
|
||||||
|
void (*argp_program_version_hook) (FILE *stream, struct argp_state *state) = 0;
|
147
argp/argp-test.c
Normal file
147
argp/argp-test.c
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
/* Test program for argp argument parser
|
||||||
|
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <argp.h>
|
||||||
|
|
||||||
|
char *argp_program_version = "argp-test 1.0";
|
||||||
|
|
||||||
|
struct argp_option sub_options[] =
|
||||||
|
{
|
||||||
|
{"subopt1", 's', 0, 0, "Nested option 1"},
|
||||||
|
{"subopt2", 'S', 0, 0, "Nested option 2"},
|
||||||
|
|
||||||
|
{ 0, 0, 0, 0, "Some more nested options:", 10},
|
||||||
|
{"subopt3", 'p', 0, 0, "Nested option 3"},
|
||||||
|
|
||||||
|
{"subopt4", 'q', 0, 0, "Nested option 4", 1},
|
||||||
|
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char sub_args_doc[] = "STRING...\n-";
|
||||||
|
static const char sub_doc[] = "\vThis is the doc string from the sub-arg-parser.";
|
||||||
|
|
||||||
|
static error_t
|
||||||
|
sub_parse_opt (int key, char *arg, struct argp_state *state)
|
||||||
|
{
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case ARGP_KEY_NO_ARGS:
|
||||||
|
printf ("NO SUB ARGS\n");
|
||||||
|
break;
|
||||||
|
case ARGP_KEY_ARG:
|
||||||
|
printf ("SUB ARG: %s\n", arg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 's' : case 'S': case 'p': case 'q':
|
||||||
|
printf ("SUB KEY %c\n", key);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return ARGP_ERR_UNKNOWN;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct argp sub_argp = {
|
||||||
|
sub_options, sub_parse_opt, sub_args_doc, sub_doc
|
||||||
|
};
|
||||||
|
|
||||||
|
#define OPT_PGRP 1
|
||||||
|
#define OPT_SESS 2
|
||||||
|
|
||||||
|
struct argp_option options[] =
|
||||||
|
{
|
||||||
|
{"pid", 'p', "PID", 0, "List the process PID"},
|
||||||
|
{"pgrp", OPT_PGRP,"PGRP",0, "List processes in the process group PGRP"},
|
||||||
|
{"no-parent", 'P', 0, 0, "Include processes without parents"},
|
||||||
|
{0, 'x', 0, OPTION_ALIAS},
|
||||||
|
{"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally"
|
||||||
|
" if there's some reason ps can't"
|
||||||
|
" print a field for any process, it's"
|
||||||
|
" removed from the output entirely)" },
|
||||||
|
{"reverse", 'r', 0, 0, "Reverse the order of any sort"},
|
||||||
|
{"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS},
|
||||||
|
{"session", OPT_SESS,"SID", OPTION_ARG_OPTIONAL,
|
||||||
|
"Add the processes from the session"
|
||||||
|
" SID (which defaults to the sid of"
|
||||||
|
" the current process)" },
|
||||||
|
|
||||||
|
{0,0,0,0, "Here are some more options:"},
|
||||||
|
{"foonly", 'f', "ZOT", 0, "Glork a foonly"},
|
||||||
|
{"zaza", 'z', 0, 0, "Snit a zar"},
|
||||||
|
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char args_doc[] = "STRING";
|
||||||
|
static const char doc[] = "Test program for argp."
|
||||||
|
"\vThis doc string comes after the options."
|
||||||
|
"\nHey! Some manual formatting!";
|
||||||
|
|
||||||
|
static error_t
|
||||||
|
parse_opt (int key, char *arg, struct argp_state *state)
|
||||||
|
{
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case ARGP_KEY_NO_ARGS:
|
||||||
|
printf ("NO ARGS\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ARGP_KEY_ARG:
|
||||||
|
if (state->arg_num > 0)
|
||||||
|
return ARGP_ERR_UNKNOWN; /* Leave it for the sub-arg parser. */
|
||||||
|
printf ("ARG: %s\n", arg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'p': case 'P': case OPT_PGRP: case 'x': case 'Q':
|
||||||
|
case 'r': case OPT_SESS: case 'f': case 'z':
|
||||||
|
{
|
||||||
|
char buf[10];
|
||||||
|
if (isprint (key))
|
||||||
|
sprintf (buf, "%c", key);
|
||||||
|
else
|
||||||
|
sprintf (buf, "%d", key);
|
||||||
|
if (arg)
|
||||||
|
printf ("KEY %s: %s\n", buf, arg);
|
||||||
|
else
|
||||||
|
printf ("KEY %s\n", buf);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return ARGP_ERR_UNKNOWN;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct argp_child argp_children[] = { { &sub_argp }, { 0 } };
|
||||||
|
static struct argp argp = { options, parse_opt, args_doc, doc, argp_children };
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
argp_parse (&argp, argc, argv, 0, 0, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
37
argp/argp-xinl.c
Normal file
37
argp/argp-xinl.c
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/* Real definitions for extern inline functions in argp.h
|
||||||
|
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ARGP_EI
|
||||||
|
#undef __OPTIMIZE__
|
||||||
|
#define __OPTIMIZE__
|
||||||
|
#include "argp.h"
|
||||||
|
|
||||||
|
/* Add weak aliases. */
|
||||||
|
#if _LIBC - 0 && defined (weak_alias)
|
||||||
|
|
||||||
|
weak_alias (__argp_usage, argp_usage)
|
||||||
|
weak_alias (__option_is_short, _option_is_short)
|
||||||
|
weak_alias (__option_is_end, _option_is_end)
|
||||||
|
|
||||||
|
#endif
|
488
argp/argp.h
Normal file
488
argp/argp.h
Normal file
@ -0,0 +1,488 @@
|
|||||||
|
/* Hierarchial argument parsing, layered over getopt.
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef __ARGP_H__
|
||||||
|
#define __ARGP_H__
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
|
||||||
|
#ifndef __const
|
||||||
|
#define __const const
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __P
|
||||||
|
# if (defined (__STDC__) && __STDC__) || defined (__cplusplus)
|
||||||
|
# define __P(args) args
|
||||||
|
# else
|
||||||
|
# define __P(args) ()
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* A description of a particular option. A pointer to an array of
|
||||||
|
these is passed in the OPTIONS field of an argp structure. Each option
|
||||||
|
entry can correspond to one long option and/or one short option; more
|
||||||
|
names for the same option can be added by following an entry in an option
|
||||||
|
array with options having the OPTION_ALIAS flag set. */
|
||||||
|
struct argp_option
|
||||||
|
{
|
||||||
|
/* The long option name. For more than one name for the same option, you
|
||||||
|
can use following options with the OPTION_ALIAS flag set. */
|
||||||
|
__const char *name;
|
||||||
|
|
||||||
|
/* What key is returned for this option. If > 0 and printable, then it's
|
||||||
|
also accepted as a short option. */
|
||||||
|
int key;
|
||||||
|
|
||||||
|
/* If non-NULL, this is the name of the argument associated with this
|
||||||
|
option, which is required unless the OPTION_ARG_OPTIONAL flag is set. */
|
||||||
|
__const char *arg;
|
||||||
|
|
||||||
|
/* OPTION_ flags. */
|
||||||
|
int flags;
|
||||||
|
|
||||||
|
/* The doc string for this option. If both NAME and KEY are 0, This string
|
||||||
|
will be printed outdented from the normal option column, making it
|
||||||
|
useful as a group header (it will be the first thing printed in its
|
||||||
|
group); in this usage, it's conventional to end the string with a `:'. */
|
||||||
|
__const char *doc;
|
||||||
|
|
||||||
|
/* The group this option is in. In a long help message, options are sorted
|
||||||
|
alphabetically within each group, and the groups presented in the order
|
||||||
|
0, 1, 2, ..., n, -m, ..., -2, -1. Every entry in an options array with
|
||||||
|
if this field 0 will inherit the group number of the previous entry, or
|
||||||
|
zero if it's the first one, unless its a group header (NAME and KEY both
|
||||||
|
0), in which case, the previous entry + 1 is the default. Automagic
|
||||||
|
options such as --help are put into group -1. */
|
||||||
|
int group;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The argument associated with this option is optional. */
|
||||||
|
#define OPTION_ARG_OPTIONAL 0x1
|
||||||
|
|
||||||
|
/* This option isn't displayed in any help messages. */
|
||||||
|
#define OPTION_HIDDEN 0x2
|
||||||
|
|
||||||
|
/* This option is an alias for the closest previous non-alias option. This
|
||||||
|
means that it will be displayed in the same help entry, and will inherit
|
||||||
|
fields other than NAME and KEY from the aliased option. */
|
||||||
|
#define OPTION_ALIAS 0x4
|
||||||
|
|
||||||
|
/* This option isn't actually an option (and so should be ignored by the
|
||||||
|
actual option parser), but rather an arbitrary piece of documentation that
|
||||||
|
should be displayed in much the same manner as the options. If this flag
|
||||||
|
is set, then the option NAME field is displayed unmodified (e.g., no `--'
|
||||||
|
prefix is added) at the left-margin (where a *short* option would normally
|
||||||
|
be displayed), and the documentation string in the normal place. For
|
||||||
|
purposes of sorting, any leading whitespace and puncuation is ignored,
|
||||||
|
except that if the first non-whitespace character is not `-', this entry
|
||||||
|
is displayed after all options (and OPTION_DOC entries with a leading `-')
|
||||||
|
in the same group. */
|
||||||
|
#define OPTION_DOC 0x8
|
||||||
|
|
||||||
|
struct argp; /* fwd declare this type */
|
||||||
|
struct argp_state; /* " */
|
||||||
|
struct argp_child; /* " */
|
||||||
|
|
||||||
|
/* The type of a pointer to an argp parsing function. */
|
||||||
|
typedef error_t (*argp_parser_t)(int key, char *arg, struct argp_state *state);
|
||||||
|
|
||||||
|
/* What to return for unrecognized keys. For special ARGP_KEY_ keys, such
|
||||||
|
returns will simply be ignored. For user keys, this error will be turned
|
||||||
|
into EINVAL (if the call to argp_parse is such that errors are propagated
|
||||||
|
back to the user instead of exiting); returning EINVAL itself would result
|
||||||
|
in an immediate stop to parsing in *all* cases. */
|
||||||
|
#define ARGP_ERR_UNKNOWN E2BIG /* Hurd should never need E2BIG. XXX */
|
||||||
|
|
||||||
|
/* Special values for the KEY argument to an argument parsing function.
|
||||||
|
ARGP_ERR_UNKNOWN should be returned if they aren't understood.
|
||||||
|
|
||||||
|
The sequence of keys to parser calls is either (where opt is a user key):
|
||||||
|
ARGP_KEY_INIT (opt | ARGP_KEY_ARG)... ARGP_KEY_END
|
||||||
|
or ARGP_KEY_INIT opt... ARGP_KEY_NO_ARGS ARGP_KEY_END
|
||||||
|
|
||||||
|
If an error occurs, then the parser is called with ARGP_KEY_ERR, and no
|
||||||
|
other calls are made. */
|
||||||
|
|
||||||
|
/* This is not an option at all, but rather a command line argument. If a
|
||||||
|
parser receiving this key returns success, the fact is recorded, and the
|
||||||
|
ARGP_KEY_NO_ARGS case won't be used. HOWEVER, if while processing the
|
||||||
|
argument, a parser function decrements the NEXT field of the state it's
|
||||||
|
passed, the option won't be considered processed; this is to allow you to
|
||||||
|
actually modify the argument (perhaps into an option), and have it
|
||||||
|
processed again. */
|
||||||
|
#define ARGP_KEY_ARG 0
|
||||||
|
/* There are no more command line arguments at all. */
|
||||||
|
#define ARGP_KEY_END 0x1000001
|
||||||
|
/* Because it's common to want to do some special processing if there aren't
|
||||||
|
any non-option args, user parsers are called with this key if they didn't
|
||||||
|
successfully process any non-option arguments. Called just before
|
||||||
|
ARGP_KEY_END (where more general validity checks on previously parsed
|
||||||
|
arguments can take place). */
|
||||||
|
#define ARGP_KEY_NO_ARGS 0x1000002
|
||||||
|
/* Passed in before any parsing is done. Afterwards, the values of each
|
||||||
|
element of the CHILD_INPUT field, if any, in the state structure is
|
||||||
|
copied to each child's state to be the initial value of the INPUT field. */
|
||||||
|
#define ARGP_KEY_INIT 0x1000003
|
||||||
|
/* Passed in when parsing has successfully been completed (even if there are
|
||||||
|
still arguments remaining). */
|
||||||
|
#define ARGP_KEY_SUCCESS 0x1000004
|
||||||
|
/* Passed in if an error occurs (in which case a call with ARGP_KEY_SUCCESS is
|
||||||
|
never made, so any cleanup must be done here). */
|
||||||
|
#define ARGP_KEY_ERROR 0x1000005
|
||||||
|
|
||||||
|
/* An argp structure contains a set of getopt options declarations, a
|
||||||
|
function to deal with getting one, and an optional pointer to another
|
||||||
|
argp structure. When actually parsing options, getopt is called with
|
||||||
|
the union of all the argp structures chained together through their
|
||||||
|
CHILD pointers, with conflicts being resolved in favor of the first
|
||||||
|
occurance in the chain. */
|
||||||
|
struct argp
|
||||||
|
{
|
||||||
|
/* An array of argp_option structures, terminated by an entry with both
|
||||||
|
NAME and KEY having a value of 0. */
|
||||||
|
__const struct argp_option *options;
|
||||||
|
|
||||||
|
/* What to do with an option from this structure. KEY is the key
|
||||||
|
associated with the option, and ARG is any associated argument (NULL if
|
||||||
|
none was supplied). If KEY isn't understood, ARGP_ERR_UNKNOWN should be
|
||||||
|
returned. If a non-zero, non-ARGP_ERR_UNKNOWN value is returned, then
|
||||||
|
parsing is stopped immediately, and that value is returned from
|
||||||
|
argp_parse(). For special (non-user-supplied) values of KEY, see the
|
||||||
|
ARGP_KEY_ definitions below. */
|
||||||
|
argp_parser_t parser;
|
||||||
|
|
||||||
|
/* A string describing what other arguments are wanted by this program. It
|
||||||
|
is only used by argp_usage to print the `Usage:' message. If it
|
||||||
|
contains newlines, the strings separated by them are considered
|
||||||
|
alternative usage patterns, and printed on separate lines (lines after
|
||||||
|
the first are prefix by ` or: ' instead of `Usage:'). */
|
||||||
|
__const char *args_doc;
|
||||||
|
|
||||||
|
/* If non-NULL, a string containing extra text to be printed before and
|
||||||
|
after the options in a long help message (separated by a vertical tab
|
||||||
|
`\v' character). */
|
||||||
|
__const char *doc;
|
||||||
|
|
||||||
|
/* A vector of argp_children structures, terminated by a member with a 0
|
||||||
|
argp field, pointing to child argps should be parsed with this one. Any
|
||||||
|
conflicts are resolved in favor of this argp, or early argps in the
|
||||||
|
CHILDREN list. This field is useful if you use libraries that supply
|
||||||
|
their own argp structure, which you want to use in conjunction with your
|
||||||
|
own. */
|
||||||
|
__const struct argp_child *children;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* When an argp has a non-zero CHILDREN field, it should point to a vector of
|
||||||
|
argp_child structures, each of which describes a subsidiary argp. */
|
||||||
|
struct argp_child
|
||||||
|
{
|
||||||
|
/* The child parser. */
|
||||||
|
__const struct argp *argp;
|
||||||
|
|
||||||
|
/* Flags for this child. */
|
||||||
|
int flags;
|
||||||
|
|
||||||
|
/* If non-zero, an optional header to be printed in help output before the
|
||||||
|
child options. As a side-effect, a non-zero value forces the child
|
||||||
|
options to be grouped together; to achieve this effect without actually
|
||||||
|
printing a header string, use a value of "". */
|
||||||
|
__const char *header;
|
||||||
|
|
||||||
|
/* Where to group the child options relative to the other (`consolidated')
|
||||||
|
options in the parent argp; the values are the same as the GROUP field
|
||||||
|
in argp_option structs, but all child-groupings follow parent options at
|
||||||
|
a particular group level. If both this field and HEADER are zero, then
|
||||||
|
they aren't grouped at all, but rather merged with the parent options
|
||||||
|
(merging the child's grouping levels with the parents). */
|
||||||
|
int group;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Parsing state. This is provided to parsing functions called by argp,
|
||||||
|
which may examine and, as noted, modify fields. */
|
||||||
|
struct argp_state
|
||||||
|
{
|
||||||
|
/* The top level ARGP being parsed. */
|
||||||
|
__const struct argp *argp;
|
||||||
|
|
||||||
|
/* The argument vector being parsed. May be modified. */
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
|
|
||||||
|
/* The index in ARGV of the next arg that to be parsed. May be modified. */
|
||||||
|
int next;
|
||||||
|
|
||||||
|
/* The flags supplied to argp_parse. May be modified. */
|
||||||
|
unsigned flags;
|
||||||
|
|
||||||
|
/* While calling a parsing function with a key of ARGP_KEY_ARG, this is the
|
||||||
|
number of the current arg, starting at zero, and incremented after each
|
||||||
|
such call returns. At all other times, this is the number of such
|
||||||
|
arguments that have been processed. */
|
||||||
|
unsigned arg_num;
|
||||||
|
|
||||||
|
/* If non-zero, the index in ARGV of the first argument following a special
|
||||||
|
`--' argument (which prevents anything following being interpreted as an
|
||||||
|
option). Only set once argument parsing has proceeded past this point. */
|
||||||
|
int quoted;
|
||||||
|
|
||||||
|
/* An arbitrary pointer passed in from the user. */
|
||||||
|
void *input;
|
||||||
|
/* Values to pass to child parsers. This vector will be the same length as
|
||||||
|
the number of children for the current parser. */
|
||||||
|
void **child_inputs;
|
||||||
|
|
||||||
|
/* For the parser's use. Initialized to 0. */
|
||||||
|
void *hook;
|
||||||
|
|
||||||
|
/* The name used when printing messages. This is initialized to ARGV[0],
|
||||||
|
or PROGRAM_INVOCATION_NAME if that is unavailable. */
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
/* Streams used when argp prints something. */
|
||||||
|
FILE *err_stream; /* For errors; initialized to stderr. */
|
||||||
|
FILE *out_stream; /* For information; initialized to stdout. */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Flags for argp_parse (note that the defaults are those that are
|
||||||
|
convenient for program command line parsing): */
|
||||||
|
|
||||||
|
/* Don't ignore the first element of ARGV. Normally (and always unless
|
||||||
|
ARGP_NO_ERRS is set) the first element of the argument vector is
|
||||||
|
skipped for option parsing purposes, as it corresponds to the program name
|
||||||
|
in a command line. */
|
||||||
|
#define ARGP_PARSE_ARGV0 0x01
|
||||||
|
|
||||||
|
/* Don't print error messages for unknown options to stderr; unless this flag
|
||||||
|
is set, ARGP_PARSE_ARGV0 is ignored, as ARGV[0] is used as the program
|
||||||
|
name in the error messages. This flag implies ARGP_NO_EXIT (on the
|
||||||
|
assumption that silent exiting upon errors is bad behaviour). */
|
||||||
|
#define ARGP_NO_ERRS 0x02
|
||||||
|
|
||||||
|
/* Don't parse any non-option args. Normally non-option args are parsed by
|
||||||
|
calling the parse functions with a key of ARGP_KEY_ARG, and the actual arg
|
||||||
|
as the value. Since it's impossible to know which parse function wants to
|
||||||
|
handle it, each one is called in turn, until one returns 0 or an error
|
||||||
|
other than ARGP_ERR_UNKNOWN; if an argument is handled by no one, the
|
||||||
|
argp_parse returns prematurely (but with a return value of 0). If all
|
||||||
|
args have been parsed without error, all parsing functions are called one
|
||||||
|
last time with a key of ARGP_KEY_END. This flag needn't normally be set,
|
||||||
|
as the normal behavior is to stop parsing as soon as some argument can't
|
||||||
|
be handled. */
|
||||||
|
#define ARGP_NO_ARGS 0x04
|
||||||
|
|
||||||
|
/* Parse options and arguments in the same order they occur on the command
|
||||||
|
line -- normally they're rearranged so that all options come first. */
|
||||||
|
#define ARGP_IN_ORDER 0x08
|
||||||
|
|
||||||
|
/* Don't provide the standard long option --help, which causes usage and
|
||||||
|
option help information to be output to stdout, and exit (0) called. */
|
||||||
|
#define ARGP_NO_HELP 0x10
|
||||||
|
|
||||||
|
/* Don't exit on errors (they may still result in error messages). */
|
||||||
|
#define ARGP_NO_EXIT 0x20
|
||||||
|
|
||||||
|
/* Use the gnu getopt `long-only' rules for parsing arguments. */
|
||||||
|
#define ARGP_LONG_ONLY 0x40
|
||||||
|
|
||||||
|
/* Turns off any message-printing/exiting options. */
|
||||||
|
#define ARGP_SILENT (ARGP_NO_EXIT | ARGP_NO_ERRS | ARGP_NO_HELP)
|
||||||
|
|
||||||
|
/* Parse the options strings in ARGC & ARGV according to the options in ARGP.
|
||||||
|
FLAGS is one of the ARGP_ flags above. If ARG_INDEX is non-NULL, the
|
||||||
|
index in ARGV of the first unparsed option is returned in it. If an
|
||||||
|
unknown option is present, ARGP_ERR_UNKNOWN is returned; if some parser
|
||||||
|
routine returned a non-zero value, it is returned; otherwise 0 is
|
||||||
|
returned. This function may also call exit unless the ARGP_NO_HELP flag
|
||||||
|
is set. INPUT is a pointer to a value to be passed in to the parser. */
|
||||||
|
error_t argp_parse __P ((__const struct argp *__argp,
|
||||||
|
int __argc, char **__argv, unsigned __flags,
|
||||||
|
int *__arg_index, void *__input));
|
||||||
|
error_t __argp_parse __P ((__const struct argp *__argp,
|
||||||
|
int __argc, char **__argv, unsigned __flags,
|
||||||
|
int *__arg_index, void *__input));
|
||||||
|
|
||||||
|
/* Global variables. */
|
||||||
|
|
||||||
|
/* If defined or set by the user program to a non-zero value, then a default
|
||||||
|
option --version is added (unless the ARGP_NO_HELP flag is used), which
|
||||||
|
will print this this string followed by a newline and exit (unless the
|
||||||
|
ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */
|
||||||
|
extern char *argp_program_version;
|
||||||
|
|
||||||
|
/* If defined or set by the user program to a non-zero value, then a default
|
||||||
|
option --version is added (unless the ARGP_NO_HELP flag is used), which
|
||||||
|
calls this function with a stream to print the version to and a pointer to
|
||||||
|
the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is
|
||||||
|
used). This variable takes precedent over ARGP_PROGRAM_VERSION. */
|
||||||
|
extern void (*argp_program_version_hook) __P ((FILE *__stream,
|
||||||
|
struct argp_state *__state));
|
||||||
|
|
||||||
|
/* If defined or set by the user program, it should point to string that is
|
||||||
|
the bug-reporting address for the program. It will be printed by
|
||||||
|
argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various
|
||||||
|
standard help messages), embedded in a sentence that says something like
|
||||||
|
`Report bugs to ADDR.'. */
|
||||||
|
extern char *argp_program_bug_address;
|
||||||
|
|
||||||
|
/* Flags for argp_help. */
|
||||||
|
#define ARGP_HELP_USAGE 0x01 /* a Usage: message. */
|
||||||
|
#define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */
|
||||||
|
#define ARGP_HELP_SEE 0x04 /* a `Try ... for more help' message. */
|
||||||
|
#define ARGP_HELP_LONG 0x08 /* a long help message. */
|
||||||
|
#define ARGP_HELP_PRE_DOC 0x10 /* doc string preceding long help. */
|
||||||
|
#define ARGP_HELP_POST_DOC 0x20 /* doc string following long help. */
|
||||||
|
#define ARGP_HELP_DOC (ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC)
|
||||||
|
#define ARGP_HELP_BUG_ADDR 0x40 /* bug report address */
|
||||||
|
#define ARGP_HELP_LONG_ONLY 0x80 /* modify output appropriately to
|
||||||
|
reflect ARGP_LONG_ONLY mode. */
|
||||||
|
|
||||||
|
/* These ARGP_HELP flags are only understood by argp_state_help. */
|
||||||
|
#define ARGP_HELP_EXIT_ERR 0x100 /* Call exit(1) instead of returning. */
|
||||||
|
#define ARGP_HELP_EXIT_OK 0x200 /* Call exit(0) instead of returning. */
|
||||||
|
|
||||||
|
/* The standard thing to do after a program command line parsing error, if an
|
||||||
|
error message has already been printed. */
|
||||||
|
#define ARGP_HELP_STD_ERR \
|
||||||
|
(ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR)
|
||||||
|
/* The standard thing to do after a program command line parsing error, if no
|
||||||
|
more specific error message has been printed. */
|
||||||
|
#define ARGP_HELP_STD_USAGE \
|
||||||
|
(ARGP_HELP_SHORT_USAGE | ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR)
|
||||||
|
/* The standard thing to do in response to a --help option. */
|
||||||
|
#define ARGP_HELP_STD_HELP \
|
||||||
|
(ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG | ARGP_HELP_EXIT_OK \
|
||||||
|
| ARGP_HELP_DOC | ARGP_HELP_BUG_ADDR)
|
||||||
|
|
||||||
|
/* Output a usage message for ARGP to STREAM. FLAGS are from the set
|
||||||
|
ARGP_HELP_*. */
|
||||||
|
extern void argp_help __P ((__const struct argp *__argp, FILE *__stream,
|
||||||
|
unsigned __flags, char *__name));
|
||||||
|
extern void __argp_help __P ((__const struct argp *__argp, FILE *__stream,
|
||||||
|
unsigned __flags, char *__name));
|
||||||
|
|
||||||
|
/* The following routines are intended to be called from within an argp
|
||||||
|
parsing routine (thus taking an argp_state structure as the first
|
||||||
|
argument). They may or may not print an error message and exit, depending
|
||||||
|
on the flags in STATE -- in any case, the caller should be prepared for
|
||||||
|
them *not* to exit, and should return an appropiate error after calling
|
||||||
|
them. [argp_usage & argp_error should probably be called argp_state_...,
|
||||||
|
but they're used often enough that they should be short] */
|
||||||
|
|
||||||
|
/* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are
|
||||||
|
from the set ARGP_HELP_*. */
|
||||||
|
extern void argp_state_help __P ((struct argp_state *__state, FILE *__stream,
|
||||||
|
unsigned __flags));
|
||||||
|
extern void __argp_state_help __P ((struct argp_state *__state, FILE *__stream,
|
||||||
|
unsigned __flags));
|
||||||
|
|
||||||
|
/* Possibly output the standard usage message for ARGP to stderr and exit. */
|
||||||
|
extern void argp_usage __P ((struct argp_state *__state));
|
||||||
|
extern void __argp_usage __P ((struct argp_state *__state));
|
||||||
|
|
||||||
|
/* If appropriate, print the printf string FMT and following args, preceded
|
||||||
|
by the program name and `:', to stderr, and followed by a `Try ... --help'
|
||||||
|
message, then exit (1). */
|
||||||
|
void argp_error __P ((struct argp_state *__state, __const char *__fmt, ...))
|
||||||
|
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||||
|
void __argp_error __P ((struct argp_state *__state, __const char *__fmt, ...))
|
||||||
|
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||||
|
|
||||||
|
/* Similar to the standard gnu error-reporting function error(), but will
|
||||||
|
respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print
|
||||||
|
to STATE->err_stream. This is useful for argument parsing code that is
|
||||||
|
shared between program startup (when exiting is desired) and runtime
|
||||||
|
option parsing (when typically an error code is returned instead). The
|
||||||
|
difference between this function and argp_error is that the latter is for
|
||||||
|
*parsing errors*, and the former is for other problems that occur during
|
||||||
|
parsing but don't reflect a (syntactic) problem with the input. */
|
||||||
|
void argp_failure __P ((struct argp_state *__state,
|
||||||
|
int __status, int __errnum, __const char *__fmt, ...))
|
||||||
|
__attribute__ ((__format__ (__printf__, 4, 5)));
|
||||||
|
void __argp_failure __P ((struct argp_state *__state,
|
||||||
|
int __status, int __errnum, __const char *__fmt, ...))
|
||||||
|
__attribute__ ((__format__ (__printf__, 4, 5)));
|
||||||
|
|
||||||
|
/* Returns true if the option OPT is a valid short option. */
|
||||||
|
extern int _option_is_short __P ((__const struct argp_option *__opt));
|
||||||
|
extern int __option_is_short __P ((__const struct argp_option *__opt));
|
||||||
|
|
||||||
|
/* Returns true if the option OPT is in fact the last (unused) entry in an
|
||||||
|
options array. */
|
||||||
|
extern int _option_is_end __P ((__const struct argp_option *__opt));
|
||||||
|
extern int __option_is_end __P ((__const struct argp_option *__opt));
|
||||||
|
|
||||||
|
#ifdef __OPTIMIZE__
|
||||||
|
|
||||||
|
#if !_LIBC
|
||||||
|
# define __argp_usage argp_usage
|
||||||
|
# define __argp_state_help argp_state_help
|
||||||
|
# define __option_is_short _option_is_short
|
||||||
|
# define __option_is_end _option_is_end
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ARGP_EI
|
||||||
|
# define ARGP_EI extern inline
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ARGP_EI void
|
||||||
|
__argp_usage (struct argp_state *__state)
|
||||||
|
{
|
||||||
|
__argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
ARGP_EI int
|
||||||
|
__option_is_short (__const struct argp_option *__opt)
|
||||||
|
{
|
||||||
|
if (__opt->flags & OPTION_DOC)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int __key = __opt->key;
|
||||||
|
return __key > 0 && isprint (__key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ARGP_EI int
|
||||||
|
__option_is_end (__const struct argp_option *__opt)
|
||||||
|
{
|
||||||
|
return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !_LIBC
|
||||||
|
# undef __argp_usage
|
||||||
|
# undef __argp_state_help
|
||||||
|
# undef __option_is_short
|
||||||
|
# undef __option_is_end
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __OPTIMIZE__ */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ARGP_H__ */
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||||
|
|
||||||
@ -34,6 +34,7 @@ catopen (const char *cat_name, int flag)
|
|||||||
{
|
{
|
||||||
__nl_catd result;
|
__nl_catd result;
|
||||||
const char *env_var;
|
const char *env_var;
|
||||||
|
const char *nlspath;
|
||||||
|
|
||||||
result = (__nl_catd) malloc (sizeof (*result));
|
result = (__nl_catd) malloc (sizeof (*result));
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
@ -82,10 +83,9 @@ catopen (const char *cat_name, int flag)
|
|||||||
return (nl_catd) -1;
|
return (nl_catd) -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__secure_getenv ("NLSPATH") != NULL)
|
nlspath = __secure_getenv ("NLSPATH");
|
||||||
result->nlspath = __strdup (getenv ("NLSPATH"));
|
result->nlspath = __strdup (nlspath != NULL && *nlspath != '\0'
|
||||||
else
|
? nlspath : NLSPATH);
|
||||||
result->nlspath = __strdup (NLSPATH);
|
|
||||||
|
|
||||||
if (result->nlspath == NULL)
|
if (result->nlspath == NULL)
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#
|
#
|
||||||
subdir := ctype
|
subdir := ctype
|
||||||
|
|
||||||
routines := ctype ctype-extn
|
routines := ctype ctype-extn ctype_l
|
||||||
aux := ctype-info
|
aux := ctype-info
|
||||||
|
|
||||||
tests := test_ctype
|
tests := test_ctype
|
||||||
|
@ -1,32 +1,68 @@
|
|||||||
/* Copyright (C) 1991 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <ansidecl.h>
|
|
||||||
|
|
||||||
#define __NO_CTYPE
|
#define __NO_CTYPE
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
/* Real function versions of the non-ANSI ctype functions. */
|
/* Real function versions of the non-ANSI ctype functions. */
|
||||||
|
|
||||||
int DEFUN(isblank, (c), int c) { return __isctype ((c), _ISblank); }
|
int
|
||||||
|
isblank (int c)
|
||||||
|
{
|
||||||
|
return __isctype (c, _ISblank);
|
||||||
|
}
|
||||||
|
|
||||||
int DEFUN(_tolower, (c), int c) { return __tolower(c); }
|
int
|
||||||
int DEFUN(_toupper, (c), int c) { return __toupper(c); }
|
_tolower (int c)
|
||||||
|
{
|
||||||
|
return __tolower (c);
|
||||||
|
}
|
||||||
|
int
|
||||||
|
_toupper (int c)
|
||||||
|
{
|
||||||
|
return __toupper (c);
|
||||||
|
}
|
||||||
|
|
||||||
int DEFUN(toascii, (c), int c) { return __toascii(c); }
|
int
|
||||||
int DEFUN(isascii, (c), int c) { return __isascii(c); }
|
toascii (int c)
|
||||||
|
{
|
||||||
|
return __toascii (c);
|
||||||
|
}
|
||||||
|
int
|
||||||
|
isascii (int c)
|
||||||
|
{
|
||||||
|
return __isascii (c);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
__isblank_l (int c, __locale_t l)
|
||||||
|
{
|
||||||
|
return __isctype_l (c, _ISblank, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
__toascii_l (int c, __locale_t l)
|
||||||
|
{
|
||||||
|
return __toascii (c);
|
||||||
|
}
|
||||||
|
int
|
||||||
|
__isascii_l (int c, __locale_t l)
|
||||||
|
{
|
||||||
|
return __isascii (c);
|
||||||
|
}
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "../locale/localeinfo.h"
|
#include "../locale/localeinfo.h"
|
||||||
|
@ -1,22 +1,20 @@
|
|||||||
/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <ansidecl.h>
|
|
||||||
|
|
||||||
#define __NO_CTYPE
|
#define __NO_CTYPE
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -24,28 +22,28 @@ Cambridge, MA 02139, USA. */
|
|||||||
/* Provide real-function versions of all the ctype macros. */
|
/* Provide real-function versions of all the ctype macros. */
|
||||||
|
|
||||||
#define func(name, type) \
|
#define func(name, type) \
|
||||||
int DEFUN(name, (c), int c) { return __isctype(c, type); }
|
int name (int c) { return __isctype (c, type); }
|
||||||
|
|
||||||
func(isalnum, _ISalnum)
|
func (isalnum, _ISalnum)
|
||||||
func(isalpha, _ISalpha)
|
func (isalpha, _ISalpha)
|
||||||
func(iscntrl, _IScntrl)
|
func (iscntrl, _IScntrl)
|
||||||
func(isdigit, _ISdigit)
|
func (isdigit, _ISdigit)
|
||||||
func(islower, _ISlower)
|
func (islower, _ISlower)
|
||||||
func(isgraph, _ISgraph)
|
func (isgraph, _ISgraph)
|
||||||
func(isprint, _ISprint)
|
func (isprint, _ISprint)
|
||||||
func(ispunct, _ISpunct)
|
func (ispunct, _ISpunct)
|
||||||
func(isspace, _ISspace)
|
func (isspace, _ISspace)
|
||||||
func(isupper, _ISupper)
|
func (isupper, _ISupper)
|
||||||
func(isxdigit, _ISxdigit)
|
func (isxdigit, _ISxdigit)
|
||||||
|
|
||||||
int
|
int
|
||||||
DEFUN(tolower, (c), int c)
|
tolower (int c)
|
||||||
{
|
{
|
||||||
return __tolower (c);
|
return __tolower (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
DEFUN(toupper, (c), int c)
|
toupper (int c)
|
||||||
{
|
{
|
||||||
return __toupper (c);
|
return __toupper (c);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 92, 93, 95, 96, 97 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -159,6 +159,83 @@ __exctype (_tolower);
|
|||||||
|
|
||||||
#endif /* Not __NO_CTYPE. */
|
#endif /* Not __NO_CTYPE. */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __USE_GNU
|
||||||
|
/* The concept of one static locale per category is not very well
|
||||||
|
thought out. Many applications will need to process its data using
|
||||||
|
information from several different locales. Another application is
|
||||||
|
the implementation of the internationalization handling in the
|
||||||
|
upcoming ISO C++ standard library. To support this another set of
|
||||||
|
the functions using locale data exist which have an additional
|
||||||
|
argument.
|
||||||
|
|
||||||
|
Attention: all these functions are *not* standardized in any form.
|
||||||
|
This is a proof-of-concept implementation. */
|
||||||
|
|
||||||
|
/* Structure for reentrant locale using functions. This is an
|
||||||
|
(almost) opaque type for the user level programs. */
|
||||||
|
# include <xlocale.h>
|
||||||
|
|
||||||
|
/* These definitions are similar to the ones above but all functions
|
||||||
|
take as an argument a handle for the locale which shall be used. */
|
||||||
|
#define __isctype_l(c, type, locale) \
|
||||||
|
((locale)->__ctype_b[(int) (c)] & (unsigned short int) type)
|
||||||
|
|
||||||
|
#define __tolower_l(c, locale) ((int) (locale)->__ctype_tolower[(int) (c)])
|
||||||
|
#define __toupper_l(c, locale) ((int) (locale)->__ctype_toupper[(int) (c)])
|
||||||
|
|
||||||
|
#define __exctype_l(name) extern int name __P ((int, __locale_t))
|
||||||
|
|
||||||
|
/* The following names are all functions:
|
||||||
|
int isCHARACTERISTIC(int c, locale_t *locale);
|
||||||
|
which return nonzero iff C has CHARACTERISTIC.
|
||||||
|
For the meaning of the characteristic names, see the `enum' above. */
|
||||||
|
__exctype_l (__isalnum_l);
|
||||||
|
__exctype_l (__isalpha_l);
|
||||||
|
__exctype_l (__iscntrl_l);
|
||||||
|
__exctype_l (__isdigit_l);
|
||||||
|
__exctype_l (__islower_l);
|
||||||
|
__exctype_l (__isgraph_l);
|
||||||
|
__exctype_l (__isprint_l);
|
||||||
|
__exctype_l (__ispunct_l);
|
||||||
|
__exctype_l (__isspace_l);
|
||||||
|
__exctype_l (__isupper_l);
|
||||||
|
__exctype_l (__isxdigit_l);
|
||||||
|
|
||||||
|
__exctype_l (__isblank_l);
|
||||||
|
|
||||||
|
|
||||||
|
/* Return the lowercase version of C in locale L. */
|
||||||
|
extern int __tolower_l __P ((int __c, __locale_t __l));
|
||||||
|
|
||||||
|
/* Return the uppercase version of C. */
|
||||||
|
extern int __toupper_l __P ((int __c, __locale_t __l));
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __NO_CTYPE
|
||||||
|
#define __isalnum_l(c,l) __isctype_l((c), _ISalnum, (l))
|
||||||
|
#define __isalpha_l(c,l) __isctype_l((c), _ISalpha, (l))
|
||||||
|
#define __iscntrl_l(c,l) __isctype_l((c), _IScntrl, (l))
|
||||||
|
#define __isdigit_l(c,l) __isctype_l((c), _ISdigit, (l))
|
||||||
|
#define __islower_l(c,l) __isctype_l((c), _ISlower, (l))
|
||||||
|
#define __isgraph_l(c,l) __isctype_l((c), _ISgraph, (l))
|
||||||
|
#define __isprint_l(c,l) __isctype_l((c), _ISprint, (l))
|
||||||
|
#define __ispunct_l(c,l) __isctype_l((c), _ISpunct, (l))
|
||||||
|
#define __isspace_l(c,l) __isctype_l((c), _ISspace, (l))
|
||||||
|
#define __isupper_l(c,l) __isctype_l((c), _ISupper, (l))
|
||||||
|
#define __isxdigit_l(c,l) __isctype_l((c), _ISxdigit, (l))
|
||||||
|
|
||||||
|
#define __isblank_l(c,l) __isctype_l((c), _ISblank, (l))
|
||||||
|
|
||||||
|
#if defined(__USE_SVID) || defined(__USE_MISC) || defined(__USE_XOPEN)
|
||||||
|
#define __isascii_l(c,l) __isascii(c)
|
||||||
|
#define __toascii_l(c,l) __toascii(c)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* Not __NO_CTYPE. */
|
||||||
|
|
||||||
|
#endif /* Use GNU. */
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
#endif /* ctype.h */
|
#endif /* ctype.h */
|
||||||
|
49
ctype/ctype_l.c
Normal file
49
ctype/ctype_l.c
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/* Copyright (C) 1991, 1992, 1997 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
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#define __NO_CTYPE
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
/* Provide real-function versions of all the ctype macros. */
|
||||||
|
|
||||||
|
#define func(name, type) \
|
||||||
|
int name (int c, __locale_t l) { return __isctype_l (c, type, l); }
|
||||||
|
|
||||||
|
func (__isalnum_l, _ISalnum)
|
||||||
|
func (__isalpha_l, _ISalpha)
|
||||||
|
func (__iscntrl_l, _IScntrl)
|
||||||
|
func (__isdigit_l, _ISdigit)
|
||||||
|
func (__islower_l, _ISlower)
|
||||||
|
func (__isgraph_l, _ISgraph)
|
||||||
|
func (__isprint_l, _ISprint)
|
||||||
|
func (__ispunct_l, _ISpunct)
|
||||||
|
func (__isspace_l, _ISspace)
|
||||||
|
func (__isupper_l, _ISupper)
|
||||||
|
func (__isxdigit_l, _ISxdigit)
|
||||||
|
|
||||||
|
int
|
||||||
|
(__tolower_l) (int c, __locale_t l)
|
||||||
|
{
|
||||||
|
return __tolower_l (c, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
(__toupper_l) (int c, __locale_t l)
|
||||||
|
{
|
||||||
|
return __toupper_l (c, l);
|
||||||
|
}
|
@ -1,22 +1,21 @@
|
|||||||
/* Copyright (C) 1991, 1994, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 1994, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <ansidecl.h>
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -30,7 +29,7 @@ Cambridge, MA 02139, USA. */
|
|||||||
__inline
|
__inline
|
||||||
#endif
|
#endif
|
||||||
static void
|
static void
|
||||||
DEFUN(print_char, (c), unsigned char c)
|
print_char (unsigned char c)
|
||||||
{
|
{
|
||||||
printf("%d/", (int) c);
|
printf("%d/", (int) c);
|
||||||
if (isgraph(c))
|
if (isgraph(c))
|
||||||
@ -40,9 +39,9 @@ DEFUN(print_char, (c), unsigned char c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
DEFUN(main, (argc, argv), int argc AND char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
register unsigned short int c;
|
unsigned short int c;
|
||||||
int lose = 0;
|
int lose = 0;
|
||||||
|
|
||||||
#define TRYEM do { \
|
#define TRYEM do { \
|
||||||
|
@ -1,28 +1,26 @@
|
|||||||
/* Copyright (C) 1992 Free Software Foundation, Inc.
|
/* Copyright (C) 1992, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <ansidecl.h>
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
DEFUN(alphasort, (a, b),
|
alphasort (const void *a, const void *b)
|
||||||
CONST PTR a AND CONST PTR b)
|
|
||||||
{
|
{
|
||||||
return strcmp (((struct dirent *) a)->d_name,
|
return strcmp (((struct dirent *) a)->d_name,
|
||||||
((struct dirent *) b)->d_name);
|
((struct dirent *) b)->d_name);
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
/* Copyright (C) 1991, 1993 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 1993, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <ansidecl.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -25,44 +24,44 @@ Cambridge, MA 02139, USA. */
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DEFUN(test, (name), CONST char *name)
|
test (const char *name)
|
||||||
{
|
{
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct dirent *entp;
|
struct dirent *entp;
|
||||||
|
|
||||||
puts(name);
|
puts (name);
|
||||||
|
|
||||||
dirp = opendir(name);
|
dirp = opendir (name);
|
||||||
if (dirp == NULL)
|
if (dirp == NULL)
|
||||||
{
|
{
|
||||||
perror("opendir");
|
perror ("opendir");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
while ((entp = readdir(dirp)) != NULL)
|
while ((entp = readdir (dirp)) != NULL)
|
||||||
printf("%s\tfile number %lu\n",
|
printf ("%s\tfile number %lu\n",
|
||||||
entp->d_name, (unsigned long int) entp->d_fileno);
|
entp->d_name, (unsigned long int) entp->d_fileno);
|
||||||
|
|
||||||
if (errno)
|
if (errno)
|
||||||
perror ("readdir");
|
perror ("readdir");
|
||||||
|
|
||||||
if (closedir(dirp) < 0)
|
if (closedir (dirp) < 0)
|
||||||
perror("closedir");
|
perror ("closedir");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
DEFUN(main, (argc, argv), int argc AND char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
--argc;
|
--argc;
|
||||||
++argv;
|
++argv;
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
test(".");
|
test (".");
|
||||||
else
|
else
|
||||||
while (argc-- > 0)
|
while (argc-- > 0)
|
||||||
test(*argv++);
|
test (*argv++);
|
||||||
|
|
||||||
exit(0);
|
exit (0);
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ subdir := elf
|
|||||||
|
|
||||||
headers = elf.h elfclass.h link.h dlfcn.h
|
headers = elf.h elfclass.h link.h dlfcn.h
|
||||||
routines = $(dl-routines) dl-open dl-close dl-symbol dl-support \
|
routines = $(dl-routines) dl-open dl-close dl-symbol dl-support \
|
||||||
enbl-secure
|
dl-version enbl-secure
|
||||||
|
|
||||||
# The core dynamic linking functions are in libc for the static and
|
# The core dynamic linking functions are in libc for the static and
|
||||||
# profiled libraries.
|
# profiled libraries.
|
||||||
@ -39,7 +39,7 @@ distribute = $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
|
|||||||
|
|
||||||
extra-libs = libdl
|
extra-libs = libdl
|
||||||
extra-libs-others = $(extra-libs)
|
extra-libs-others = $(extra-libs)
|
||||||
libdl-routines := dlopen dlclose dlsym dlerror dladdr
|
libdl-routines := dlopen dlclose dlsym dlvsym dlerror dladdr
|
||||||
|
|
||||||
before-compile = $(objpfx)trusted-dirs.h
|
before-compile = $(objpfx)trusted-dirs.h
|
||||||
|
|
||||||
|
@ -66,9 +66,9 @@ _dl_signal_error (int errcode,
|
|||||||
else if (receiver)
|
else if (receiver)
|
||||||
{
|
{
|
||||||
/* We are inside _dl_receive_error. Call the user supplied
|
/* We are inside _dl_receive_error. Call the user supplied
|
||||||
handler and resume the work. The receiver will still
|
handler and resume the work. The receiver will still be
|
||||||
installed. */
|
installed. */
|
||||||
(*receiver) (errstring, objname);
|
(*receiver) (errcode, objname, errstring);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -154,11 +154,34 @@ _dl_map_object_from_fd (char *name, int fd, char *realname,
|
|||||||
for (l = _dl_loaded; l; l = l->l_next)
|
for (l = _dl_loaded; l; l = l->l_next)
|
||||||
if (! strcmp (realname, l->l_name))
|
if (! strcmp (realname, l->l_name))
|
||||||
{
|
{
|
||||||
|
struct libname_list *lnp, *lastp;
|
||||||
/* The object is already loaded.
|
/* The object is already loaded.
|
||||||
Just bump its reference count and return it. */
|
Just bump its reference count and return it. */
|
||||||
__close (fd);
|
__close (fd);
|
||||||
free (name);
|
|
||||||
|
/* If the name is not in the list of names for this object add
|
||||||
|
it. */
|
||||||
free (realname);
|
free (realname);
|
||||||
|
lastp = NULL;
|
||||||
|
for (lnp = l->l_libname; lnp != NULL; lastp = lnp, lnp = lnp->next)
|
||||||
|
if (strcmp (name, lnp->name) == 0)
|
||||||
|
{
|
||||||
|
free (name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (lnp == NULL)
|
||||||
|
{
|
||||||
|
struct libname_list *newname = malloc (sizeof *newname);
|
||||||
|
if (newname == NULL)
|
||||||
|
/* No more memory. */
|
||||||
|
lose (ENOMEM, "cannot allocate name record");
|
||||||
|
/* The object should have a libname set. */
|
||||||
|
assert (lastp != NULL);
|
||||||
|
|
||||||
|
newname->name = name;
|
||||||
|
newname->next = NULL;
|
||||||
|
lastp->next = newname;
|
||||||
|
}
|
||||||
++l->l_opencount;
|
++l->l_opencount;
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
@ -517,8 +540,7 @@ _dl_map_object (struct link_map *loader, const char *name, int type,
|
|||||||
|
|
||||||
/* Look for this name among those already loaded. */
|
/* Look for this name among those already loaded. */
|
||||||
for (l = _dl_loaded; l; l = l->l_next)
|
for (l = _dl_loaded; l; l = l->l_next)
|
||||||
if (! strcmp (name, l->l_libname) || /* NAME was requested before. */
|
if (_dl_does_name_match_p (name, l) ||
|
||||||
! strcmp (name, l->l_name) || /* NAME was found before. */
|
|
||||||
/* If the requested name matches the soname of a loaded object,
|
/* If the requested name matches the soname of a loaded object,
|
||||||
use that object. */
|
use that object. */
|
||||||
(l->l_info[DT_SONAME] &&
|
(l->l_info[DT_SONAME] &&
|
||||||
@ -559,15 +581,17 @@ _dl_map_object (struct link_map *loader, const char *name, int type,
|
|||||||
l->l_info[DT_STRTAB]->d_un.d_ptr +
|
l->l_info[DT_STRTAB]->d_un.d_ptr +
|
||||||
l->l_info[DT_RPATH]->d_un.d_val), NULL);
|
l->l_info[DT_RPATH]->d_un.d_val), NULL);
|
||||||
/* Try an environment variable (unless setuid). */
|
/* Try an environment variable (unless setuid). */
|
||||||
if (fd == -1 && ! __libc_enable_secure)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
static const char *trusted_dirs[] =
|
static const char *trusted_dirs[] =
|
||||||
{
|
{
|
||||||
#include "trusted-dirs.h"
|
#include "trusted-dirs.h"
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
const char *ld_library_path = getenv ("LD_LIBRARY_PATH");
|
||||||
|
|
||||||
trypath (getenv ("LD_LIBRARY_PATH"), trusted_dirs);
|
if (ld_library_path != NULL && *ld_library_path != '\0')
|
||||||
|
trypath (ld_library_path, trusted_dirs);
|
||||||
}
|
}
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
|
159
elf/dl-lookup.c
159
elf/dl-lookup.c
@ -1,5 +1,5 @@
|
|||||||
/* Look up a symbol in the loaded objects.
|
/* Look up a symbol in the loaded objects.
|
||||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -22,6 +22,9 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "../stdio-common/_itoa.h"
|
||||||
|
|
||||||
|
#define VERSTAG(tag) (DT_NUM + DT_PROCNUM + DT_VERSIONTAGIDX (tag))
|
||||||
|
|
||||||
struct sym_val
|
struct sym_val
|
||||||
{
|
{
|
||||||
@ -30,22 +33,46 @@ struct sym_val
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* This is the hashing function specified by the ELF ABI. */
|
/* This is the hashing function specified by the ELF ABI. In the
|
||||||
|
first five operations now overflow is possible so we optimized it a
|
||||||
|
bit. */
|
||||||
static inline unsigned
|
static inline unsigned
|
||||||
_dl_elf_hash (const char *name)
|
_dl_elf_hash (const char *name)
|
||||||
{
|
{
|
||||||
unsigned long int hash = 0;
|
unsigned long int hash = 0;
|
||||||
while (*name != '\0')
|
if (*name != '\0')
|
||||||
{
|
{
|
||||||
unsigned long int hi;
|
|
||||||
hash = (hash << 4) + *name++;
|
hash = (hash << 4) + *name++;
|
||||||
hi = hash & 0xf0000000;
|
if (*name != '\0')
|
||||||
if (hi != 0)
|
|
||||||
{
|
{
|
||||||
hash ^= hi >> 24;
|
hash = (hash << 4) + *name++;
|
||||||
/* The ELF ABI says `hash &= ~hi', but this is equivalent
|
if (*name != '\0')
|
||||||
in this case and on some machines one insn instead of two. */
|
{
|
||||||
hash ^= hi;
|
hash = (hash << 4) + *name++;
|
||||||
|
if (*name != '\0')
|
||||||
|
{
|
||||||
|
hash = (hash << 4) + *name++;
|
||||||
|
if (*name != '\0')
|
||||||
|
{
|
||||||
|
hash = (hash << 4) + *name++;
|
||||||
|
while (*name != '\0')
|
||||||
|
{
|
||||||
|
unsigned long int hi;
|
||||||
|
hash = (hash << 4) + *name++;
|
||||||
|
hi = hash & 0xf0000000;
|
||||||
|
if (hi != 0)
|
||||||
|
{
|
||||||
|
hash ^= hi >> 24;
|
||||||
|
/* The ELF ABI says `hash &= ~hi', but
|
||||||
|
this is equivalent in this case and
|
||||||
|
on some machines one insn instead of
|
||||||
|
two. */
|
||||||
|
hash ^= hi;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
@ -57,7 +84,8 @@ static inline ElfW(Addr)
|
|||||||
do_lookup (const char *undef_name, unsigned long int hash,
|
do_lookup (const char *undef_name, unsigned long int hash,
|
||||||
const ElfW(Sym) **ref, struct sym_val *result,
|
const ElfW(Sym) **ref, struct sym_val *result,
|
||||||
struct link_map *list[], size_t i, size_t n,
|
struct link_map *list[], size_t i, size_t n,
|
||||||
const char *reference_name, struct link_map *skip, int flags)
|
const char *reference_name, const hash_name_pair *version,
|
||||||
|
struct link_map *skip, int flags)
|
||||||
{
|
{
|
||||||
struct link_map *map;
|
struct link_map *map;
|
||||||
|
|
||||||
@ -65,6 +93,7 @@ do_lookup (const char *undef_name, unsigned long int hash,
|
|||||||
{
|
{
|
||||||
const ElfW(Sym) *symtab;
|
const ElfW(Sym) *symtab;
|
||||||
const char *strtab;
|
const char *strtab;
|
||||||
|
const ElfW(Half) *verstab;
|
||||||
ElfW(Symndx) symidx;
|
ElfW(Symndx) symidx;
|
||||||
|
|
||||||
map = list[i];
|
map = list[i];
|
||||||
@ -79,6 +108,12 @@ do_lookup (const char *undef_name, unsigned long int hash,
|
|||||||
|
|
||||||
symtab = ((void *) map->l_addr + map->l_info[DT_SYMTAB]->d_un.d_ptr);
|
symtab = ((void *) map->l_addr + map->l_info[DT_SYMTAB]->d_un.d_ptr);
|
||||||
strtab = ((void *) map->l_addr + map->l_info[DT_STRTAB]->d_un.d_ptr);
|
strtab = ((void *) map->l_addr + map->l_info[DT_STRTAB]->d_un.d_ptr);
|
||||||
|
if (version != NULL
|
||||||
|
&& map->l_nversions > 0 && map->l_info[VERSTAG (DT_VERSYM)] != NULL)
|
||||||
|
verstab = ((void *) map->l_addr
|
||||||
|
+ map->l_info[VERSTAG (DT_VERSYM)]->d_un.d_ptr);
|
||||||
|
else
|
||||||
|
verstab = NULL;
|
||||||
|
|
||||||
/* Search the appropriate hash bucket in this object's symbol table
|
/* Search the appropriate hash bucket in this object's symbol table
|
||||||
for a definition for the same symbol name. */
|
for a definition for the same symbol name. */
|
||||||
@ -108,6 +143,15 @@ do_lookup (const char *undef_name, unsigned long int hash,
|
|||||||
/* Not the symbol we are looking for. */
|
/* Not the symbol we are looking for. */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (verstab != NULL)
|
||||||
|
{
|
||||||
|
/* We can match the version information. */
|
||||||
|
ElfW(Half) ndx = verstab[symidx] & 0x7fff;
|
||||||
|
if (map->l_versions[ndx].hash != version->hash
|
||||||
|
|| strcmp (map->l_versions[ndx].name, version->name))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch (ELFW(ST_BIND) (sym->st_info))
|
switch (ELFW(ST_BIND) (sym->st_info))
|
||||||
{
|
{
|
||||||
case STB_GLOBAL:
|
case STB_GLOBAL:
|
||||||
@ -155,14 +199,14 @@ _dl_lookup_symbol (const char *undef_name, const ElfW(Sym) **ref,
|
|||||||
for (scope = symbol_scope; *scope; ++scope)
|
for (scope = symbol_scope; *scope; ++scope)
|
||||||
if (do_lookup (undef_name, hash, ref, ¤t_value,
|
if (do_lookup (undef_name, hash, ref, ¤t_value,
|
||||||
(*scope)->l_searchlist, 0, (*scope)->l_nsearchlist,
|
(*scope)->l_searchlist, 0, (*scope)->l_nsearchlist,
|
||||||
reference_name, NULL, flags))
|
reference_name, NULL, NULL, flags))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (current_value.s == NULL &&
|
if (current_value.s == NULL &&
|
||||||
(*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK))
|
(*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK))
|
||||||
{
|
{
|
||||||
/* We could find no value for a strong reference. */
|
/* We could find no value for a strong reference. */
|
||||||
const char msg[] = "undefined symbol: ";
|
static const char msg[] = "undefined symbol: ";
|
||||||
const size_t len = strlen (undef_name);
|
const size_t len = strlen (undef_name);
|
||||||
char buf[sizeof msg + len];
|
char buf[sizeof msg + len];
|
||||||
memcpy (buf, msg, sizeof msg - 1);
|
memcpy (buf, msg, sizeof msg - 1);
|
||||||
@ -199,11 +243,96 @@ _dl_lookup_symbol_skip (const char *undef_name, const ElfW(Sym) **ref,
|
|||||||
|
|
||||||
if (! do_lookup (undef_name, hash, ref, ¤t_value,
|
if (! do_lookup (undef_name, hash, ref, ¤t_value,
|
||||||
(*scope)->l_dupsearchlist, i, (*scope)->l_ndupsearchlist,
|
(*scope)->l_dupsearchlist, i, (*scope)->l_ndupsearchlist,
|
||||||
reference_name, skip_map, flags))
|
reference_name, NULL, skip_map, flags))
|
||||||
while (*++scope)
|
while (*++scope)
|
||||||
if (do_lookup (undef_name, hash, ref, ¤t_value,
|
if (do_lookup (undef_name, hash, ref, ¤t_value,
|
||||||
(*scope)->l_dupsearchlist, 0, (*scope)->l_ndupsearchlist,
|
(*scope)->l_dupsearchlist, 0, (*scope)->l_ndupsearchlist,
|
||||||
reference_name, skip_map, flags))
|
reference_name, NULL, skip_map, flags))
|
||||||
|
break;
|
||||||
|
|
||||||
|
*ref = current_value.s;
|
||||||
|
return current_value.a;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* This function works like _dl_lookup_symbol but it takes an
|
||||||
|
additional arguement with the version number of the requested
|
||||||
|
symbol.
|
||||||
|
|
||||||
|
XXX We'll see whether we need this separate function. */
|
||||||
|
ElfW(Addr)
|
||||||
|
_dl_lookup_versioned_symbol (const char *undef_name, const ElfW(Sym) **ref,
|
||||||
|
struct link_map *symbol_scope[],
|
||||||
|
const char *reference_name,
|
||||||
|
const hash_name_pair *version, int flags)
|
||||||
|
{
|
||||||
|
const unsigned long int hash = _dl_elf_hash (undef_name);
|
||||||
|
struct sym_val current_value = { 0, NULL };
|
||||||
|
struct link_map **scope;
|
||||||
|
|
||||||
|
/* Search the relevant loaded objects for a definition. */
|
||||||
|
for (scope = symbol_scope; *scope; ++scope)
|
||||||
|
if (do_lookup (undef_name, hash, ref, ¤t_value,
|
||||||
|
(*scope)->l_searchlist, 0, (*scope)->l_nsearchlist,
|
||||||
|
reference_name, version, NULL, flags))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (current_value.s == NULL &&
|
||||||
|
(*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK))
|
||||||
|
{
|
||||||
|
/* We could find no value for a strong reference. */
|
||||||
|
static const char msg1[] = "undefined symbol: ";
|
||||||
|
const size_t len = strlen (undef_name);
|
||||||
|
static const char msg2[] = ", version ";
|
||||||
|
const size_t verslen = strlen (version->name ?: "") + 1;
|
||||||
|
char buf[sizeof msg1 - 1 + len + sizeof msg2 - 1 + verslen];
|
||||||
|
|
||||||
|
memcpy (buf, msg1, sizeof msg1 - 1);
|
||||||
|
memcpy (&buf[sizeof msg1 - 1], undef_name, len + 1);
|
||||||
|
memcpy (&buf[sizeof msg1 - 1 + len], msg2, sizeof msg2 - 1);
|
||||||
|
memcpy (&buf[sizeof msg1 - 1 + len + sizeof msg2 - 1], version->name,
|
||||||
|
verslen);
|
||||||
|
_dl_signal_error (0, reference_name, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
*ref = current_value.s;
|
||||||
|
return current_value.a;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Similar to _dl_lookup_symbol_skip but takes an additional argument
|
||||||
|
with the version we are looking for. */
|
||||||
|
ElfW(Addr)
|
||||||
|
_dl_lookup_versioned_symbol_skip (const char *undef_name,
|
||||||
|
const ElfW(Sym) **ref,
|
||||||
|
struct link_map *symbol_scope[],
|
||||||
|
const char *reference_name,
|
||||||
|
const char *version_name,
|
||||||
|
struct link_map *skip_map,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
const unsigned long int hash = _dl_elf_hash (undef_name);
|
||||||
|
struct sym_val current_value = { 0, NULL };
|
||||||
|
struct link_map **scope;
|
||||||
|
hash_name_pair version;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
/* First convert the VERSION_NAME into a `hash_name_pair' value. */
|
||||||
|
version.hash = _dl_elf_hash (version_name);
|
||||||
|
version.name = version_name;
|
||||||
|
|
||||||
|
/* Search the relevant loaded objects for a definition. */
|
||||||
|
scope = symbol_scope;
|
||||||
|
for (i = 0; (*scope)->l_dupsearchlist[i] != skip_map; ++i)
|
||||||
|
assert (i < (*scope)->l_ndupsearchlist);
|
||||||
|
|
||||||
|
if (! do_lookup (undef_name, hash, ref, ¤t_value,
|
||||||
|
(*scope)->l_dupsearchlist, i, (*scope)->l_ndupsearchlist,
|
||||||
|
reference_name, &version, skip_map, flags))
|
||||||
|
while (*++scope)
|
||||||
|
if (do_lookup (undef_name, hash, ref, ¤t_value,
|
||||||
|
(*scope)->l_dupsearchlist, 0, (*scope)->l_ndupsearchlist,
|
||||||
|
reference_name, &version, skip_map, flags))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
*ref = current_value.s;
|
*ref = current_value.s;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Storage management for the chain of loaded shared objects.
|
/* Storage management for the chain of loaded shared objects.
|
||||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -34,12 +34,15 @@ struct link_map *
|
|||||||
_dl_new_object (char *realname, const char *libname, int type)
|
_dl_new_object (char *realname, const char *libname, int type)
|
||||||
{
|
{
|
||||||
struct link_map *new = malloc (sizeof *new);
|
struct link_map *new = malloc (sizeof *new);
|
||||||
if (! new)
|
struct libname_list *newname = malloc (sizeof *newname);
|
||||||
|
if (! new || ! newname)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
memset (new, 0, sizeof *new);
|
memset (new, 0, sizeof *new);
|
||||||
new->l_name = realname;
|
new->l_name = realname;
|
||||||
new->l_libname = libname;
|
newname->name = libname;
|
||||||
|
newname->next = NULL;
|
||||||
|
new->l_libname = newname;
|
||||||
new->l_type = type;
|
new->l_type = type;
|
||||||
|
|
||||||
if (_dl_loaded == NULL)
|
if (_dl_loaded == NULL)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Load a shared object at runtime, relocate it, and run its initializer.
|
/* Load a shared object at runtime, relocate it, and run its initializer.
|
||||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -54,6 +54,8 @@ _dl_open (const char *file, int mode)
|
|||||||
/* Load that object's dependencies. */
|
/* Load that object's dependencies. */
|
||||||
_dl_map_object_deps (new, NULL, 0, 0);
|
_dl_map_object_deps (new, NULL, 0, 0);
|
||||||
|
|
||||||
|
/* So far, so good. Now check the versions. */
|
||||||
|
(void) _dl_check_map_versions (new, 0);
|
||||||
|
|
||||||
/* Relocate the objects loaded. We do this in reverse order so that copy
|
/* Relocate the objects loaded. We do this in reverse order so that copy
|
||||||
relocs of earlier objects overwrite the data written by later objects. */
|
relocs of earlier objects overwrite the data written by later objects. */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Relocate a shared object and resolve its references to other loaded objects.
|
/* Relocate a shared object and resolve its references to other loaded objects.
|
||||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -57,9 +57,12 @@ _dl_relocate_object (struct link_map *l, struct link_map *scope[], int lazy)
|
|||||||
= ((void *) l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr);
|
= ((void *) l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr);
|
||||||
|
|
||||||
/* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */
|
/* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */
|
||||||
#define RESOLVE(ref, flags) \
|
#define RESOLVE(ref, version, flags) \
|
||||||
(_dl_lookup_symbol (strtab + (*ref)->st_name, ref, scope, \
|
((version) != NULL && (version)->hash != 0 \
|
||||||
l->l_name, flags))
|
? _dl_lookup_versioned_symbol (strtab + (*ref)->st_name, (ref), scope, \
|
||||||
|
l->l_name, (version), (flags)) \
|
||||||
|
: _dl_lookup_symbol (strtab + (*ref)->st_name, (ref), scope, \
|
||||||
|
l->l_name, (flags)))
|
||||||
|
|
||||||
#include "dynamic-link.h"
|
#include "dynamic-link.h"
|
||||||
ELF_DYNAMIC_RELOCATE (l, lazy);
|
ELF_DYNAMIC_RELOCATE (l, lazy);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* On-demand PLT fixup for shared objects.
|
/* On-demand PLT fixup for shared objects.
|
||||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -74,15 +74,19 @@ _dl_object_relocation_scope (struct link_map *l)
|
|||||||
#define elf_machine_rel 1
|
#define elf_machine_rel 1
|
||||||
#define elf_machine_rela 2
|
#define elf_machine_rela 2
|
||||||
#if elf_machine_relplt == elf_machine_rel
|
#if elf_machine_relplt == elf_machine_rel
|
||||||
#define PLTREL ElfW(Rel)
|
# define PLTREL ElfW(Rel)
|
||||||
#elif elf_machine_relplt == elf_machine_rela
|
#elif elf_machine_relplt == elf_machine_rela
|
||||||
#define PLTREL ElfW(Rela)
|
# define PLTREL ElfW(Rela)
|
||||||
#else
|
#else
|
||||||
#error "dl-machine.h bug: elf_machine_relplt not rel or rela"
|
# error "dl-machine.h bug: elf_machine_relplt not rel or rela"
|
||||||
#endif
|
#endif
|
||||||
#undef elf_machine_rel
|
#undef elf_machine_rel
|
||||||
#undef elf_machine_rela
|
#undef elf_machine_rela
|
||||||
|
|
||||||
|
#ifndef VERSYMIDX
|
||||||
|
# define VERSYMIDX(sym) (DT_NUM + DT_PROCNUM + DT_VERSIONTAGIDX (sym))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* We need to define the function as a local symbol so that the reference
|
/* We need to define the function as a local symbol so that the reference
|
||||||
in the trampoline code will be a local PC-relative call. Tell the
|
in the trampoline code will be a local PC-relative call. Tell the
|
||||||
compiler not to worry that the function appears not to be called. */
|
compiler not to worry that the function appears not to be called. */
|
||||||
@ -122,13 +126,28 @@ fixup (
|
|||||||
|
|
||||||
{
|
{
|
||||||
/* This macro is used as a callback from the elf_machine_relplt code. */
|
/* This macro is used as a callback from the elf_machine_relplt code. */
|
||||||
#define RESOLVE(ref, flags) \
|
#define RESOLVE(ref, version, flags) \
|
||||||
(_dl_lookup_symbol (strtab + (*ref)->st_name, ref, scope, \
|
((version) != NULL && (version)->hash != 0 \
|
||||||
l->l_name, flags))
|
? _dl_lookup_versioned_symbol (strtab + (*ref)->st_name, (ref), scope, \
|
||||||
|
l->l_name, (version), (flags)) \
|
||||||
|
: _dl_lookup_symbol (strtab + (*ref)->st_name, (ref), scope, \
|
||||||
|
l->l_name, (flags)))
|
||||||
#include "dynamic-link.h"
|
#include "dynamic-link.h"
|
||||||
|
|
||||||
/* Perform the specified relocation. */
|
/* Perform the specified relocation. */
|
||||||
elf_machine_relplt (l, reloc, &symtab[ELFW(R_SYM) (reloc->r_info)]);
|
if (l->l_info[VERSYMIDX (DT_VERNEEDNUM)])
|
||||||
|
{
|
||||||
|
const ElfW(Half) * version =
|
||||||
|
(const ElfW(Half) *) (l->l_addr +
|
||||||
|
l->l_info[VERSYMIDX (DT_VERSYM)]->d_un.d_ptr);
|
||||||
|
ElfW(Half) ndx = version[ELFW(R_SYM) (reloc->r_info)];
|
||||||
|
|
||||||
|
elf_machine_relplt (l, reloc, &symtab[ELFW(R_SYM) (reloc->r_info)],
|
||||||
|
&l->l_versions[ndx]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
elf_machine_relplt (l, reloc, &symtab[ELFW(R_SYM) (reloc->r_info)],
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
*_dl_global_scope_end = NULL;
|
*_dl_global_scope_end = NULL;
|
||||||
|
337
elf/dl-version.c
Normal file
337
elf/dl-version.c
Normal file
@ -0,0 +1,337 @@
|
|||||||
|
/* Handle symbol and library versioning.
|
||||||
|
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <elf.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <link.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "../stdio-common/_itoa.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Set in rtld.c at startup. */
|
||||||
|
extern char **_dl_argv;
|
||||||
|
|
||||||
|
#define VERSTAG(tag) (DT_NUM + DT_PROCNUM + DT_VERSIONTAGIDX (tag))
|
||||||
|
|
||||||
|
|
||||||
|
#define make_string(string, rest...) \
|
||||||
|
({ \
|
||||||
|
const char *all[] = { string, ## rest }; \
|
||||||
|
size_t len, cnt; \
|
||||||
|
char *result, *cp; \
|
||||||
|
\
|
||||||
|
len = 1; \
|
||||||
|
for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt) \
|
||||||
|
len += strlen (all[cnt]); \
|
||||||
|
\
|
||||||
|
cp = result = alloca (len); \
|
||||||
|
for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt) \
|
||||||
|
cp = stpcpy (cp, all[cnt]); \
|
||||||
|
\
|
||||||
|
result; \
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
static inline struct link_map *
|
||||||
|
find_needed (struct link_map *map, const char *name)
|
||||||
|
{
|
||||||
|
unsigned int n;
|
||||||
|
|
||||||
|
for (n = 0; n < map->l_nsearchlist; ++n)
|
||||||
|
if (_dl_does_name_match_p (name, map->l_searchlist[n]))
|
||||||
|
return map->l_searchlist[n];
|
||||||
|
|
||||||
|
/* Should never happen. */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
match_symbol (const char *name, ElfW(Word) hash, const char *string,
|
||||||
|
struct link_map *map, int verbose, int weak)
|
||||||
|
{
|
||||||
|
const char *strtab = (const char *) (map->l_addr
|
||||||
|
+ map->l_info[DT_STRTAB]->d_un.d_ptr);
|
||||||
|
ElfW(Addr) def_offset = map->l_info[VERSTAG (DT_VERDEF)]->d_un.d_ptr;
|
||||||
|
ElfW(Verdef) *def;
|
||||||
|
|
||||||
|
if (def_offset == 0)
|
||||||
|
{
|
||||||
|
/* The file has no symbol versioning. I.e., the dependent
|
||||||
|
object was linked against another version of this file. We
|
||||||
|
only print a message if verbose output is requested. */
|
||||||
|
if (verbose)
|
||||||
|
_dl_signal_error (0, map->l_name, make_string ("\
|
||||||
|
no version information available (required by ",
|
||||||
|
name, ")"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
def = (ElfW(Verdef) *) (map->l_addr + def_offset);
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
/* Currently the version number of the definition entry is 1.
|
||||||
|
Make sure all we see is this version. */
|
||||||
|
if (def->vd_version != 1)
|
||||||
|
{
|
||||||
|
char buf[20];
|
||||||
|
buf[sizeof (buf) - 1] = '\0';
|
||||||
|
_dl_signal_error (0, map->l_name,
|
||||||
|
make_string ("unsupported version ",
|
||||||
|
_itoa_word (def->vd_version,
|
||||||
|
&buf[sizeof (buf) - 1],
|
||||||
|
10, 0),
|
||||||
|
" of Verdef record"));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Compare the hash values. */
|
||||||
|
if (hash == def->vd_hash)
|
||||||
|
{
|
||||||
|
ElfW(Verdaux) *aux = (ElfW(Verdaux) *) ((char *) def + def->vd_aux);
|
||||||
|
|
||||||
|
/* To be safe, compare the string as well. */
|
||||||
|
if (strcmp (string, strtab + aux->vda_name) == 0)
|
||||||
|
/* Bingo! */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If no more definitions we failed to find what we want. */
|
||||||
|
if (def->vd_next == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Next definition. */
|
||||||
|
def = (ElfW(Verdef) *) ((char *) def + def->vd_next);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Symbol not found. If it was a weak reference it is not fatal. */
|
||||||
|
if (weak)
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
|
_dl_signal_error (0, map->l_name,
|
||||||
|
make_string ("weak version `", string,
|
||||||
|
"' not found (required by ", name,
|
||||||
|
")"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_dl_signal_error (0, map->l_name,
|
||||||
|
make_string ("version `", string,
|
||||||
|
"' not found (required by ", name, ")"));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
_dl_check_map_versions (struct link_map *map, int verbose)
|
||||||
|
{
|
||||||
|
int result = 0;
|
||||||
|
const char *strtab = (const char *) (map->l_addr
|
||||||
|
+ map->l_info[DT_STRTAB]->d_un.d_ptr);
|
||||||
|
/* Pointer to section with needed versions. */
|
||||||
|
ElfW(Dyn) *dyn = map->l_info[VERSTAG (DT_VERNEED)];
|
||||||
|
/* Pointer to dynamic section with definitions. */
|
||||||
|
ElfW(Dyn) *def = map->l_info[VERSTAG (DT_VERDEF)];
|
||||||
|
/* We need to find out which is the highest version index used
|
||||||
|
in a dependecy. */
|
||||||
|
unsigned int ndx_high = 0;
|
||||||
|
|
||||||
|
if (dyn != NULL)
|
||||||
|
{
|
||||||
|
/* This file requires special versions from its dependencies. */
|
||||||
|
ElfW(Verneed) *ent = (ElfW(Verneed) *) (map->l_addr + dyn->d_un.d_ptr);
|
||||||
|
|
||||||
|
/* Currently the version number of the needed entry is 1.
|
||||||
|
Make sure all we see is this version. */
|
||||||
|
if (ent->vn_version != 1)
|
||||||
|
{
|
||||||
|
char buf[20];
|
||||||
|
buf[sizeof (buf) - 1] = '\0';
|
||||||
|
_dl_signal_error (0, (*map->l_name ? map->l_name : _dl_argv[0]),
|
||||||
|
make_string ("unsupported version ",
|
||||||
|
_itoa_word (ent->vn_version,
|
||||||
|
&buf[sizeof (buf) - 1],
|
||||||
|
10, 0),
|
||||||
|
" of Verneed record\n"));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
ElfW(Vernaux) *aux;
|
||||||
|
struct link_map *needed = find_needed (map, strtab + ent->vn_file);
|
||||||
|
|
||||||
|
/* If NEEDED is NULL this means a dependency was not found
|
||||||
|
and no stub entry was created. This should never happen. */
|
||||||
|
assert (needed != NULL);
|
||||||
|
|
||||||
|
/* NEEDED is the map for the file we need. Now look for the
|
||||||
|
dependency symbols. */
|
||||||
|
aux = (ElfW(Vernaux) *) ((char *) ent + ent->vn_aux);
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
/* Match the symbol. */
|
||||||
|
result |= match_symbol ((*map->l_name
|
||||||
|
? map->l_name : _dl_argv[0]),
|
||||||
|
aux->vna_hash,
|
||||||
|
strtab + aux->vna_name,
|
||||||
|
needed, verbose,
|
||||||
|
aux->vna_flags & VER_FLG_WEAK);
|
||||||
|
|
||||||
|
/* Compare the version index. */
|
||||||
|
if ((aux->vna_other & 0x7fff) > ndx_high)
|
||||||
|
ndx_high = aux->vna_other & 0x7fff;
|
||||||
|
|
||||||
|
if (aux->vna_next == 0)
|
||||||
|
/* No more symbols. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Next symbol. */
|
||||||
|
aux = (ElfW(Vernaux) *) ((char *) aux + aux->vna_next);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ent->vn_next == 0)
|
||||||
|
/* No more dependencies. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Next dependency. */
|
||||||
|
ent = (ElfW(Verneed) *) ((char *) ent + ent->vn_next);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We also must store the names of the defined versions. Determine
|
||||||
|
the maximum index here as well.
|
||||||
|
|
||||||
|
XXX We could avoid the loop by just taking the number of definitions
|
||||||
|
as an upper bound of new indeces. */
|
||||||
|
if (def != NULL)
|
||||||
|
{
|
||||||
|
ElfW(Verdef) *ent;
|
||||||
|
ent = (ElfW(Verdef) *) (map->l_addr + def->d_un.d_ptr);
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if ((ent->vd_ndx & 0x7fff) > ndx_high)
|
||||||
|
ndx_high = ent->vd_ndx & 0x7fff;
|
||||||
|
|
||||||
|
if (ent->vd_next == 0)
|
||||||
|
/* No more definitions. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
ent = (ElfW(Verdef) *) ((char *) ent + ent->vd_next);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ndx_high > 0)
|
||||||
|
{
|
||||||
|
/* Now we are ready to build the array with the version names
|
||||||
|
which can be indexed by the version index in the VERSYM
|
||||||
|
section. */
|
||||||
|
map->l_versions = (hash_name_pair*) malloc ((ndx_high + 1)
|
||||||
|
* sizeof (hash_name_pair));
|
||||||
|
memset (map->l_versions, '\0', (ndx_high + 1) * sizeof (hash_name_pair));
|
||||||
|
if (map->l_versions == NULL)
|
||||||
|
{
|
||||||
|
_dl_signal_error (ENOMEM, (*map->l_name ? map->l_name : _dl_argv[0]),
|
||||||
|
"cannot allocate version name table");
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Store the number of available symbols. */
|
||||||
|
map->l_nversions = ndx_high + 1;
|
||||||
|
|
||||||
|
if (dyn != NULL)
|
||||||
|
{
|
||||||
|
ElfW(Verneed) *ent;
|
||||||
|
ent = (ElfW(Verneed) *) (map->l_addr + dyn->d_un.d_ptr);
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
ElfW(Vernaux) *aux;
|
||||||
|
aux = (ElfW(Vernaux) *) ((char *) ent + ent->vn_aux);
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
ElfW(Half) ndx = aux->vna_other & 0x7fff;
|
||||||
|
map->l_versions[ndx].hash = aux->vna_hash;
|
||||||
|
map->l_versions[ndx].name = &strtab[aux->vna_name];
|
||||||
|
|
||||||
|
if (aux->vna_next == 0)
|
||||||
|
/* No more symbols. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Advance to next symbol. */
|
||||||
|
aux = (ElfW(Vernaux) *) ((char *) aux + aux->vna_next);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ent->vn_next == 0)
|
||||||
|
/* No more dependencies. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Advance to next dependency. */
|
||||||
|
ent = (ElfW(Verneed) *) ((char *) ent + ent->vn_next);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* And insert the defined versions. */
|
||||||
|
if (def != NULL)
|
||||||
|
{
|
||||||
|
ElfW(Verdef) *ent;
|
||||||
|
ent = (ElfW(Verdef) *) (map->l_addr + def->d_un.d_ptr);
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
ElfW(Verdaux) *aux;
|
||||||
|
aux = (ElfW(Verdaux) *) ((char *) ent + ent->vd_aux);
|
||||||
|
|
||||||
|
if ((ent->vd_flags & VER_FLG_BASE) == 0)
|
||||||
|
{
|
||||||
|
/* The name of the base version should not be
|
||||||
|
available for matching a versioned symbol. */
|
||||||
|
ElfW(Half) ndx = ent->vd_ndx & 0x7fff;
|
||||||
|
map->l_versions[ndx].hash = ent->vd_hash;
|
||||||
|
map->l_versions[ndx].name = &strtab[aux->vda_name];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ent->vd_next == 0)
|
||||||
|
/* No more definitions. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
ent = (ElfW(Verdef) *) ((char *) ent + ent->vd_next);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
_dl_check_all_versions (struct link_map *map, int verbose)
|
||||||
|
{
|
||||||
|
struct link_map *l;
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
for (l = map; l != NULL; l = l->l_next)
|
||||||
|
result |= _dl_check_map_versions (l, verbose);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/* dlerror -- Return error detail for failing <dlfcn.h> functions.
|
/* Return error detail for failing <dlfcn.h> functions.
|
||||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
13
elf/dlfcn.h
13
elf/dlfcn.h
@ -1,5 +1,5 @@
|
|||||||
/* dlfcn.h -- User functions for run-time dynamic loading.
|
/* User functions for run-time dynamic loading.
|
||||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -52,6 +52,15 @@ extern int dlclose __P ((void *__handle));
|
|||||||
of the symbol called NAME. */
|
of the symbol called NAME. */
|
||||||
extern void *dlsym __P ((void *__handle, __const char *__name));
|
extern void *dlsym __P ((void *__handle, __const char *__name));
|
||||||
|
|
||||||
|
#ifdef __USE_GNU
|
||||||
|
/* Find the run-time address in the shared object HANDLE refers to
|
||||||
|
of the symbol called NAME with VERSION. */
|
||||||
|
extern void *__dlvsym __P ((void *__handle, __const char *__name,
|
||||||
|
__const char *__version));
|
||||||
|
extern void *dlvsym __P ((void *__handle, __const char *__name,
|
||||||
|
__const char *__version));
|
||||||
|
#endif
|
||||||
|
|
||||||
/* When any of the above functions fails, call this function
|
/* When any of the above functions fails, call this function
|
||||||
to return a string describing the error. Each call resets
|
to return a string describing the error. Each call resets
|
||||||
the error string so that a following call returns null. */
|
the error string so that a following call returns null. */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* dlopen -- Load a shared object at run time.
|
/* Load a shared object at run time.
|
||||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* dlsym -- Look up a symbol in a shared object loaded by `dlopen'.
|
/* Look up a symbol in a shared object loaded by `dlopen'.
|
||||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
72
elf/dlvsym.c
Normal file
72
elf/dlvsym.c
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
/* Look up a symbol in a shared object loaded by `dlopen'.
|
||||||
|
Copyright (C) 1995, 1996, 1997 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
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <link.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
|
||||||
|
void *
|
||||||
|
__dlvsym (void *handle, const char *name, const char *version)
|
||||||
|
{
|
||||||
|
ElfW(Addr) caller = (ElfW(Addr)) __builtin_return_address (0);
|
||||||
|
ElfW(Addr) loadbase;
|
||||||
|
const ElfW(Sym) *ref = NULL;
|
||||||
|
void doit (void)
|
||||||
|
{
|
||||||
|
if (handle == NULL)
|
||||||
|
/* Search the global scope. */
|
||||||
|
loadbase = _dl_lookup_versioned_symbol
|
||||||
|
(name, &ref, &(_dl_global_scope ?: _dl_default_scope)[2], NULL,
|
||||||
|
version, 0);
|
||||||
|
else if (handle == RTLD_NEXT)
|
||||||
|
{
|
||||||
|
struct link_map *l, *match;
|
||||||
|
|
||||||
|
/* Find the highest-addressed object that CALLER is not below. */
|
||||||
|
match = NULL;
|
||||||
|
for (l = _dl_loaded; l; l = l->l_next)
|
||||||
|
if (caller >= l->l_addr && (!match || match->l_addr < l->l_addr))
|
||||||
|
match = l;
|
||||||
|
|
||||||
|
if (! match)
|
||||||
|
_dl_signal_error (0, NULL, _("\
|
||||||
|
RTLD_NEXT used in code not dynamically loaded"));
|
||||||
|
|
||||||
|
l = match;
|
||||||
|
while (l->l_loader)
|
||||||
|
l = l->l_loader;
|
||||||
|
|
||||||
|
loadbase = _dl_lookup_versioned_symbol_skip
|
||||||
|
(name, &ref, &_dl_loaded, NULL, version, l, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Search the scope of the given object. */
|
||||||
|
struct link_map *map = handle;
|
||||||
|
struct link_map *mapscope[2] = { map, NULL };
|
||||||
|
loadbase = _dl_lookup_versioned_symbol
|
||||||
|
(name, &ref, mapscope, map->l_name, version, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _dlerror_run (doit) ? NULL : (void *) (loadbase + ref->st_value);
|
||||||
|
}
|
||||||
|
weak_alias (__dlvsym, dlvsym)
|
36
elf/do-rel.h
36
elf/do-rel.h
@ -1,5 +1,5 @@
|
|||||||
/* Do relocations for ELF dynamic linking.
|
/* Do relocations for ELF dynamic linking.
|
||||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -21,11 +21,14 @@
|
|||||||
`elf_dynamic_do_rel' and `elf_dynamic_do_rela'. */
|
`elf_dynamic_do_rel' and `elf_dynamic_do_rela'. */
|
||||||
|
|
||||||
#ifdef DO_RELA
|
#ifdef DO_RELA
|
||||||
#define elf_dynamic_do_rel elf_dynamic_do_rela
|
# define elf_dynamic_do_rel elf_dynamic_do_rela
|
||||||
#define Rel Rela
|
# define Rel Rela
|
||||||
#define elf_machine_rel elf_machine_rela
|
# define elf_machine_rel elf_machine_rela
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef VERSYMIDX
|
||||||
|
# define VERSYMIDX(sym) (DT_NUM + DT_PROCNUM + DT_VERSIONTAGIDX (sym))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Perform the relocations in MAP on the running program image as specified
|
/* Perform the relocations in MAP on the running program image as specified
|
||||||
by RELTAG, SZTAG. If LAZY is nonzero, this is the first pass on PLT
|
by RELTAG, SZTAG. If LAZY is nonzero, this is the first pass on PLT
|
||||||
@ -37,8 +40,6 @@ elf_dynamic_do_rel (struct link_map *map,
|
|||||||
int reltag, int sztag,
|
int reltag, int sztag,
|
||||||
int lazy)
|
int lazy)
|
||||||
{
|
{
|
||||||
const ElfW(Sym) *const symtab
|
|
||||||
= (const ElfW(Sym) *) (map->l_addr + map->l_info[DT_SYMTAB]->d_un.d_ptr);
|
|
||||||
const ElfW(Rel) *r
|
const ElfW(Rel) *r
|
||||||
= (const ElfW(Rel) *) (map->l_addr + map->l_info[reltag]->d_un.d_ptr);
|
= (const ElfW(Rel) *) (map->l_addr + map->l_info[reltag]->d_un.d_ptr);
|
||||||
const ElfW(Rel) *end = &r[map->l_info[sztag]->d_un.d_val / sizeof *r];
|
const ElfW(Rel) *end = &r[map->l_info[sztag]->d_un.d_val / sizeof *r];
|
||||||
@ -48,8 +49,27 @@ elf_dynamic_do_rel (struct link_map *map,
|
|||||||
for (; r < end; ++r)
|
for (; r < end; ++r)
|
||||||
elf_machine_lazy_rel (map, r);
|
elf_machine_lazy_rel (map, r);
|
||||||
else
|
else
|
||||||
for (; r < end; ++r)
|
{
|
||||||
elf_machine_rel (map, r, &symtab[ELFW(R_SYM) (r->r_info)]);
|
const ElfW(Sym) *const symtab =
|
||||||
|
(const ElfW(Sym) *) (map->l_addr + map->l_info[DT_SYMTAB]->d_un.d_ptr);
|
||||||
|
|
||||||
|
if (map->l_info[VERSYMIDX (DT_VERNEEDNUM)])
|
||||||
|
{
|
||||||
|
const ElfW(Half) *const version =
|
||||||
|
(const ElfW(Half) *) (map->l_addr
|
||||||
|
+ map->l_info[VERSYMIDX (DT_VERSYM)]->d_un.d_ptr);
|
||||||
|
|
||||||
|
for (; r < end; ++r)
|
||||||
|
{
|
||||||
|
ElfW(Half) ndx = version[ELFW(R_SYM) (r->r_info)];
|
||||||
|
elf_machine_rel (map, r, &symtab[ELFW(R_SYM) (r->r_info)],
|
||||||
|
&map->l_versions[ndx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
for (; r < end; ++r)
|
||||||
|
elf_machine_rel (map, r, &symtab[ELFW(R_SYM) (r->r_info)], NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef elf_dynamic_do_rel
|
#undef elf_dynamic_do_rel
|
||||||
|
48
elf/elf.h
48
elf/elf.h
@ -504,6 +504,20 @@ typedef struct
|
|||||||
entry */
|
entry */
|
||||||
} Elf32_Verdef;
|
} Elf32_Verdef;
|
||||||
|
|
||||||
|
/* XXX We have no information what types should be used for 64 bit
|
||||||
|
architectures. What is following is only an intelligent guess. */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Elf64_Half vd_version; /* Version revision */
|
||||||
|
Elf64_Half vd_flags; /* Version information */
|
||||||
|
Elf64_Half vd_ndx; /* Version Index */
|
||||||
|
Elf64_Half vd_cnt; /* Number of associated aux entries */
|
||||||
|
Elf64_Word vd_hash; /* Version name hash value */
|
||||||
|
Elf64_Word vd_aux; /* Offset in bytes to verdaux array */
|
||||||
|
Elf64_Word vd_next; /* Offset in bytes to next verdef
|
||||||
|
entry */
|
||||||
|
} Elf64_Verdef;
|
||||||
|
|
||||||
/* Legal values for vd_version (version revision). */
|
/* Legal values for vd_version (version revision). */
|
||||||
#define VER_DEF_NONE 0 /* No version */
|
#define VER_DEF_NONE 0 /* No version */
|
||||||
#define VER_DEF_CURRENT 1 /* Current version */
|
#define VER_DEF_CURRENT 1 /* Current version */
|
||||||
@ -522,6 +536,15 @@ typedef struct
|
|||||||
entry */
|
entry */
|
||||||
} Elf32_Verdaux;
|
} Elf32_Verdaux;
|
||||||
|
|
||||||
|
/* XXX We have no information what types should be used for 64 bit
|
||||||
|
architectures. What is following is only an intelligent guess. */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Elf64_Addr vda_name; /* Version or dependency names */
|
||||||
|
Elf64_Word vda_next; /* Offset in bytes to next verdaux
|
||||||
|
entry */
|
||||||
|
} Elf64_Verdaux;
|
||||||
|
|
||||||
/* Version dependency section. */
|
/* Version dependency section. */
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -535,6 +558,19 @@ typedef struct
|
|||||||
entry */
|
entry */
|
||||||
} Elf32_Verneed;
|
} Elf32_Verneed;
|
||||||
|
|
||||||
|
/* XXX We have no information what types should be used for 64 bit
|
||||||
|
architectures. What is following is only an intelligent guess. */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Elf64_Half vn_version; /* Version of structure */
|
||||||
|
Elf64_Half vn_cnt; /* Number of associated aux entries */
|
||||||
|
Elf64_Addr vn_file; /* Offset of filename for this
|
||||||
|
dependency */
|
||||||
|
Elf64_Word vn_aux; /* Offset in bytes to vernaux array */
|
||||||
|
Elf64_Word vn_next; /* Offset in bytes to next verneed
|
||||||
|
entry */
|
||||||
|
} Elf64_Verneed;
|
||||||
|
|
||||||
/* Legal values for vn_version (version revision). */
|
/* Legal values for vn_version (version revision). */
|
||||||
#define VER_NEED_NONE 0 /* No version */
|
#define VER_NEED_NONE 0 /* No version */
|
||||||
#define VER_NEED_CURRENT 1 /* Current version */
|
#define VER_NEED_CURRENT 1 /* Current version */
|
||||||
@ -552,6 +588,18 @@ typedef struct
|
|||||||
entry */
|
entry */
|
||||||
} Elf32_Vernaux;
|
} Elf32_Vernaux;
|
||||||
|
|
||||||
|
/* XXX We have no information what types should be used for 64 bit
|
||||||
|
architectures. What is following is only an intelligent guess. */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Elf64_Word vna_hash; /* Hash value of dependency name */
|
||||||
|
Elf64_Half vna_flags; /* Dependency specific information */
|
||||||
|
Elf64_Half vna_other; /* Unused */
|
||||||
|
Elf64_Addr vna_name; /* Dependency name string offset */
|
||||||
|
Elf64_Word vna_next; /* Offset in bytes to next vernaux
|
||||||
|
entry */
|
||||||
|
} Elf64_Vernaux;
|
||||||
|
|
||||||
/* Legal values for vna_flags. */
|
/* Legal values for vna_flags. */
|
||||||
#define VER_FLG_WEAK 0x2 /* Weak verison identifier */
|
#define VER_FLG_WEAK 0x2 /* Weak verison identifier */
|
||||||
|
|
||||||
|
@ -29,7 +29,8 @@ TEXTDOMAIN=libc
|
|||||||
TEXTDOMAINDIR=@TEXTDOMAINDIR@
|
TEXTDOMAINDIR=@TEXTDOMAINDIR@
|
||||||
|
|
||||||
RTLD=@RTLD@
|
RTLD=@RTLD@
|
||||||
RELOCS=
|
warn=
|
||||||
|
bind_now=
|
||||||
|
|
||||||
while test $# -gt 0; do
|
while test $# -gt 0; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -49,12 +50,13 @@ Report bugs using the \`glibcbug' script to <bugs@gnu.ai.mit.edu>."
|
|||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
-d | --d | --da | --dat | --data | --data- | --data-r | --data-re | \
|
-d | --d | --da | --dat | --data | --data- | --data-r | --data-re | \
|
||||||
--data-rel | --data-relo | --data-reloc | --data-relocs)
|
--data-rel | --data-relo | --data-reloc | --data-relocs)
|
||||||
RELOCS='--data-relocs'
|
warn=yes
|
||||||
shift ;;
|
shift ;;
|
||||||
-r | --f | --fu | --fun | --func | --funct | --functi | --functio | \
|
-r | --f | --fu | --fun | --func | --funct | --functi | --functio | \
|
||||||
--function | --function- | --function-r | --function-re | --function-rel | \
|
--function | --function- | --function-r | --function-re | --function-rel | \
|
||||||
--function-relo | --function-reloc | --function-relocs)
|
--function-relo | --function-reloc | --function-relocs)
|
||||||
RELOCS='--function-relocs'
|
warn=yes
|
||||||
|
bind_now=yes
|
||||||
shift ;;
|
shift ;;
|
||||||
--) # Stop option processing.
|
--) # Stop option processing.
|
||||||
shift; break ;;
|
shift; break ;;
|
||||||
@ -85,7 +87,8 @@ case $# in
|
|||||||
test -x "$file" ||
|
test -x "$file" ||
|
||||||
echo $"ldd: warning: you do not have execution permission for" "\`$file'"
|
echo $"ldd: warning: you do not have execution permission for" "\`$file'"
|
||||||
if ${RTLD} --verify "$file"; then
|
if ${RTLD} --verify "$file"; then
|
||||||
LD_TRACE_LOADED_OBJECTS=1 exec ${RTLD} ${RELOCS} "$file" || exit 1
|
LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now \
|
||||||
|
exec ${RTLD} ${RELOCS} "$file" || exit 1
|
||||||
else
|
else
|
||||||
echo $" not a dynamic executable"
|
echo $" not a dynamic executable"
|
||||||
exit 1
|
exit 1
|
||||||
@ -111,7 +114,8 @@ case $# in
|
|||||||
test -x "$file" || echo $"\
|
test -x "$file" || echo $"\
|
||||||
ldd: warning: you do not have execution permission for" "\`$file'"
|
ldd: warning: you do not have execution permission for" "\`$file'"
|
||||||
if ${RTLD} --verify "$file"; then
|
if ${RTLD} --verify "$file"; then
|
||||||
LD_TRACE_LOADED_OBJECTS=1 ${RTLD} ${RELOCS} "$file" || result=1
|
LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now \
|
||||||
|
${RTLD} ${RELOCS} "$file" || result=1
|
||||||
else
|
else
|
||||||
echo $" not a dynamic executable"
|
echo $" not a dynamic executable"
|
||||||
result=1
|
result=1
|
||||||
|
@ -25,7 +25,8 @@
|
|||||||
# variable LD_TRACE_LOADED_OBJECTS to a non-empty value.
|
# variable LD_TRACE_LOADED_OBJECTS to a non-empty value.
|
||||||
|
|
||||||
RTLD=@RTLD@
|
RTLD=@RTLD@
|
||||||
RELOCS=
|
warn=
|
||||||
|
bind_now=
|
||||||
|
|
||||||
while test $# -gt 0; do
|
while test $# -gt 0; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -45,12 +46,13 @@ Report bugs using the \`glibcbug' script to <bugs@gnu.ai.mit.edu>."
|
|||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
-d | --d | --da | --dat | --data | --data- | --data-r | --data-re | \
|
-d | --d | --da | --dat | --data | --data- | --data-r | --data-re | \
|
||||||
--data-rel | --data-relo | --data-reloc | --data-relocs)
|
--data-rel | --data-relo | --data-reloc | --data-relocs)
|
||||||
RELOCS='--data-relocs'
|
warn=yes
|
||||||
shift ;;
|
shift ;;
|
||||||
-r | --f | --fu | --fun | --func | --funct | --functi | --functio | \
|
-r | --f | --fu | --fun | --func | --funct | --functi | --functio | \
|
||||||
--function | --function- | --function-r | --function-re | --function-rel | \
|
--function | --function- | --function-r | --function-re | --function-rel | \
|
||||||
--function-relo | --function-reloc | --function-relocs)
|
--function-relo | --function-reloc | --function-relocs)
|
||||||
RELOCS='--function-relocs'
|
warn=yes
|
||||||
|
bind_now=yes
|
||||||
shift ;;
|
shift ;;
|
||||||
--) # Stop option processing.
|
--) # Stop option processing.
|
||||||
shift; break ;;
|
shift; break ;;
|
||||||
@ -84,7 +86,8 @@ Try \`ldd --help' for more information."
|
|||||||
test -x "$file" ||
|
test -x "$file" ||
|
||||||
echo "ldd: warning: you do not have execution permission for \`$file'"
|
echo "ldd: warning: you do not have execution permission for \`$file'"
|
||||||
if ${RTLD} --verify "$file"; then
|
if ${RTLD} --verify "$file"; then
|
||||||
LD_TRACE_LOADED_OBJECTS=1 exec ${RTLD} ${RELOCS} "$file" || exit 1
|
LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now \
|
||||||
|
exec ${RTLD} "$file" || exit 1
|
||||||
else
|
else
|
||||||
echo ' not a dynamic executable'
|
echo ' not a dynamic executable'
|
||||||
exit 1
|
exit 1
|
||||||
@ -112,7 +115,8 @@ Try \`ldd --help' for more information."
|
|||||||
test -x "$file" || echo "\
|
test -x "$file" || echo "\
|
||||||
ldd: warning: you do not have execution permission for \`$file'"
|
ldd: warning: you do not have execution permission for \`$file'"
|
||||||
if ${RTLD} --verify "$file"; then
|
if ${RTLD} --verify "$file"; then
|
||||||
LD_TRACE_LOADED_OBJECTS=1 ${RTLD} ${RELOCS} "$file" || result=1
|
LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now \
|
||||||
|
${RTLD} "$file" || result=1
|
||||||
else
|
else
|
||||||
echo ' not a dynamic executable'
|
echo ' not a dynamic executable'
|
||||||
result=1
|
result=1
|
||||||
|
66
elf/link.h
66
elf/link.h
@ -74,6 +74,13 @@ extern struct r_debug _r_debug;
|
|||||||
|
|
||||||
extern ElfW(Dyn) _DYNAMIC[];
|
extern ElfW(Dyn) _DYNAMIC[];
|
||||||
|
|
||||||
|
/* For the version handling we need an array with only names and their
|
||||||
|
hash values. */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
ElfW(Word) hash;
|
||||||
|
} hash_name_pair;
|
||||||
|
|
||||||
/* Structure describing a loaded shared object. The `l_next' and `l_prev'
|
/* Structure describing a loaded shared object. The `l_next' and `l_prev'
|
||||||
members form a chain of all the shared objects loaded at startup.
|
members form a chain of all the shared objects loaded at startup.
|
||||||
@ -94,7 +101,11 @@ struct link_map
|
|||||||
/* All following members are internal to the dynamic linker.
|
/* All following members are internal to the dynamic linker.
|
||||||
They may change without notice. */
|
They may change without notice. */
|
||||||
|
|
||||||
const char *l_libname; /* Name requested (before search). */
|
struct libname_list
|
||||||
|
{
|
||||||
|
const char *name; /* Name requested (before search). */
|
||||||
|
struct libname_list *next; /* Link to next name for this object. */
|
||||||
|
} *l_libname;
|
||||||
/* Indexed pointers to dynamic section.
|
/* Indexed pointers to dynamic section.
|
||||||
[0,DT_NUM) are indexed by the processor-independent tags.
|
[0,DT_NUM) are indexed by the processor-independent tags.
|
||||||
[DT_NUM,DT_NUM+DT_PROCNUM) are indexed by the tag minus DT_LOPROC.
|
[DT_NUM,DT_NUM+DT_PROCNUM) are indexed by the tag minus DT_LOPROC.
|
||||||
@ -139,13 +150,34 @@ struct link_map
|
|||||||
unsigned int l_init_running:1; /* Nonzero while DT_INIT function runs. */
|
unsigned int l_init_running:1; /* Nonzero while DT_INIT function runs. */
|
||||||
unsigned int l_global:1; /* Nonzero if object in _dl_global_scope. */
|
unsigned int l_global:1; /* Nonzero if object in _dl_global_scope. */
|
||||||
unsigned int l_reserved:2; /* Reserved for internal use. */
|
unsigned int l_reserved:2; /* Reserved for internal use. */
|
||||||
|
|
||||||
|
/* Array with version names. */
|
||||||
|
unsigned int l_nversions;
|
||||||
|
hash_name_pair *l_versions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Test whether given NAME matches any of the names of the given object. */
|
||||||
|
static inline int
|
||||||
|
__attribute__ ((unused))
|
||||||
|
_dl_does_name_match_p (const char *__name, struct link_map *__map)
|
||||||
|
{
|
||||||
|
int __found = strcmp (__name, __map->l_name) == 0;
|
||||||
|
struct libname_list *__runp = __map->l_libname;
|
||||||
|
|
||||||
|
while (! __found && __runp != NULL)
|
||||||
|
if (strcmp (__name, __runp->name) == 0)
|
||||||
|
__found = 1;
|
||||||
|
else
|
||||||
|
__runp = __runp->next;
|
||||||
|
|
||||||
|
return __found;
|
||||||
|
}
|
||||||
|
|
||||||
/* Function used as argument for `_dl_receive_error' function. The
|
/* Function used as argument for `_dl_receive_error' function. The
|
||||||
arguments are the error string and the objname the error occurred
|
arguments are the error code, error string, and the objname the
|
||||||
in. */
|
error occurred in. */
|
||||||
typedef void (*receiver_fct) (const char *, const char *);
|
typedef void (*receiver_fct) (int, const char *, const char *);
|
||||||
|
|
||||||
/* Internal functions of the run-time dynamic linker.
|
/* Internal functions of the run-time dynamic linker.
|
||||||
These can be accessed if you link again the dynamic linker
|
These can be accessed if you link again the dynamic linker
|
||||||
@ -264,6 +296,14 @@ extern ElfW(Addr) _dl_lookup_symbol (const char *undef,
|
|||||||
const char *reference_name,
|
const char *reference_name,
|
||||||
int flags);
|
int flags);
|
||||||
|
|
||||||
|
/* Lookup versioned symbol. */
|
||||||
|
extern ElfW(Addr) _dl_lookup_versioned_symbol (const char *undef,
|
||||||
|
const ElfW(Sym) **sym,
|
||||||
|
struct link_map *symbol_scope[],
|
||||||
|
const char *reference_name,
|
||||||
|
const hash_name_pair *version,
|
||||||
|
int flags);
|
||||||
|
|
||||||
/* For handling RTLD_NEXT we must be able to skip shared objects. */
|
/* For handling RTLD_NEXT we must be able to skip shared objects. */
|
||||||
extern ElfW(Addr) _dl_lookup_symbol_skip (const char *undef,
|
extern ElfW(Addr) _dl_lookup_symbol_skip (const char *undef,
|
||||||
const ElfW(Sym) **sym,
|
const ElfW(Sym) **sym,
|
||||||
@ -272,6 +312,16 @@ extern ElfW(Addr) _dl_lookup_symbol_skip (const char *undef,
|
|||||||
struct link_map *skip_this,
|
struct link_map *skip_this,
|
||||||
int flags);
|
int flags);
|
||||||
|
|
||||||
|
/* For handling RTLD_NEXT with versioned symbols we must be able to
|
||||||
|
skip shared objects. */
|
||||||
|
extern ElfW(Addr) _dl_lookup_versioned_symbol_skip (const char *undef,
|
||||||
|
const ElfW(Sym) **sym,
|
||||||
|
struct link_map *symbol_scope[],
|
||||||
|
const char *reference_name,
|
||||||
|
const char *version_name,
|
||||||
|
struct link_map *skip_this,
|
||||||
|
int flags);
|
||||||
|
|
||||||
/* Look up symbol NAME in MAP's scope and return its run-time address. */
|
/* Look up symbol NAME in MAP's scope and return its run-time address. */
|
||||||
extern ElfW(Addr) _dl_symbol_value (struct link_map *map, const char *name);
|
extern ElfW(Addr) _dl_symbol_value (struct link_map *map, const char *name);
|
||||||
|
|
||||||
@ -319,6 +369,14 @@ extern void _dl_relocate_object (struct link_map *map,
|
|||||||
struct link_map *scope[],
|
struct link_map *scope[],
|
||||||
int lazy);
|
int lazy);
|
||||||
|
|
||||||
|
/* Check the version dependencies of all objects available through
|
||||||
|
MAP. If VERBOSE print some more diagnostics. */
|
||||||
|
extern int _dl_check_all_versions (struct link_map *map, int verbose);
|
||||||
|
|
||||||
|
/* Check the version dependencies for MAP. If VERBOSE print some more
|
||||||
|
diagnostics. */
|
||||||
|
extern int _dl_check_map_versions (struct link_map *map, int verbose);
|
||||||
|
|
||||||
/* Return the address of the next initializer function for MAP or one of
|
/* Return the address of the next initializer function for MAP or one of
|
||||||
its dependencies that has not yet been run. When there are no more
|
its dependencies that has not yet been run. When there are no more
|
||||||
initializers to be run, this returns zero. The functions are returned
|
initializers to be run, this returns zero. The functions are returned
|
||||||
|
77
elf/rtld.c
77
elf/rtld.c
@ -45,7 +45,12 @@ extern void *_dl_sysdep_read_whole_file (const char *filename,
|
|||||||
int mmap_prot);
|
int mmap_prot);
|
||||||
|
|
||||||
/* Helper function to handle errors while resolving symbols. */
|
/* Helper function to handle errors while resolving symbols. */
|
||||||
static void print_unresolved (const char *errstring, const char *objname);
|
static void print_unresolved (int errcode, const char *objname,
|
||||||
|
const char *errsting);
|
||||||
|
|
||||||
|
/* Helper function to handle errors when a version is missing. */
|
||||||
|
static void print_missing_version (int errcode, const char *objname,
|
||||||
|
const char *errsting);
|
||||||
|
|
||||||
|
|
||||||
int _dl_argc;
|
int _dl_argc;
|
||||||
@ -66,6 +71,7 @@ static void dl_main (const ElfW(Phdr) *phdr,
|
|||||||
ElfW(Addr) *user_entry);
|
ElfW(Addr) *user_entry);
|
||||||
|
|
||||||
struct link_map _dl_rtld_map;
|
struct link_map _dl_rtld_map;
|
||||||
|
struct libname_list _dl_rtld_libname;
|
||||||
|
|
||||||
#ifdef RTLD_START
|
#ifdef RTLD_START
|
||||||
RTLD_START
|
RTLD_START
|
||||||
@ -81,7 +87,7 @@ _dl_start (void *arg)
|
|||||||
/* This #define produces dynamic linking inline functions for
|
/* This #define produces dynamic linking inline functions for
|
||||||
bootstrap relocation instead of general-purpose relocation. */
|
bootstrap relocation instead of general-purpose relocation. */
|
||||||
#define RTLD_BOOTSTRAP
|
#define RTLD_BOOTSTRAP
|
||||||
#define RESOLVE(sym, flags) bootstrap_map.l_addr
|
#define RESOLVE(sym, version, flags) bootstrap_map.l_addr
|
||||||
#include "dynamic-link.h"
|
#include "dynamic-link.h"
|
||||||
|
|
||||||
/* Figure out the run-time load address of the dynamic linker itself. */
|
/* Figure out the run-time load address of the dynamic linker itself. */
|
||||||
@ -155,7 +161,8 @@ dl_main (const ElfW(Phdr) *phdr,
|
|||||||
/* LAZY is determined by the parameters --datadeps and --function-deps
|
/* LAZY is determined by the parameters --datadeps and --function-deps
|
||||||
if we trace the binary. */
|
if we trace the binary. */
|
||||||
if (mode == trace)
|
if (mode == trace)
|
||||||
lazy = -1;
|
lazy = (*(getenv ("LD_WARN") ?: "") == '\0' ? -1
|
||||||
|
: (*(getenv ("LD_BIND_NOW") ?: "") == '\0' ? 1 : 0));
|
||||||
else
|
else
|
||||||
lazy = !__libc_enable_secure && *(getenv ("LD_BIND_NOW") ?: "") == '\0';
|
lazy = !__libc_enable_secure && *(getenv ("LD_BIND_NOW") ?: "") == '\0';
|
||||||
|
|
||||||
@ -212,24 +219,6 @@ of this helper program; chances are you did not intend to run this program.\n",
|
|||||||
{
|
{
|
||||||
mode = verify;
|
mode = verify;
|
||||||
|
|
||||||
++_dl_skip_args;
|
|
||||||
--_dl_argc;
|
|
||||||
++_dl_argv;
|
|
||||||
}
|
|
||||||
else if (! strcmp (_dl_argv[1], "--data-relocs"))
|
|
||||||
{
|
|
||||||
mode = trace;
|
|
||||||
lazy = 1; /* This means do only data relocation analysis. */
|
|
||||||
|
|
||||||
++_dl_skip_args;
|
|
||||||
--_dl_argc;
|
|
||||||
++_dl_argv;
|
|
||||||
}
|
|
||||||
else if (! strcmp (_dl_argv[1], "--function-relocs"))
|
|
||||||
{
|
|
||||||
mode = trace;
|
|
||||||
lazy = 0; /* This means do also function relocation analysis. */
|
|
||||||
|
|
||||||
++_dl_skip_args;
|
++_dl_skip_args;
|
||||||
--_dl_argc;
|
--_dl_argc;
|
||||||
++_dl_argv;
|
++_dl_argv;
|
||||||
@ -307,12 +296,19 @@ of this helper program; chances are you did not intend to run this program.\n",
|
|||||||
dlopen call or DT_NEEDED entry, for something that wants to link
|
dlopen call or DT_NEEDED entry, for something that wants to link
|
||||||
against the dynamic linker as a shared library, will know that
|
against the dynamic linker as a shared library, will know that
|
||||||
the shared object is already loaded. */
|
the shared object is already loaded. */
|
||||||
_dl_rtld_map.l_libname = (const char *) l->l_addr + ph->p_vaddr;
|
_dl_rtld_libname.name = (const char *) l->l_addr + ph->p_vaddr;
|
||||||
|
_dl_rtld_libname.next = NULL;
|
||||||
|
_dl_rtld_map.l_libname = &_dl_rtld_libname;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (! _dl_rtld_map.l_libname && _dl_rtld_map.l_name)
|
if (! _dl_rtld_map.l_libname && _dl_rtld_map.l_name)
|
||||||
/* We were invoked directly, so the program might not have a PT_INTERP. */
|
{
|
||||||
_dl_rtld_map.l_libname = _dl_rtld_map.l_name;
|
/* We were invoked directly, so the program might not have a
|
||||||
|
PT_INTERP. */
|
||||||
|
_dl_rtld_libname.name = _dl_rtld_map.l_name;
|
||||||
|
_dl_rtld_libname.next = NULL;
|
||||||
|
_dl_rtld_map.l_libname = &_dl_rtld_libname;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
assert (_dl_rtld_map.l_libname); /* How else did we get here? */
|
assert (_dl_rtld_map.l_libname); /* How else did we get here? */
|
||||||
|
|
||||||
@ -332,7 +328,7 @@ of this helper program; chances are you did not intend to run this program.\n",
|
|||||||
if (! _dl_rtld_map.l_name)
|
if (! _dl_rtld_map.l_name)
|
||||||
/* If not invoked directly, the dynamic linker shared object file was
|
/* If not invoked directly, the dynamic linker shared object file was
|
||||||
found by the PT_INTERP name. */
|
found by the PT_INTERP name. */
|
||||||
_dl_rtld_map.l_name = (char *) _dl_rtld_map.l_libname;
|
_dl_rtld_map.l_name = (char *) _dl_rtld_map.l_libname->name;
|
||||||
_dl_rtld_map.l_type = lt_library;
|
_dl_rtld_map.l_type = lt_library;
|
||||||
while (l->l_next)
|
while (l->l_next)
|
||||||
l = l->l_next;
|
l = l->l_next;
|
||||||
@ -481,6 +477,19 @@ of this helper program; chances are you did not intend to run this program.\n",
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Now let us see whether all libraries are available in the
|
||||||
|
versions we need. */
|
||||||
|
{
|
||||||
|
void doit (void)
|
||||||
|
{
|
||||||
|
if (_dl_check_all_versions (l, 1) && mode == normal)
|
||||||
|
/* We cannot start the application. Abort now. */
|
||||||
|
_exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
_dl_receive_error (print_missing_version, doit);
|
||||||
|
}
|
||||||
|
|
||||||
if (mode != normal)
|
if (mode != normal)
|
||||||
{
|
{
|
||||||
/* We were run just to list the shared libraries. It is
|
/* We were run just to list the shared libraries. It is
|
||||||
@ -496,7 +505,8 @@ of this helper program; chances are you did not intend to run this program.\n",
|
|||||||
for (l = _dl_loaded->l_next; l; l = l->l_next)
|
for (l = _dl_loaded->l_next; l; l = l->l_next)
|
||||||
if (l->l_opencount == 0)
|
if (l->l_opencount == 0)
|
||||||
/* The library was not found. */
|
/* The library was not found. */
|
||||||
_dl_sysdep_message ("\t", l->l_libname, " => not found\n", NULL);
|
_dl_sysdep_message ("\t", l->l_libname->name, " => not found\n",
|
||||||
|
NULL);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buf[20], *bp;
|
char buf[20], *bp;
|
||||||
@ -505,7 +515,7 @@ of this helper program; chances are you did not intend to run this program.\n",
|
|||||||
while ((size_t) (&buf[sizeof buf - 1] - bp)
|
while ((size_t) (&buf[sizeof buf - 1] - bp)
|
||||||
< sizeof l->l_addr * 2)
|
< sizeof l->l_addr * 2)
|
||||||
*--bp = '0';
|
*--bp = '0';
|
||||||
_dl_sysdep_message ("\t", l->l_libname, " => ", l->l_name,
|
_dl_sysdep_message ("\t", l->l_libname->name, " => ", l->l_name,
|
||||||
" (0x", bp, ")\n", NULL);
|
" (0x", bp, ")\n", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,7 +639,18 @@ of this helper program; chances are you did not intend to run this program.\n",
|
|||||||
/* This is a little helper function for resolving symbols while
|
/* This is a little helper function for resolving symbols while
|
||||||
tracing the binary. */
|
tracing the binary. */
|
||||||
static void
|
static void
|
||||||
print_unresolved (const char *errstring, const char *objname)
|
print_unresolved (int errcode __attribute__ ((unused)), const char *objname,
|
||||||
|
const char *errstring)
|
||||||
{
|
{
|
||||||
_dl_sysdep_error (errstring, " (", objname, ")\n", NULL);
|
_dl_sysdep_error (errstring, " (", objname, ")\n", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is a little helper function for resolving symbols while
|
||||||
|
tracing the binary. */
|
||||||
|
static void
|
||||||
|
print_missing_version (int errcode __attribute__ ((unused)),
|
||||||
|
const char *objname, const char *errstring)
|
||||||
|
{
|
||||||
|
_dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>", ": ",
|
||||||
|
objname, ": ", errstring, "\n", NULL);
|
||||||
|
}
|
||||||
|
@ -190,7 +190,7 @@
|
|||||||
/* Major and minor version number of the GNU C library package. Use
|
/* Major and minor version number of the GNU C library package. Use
|
||||||
these macros to test for features in specific releases. */
|
these macros to test for features in specific releases. */
|
||||||
#define __GLIBC__ 2
|
#define __GLIBC__ 2
|
||||||
#define __GLIBC_MINOR__ 0
|
#define __GLIBC_MINOR__ 1
|
||||||
|
|
||||||
|
|
||||||
#if !defined __GNUC__ || __GNUC__ < 2
|
#if !defined __GNUC__ || __GNUC__ < 2
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
Contributed by David Mosberger (davidm@cs.arizona.edu).
|
Contributed by David Mosberger (davidm@cs.arizona.edu).
|
||||||
|
|
||||||
This file is part of the GNU C Library.
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
modify it under the terms of the GNU Library General Public License as
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
published by the Free Software Foundation; either version 2 of the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
License, or (at your option) any later version.
|
Library General Public License for more details.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
You should have received a copy of the GNU Library General Public
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Library General Public License for more details.
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
|
||||||
Cambridge, MA 02139, USA. */
|
|
||||||
|
|
||||||
/* __bb_exit_func() dumps all the basic-block statistics linked into
|
/* __bb_exit_func() dumps all the basic-block statistics linked into
|
||||||
the bb_head chain to .d files. */
|
the bb_head chain to .d files. */
|
||||||
@ -24,19 +23,19 @@ Cambridge, MA 02139, USA. */
|
|||||||
#include <sys/gmon_out.h>
|
#include <sys/gmon_out.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <ansidecl.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
/* structure emitted by -a */
|
/* structure emitted by -a */
|
||||||
struct bb {
|
struct bb
|
||||||
long zero_word;
|
{
|
||||||
const char *filename;
|
long int zero_word;
|
||||||
long *counts;
|
const char *filename;
|
||||||
long ncounts;
|
long int *counts;
|
||||||
struct bb *next;
|
long int ncounts;
|
||||||
const unsigned long *addresses;
|
struct bb *next;
|
||||||
};
|
const unsigned long int *addresses;
|
||||||
|
};
|
||||||
|
|
||||||
extern struct bb *__bb_head; /* from gmon.c */
|
extern struct bb *__bb_head; /* from gmon.c */
|
||||||
|
|
||||||
@ -44,35 +43,37 @@ extern struct bb *__bb_head; /* from gmon.c */
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DEFUN_VOID(__bb_exit_func)
|
__bb_exit_func (void)
|
||||||
{
|
{
|
||||||
const int version = GMON_VERSION;
|
const int version = GMON_VERSION;
|
||||||
struct gmon_hdr ghdr;
|
struct gmon_hdr ghdr;
|
||||||
struct bb *ptr;
|
struct bb *ptr;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
fp = fopen(OUT_NAME, "wb");
|
fp = fopen (OUT_NAME, "wb");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
perror(OUT_NAME);
|
perror (OUT_NAME);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bcopy(GMON_MAGIC, &ghdr.cookie[0], 4);
|
bcopy (GMON_MAGIC, &ghdr.cookie[0], 4);
|
||||||
bcopy(&version, &ghdr.version, sizeof(version));
|
bcopy (&version, &ghdr.version, sizeof (version));
|
||||||
fwrite(&ghdr, sizeof(ghdr), 1, fp);
|
fwrite (&ghdr, sizeof (ghdr), 1, fp);
|
||||||
|
|
||||||
for (ptr = __bb_head; ptr != 0; ptr = ptr->next) {
|
for (ptr = __bb_head; ptr != 0; ptr = ptr->next)
|
||||||
u_int ncounts = ptr->ncounts;
|
{
|
||||||
u_char tag;
|
u_int ncounts = ptr->ncounts;
|
||||||
u_int i;
|
u_char tag;
|
||||||
|
u_int i;
|
||||||
|
|
||||||
tag = GMON_TAG_BB_COUNT;
|
tag = GMON_TAG_BB_COUNT;
|
||||||
fwrite(&tag, sizeof(tag), 1, fp);
|
fwrite (&tag, sizeof (tag), 1, fp);
|
||||||
fwrite(&ncounts, sizeof(ncounts), 1, fp);
|
fwrite (&ncounts, sizeof (ncounts), 1, fp);
|
||||||
|
|
||||||
for (i = 0; i < ncounts; ++i) {
|
for (i = 0; i < ncounts; ++i)
|
||||||
fwrite(&ptr->addresses[i], sizeof(ptr->addresses[0]), 1, fp);
|
{
|
||||||
fwrite(&ptr->counts[i], sizeof(ptr->counts[0]), 1, fp);
|
fwrite (&ptr->addresses[i], sizeof (ptr->addresses[0]), 1, fp);
|
||||||
|
fwrite (&ptr->counts[i], sizeof (ptr->counts[0]), 1, fp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
|
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
|
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
|
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
|
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
|
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
|
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/fd.h>
|
#include <hurd/fd.h>
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <mach/exc_server.h>
|
#include <mach/exc_server.h>
|
||||||
#include <hurd/signal.h>
|
#include <hurd/signal.h>
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* _hurd_ctty_input -- Do an input RPC and generate SIGTTIN if necessary.
|
/* _hurd_ctty_input -- Do an input RPC and generate SIGTTIN if necessary.
|
||||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/signal.h>
|
#include <hurd/signal.h>
|
||||||
@ -52,7 +52,7 @@ _hurd_ctty_input (io_t port, io_t ctty, error_t (*rpc) (io_t))
|
|||||||
if (err == EBACKGROUND)
|
if (err == EBACKGROUND)
|
||||||
{
|
{
|
||||||
/* Send a SIGTTIN signal to our process group.
|
/* Send a SIGTTIN signal to our process group.
|
||||||
|
|
||||||
We must remember here not to clobber ERR, since
|
We must remember here not to clobber ERR, since
|
||||||
the loop condition below uses it to recall that
|
the loop condition below uses it to recall that
|
||||||
we should retry after a stop. */
|
we should retry after a stop. */
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* _hurd_ctty_output -- Do an output RPC and generate SIGTTOU if necessary.
|
/* _hurd_ctty_output -- Do an output RPC and generate SIGTTOU if necessary.
|
||||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/signal.h>
|
#include <hurd/signal.h>
|
||||||
@ -57,7 +57,7 @@ _hurd_ctty_output (io_t port, io_t ctty, error_t (*rpc) (io_t))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Send a SIGTTOU signal to our process group.
|
/* Send a SIGTTOU signal to our process group.
|
||||||
|
|
||||||
We must remember here not to clobber ERR, since
|
We must remember here not to clobber ERR, since
|
||||||
the loop condition below uses it to recall that
|
the loop condition below uses it to recall that
|
||||||
we should retry after a stop. */
|
we should retry after a stop. */
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <ansidecl.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/fd.h>
|
#include <hurd/fd.h>
|
||||||
@ -24,7 +23,7 @@ Cambridge, MA 02139, USA. */
|
|||||||
|
|
||||||
/* Change the current root directory to FD. */
|
/* Change the current root directory to FD. */
|
||||||
int
|
int
|
||||||
DEFUN(fchroot, (fd), int fd)
|
fchroot (int fd)
|
||||||
{
|
{
|
||||||
error_t err;
|
error_t err;
|
||||||
file_t dir;
|
file_t dir;
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
/* Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd/fd.h>
|
#include <hurd/fd.h>
|
||||||
|
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
/* Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* _hurd_fd_write -- write to a file descriptor; handles job control et al.
|
/* _hurd_fd_write -- write to a file descriptor; handles job control et al.
|
||||||
Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
/* Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
/* Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <ansidecl.h>
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -87,7 +86,7 @@ static const __io_functions funcsio = { readio, writeio, seekio, closeio };
|
|||||||
|
|
||||||
|
|
||||||
/* Defined in fopen.c. */
|
/* Defined in fopen.c. */
|
||||||
extern int EXFUN(__getmode, (CONST char *mode, __io_mode *mptr));
|
extern int __getmode (const char *mode, __io_mode *mptr);
|
||||||
|
|
||||||
|
|
||||||
/* Open a stream on PORT. MODE is as for fopen. */
|
/* Open a stream on PORT. MODE is as for fopen. */
|
||||||
@ -119,7 +118,7 @@ __fopenport (mach_port_t port, const char *mode)
|
|||||||
if (stream == NULL)
|
if (stream == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
stream->__cookie = (PTR) port;
|
stream->__cookie = (void *) port;
|
||||||
stream->__mode = m;
|
stream->__mode = m;
|
||||||
stream->__io_funcs = funcsio;
|
stream->__io_funcs = funcsio;
|
||||||
stream->__room_funcs = __default_room_functions;
|
stream->__room_funcs = __default_room_functions;
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Get a host configuration item kept as the whole contents of a file.
|
/* Get a host configuration item kept as the whole contents of a file.
|
||||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 1992, 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ __getdport (int fd)
|
|||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return MACH_PORT_NULL;
|
return MACH_PORT_NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__mach_port_mod_refs (__mach_task_self (), _hurd_init_dtable[fd],
|
__mach_port_mod_refs (__mach_task_self (), _hurd_init_dtable[fd],
|
||||||
MACH_PORT_RIGHT_SEND, 1);
|
MACH_PORT_RIGHT_SEND, 1);
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/id.h>
|
#include <hurd/id.h>
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1992 Free Software Foundation, Inc.
|
/* Copyright (C) 1992, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
|
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/signal.h>
|
#include <hurd/signal.h>
|
||||||
|
28
hurd/hurd.h
28
hurd/hurd.h
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _HURD_H
|
#ifndef _HURD_H
|
||||||
|
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* File descriptors.
|
/* File descriptors.
|
||||||
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _HURD_FD_H
|
#ifndef _HURD_FD_H
|
||||||
|
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* User and group IDs.
|
/* User and group IDs.
|
||||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
Copyright (C) 1993, 1994, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _HURD_ID_H
|
#ifndef _HURD_ID_H
|
||||||
|
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* User-registered handlers for specific `ioctl' requests.
|
/* User-registered handlers for specific `ioctl' requests.
|
||||||
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _HURD_IOCTL_H
|
#ifndef _HURD_IOCTL_H
|
||||||
#define _HURD_IOCTL_H 1
|
#define _HURD_IOCTL_H 1
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Declarations of file name translation functions for the GNU Hurd.
|
/* Declarations of file name translation functions for the GNU Hurd.
|
||||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _HURD_LOOKUP_H
|
#ifndef _HURD_LOOKUP_H
|
||||||
#define _HURD_LOOKUP_H 1
|
#define _HURD_LOOKUP_H 1
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Lightweight user references for ports.
|
/* Lightweight user references for ports.
|
||||||
Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _HURD_PORT_H
|
#ifndef _HURD_PORT_H
|
||||||
|
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Resource limits for the Hurd.
|
/* Resource limits for the Hurd.
|
||||||
Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _HURD_RESOURCE_H
|
#ifndef _HURD_RESOURCE_H
|
||||||
#define _HURD_RESOURCE_H
|
#define _HURD_RESOURCE_H
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Internal per-thread variables for the Hurd.
|
/* Internal per-thread variables for the Hurd.
|
||||||
Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _HURD_THREADVAR_H
|
#ifndef _HURD_THREADVAR_H
|
||||||
#define _HURD_THREADVAR_H
|
#define _HURD_THREADVAR_H
|
||||||
@ -33,7 +33,7 @@ Cambridge, MA 02139, USA. */
|
|||||||
stack pointer is ignored; and __hurd_threadvar_stack_offset gives the
|
stack pointer is ignored; and __hurd_threadvar_stack_offset gives the
|
||||||
address of a small allocated region which contains the variables for the
|
address of a small allocated region which contains the variables for the
|
||||||
single thread. */
|
single thread. */
|
||||||
|
|
||||||
extern unsigned long int __hurd_threadvar_stack_mask;
|
extern unsigned long int __hurd_threadvar_stack_mask;
|
||||||
extern unsigned long int __hurd_threadvar_stack_offset;
|
extern unsigned long int __hurd_threadvar_stack_offset;
|
||||||
|
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Support for chains recording users of a resource; `struct hurd_userlink'.
|
/* Support for chains recording users of a resource; `struct hurd_userlink'.
|
||||||
Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _HURD_USERLINK_H
|
#ifndef _HURD_USERLINK_H
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ Cambridge, MA 02139, USA. */
|
|||||||
|
|
||||||
/* This structure records a link in two doubly-linked lists.
|
/* This structure records a link in two doubly-linked lists.
|
||||||
We call these the per-resource user list and the per-thread
|
We call these the per-resource user list and the per-thread
|
||||||
active-resource list.
|
active-resource list.
|
||||||
|
|
||||||
Users of a given resource are recorded by their presence in a list
|
Users of a given resource are recorded by their presence in a list
|
||||||
associated with that resource. A user attaches his own link (in local
|
associated with that resource. A user attaches his own link (in local
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 92, 93, 94, 95, 97 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/msg_server.h>
|
#include <hurd/msg_server.h>
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Host configuration items kept as the whole contents of a file.
|
/* Host configuration items kept as the whole contents of a file.
|
||||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
/* Fetch and atomically store the contents of the file ITEM.
|
/* Fetch and atomically store the contents of the file ITEM.
|
||||||
Returns the size read or written, or -1 for errors.
|
Returns the size read or written, or -1 for errors.
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
/* Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/id.h>
|
#include <hurd/id.h>
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1992, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* ioctl commands which must be done in the C library.
|
/* ioctl commands which must be done in the C library.
|
||||||
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/fd.h>
|
#include <hurd/fd.h>
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1992, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/lookup.h>
|
#include <hurd/lookup.h>
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1992, 1994, 1995, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1992, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/msg_server.h>
|
#include <hurd/msg_server.h>
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 92, 93, 94, 95, 97 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
pid_t _hurd_pid, _hurd_ppid, _hurd_pgrp;
|
pid_t _hurd_pid, _hurd_ppid, _hurd_pgrp;
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/port.h>
|
#include <hurd/port.h>
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Support code for dealing with priorities in the Hurd.
|
/* Support code for dealing with priorities in the Hurd.
|
||||||
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd/resource.h>
|
#include <hurd/resource.h>
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Resource limits.
|
/* Resource limits.
|
||||||
Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <cthreads.h>
|
#include <cthreads.h>
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
/* _hurd_socket_server - Find the server for a socket domain.
|
/* _hurd_socket_server - Find the server for a socket domain.
|
||||||
|
Copyright (C) 1991, 92, 93, 94, 95, 97 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
This file is part of the GNU C Library.
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
modify it under the terms of the GNU Library General Public License as
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
published by the Free Software Foundation; either version 2 of the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
License, or (at your option) any later version.
|
Library General Public License for more details.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
You should have received a copy of the GNU Library General Public
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Library General Public License for more details.
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
|
||||||
Cambridge, MA 02139, USA. */
|
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Initial program startup for running under the GNU Hurd.
|
/* Initial program startup for running under the GNU Hurd.
|
||||||
Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Data from initial program startup for running under the GNU Hurd.
|
/* Data from initial program startup for running under the GNU Hurd.
|
||||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#ifndef _HURDSTARTUP_H
|
#ifndef _HURDSTARTUP_H
|
||||||
#define _HURDSTARTUP_H 1
|
#define _HURDSTARTUP_H 1
|
||||||
@ -31,7 +31,7 @@ Cambridge, MA 02139, USA. */
|
|||||||
char *envp_terminator = NULL;
|
char *envp_terminator = NULL;
|
||||||
struct hurd_startup_data data;
|
struct hurd_startup_data data;
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct hurd_startup_data
|
struct hurd_startup_data
|
||||||
{
|
{
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/* Copyright (C) 1994 Free Software Foundation, Inc.
|
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/fd.h>
|
#include <hurd/fd.h>
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Replacement for mach_msg used in interruptible Hurd RPCs.
|
/* Replacement for mach_msg used in interruptible Hurd RPCs.
|
||||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <mach.h>
|
#include <mach.h>
|
||||||
#include <mach/mig_errors.h>
|
#include <mach/mig_errors.h>
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Special MiG definitions for interruptible RPC stubs.
|
/* Special MiG definitions for interruptible RPC stubs.
|
||||||
Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
/* Cause user stubs for interruptible RPCs to import a special header to
|
/* Cause user stubs for interruptible RPCs to import a special header to
|
||||||
modify their behavior. */
|
modify their behavior. */
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/* Special MiG definitions for interruptible RPC stubs.
|
/* Special MiG definitions for interruptible RPC stubs.
|
||||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of the
|
published by the Free Software Foundation; either version 2 of the
|
||||||
License, or (at your option) any later version.
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
/* This file is imported by the MiG-generated user stubs for interruptible
|
/* This file is imported by the MiG-generated user stubs for interruptible
|
||||||
RPCs. We modify them to use our own function in place of mach_msg. */
|
RPCs. We modify them to use our own function in place of mach_msg. */
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
/* Demux messages sent on the signal port.
|
/* Demux messages sent on the signal port.
|
||||||
|
Copyright (C) 1991, 1992, 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc.
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
This file is part of the GNU C Library.
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
modify it under the terms of the GNU Library General Public License as
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
published by the Free Software Foundation; either version 2 of the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
License, or (at your option) any later version.
|
Library General Public License for more details.
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
You should have received a copy of the GNU Library General Public
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Library General Public License for more details.
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
|
||||||
Cambridge, MA 02139, USA. */
|
|
||||||
|
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/signal.h>
|
#include <hurd/signal.h>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user