update from main archive 960815

This commit is contained in:
Ulrich Drepper 1996-08-16 01:33:20 +00:00
parent ad86485dcf
commit 2de99474c3
9 changed files with 228 additions and 45 deletions

View File

@ -18,7 +18,7 @@ case $# in
*) file="./$1" ;; *) file="./$1" ;;
esac esac
if ${RTLD} --verify "$file"; then if ${RTLD} --verify "$file"; then
LD_TRACE_LOADED_OBJECTS=1 exec "$file" && exit 1 LD_TRACE_LOADED_OBJECTS=1 exec ${RTLD} "$file" && exit 1
else else
echo ' not a dynamic executable' echo ' not a dynamic executable'
fi fi
@ -32,7 +32,7 @@ case $# in
*) file="./$file" ;; *) file="./$file" ;;
esac esac
if ${RTLD} --verify "$file"; then if ${RTLD} --verify "$file"; then
LD_TRACE_LOADED_OBJECTS=1 "$file" LD_TRACE_LOADED_OBJECTS=1 ${RTLD} "$file"
else else
echo ' not a dynamic executable' echo ' not a dynamic executable'
fi fi

View File

@ -126,10 +126,12 @@ dl_main (const ElfW(Phdr) *phdr,
const ElfW(Phdr) *ph; const ElfW(Phdr) *ph;
struct link_map *l; struct link_map *l;
int lazy; int lazy;
enum { normal, list, verify } mode = normal; enum { normal, list, verify, trace } mode;
struct link_map **preloads; struct link_map **preloads;
unsigned int npreloads; unsigned int npreloads;
mode = getenv ("LD_TRACE_LOADED_OBJECTS") != NULL ? trace : normal;
if (*user_entry == (ElfW(Addr)) &_start) if (*user_entry == (ElfW(Addr)) &_start)
{ {
/* Ho ho. We are not the program interpreter! We are the program /* Ho ho. We are not the program interpreter! We are the program
@ -187,7 +189,22 @@ of this helper program; chances are you did not intend to run this program.\n",
--_dl_argc; --_dl_argc;
++_dl_argv; ++_dl_argv;
l = _dl_map_object (NULL, _dl_argv[0], lt_library); if (mode == verify)
{
void doit (void)
{
l = _dl_map_object (NULL, _dl_argv[0], lt_library);
}
const char *err_str = NULL;
const char *obj_name __attribute__ ((unused));
(void) _dl_catch_error (&err_str, &obj_name, doit);
if (err_str != NULL)
_exit (EXIT_FAILURE);
}
else
l = _dl_map_object (NULL, _dl_argv[0], lt_library);
phdr = l->l_phdr; phdr = l->l_phdr;
phent = l->l_phnum; phent = l->l_phnum;
l->l_name = (char *) ""; l->l_name = (char *) "";
@ -197,7 +214,7 @@ of this helper program; chances are you did not intend to run this program.\n",
{ {
/* Create a link_map for the executable itself. /* Create a link_map for the executable itself.
This will be what dlopen on "" returns. */ This will be what dlopen on "" returns. */
l = _dl_new_object ((char *) "", "", lt_library); l = _dl_new_object ((char *) "", "", lt_executable);
l->l_phdr = phdr; l->l_phdr = phdr;
l->l_phnum = phent; l->l_phnum = phent;
l->l_entry = *user_entry; l->l_entry = *user_entry;
@ -340,7 +357,7 @@ of this helper program; chances are you did not intend to run this program.\n",
} }
} }
if (mode != normal || getenv ("LD_TRACE_LOADED_OBJECTS") != NULL) 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
important that we do this before real relocation, because the important that we do this before real relocation, because the
@ -363,7 +380,7 @@ of this helper program; chances are you did not intend to run this program.\n",
" (0x", bp, ")\n", NULL); " (0x", bp, ")\n", NULL);
} }
if (mode != normal) if (mode != trace)
for (i = 1; i < _dl_argc; ++i) for (i = 1; i < _dl_argc; ++i)
{ {
const ElfW(Sym) *ref = NULL; const ElfW(Sym) *ref = NULL;

View File

@ -38,8 +38,9 @@ static char sccsid[] = "@(#)ruserpass.c 8.3 (Berkeley) 4/2/94";
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <assert.h>
#include <ctype.h> #include <ctype.h>
/*#include <err.h> */ #include <err.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -81,7 +82,7 @@ int
ruserpass(host, aname, apass) ruserpass(host, aname, apass)
char *host, **aname, **apass; char *host, **aname, **apass;
{ {
char *hdir, buf[BUFSIZ], *tmp; char *hdir, *buf, *tmp;
char myname[1024], *mydomain; char myname[1024], *mydomain;
int t, i, c, usedefault = 0; int t, i, c, usedefault = 0;
struct stat stb; struct stat stb;
@ -89,11 +90,14 @@ ruserpass(host, aname, apass)
hdir = getenv("HOME"); hdir = getenv("HOME");
if (hdir == NULL) if (hdir == NULL)
hdir = "."; hdir = ".";
buf = alloca (strlen (hdir) + 8);
(void) sprintf(buf, "%s/.netrc", hdir); (void) sprintf(buf, "%s/.netrc", hdir);
cfile = fopen(buf, "r"); cfile = fopen(buf, "r");
if (cfile == NULL) { if (cfile == NULL) {
/* if (errno != ENOENT) if (errno != ENOENT)
warn("%s", buf);*/ warn("%s", buf);
return (0); return (0);
} }
if (gethostname(myname, sizeof(myname)) < 0) if (gethostname(myname, sizeof(myname)) < 0)
@ -113,13 +117,13 @@ next:
continue; continue;
/* /*
* Allow match either for user's input host name * Allow match either for user's input host name
* or official hostname. Also allow match of * or official hostname. Also allow match of
* incompletely-specified host in local domain. * incompletely-specified host in local domain.
*/ */
if (strcasecmp(host, tokval) == 0) if (strcasecmp(host, tokval) == 0)
goto match; goto match;
/* if (strcasecmp(hostname, tokval) == 0) /* if (strcasecmp(hostname, tokval) == 0)
goto match; goto match;
if ((tmp = strchr(hostname, '.')) != NULL && if ((tmp = strchr(hostname, '.')) != NULL &&
strcasecmp(tmp, mydomain) == 0 && strcasecmp(tmp, mydomain) == 0 &&
strncasecmp(hostname, tokval, tmp-hostname) == 0 && strncasecmp(hostname, tokval, tmp-hostname) == 0 &&
@ -137,7 +141,7 @@ next:
case LOGIN: case LOGIN:
if (token()) if (token())
if (*aname == 0) { if (*aname == 0) {
*aname = malloc((unsigned) strlen(tokval) + 1); *aname = malloc((unsigned) strlen(tokval) + 1);
(void) strcpy(*aname, tokval); (void) strcpy(*aname, tokval);
} else { } else {
@ -149,8 +153,8 @@ next:
if (strcmp(*aname, "anonymous") && if (strcmp(*aname, "anonymous") &&
fstat(fileno(cfile), &stb) >= 0 && fstat(fileno(cfile), &stb) >= 0 &&
(stb.st_mode & 077) != 0) { (stb.st_mode & 077) != 0) {
/* warnx("Error: .netrc file is readable by others."); warnx(_("Error: .netrc file is readable by others."));
warnx("Remove password or make file unreadable by others.");*/ warnx(_("Remove password or make file unreadable by others."));
goto bad; goto bad;
} }
if (token() && *apass == 0) { if (token() && *apass == 0) {
@ -177,7 +181,7 @@ next:
if (proxy) { if (proxy) {
(void) fclose(cfile); (void) fclose(cfile);
return (0); return (0);
} }
while ((c=getc(cfile)) != EOF && c == ' ' || c == '\t'); while ((c=getc(cfile)) != EOF && c == ' ' || c == '\t');
if (c == EOF || c == '\n') { if (c == EOF || c == '\n') {
printf("Missing macdef name argument.\n"); printf("Missing macdef name argument.\n");
@ -234,7 +238,7 @@ next:
#endif #endif
break; break;
default: default:
/* warnx("Unknown .netrc keyword %s", tokval);*/ warnx(_("Unknown .netrc keyword %s"), tokval);
break; break;
} }
goto done; goto done;

View File

@ -12,8 +12,8 @@
@c sold 0.06/1.09, print run out 21may96 @c sold 0.06/1.09, print run out 21may96
@set EDITION 0.07 DRAFT @set EDITION 0.07 DRAFT
@set VERSION 1.09 Beta @set VERSION 2.00 Beta
@set UPDATED 21 May 1996 @set UPDATED 16 Aug 1996
@set ISBN 1-882114-53-1 @set ISBN 1-882114-53-1
@ifinfo @ifinfo

View File

@ -17,7 +17,7 @@ scheme @dfn{Name Service Switch} (NSS).
Though the interface might be similar to Sun's version there is no Though the interface might be similar to Sun's version there is no
common code. We never saw any source code of Sun's implementation and common code. We never saw any source code of Sun's implementation and
so the internal interface are incompatible. This is also manifest in the so the internal interface is incompatible. This is also manifests in the
file names we use as we will see later. file names we use as we will see later.
@ -158,9 +158,9 @@ The second item in the specification gives the user much finer control
on the lookup process. Action items are placed between two service on the lookup process. Action items are placed between two service
names and are written within brackets. The general form is names and are written within brackets. The general form is
@smallexample @display
[ @r{(}!@r{?} @var{status} = @var{action}@r{)+} ] @t{[} ( @t{!}? @var{status} @t{=} @var{action} )+ @t{]}
@end smallexample @end display
@noindent @noindent
where where
@ -331,6 +331,21 @@ access them. If a function is not available it is simply treated as if
the function would return @code{unavail} the function would return @code{unavail}
(@pxref{Actions in the NSS configuration}). (@pxref{Actions in the NSS configuration}).
The file name @file{libnss_files.so.1} would be on a @w{Solaris 2}
system @file{nss_files.so.1}. This is the difference mentioned above.
Sun's NSS modules are usable as modules which get indirectly loaded
only.
The NSS modules in the GNU C Library are prepared to be used as normal
libraries itself.
@comment Fix me if necessary.
This is @emph{not} true in the moment, though. But the different
organization of the name space in the modules does not make it
impossible like it is for Solaris. Now you can see why the modules are
still libraries.@footnote{There is a second explanation: we were too
lazy to change the Makefiles to allow the generation of shared objects
not starting with @file{lib} but do not tell this anybody.}
@node NSS Modules Interface, , NSS Module Names, NSS Module Internals @node NSS Modules Interface, , NSS Module Names, NSS Module Internals
@subsection The Interface of the Function in NSS Modules @subsection The Interface of the Function in NSS Modules

View File

@ -624,7 +624,20 @@ time conversion (@pxref{Locales}).
Ordinary characters appearing in the @var{template} are copied to the Ordinary characters appearing in the @var{template} are copied to the
output string @var{s}; this can include multibyte character sequences. output string @var{s}; this can include multibyte character sequences.
Conversion specifiers are introduced by a @samp{%} character, and are Conversion specifiers are introduced by a @samp{%} character. Now can
follow an optional flag which can be one of the following. These flags
only affect the output of numbers:
@table @code
@item _
The number is padded with spaces.
@item -
The number is not padded at all.
@end table
The default action is to pad the number with zeros. Following to the
flag comes the format specifier. The whole @samp{%} sequence is
replaced in the output string as follows: replaced in the output string as follows:
@table @code @table @code
@ -643,9 +656,29 @@ The full month name according to the current locale.
@item %c @item %c
The preferred date and time representation for the current locale. The preferred date and time representation for the current locale.
@item %C
The century of the year.
@item %d @item %d
The day of the month as a decimal number (range @code{01} to @code{31}). The day of the month as a decimal number (range @code{01} to @code{31}).
@item %D
The date using the format @code{%m/%d/%y}.
This format is a GNU extension.
@item %d
The day of the month like with @code{%d}, but padded with blank (range
@code{ 1} to @code{31}).
This format is a GNU extension.
@item %h
The abbreviated month name according to the current locale. The action
is the same as for @code{%b}.
This format is a GNU extension.
@item %H @item %H
The hour as a decimal number, using a 24-hour clock (range @code{00} to The hour as a decimal number, using a 24-hour clock (range @code{00} to
@code{23}). @code{23}).
@ -657,19 +690,64 @@ The hour as a decimal number, using a 12-hour clock (range @code{01} to
@item %j @item %j
The day of the year as a decimal number (range @code{001} to @code{366}). The day of the year as a decimal number (range @code{001} to @code{366}).
@item %k
The hour as a decimal number, using a 24-hour clock like @code{%H}, but
padded with blank (range @code{ 0} to @code{23}).
This format is a GNU extension.
@item %l
The hour as a decimal number, using a 12-hour clock like @code{%I}, but
padded with blank (range @code{ 0} to @code{12}).
This format is a GNU extension.
@item %m @item %m
The month as a decimal number (range @code{01} to @code{12}). The month as a decimal number (range @code{01} to @code{12}).
@item %M @item %M
The minute as a decimal number. The minute as a decimal number.
@item %n
A single @samp{\n} (newline) character.
This format is a GNU extension.
@item %p @item %p
Either @samp{am} or @samp{pm}, according to the given time value; or the Either @samp{am} or @samp{pm}, according to the given time value; or the
corresponding strings for the current locale. corresponding strings for the current locale.
@item %r
The time in decinal numbers using the format @code{%I:%M:%S %p}.
This format is a GNU extension.
@item %R
The hour and minute in decimal numbers using the format @code{%H:%M}.
This format is a GNU extension.
@item %s
The seconds since the epoch, i.e., 1 January 1970 00:00:00 UTC. Note
that this value is the number of seconds between the epoch and the
current date as defined by the @code{localtime} system call. It is not
changed by the @code{--date} option.
This format is a GNU extension.
@item %S @item %S
The second as a decimal number. The second as a decimal number.
@item %t
A single @samp{\t} (tabulator) character.
This format is a GNU extension.
@item %T
The time using decimal numbers using the format @code{%H:%M:%S}.
This format is a GNU extension.
@item %U @item %U
The week number of the current year as a decimal number, starting with The week number of the current year as a decimal number, starting with
the first Sunday as the first day of the first week. All days preceding the first Sunday as the first day of the first week. All days preceding
@ -682,14 +760,14 @@ containing January 1 has four or more days in the new year it is
considered to be week @code{1}. Otherwise it is week @code{53} of the considered to be week @code{1}. Otherwise it is week @code{53} of the
previous year. This is standardized in @w{ISO 8601:1988}. previous year. This is standardized in @w{ISO 8601:1988}.
@item %w
The day of the week as a decimal number, Sunday being @code{0}.
@item %W @item %W
The week number of the current year as a decimal number, starting with The week number of the current year as a decimal number, starting with
the first Monday as the first day of the first week. All days preceding the first Monday as the first day of the first week. All days preceding
the first Monday in the year are considered to be in week @code{0}. the first Monday in the year are considered to be in week @code{0}.
@item %w
The day of the week as a decimal number, Sunday being @code{0}.
@item %x @item %x
The preferred date representation for the current locale, but without the The preferred date representation for the current locale, but without the
time. time.
@ -704,6 +782,12 @@ The year as a decimal number, but without a century (range @code{00} to
@item %Y @item %Y
The year as a decimal number, including the century. The year as a decimal number, including the century.
@item %z
@w{RFC 822}/@w{ISO 8601:1988} style numeric time zone (e.g., -0600 or
+0100), or nothing if no time zone is determinable. This value reflects
the @emph{current} time zone. It is not changed by the @code{--date}
option.
@item %Z @item %Z
The time zone or name or abbreviation (empty if the time zone can't be The time zone or name or abbreviation (empty if the time zone can't be
determined). determined).

View File

@ -42,7 +42,7 @@ struct timeval;
typedef __fd_mask fd_mask; typedef __fd_mask fd_mask;
/* Representation of a set of file descriptors. */ /* Representation of a set of file descriptors. */
#define fd_set __fd_set typedef __fd_set fd_set;
/* Maximum number of file descriptors in `fd_set'. */ /* Maximum number of file descriptors in `fd_set'. */
#define FD_SETSIZE __FD_SETSIZE #define FD_SETSIZE __FD_SETSIZE

View File

@ -1,4 +1,4 @@
# SOME DESCRIPTIVE TITLE. # GNU libc message catalog of translations
# Copyright (C) YEAR Free Software Foundation, Inc. # Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
# #

View File

@ -75,7 +75,11 @@ Cambridge, MA 02139, USA. */
#endif #endif
#endif #endif
static unsigned int week __P((const struct tm *const, int, int)); /* Uncomment following line in the production version. */
/* #define NDEBUG */
#include <assert.h>
static unsigned int week __P ((const struct tm *const, int, int));
#define add(n, f) \ #define add(n, f) \
@ -91,7 +95,7 @@ static unsigned int week __P((const struct tm *const, int, int));
p += (n); \ p += (n); \
} \ } \
} while (0) } while (0)
#define cpy(n, s) add((n), memcpy((PTR) p, (PTR) (s), (n))) #define cpy(n, s) add ((n), memcpy((PTR) p, (PTR) (s), (n)))
#ifdef _LIBC #ifdef _LIBC
#define fmt(n, args) add((n), if (sprintf args != (n)) return 0) #define fmt(n, args) add((n), if (sprintf args != (n)) return 0)
@ -187,8 +191,8 @@ strftime (s, maxsize, format, tp)
size_t am_len = 3; size_t am_len = 3;
size_t ap_len = 2; size_t ap_len = 2;
#endif #endif
size_t wkday_len = strlen(f_wkday); size_t wkday_len = strlen (f_wkday);
size_t month_len = strlen(f_month); size_t month_len = strlen (f_month);
const unsigned int y_week0 = week (tp, 0, 7); const unsigned int y_week0 = week (tp, 0, 7);
const unsigned int y_week1 = week (tp, 1, 7); const unsigned int y_week1 = week (tp, 1, 7);
const unsigned int y_week2 = week (tp, 1, 3); const unsigned int y_week2 = week (tp, 1, 3);
@ -228,10 +232,10 @@ strftime (s, maxsize, format, tp)
const char *subfmt; const char *subfmt;
#if HAVE_MBLEN #if HAVE_MBLEN
if (!isascii(*f)) if (!isascii (*f))
{ {
/* Non-ASCII, may be a multibyte. */ /* Non-ASCII, may be a multibyte. */
int len = mblen(f, strlen(f)); int len = mblen (f, strlen (f));
if (len > 0) if (len > 0)
{ {
cpy(len, f); cpy(len, f);
@ -242,7 +246,7 @@ strftime (s, maxsize, format, tp)
if (*f != '%') if (*f != '%')
{ {
add(1, *p = *f); add (1, *p = *f);
continue; continue;
} }
@ -268,24 +272,24 @@ strftime (s, maxsize, format, tp)
{ {
case '\0': case '\0':
case '%': case '%':
add(1, *p = *f); add (1, *p = *f);
break; break;
case 'a': case 'a':
cpy(aw_len, a_wkday); cpy (aw_len, a_wkday);
break; break;
case 'A': case 'A':
cpy(wkday_len, f_wkday); cpy (wkday_len, f_wkday);
break; break;
case 'b': case 'b':
case 'h': /* GNU extension. */ case 'h': /* GNU extension. */
cpy(am_len, a_month); cpy (am_len, a_month);
break; break;
case 'B': case 'B':
cpy(month_len, f_month); cpy (month_len, f_month);
break; break;
case 'c': case 'c':
@ -392,7 +396,7 @@ strftime (s, maxsize, format, tp)
break; break;
case 'p': case 'p':
cpy(ap_len, ampm); cpy (ap_len, ampm);
break; break;
case 'R': /* GNU extension. */ case 'R': /* GNU extension. */
@ -406,17 +410,38 @@ strftime (s, maxsize, format, tp)
case 'S': case 'S':
DO_NUMBER (2, tp->tm_sec); DO_NUMBER (2, tp->tm_sec);
case 's': /* GNU extension. */
{
struct tm writable_tm = *tp;
unsigned long int num = (unsigned long int) mktime (&writable_tm);
/* `3 * sizeof (unsigned long int)' is an approximation of
the size of the decimal representation of NUM, valid
for sizes <= 16. */
int printed = 3 * sizeof (unsigned long int);
maxdigits = printed;
assert (sizeof (unsigned long int) <= 16);
#ifdef _LIBC
add (maxdigits, printed = sprintf (p, "%lu", num));
#else
add (maxdigits, sprintf (p, "%lu", num); printed = strlen (p));
#endif
/* Back up if fewer than MAXDIGITS chars written for pad_none. */
p -= maxdigits - printed;
i -= maxdigits - printed;
}
break;
case 'X': case 'X':
#ifdef _NL_CURRENT #ifdef _NL_CURRENT
subfmt = _NL_CURRENT (LC_TIME, T_FMT); subfmt = _NL_CURRENT (LC_TIME, T_FMT);
goto subformat; goto subformat;
#endif #endif
/* Fall through. */ /* Fall through. */
case 'T': /* GNU extenstion. */ case 'T': /* GNU extension. */
subfmt = "%H:%M:%S"; subfmt = "%H:%M:%S";
goto subformat; goto subformat;
case 't': /* GNU extenstion. */ case 't': /* GNU extension. */
add (1, *p = '\t'); add (1, *p = '\t');
break; break;
@ -442,8 +467,46 @@ strftime (s, maxsize, format, tp)
cpy(zonelen, zone); cpy(zonelen, zone);
break; break;
case 'z':
{
struct tm tml = *tp;
time_t t = mktime (&tml);
struct tm tmg;
int diff;
tml = *localtime (&t); /* Canonicalize the local time. */
tmg = *gmtime (&t);
/* Compute the difference. */
diff = tml.tm_min - tmg.tm_min;
diff += 60 * (tml.tm_hour - tmg.tm_hour);
if (tml.tm_mon != tmg.tm_mon)
{
/* We assume no timezone differs from UTC by more than
+- 23 hours. This should be safe. */
if (tmg.tm_mday == 1)
tml.tm_mday = 0;
else /* tml.tm_mday == 1 */
tmg.tm_mday = 0;
}
diff += 1440 * (tml.tm_mday - tmg.tm_mday);
if (diff < 0)
{
add (1, *p = '-');
diff = -diff;
}
else
add (1, *p = '+');
pad = pad_zero;
DO_NUMBER (4, ((diff / 60) % 24) * 100 + diff % 60);
}
default: default:
/* Bad format. */ /* Bad format. */
add (1, *p = *f);
break; break;
} }
} }