diff options
-rw-r--r-- | ChangeLog | 51 | ||||
-rw-r--r-- | Makefile | 26 | ||||
-rw-r--r-- | Makerules | 11 | ||||
-rw-r--r-- | db2/Versions | 51 | ||||
-rw-r--r-- | libio/Versions | 27 | ||||
-rw-r--r-- | libio/iofread_u.c | 1 | ||||
-rw-r--r-- | libio/iofwrite_u.c | 1 | ||||
-rw-r--r-- | nis/nss_nis/nis-pwd.c | 207 | ||||
-rw-r--r-- | posix/Makefile | 5 | ||||
-rw-r--r-- | posix/annexc.c | 23 | ||||
-rw-r--r-- | stdio-common/Versions | 19 | ||||
-rw-r--r-- | stdio-common/test_rdwr.c | 2 | ||||
-rw-r--r-- | stdio/Versions | 45 | ||||
-rw-r--r-- | versions.awk | 29 |
14 files changed, 392 insertions, 106 deletions
@@ -1,3 +1,54 @@ +1998-07-06 14:36 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * posix/Makefile (generated): Remove $(objpfx) from the names. + +1998-07-05 Andreas Jaeger <aj@arthur.rhein-neckar.de> + + * stdio-common/test_rdwr.c: Use %Zu for size_t in printf + format string. + + * libio/iofread_u.c: Include <stdio.h> for prototype. + * libio/iofwrite_u.c: Likewise. + +1998-07-06 Andreas Jaeger <aj@arthur.rhein-neckar.de> + + * db2/Versions: New file. + +1998-07-04 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * Makefile (lib-noranlib): Don't depend on sysd-versions. + ($(common-objpfx)sysd-versions): Remove rule. + * Makerules ($(common-objpfx)sysd-versions): Define here instead. + Pass name of Versions.def file to script and redirect output to + target. Include it and make all generated version maps depend on + it. + * versions.awk: Print out variable definition containing all + generated version maps. Print error messages to stderr. Remove + temp file. + +1998-07-04 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * posix/annexc.c (check_header): Terminate macro name before + comparing. + (get_null_defines): Allow builtin macros with parameters. + (fmt, testfmt): Add -D_LIBC. + * posix/Makefile: Remove bogus duplicate include directories from + annexc test command. + +1998-07-06 12:04 Ulrich Drepper <drepper@cygnus.com> + + * nis/nss_nis/nis-pwd.c (internal_nis_getpwent_r): Handle adjunct + password scheme. + (_nss_nis_getpwnam_r): Likewise. + (_nss_nis_getpwuid_r): Likewise. + +1998-07-05 Mark Kettenis <kettenis@phys.uva.nl> + + * libio/Versions: Move symbols whose source lives in + stdio-common to ... + * stdio-common/Versions: ... here. + * stdio/Versions: Add missing symbols. + 1998-07-05 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/__sendmsg.S: Define function as @@ -77,10 +77,6 @@ ifeq (yes,$(build-shared)) install-others += $(inst_includedir)/gnu/lib-names.h endif -ifeq ($(versioning),yes) -lib-noranlib: lib-mapfiles -endif - include Makerules ifeq ($(build-programs),yes) @@ -315,25 +311,3 @@ headers2_0 := __math.h bytesex.h confname.h direntry.h elfclass.h \ .PHONY: remove-old-headers remove-old-headers: rm -f $(addprefix $(inst_includedir)/, $(headers2_0)) - -# Generate version maps. -ifeq ($(versioning),yes) -ifndef avoid-generated -$(common-objpfx)sysd-versions: Versions.def - (echo define vers-libs; \ - sed -n 's/\(lib[a-zA-Z0-9_][a-zA-Z0-9_]*\) {/$$(common-objpfx)\1%map/p' $<; \ - echo endef) > $@T - mv -f $@T $@ --include $(common-objpfx)sysd-versions -vers-libs := $(subst $(\n), ,$(vers-libs)) - -$(vers-libs): versions.awk \ - $(wildcard $(subdirs:%=%/Versions)) \ - $(wildcard $(+sysdep_dirs:%=%/Versions)) - $(AWK) -v 'buildroot=$(common-objpfx)' -f $^ - -lib-mapfiles: $(common-objpfx)sysd-versions $(subst %,.,$(vers-libs)) -else -lib-mapfiles: -endif -endif @@ -276,6 +276,17 @@ ifndef sysd-rules-done no_deps=t endif +# Generate version maps. +ifeq ($(versioning),yes) +-include $(common-objpfx)sysd-versions +$(common-objpfx)sysd-versions: $(..)Versions.def $(..)versions.awk \ + $(wildcard $(all-subdirs:%=$(..)%/Versions)) \ + $(wildcard $(+sysdep_dirs:%=%/Versions)) + $(AWK) -v buildroot=$(common-objpfx) -v defsfile=$< \ + -f $(filter-out $<,$^) > $@T + mv -f $@T $@ +$(all-version-maps): $(common-objpfx)sysd-versions +endif ifndef compile-command.S compile-command.S = $(compile.S) $(OUTPUT_OPTION) diff --git a/db2/Versions b/db2/Versions new file mode 100644 index 0000000000..c7821c0337 --- /dev/null +++ b/db2/Versions @@ -0,0 +1,51 @@ +libdb { + GLIBC_2.0 { + # db 1.85 interface + dbopen; __dbopen; + + # The compatibility functions. + dbm_clearerr; dbm_close; dbm_delete; dbm_dirfno; dbm_error; + dbm_fetch; dbm_firstkey; dbminit; dbm_nextkey; dbm_open; + dbm_pagfno; dbm_store; + } + GLIBC_2.1 { + # db.2.x interface + # Internal functions used by db maintenance programs + __bam_init_print; __bam_pgin; __bam_pgout; + __db_dispatch;__db_dump; __db_err; __db_init_print;__db_jump; + __db_omode;__db_prdbt; + __ham_init_print; __ham_pgin; __ham_pgout; + __lock_dump_region; + __log_init_print; + __memp_dump_region; + __txn_init_print; + + # Constants + db_rw_conflicts; db_riw_conflicts; + + # Functions + db_appexit; db_appinit; db_jump_set; db_open; db_value_set; + db_version; + lock_close; lock_detect; lock_get; lock_id; lock_open; lock_put; + lock_stat; lock_unlink; lock_vec; log_archive; log_close; + log_compare; log_file; log_flush; log_get; log_open; log_put; + log_register; log_stat; log_unlink; log_unregister; + + memp_close; memp_fclose; memp_fget; memp_fopen; memp_fput; + memp_fset; memp_fsync; memp_open; memp_register; memp_stat; + memp_sync; memp_trickle; memp_unlink; + + txn_abort; txn_begin; txn_checkpoint; txn_close; txn_commit; + txn_id; txn_open; txn_prepare; txn_stat; txn_unlink; + + # compatibility interface for ndbm + __db_ndbm_clearerr; __db_ndbm_close; __db_ndbm_delete; + __db_ndbm_dirfno; __db_ndbm_error; __db_ndbm_fetch; + __db_ndbm_firstkey; __db_ndbm_nextkey; __db_ndbm_open; + __db_ndbm_pagfno; __db_ndbm_rdonly; __db_ndbm_store; + + # compatibility interface for dbm + __db_dbm_delete; __db_dbm_fetch; __db_dbm_firstkey; __db_dbm_init; + __db_dbm_nextkey; __db_dbm_store; + } +} diff --git a/libio/Versions b/libio/Versions index e837abb5d7..83fc6ed540 100644 --- a/libio/Versions +++ b/libio/Versions @@ -43,48 +43,39 @@ libc { # variables in normal name space stderr; stdin; stdout; - # a* - asprintf; - # c* clearerr; clearerr_unlocked; - # d* - dprintf; - # f* fclose; fcloseall; fdopen; feof; feof_locked; feof_unlocked; ferror; ferror_locked; ferror_unlocked; fflush; fflush_locked; fflush_unlocked; fgetc; fgetpos; fgets; fileno; fileno_locked; fileno_unlocked; flockfile; - fopen; fopencookie; fprintf; fputc; fputc_locked; fputc_unlocked; fputs; - fread; freopen; fscanf; fseek; fsetpos; ftell; ftrylockfile; funlockfile; + fopen; fopencookie; fputc; fputc_locked; fputc_unlocked; fputs; + fread; freopen; fseek; fsetpos; ftell; ftrylockfile; funlockfile; fwrite; # g* getc; getc_locked; getc_unlocked; getchar; getchar_unlocked; getdelim; - getline; gets; getw; + gets; # o* - obstack_printf; obstack_vprintf; open_memstream; + open_memstream; open_obstack_stream; obstack_printf; obstack_vprintf; # p* - pclose; popen; printf; putc; putc_locked; putc_unlocked; putchar; + pclose; popen; putc; putc_locked; putc_unlocked; putchar; putchar_unlocked; puts; - # p* - putw; rewind; - - # s* - scanf; setbuf; setbuffer; setlinebuf; + # r* + rewind; # s* - setvbuf; snprintf; sprintf; sscanf; + setbuf; setbuffer; setlinebuf; setvbuf; # u* ungetc; # v* - vasprintf; vdprintf; vprintf; vscanf; vsnprintf; vsprintf; vsscanf; + vasprintf; vdprintf; vscanf; vsnprintf; vsprintf; vsscanf; } GLIBC_2.1 { # global variables diff --git a/libio/iofread_u.c b/libio/iofread_u.c index bd7ceaf379..69627165eb 100644 --- a/libio/iofread_u.c +++ b/libio/iofread_u.c @@ -24,6 +24,7 @@ General Public License. */ #include "libioP.h" +#include <stdio.h> _IO_size_t fread_unlocked (buf, size, count, fp) diff --git a/libio/iofwrite_u.c b/libio/iofwrite_u.c index 7d1d24b758..3ffc9bff2b 100644 --- a/libio/iofwrite_u.c +++ b/libio/iofwrite_u.c @@ -24,6 +24,7 @@ General Public License. */ #include "libioP.h" +#include <stdio.h> _IO_size_t fwrite_unlocked (buf, size, count, fp) diff --git a/nis/nss_nis/nis-pwd.c b/nis/nss_nis/nis-pwd.c index 296526d7e6..b70091508c 100644 --- a/nis/nss_nis/nis-pwd.c +++ b/nis/nss_nis/nis-pwd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996. @@ -82,8 +82,8 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen, int *errnop) { struct parser_data *data = (void *) buffer; - char *domain, *result, *outkey; - int len, keylen, parse_res; + char *domain; + int parse_res; if (yp_get_default_domain (&domain)) return NSS_STATUS_UNAVAIL; @@ -92,7 +92,9 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen, do { enum nss_status retval; - char *p; + char *result, *outkey, *result2, *p; + int len, keylen, len2; + size_t namelen; if (new_start) retval = yperr2nss (yp_first (domain, "passwd.byname", @@ -109,15 +111,63 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen, return retval; } - if ((size_t) (len + 1) > buflen) - { - free (result); - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; - } + /* Check for adjunct style secret passwords. They can be + recognized by a password starting with "##". */ + p = strchr (result, ':'); + if (p != NULL /* This better should be true in all cases. */ + && p[1] == '#' && p[2] == '#' + && (namelen = p - result, + yp_match (domain, "passwd.adjunct.byname", result, namelen, + &result2, &len2)) == YPERR_SUCCESS) + { + /* We found a passwd.adjunct entry. Merge encrypted + password therein into original result. */ + char *encrypted = strchr (result2, ':'); + char *endp; + size_t restlen; + + if (encrypted != NULL + || (endp = strchr (++encrypted, ':')) == NULL + || (p = strchr (p + 1, ':')) == NULL) + { + /* Invalid format of the entry. This never should happen + unless the data from which the NIS table is generated is + wrong. We simply ignore it. */ + free (result2); + goto non_adjunct; + } + + restlen = len - (p - result); + if ((size_t) (namelen + (endp - encrypted) + restlen + 2) > buflen) + { + free (result2); + free (result); + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + + __mempcpy (__mempcpy (__mempcpy (__mempcpy (buffer, result, namelen), + ":", 1), + encrypted, endp - encrypted), + p, restlen + 1); + p = buffer; + + free (result2); + } + else + { + non_adjunct: + if ((size_t) (len + 1) > buflen) + { + free (result); + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + + p = strncpy (buffer, result, len); + buffer[len] = '\0'; + } - p = strncpy (buffer, result, len); - buffer[len] = '\0'; while (isspace (*p)) ++p; free (result); @@ -161,8 +211,9 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd, { struct parser_data *data = (void *) buffer; enum nss_status retval; - char *domain, *result, *p; - int len, parse_res; + char *domain, *result, *result2, *p; + int len, len2, parse_res; + size_t namelen; if (name == NULL) { @@ -173,8 +224,10 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd, if (yp_get_default_domain (&domain)) return NSS_STATUS_UNAVAIL; + namelen = strlen (name); + retval = yperr2nss (yp_match (domain, "passwd.byname", name, - strlen (name), &result, &len)); + namelen, &result, &len)); if (retval != NSS_STATUS_SUCCESS) { @@ -183,15 +236,62 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd, return retval; } - if ((size_t) (len + 1) > buflen) + /* Check for adjunct style secret passwords. They can be recognized + by a password starting with "##". */ + p = strchr (result, ':'); + if (p != NULL /* This better should be true in all cases. */ + && p[1] == '#' && p[2] == '#' + && yp_match (domain, "passwd.adjunct.byname", name, namelen, + &result2, &len2) == YPERR_SUCCESS) { - free (result); - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + /* We found a passwd.adjunct entry. Merge encrypted password + therein into original result. */ + char *encrypted = strchr (result2, ':'); + char *endp; + size_t restlen; + + if (encrypted != NULL + || (endp = strchr (++encrypted, ':')) == NULL + || (p = strchr (p + 1, ':')) == NULL) + { + /* Invalid format of the entry. This never should happen + unless the data from which the NIS table is generated is + wrong. We simply ignore it. */ + free (result2); + goto non_adjunct; + } + + restlen = len - (p - result); + if ((size_t) (namelen + (endp - encrypted) + restlen + 2) > buflen) + { + free (result2); + free (result); + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + + __mempcpy (__mempcpy (__mempcpy (__mempcpy (buffer, name, namelen), + ":", 1), + encrypted, endp - encrypted), + p, restlen + 1); + p = buffer; + + free (result2); + } + else + { + non_adjunct: + if ((size_t) (len + 1) > buflen) + { + free (result); + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + + p = strncpy (buffer, result, len); + buffer[len] = '\0'; } - p = strncpy (buffer, result, len); - buffer[len] = '\0'; while (isspace (*p)) ++p; free (result); @@ -214,9 +314,10 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd, { struct parser_data *data = (void *) buffer; enum nss_status retval; - char *domain, *result, *p; - int len, nlen, parse_res; + char *domain, *result, *p, *result2; + int len, nlen, parse_res, len2; char buf[32]; + size_t namelen; if (yp_get_default_domain (&domain)) return NSS_STATUS_UNAVAIL; @@ -233,15 +334,63 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd, return retval; } - if ((size_t) (len + 1) > buflen) + /* Check for adjunct style secret passwords. They can be recognized + by a password starting with "##". */ + p = strchr (result, ':'); + if (p != NULL /* This better should be true in all cases. */ + && p[1] == '#' && p[2] == '#' + && (namelen = p - result, + yp_match (domain, "passwd.adjunct.byname", result, namelen, + &result2, &len2)) == YPERR_SUCCESS) { - free (result); - *errnop = ERANGE; - return NSS_STATUS_TRYAGAIN; + /* We found a passwd.adjunct entry. Merge encrypted password + therein into original result. */ + char *encrypted = strchr (result2, ':'); + char *endp; + size_t restlen; + + if (encrypted != NULL + || (endp = strchr (++encrypted, ':')) == NULL + || (p = strchr (p + 1, ':')) == NULL) + { + /* Invalid format of the entry. This never should happen + unless the data from which the NIS table is generated is + wrong. We simply ignore it. */ + free (result2); + goto non_adjunct; + } + + restlen = len - (p - result); + if ((size_t) (namelen + (endp - encrypted) + restlen + 2) > buflen) + { + free (result2); + free (result); + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + + __mempcpy (__mempcpy (__mempcpy (__mempcpy (buffer, result, namelen), + ":", 1), + encrypted, endp - encrypted), + p, restlen + 1); + p = buffer; + + free (result2); + } + else + { + non_adjunct: + if ((size_t) (len + 1) > buflen) + { + free (result); + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } + + p = strncpy (buffer, result, len); + buffer[len] = '\0'; } - p = strncpy (buffer, result, len); - buffer[len] = '\0'; while (isspace (*p)) ++p; free (result); diff --git a/posix/Makefile b/posix/Makefile index ad70fddd63..5eadf35eb7 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -64,7 +64,7 @@ before-compile := testcases.h ptestcases.h # So they get cleaned up. generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \ - $(objpfx)annexc $(objpfx)annexc.out + annexc annexc.out include ../Rules @@ -137,7 +137,8 @@ endif # Run a test on the header files we use. # XXX Please note that for now we ignore the result of this test. tests: $(objpfx)annexc - -$(dir $<)$(notdir $<) '$(CC)' '-I../include -I../include -I.. $(+sysdep-includes) -I../include -I../include -I..' > $<.out + -$(dir $<)$(notdir $<) '$(CC)' \ + '-I../include -I.. $(+sysdep-includes)' > $<.out $(objpfx)annexc: annexc.c $(native-compile) diff --git a/posix/annexc.c b/posix/annexc.c index dbc5e28520..8b95311314 100644 --- a/posix/annexc.c +++ b/posix/annexc.c @@ -609,12 +609,12 @@ static struct header /* Format string to build command to invoke compiler. */ static const char fmt[] = "\ echo \"#include <%s>\" |\ -%s -E -dM -D_POSIX_SOURCE %s \ +%s -E -dM -D_POSIX_SOURCE -D_LIBC %s \ -isystem `%s --print-prog-name=include` - > %s"; static const char testfmt[] = "\ echo \"#include <unistd.h>\n#ifndef %s\n#error not defined\n#endif\n\" |\ -%s -E -dM -D_POSIX_SOURCE %s \ +%s -E -dM -D_POSIX_SOURCE -D_LIBC %s \ -isystem `%s --print-prog-name=include` - 2> /dev/null > %s"; @@ -709,7 +709,7 @@ get_null_defines (void) while (fgets (line, sizeof line, input) != NULL) { - char *start, *end; + char *start; if (strlen (line) < 9 || line[7] != ' ') { /* "#define A" */ printf ("Malformed input, expected '#define MACRO'\ngot '%s'\n", @@ -730,9 +730,7 @@ get_null_defines (void) } } start = &line[8]; - for (end = start + 1; !isspace (*end) && *end != '\0'; ++end) - ; - result[result_len++] = xstrndup (start, end - start); + result[result_len++] = xstrndup (start, strcspn (start, " (")); if (first) { @@ -809,7 +807,6 @@ check_header (const struct header *header, const char **except) while (fgets (line, sizeof line, input) != NULL) { - char *endmac; const char **ignore; if (strlen (line) < 9 || line[7] != ' ') { /* "#define A" */ @@ -819,9 +816,13 @@ check_header (const struct header *header, const char **except) continue; } + /* Find next char after the macro identifier; this can be either + a space or an open parenthesis. */ + line[8 + strcspn (&line[8], " (")] = '\0'; + /* Now check whether it's one of the required macros. */ for (i = 0; i < header->nsyms; ++i) - if (!strncmp (&line[8], header->syms[i], strlen (header->syms[i]))) + if (!strcmp (&line[8], header->syms[i])) break; if (i < header->nsyms) { @@ -833,12 +834,6 @@ check_header (const struct header *header, const char **except) if (line[8] == '_') continue; - /* Find next char after the macro identifier; this can be either - a space or an open parenthesis. */ - endmac = strpbrk (&line[8], " ("); - if (endmac != NULL) - *endmac = '\0'; - /* Maybe one of the symbols which are always defined. */ for (ignore = except; *ignore != NULL; ++ignore) if (! strcmp (&line[8], *ignore)) diff --git a/stdio-common/Versions b/stdio-common/Versions index 5db571db92..d38ef7e123 100644 --- a/stdio-common/Versions +++ b/stdio-common/Versions @@ -10,20 +10,35 @@ libc { # variables in normal name space sys_errlist; sys_nerr; sys_sigabbrev; sys_siglist; + # a* + asprintf; + # c* ctermid; cuserid; + # d* + dprintf; + + # f* + fprintf; fscanf; + + # g* + getline; getw; + # p* - parse_printf_format; perror; + parse_printf_format; perror; printf; putw; # r* register_printf_function; remove; rename; + # s* + scanf; snprintf; sprintf; sscanf; + # t* tempnam; tmpfile; tmpnam; tmpnam_r; # v* - vfprintf; vfscanf; + vfprintf; vfscanf; vprintf; } GLIBC_2.1 { # p* diff --git a/stdio-common/test_rdwr.c b/stdio-common/test_rdwr.c index e274dcc665..a3b01b7c7c 100644 --- a/stdio-common/test_rdwr.c +++ b/stdio-common/test_rdwr.c @@ -91,7 +91,7 @@ main (int argc, char **argv) } else if (where == -1L) { - printf ("ftell got %s (should be at %u).\n", + printf ("ftell got %s (should be at %Zu).\n", strerror (errno), replace_from); lose = 1; } diff --git a/stdio/Versions b/stdio/Versions index 5c6bbe35c5..2dfd4a8de0 100644 --- a/stdio/Versions +++ b/stdio/Versions @@ -2,5 +2,50 @@ libc { GLIBC_2.0 { # more or less standard functions __fillbf; __flshfp; + + # functions used in inline functions or macros + __getdelim; __line_wrap_output; __line_wrap_update; + __vfscanf; __vsscanf; + + # variables in normal name space + stderr; stdin; stdout; + + # c* + clearerr; + + # f* + fclose; fcloseall; fdopen; feof; ferror; fflush; fgetc; fgetpos; fgets; + fileno; fmemopen; fopen; fopencookie; fputc; fputs; fread; freopen; + fseek; fsetpos; ftell; fwrite; + + # g* + getc; getchar; getdelim; gets; + + # l* + line_wrap_stream; line_unwrap_stream; line_wrapped; line_wrap_lmargin; + line_wrap_set_lmargin; line_wrap_rmargin; line_wrap_set_rmargin; + line_wrap_wmargin; line_wrap_set_wmargin; line_wrap_point; + + # o* + open_memstream; open_obstack_stream; obstack_printf; obstack_vprintf; + + # p* + pclose; popen; putc; putchar; puts; + + # r* + rewind; + + # s* + setbuf; setbuffer; setlinebuf; setvbuf; + + # u* + ungetc; + + # v* + vasprintf; vdprintf; vscanf; vsnprintf; vsprintf; vsscanf; + } + GLIBC_2.1 { + # functions used in other libraries + __asprintf; } } diff --git a/versions.awk b/versions.awk index 57660d235a..7565ee10ca 100644 --- a/versions.awk +++ b/versions.awk @@ -6,26 +6,24 @@ # Read definitions for the versions. BEGIN { nlibs=0; - while (getline < "Versions.def") { + while (getline < defsfile) { if (/^[a-zA-Z_]+ {/) { libs[$1] = 1; curlib = $1; - while (getline < "Versions.def" && ! /^}/) { + while (getline < defsfile && ! /^}/) { + versions[$1] = 1; if (NF > 1) { - versions[$1] = 1; - derived[curlib, $1] = (" " $2); + derived[curlib, $1] = " " $2; for (n = 3; n <= NF; ++n) { - derived[curlib, $1] = sprintf("%s, %s", derived[curlib, $1], $n); + derived[curlib, $1] = derived[curlib, $1] ", " $n; } - } else { - versions[$1] = 1; } } } } - close("Versions.def"); + close(defsfile); - tmpfile = (buildroot "/Versions.tmp"); + tmpfile = (buildroot "Versions.tmp"); sort = ("sort -n >" tmpfile); } @@ -37,8 +35,8 @@ BEGIN { # This matches the beginning of the version information for a new library. /^[a-zA-Z_]+/ { actlib = $1; - if (libs[$1] != 1) { - printf("no versions defined for %s\n", $1); + if (!libs[$1]) { + printf("no versions defined for %s\n", $1) > "/dev/stderr"; exit 1; } next; @@ -47,8 +45,8 @@ BEGIN { # This matches the beginning of a new version for the current library. /^ [A-Za-z_]/ { actver = $1; - if (versions[$1] != 1) { - printf("version %s not defined\n", $1); + if (!versions[$1]) { + printf("version %s not defined\n", $1) > "/dev/stderr"; exit 1; } next; @@ -75,6 +73,7 @@ END { close(sort); oldlib=""; oldver=""; + printf("all-version-maps ="); while(getline < tmpfile) { if ($1 != oldlib) { if (oldlib != "") { @@ -85,6 +84,7 @@ END { oldlib = $1; outfile = (buildroot oldlib ".map"); firstinfile = 1; + printf(" $(common-objpfx)%s.map", oldlib); } if ($2 != oldver) { if (oldver != "") { @@ -99,7 +99,8 @@ END { } printf("\n") > outfile; } + printf("\n"); closeversion(oldver); close(outfile); - rm tmpfile; + system("rm " tmpfile); } |