about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog28
-rw-r--r--locale/programs/ld-ctype.c15
-rw-r--r--locale/programs/ld-time.c52
-rw-r--r--locale/programs/linereader.c2
-rw-r--r--posix/wordexp-test.c15
-rw-r--r--posix/wordexp.c16
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h8
-rw-r--r--sysdeps/unix/sysv/linux/bits/types.h4
8 files changed, 104 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index 54e379d8d9..85cb310550 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+1999-11-05  Ulrich Drepper  <drepper@cygnus.com>
+
+	* sysdeps/unix/sysv/linux/bits/resource.h (RLIM_INFINITY): Adjust
+	for kernel changes.
+	* sysdeps/unix/sysv/linux/bits/types.h (__rlim_t, __rlim64_t): Make
+	unsigned.
+
+1999-10-04  Tim Waugh <twaugh@redhat.com>
+
+	* posix/wordexp-test.c: More tests.
+
+	* posix/wordexp.c (wordexp): Explicit null words should be kept.
+
+1999-11-04  Shinya Hanataka  <hanataka@abyss.rim.or.jp>
+
+	* locale/programs/linereader.c (get_string): Correct type of buf2
+	variable.
+	* locale/programs/ld-ctype.c (ctype_output): Store index correctly
+	for _NL_CTYPE_INDIGITS_MB_LEN, _NL_CTYPE_INDIGITS_WC_LEN,
+	_NL_CTYPE_INDIGITS*_MB, _NL_CTYPE_OUTDIGIT*_MB, and
+	_NL_CTYPE_OUTDIGIT*_WC.
+	(allocate_arrays): Completely initialize mapping tables.
+	* locale/programs/ld-time.c (time_startup): We need the wide car
+	string.
+	(time_finish): Correct handling of era.
+	(time_output): Fix a few array indeces.
+	(time_read): Pass the repertoire map to lr_token.
+
 1999-11-03  Ulrich Drepper  <drepper@cygnus.com>
 
 	* Versions.def: Add version for libthread_db.
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index ffc759b272..6378c131bf 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -836,6 +836,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
 	    iov[2 + elem + offset].iov_len = sizeof (uint32_t);
 	    *(uint32_t *) iov[2 + elem + offset].iov_base =
 	      ctype->mbdigits_act / 10;
+	    idx[elem + 1] = idx[elem] + sizeof (uint32_t);
 	    break;
 
 	  case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_WC_LEN):
@@ -843,6 +844,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
 	    iov[2 + elem + offset].iov_len = sizeof (uint32_t);
 	    *(uint32_t *) iov[2 + elem + offset].iov_base =
 	      ctype->wcdigits_act / 10;
+	    idx[elem + 1] = idx[elem] + sizeof (uint32_t);
 	    break;
 
 	  case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_MB) ... _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS9_MB):
@@ -865,6 +867,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
 			      ctype->mbdigits[cnt]->nbytes);
 		*cp++ = '\0';
 	      }
+	    idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len;
 	    break;
 
 	  case _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT0_MB) ... _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT9_MB):
@@ -880,6 +883,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
 	    *(char *) mempcpy (iov[2 + elem + offset].iov_base,
 			       ctype->mbdigits[cnt]->bytes,
 			       ctype->mbdigits[cnt]->nbytes) = '\0';
+	    idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len;
 	    break;
 
 	  case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_WC) ... _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS9_WC):
@@ -893,12 +897,14 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
 		 cnt < ctype->wcdigits_act; cnt += 10)
 	      ((uint32_t *) iov[2 + elem + offset].iov_base)[cnt / 10]
 		= ctype->wcdigits[cnt];
+	    idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len;
 	    break;
 
 	  case _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT0_WC) ... _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT9_WC):
 	    cnt = elem - _NL_CTYPE_OUTDIGIT0_WC;
 	    iov[2 + elem + offset].iov_base = &ctype->wcoutdigits[cnt];
 	    iov[2 + elem + offset].iov_len = sizeof (uint32_t);
+	    idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len;
 	    break;
 
 	  default:
@@ -2933,6 +2939,12 @@ Computing table size for character classes might take a while..."),
 
       /* EOF must map to EOF.  */
       ctype->map[idx][127] = EOF;
+
+      /* The 32 bit map collection.  */
+      for (idx2 = 0; idx2 < ctype->map_collection_act[idx]; ++idx2)
+	if (ctype->map_collection[idx][idx2] != 0)
+	  ctype->map[idx][128 + ctype->charnames[idx2]]
+	    = ctype->map_collection[idx][idx2];
     }
 
   /* Extra array for class and map names.  */
@@ -3041,7 +3053,8 @@ Computing table size for character classes might take a while..."),
 	}
 
       /* Next we allocate an array large enough and fill in the values.  */
-      sorted = alloca (number * sizeof (struct translit_t **));
+      sorted = (struct translit_t **) alloca (number
+					      * sizeof (struct translit_t **));
       runp = ctype->translit;
       number = 0;
       do
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index 6703eb7a60..b08906ef3e 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -118,7 +118,7 @@ time_startup (struct linereader *lr, struct localedef_t *locale,
   if (time != NULL)
     {
       lr->translate_strings = 1;
-      lr->return_widestr = 0;
+      lr->return_widestr = 1;
     }
 }
 
@@ -432,12 +432,12 @@ time_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	    }
 
 	  /* Now generate the wide character name and format.  */
-	  wstr = wcschr ((wchar_t *) time->wera, L':');	/* end direction */
-	  wstr = wstr ? wcschr (wstr, L':') : NULL;	/* end offset */
-	  wstr = wstr ? wcschr (wstr, L':') : NULL;	/* end start */
-	  wstr = wstr ? wcschr (wstr, L':') : NULL;	/* end end */
+	  wstr = wcschr ((wchar_t *) time->wera[idx], L':');/* end direction */
+	  wstr = wstr ? wcschr (wstr + 1, L':') : NULL;	/* end offset */
+	  wstr = wstr ? wcschr (wstr + 1, L':') : NULL;	/* end start */
+	  wstr = wstr ? wcschr (wstr + 1, L':') : NULL;	/* end end */
 	  time->era_entries[idx].wname = (uint32_t *) wstr;
-	  wstr = wstr ? wcschr (wstr, L':') : NULL;	/* end name */
+	  wstr = wstr ? wcschr (wstr + 1, L':') : NULL;	/* end name */
 	  time->era_entries[idx].wformat = (uint32_t *) wstr;
 	}
     }
@@ -670,12 +670,11 @@ time_output (struct localedef_t *locale, struct charmap_t *charmap,
       assert (idx[1 + last_idx] % 4 == 0);
 
       iov[2 + cnt].iov_base = (void *) time->era_entries[num].wname;
-      iov[2 + cnt].iov_len = ((wcschr ((wchar_t *) time->era_entries[cnt].wformat, L'\0')
+      iov[2 + cnt].iov_len = ((wcschr ((wchar_t *) time->era_entries[num].wformat, L'\0')
 			       - (wchar_t *) time->era_entries[num].wname + 1)
 			      * sizeof (uint32_t));
-      ++cnt;
-
       idx[1 + last_idx] += iov[2 + cnt].iov_len;
+      ++cnt;
     }
   ++last_idx;
 
@@ -869,7 +868,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
 
   do
     {
-      now = lr_token (ldfile, charmap, NULL);
+      now = lr_token (ldfile, charmap, repertoire);
       nowtok = now->tok;
     }
   while (nowtok == tok_eol);
@@ -895,7 +894,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
       /* Ingore empty lines.  */
       if (nowtok == tok_eol)
 	{
-	  now = lr_token (ldfile, charmap, NULL);
+	  now = lr_token (ldfile, charmap, repertoire);
 	  nowtok = now->tok;
 	  continue;
 	}
@@ -946,7 +945,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
 		}							      \
 									      \
 	      /* Match the semicolon.  */				      \
-	      now = lr_token (ldfile, charmap, NULL);			      \
+	      now = lr_token (ldfile, charmap, repertoire);		      \
 	      if (now->tok != tok_semicolon && now->tok != tok_eol)	      \
 		break;							      \
 	    }								      \
@@ -960,7 +959,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
 	      								      \
 	      if (now->tok == tok_semicolon)				      \
 		{							      \
-		  now = lr_token (ldfile, charmap, NULL);		      \
+		  now = lr_token (ldfile, charmap, repertoire);		      \
 		  if (now->tok == tok_eol)				      \
 		    lr_error (ldfile, _("extra trailing semicolon"));	      \
 		  else if (now->tok == tok_string)			      \
@@ -994,10 +993,9 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
 	      lr_ignore_rest (ldfile, 0);
 	      break;
 	    }
-
 	  do
 	    {
-	      now = lr_token (ldfile, charmap, NULL);
+	      now = lr_token (ldfile, charmap, repertoire);
 	      if (now->tok != tok_string)
 		goto err_label;
 	      if (!ignore_content && (now->val.str.startmb == NULL
@@ -1008,7 +1006,6 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
 		  lr_ignore_rest (ldfile, 0);
 		  break;
 		}
-
 	      if (!ignore_content)
 		{
 		  time->era = xrealloc (time->era,
@@ -1020,9 +1017,8 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
 					 * sizeof (char *));
 		  time->wera[time->num_era++] = now->val.str.startwc;
 		}
-
-	      now = lr_token (ldfile, charmap, NULL);
-	      if (now->tok != tok_eof && now->tok != tok_semicolon)
+	      now = lr_token (ldfile, charmap, repertoire);
+	      if (now->tok != tok_eol && now->tok != tok_semicolon)
 		goto err_label;
 	    }
 	  while (now->tok == tok_semicolon);
@@ -1038,7 +1034,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
 	      break;							      \
 	    }								      \
 									      \
-	  now = lr_token (ldfile, charmap, NULL);			      \
+	  now = lr_token (ldfile, charmap, repertoire);			      \
 	  if (now->tok != tok_string)					      \
 	    goto err_label;						      \
 	  else if (time->cat != NULL)					      \
@@ -1079,7 +1075,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
 	      break;							      \
 	    }								      \
 									      \
-	  now = lr_token (ldfile, charmap, NULL);			      \
+	  now = lr_token (ldfile, charmap, repertoire);			      \
 	  if (now->tok != tok_number)					      \
 	    goto err_label;						      \
 	  else if (time->cat != 0)					      \
@@ -1102,25 +1098,25 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
 	      break;
 	    }
 
-	  now = lr_token (ldfile, charmap, NULL);
+	  now = lr_token (ldfile, charmap, repertoire);
 	  if (now->tok != tok_number)
 	    goto err_label;
 	  time->week_ndays = now->val.num;
 
-	  now = lr_token (ldfile, charmap, NULL);
+	  now = lr_token (ldfile, charmap, repertoire);
 	  if (now->tok != tok_semicolon)
 	    goto err_label;
 
-	  now = lr_token (ldfile, charmap, NULL);
+	  now = lr_token (ldfile, charmap, repertoire);
 	  if (now->tok != tok_number)
 	    goto err_label;
 	  time->week_1stday = now->val.num;
 
-	  now = lr_token (ldfile, charmap, NULL);
+	  now = lr_token (ldfile, charmap, repertoire);
 	  if (now->tok != tok_semicolon)
 	    goto err_label;
 
-	  now = lr_token (ldfile, charmap, NULL);
+	  now = lr_token (ldfile, charmap, repertoire);
 	  if (now->tok != tok_number)
 	    goto err_label;
 	  time->week_1stweek = now->val.num;
@@ -1130,7 +1126,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
 
 	case tok_end:
 	  /* Next we assume `LC_TIME'.  */
-	  now = lr_token (ldfile, charmap, NULL);
+	  now = lr_token (ldfile, charmap, repertoire);
 	  if (now->tok == tok_eof)
 	    break;
 	  if (now->tok == tok_eol)
@@ -1147,7 +1143,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
 	}
 
       /* Prepare for the next round.  */
-      now = lr_token (ldfile, charmap, NULL);
+      now = lr_token (ldfile, charmap, repertoire);
       nowtok = now->tok;
     }
 
diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
index 99ed0f2480..564173083e 100644
--- a/locale/programs/linereader.c
+++ b/locale/programs/linereader.c
@@ -535,7 +535,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap,
 {
   int return_widestr = lr->return_widestr;
   char *buf;
-  char *buf2 = NULL;
+  wchar_t *buf2 = NULL;
   size_t bufact;
   size_t bufmax = 56;
 
diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c
index 03a5d3a9b1..56bac3f3ea 100644
--- a/posix/wordexp-test.c
+++ b/posix/wordexp-test.c
@@ -89,6 +89,9 @@ struct test_case_struct
     { 0, "foo", "\"$var\"\"$var\"", 0, 1, { "foofoo", }, IFS },
     { 0, NULL, "'singly-quoted'", 0, 1, { "singly-quoted", }, IFS },
     { 0, NULL, "contin\\\nuation", 0, 1, { "continuation", }, IFS },
+    { 0, NULL, "explicit ''", 0, 2, { "explicit", "", }, IFS },
+    { 0, NULL, "explicit \"\"", 0, 2, { "explicit", "", }, IFS },
+    { 0, NULL, "explicit ``", 0, 1, { "explicit", }, IFS },
 
     /* Simple command substitution */
     { 0, NULL, "$(echo hello)", 0, 1, { "hello", }, IFS },
@@ -244,6 +247,7 @@ main (int argc, char *argv[])
     if (testit (&test_case[test]))
       ++fail;
 
+  /* Tilde-expansion tests. */
   pw = getpwnam ("root");
   if (pw != NULL)
     {
@@ -259,6 +263,17 @@ main (int argc, char *argv[])
 
       if (testit (&ts))
 	++fail;
+
+      ts.retval = 0;
+      ts.env = pw->pw_dir;
+      ts.words = "${var#~root}x";
+      ts.flags = 0;
+      ts.wordc = 1;
+      ts.wordv[0] = "x";
+      ts.ifs = IFS;
+
+      if (testit (&ts))
+	++fail;
     }
 
   puts ("tests completed, now cleaning up");
diff --git a/posix/wordexp.c b/posix/wordexp.c
index dde9183db5..302cf0884f 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -2236,6 +2236,14 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags)
 	if (error)
 	  goto do_error;
 
+	if (!word_length)
+	  {
+	    error = w_addword (pwordexp, NULL);
+
+	    if (error)
+	      return error;
+	  }
+
 	break;
 
       case '\'':
@@ -2246,6 +2254,14 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags)
 	if (error)
 	  goto do_error;
 
+	if (!word_length)
+	  {
+	    error = w_addword (pwordexp, NULL);
+
+	    if (error)
+	      return error;
+	  }
+
 	break;
 
       case '~':
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index 7b188b9f9f..42e0d36f19 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  Linux version.
-   Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1996, 1997, 1998, 1999 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
@@ -106,13 +106,13 @@ enum __rlimit_resource
 
 /* Value to indicate that there is no limit.  */
 #ifndef __USE_FILE_OFFSET64
-# define RLIM_INFINITY ((long int)(~0UL >> 1))
+# define RLIM_INFINITY ((unsigned long int)(~0UL))
 #else
-# define RLIM_INFINITY 0x7fffffffffffffffLL
+# define RLIM_INFINITY 0xffffffffffffffffuLL
 #endif
 
 #ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffLL
+# define RLIM64_INFINITY 0xffffffffffffffffuLL
 #endif
 
 /* We can represent all limits.  */
diff --git a/sysdeps/unix/sysv/linux/bits/types.h b/sysdeps/unix/sysv/linux/bits/types.h
index 28d6157e07..a73afee327 100644
--- a/sysdeps/unix/sysv/linux/bits/types.h
+++ b/sysdeps/unix/sysv/linux/bits/types.h
@@ -68,8 +68,8 @@ typedef long int __off_t;		/* Type of file sizes and offsets.  */
 typedef __quad_t __loff_t;		/* Type of file sizes and offsets.  */
 typedef int __pid_t;			/* Type of process identifications.  */
 typedef int __ssize_t;			/* Type of a byte count, or error.  */
-typedef long int __rlim_t;		/* Type of resource counts.  */
-typedef __quad_t __rlim64_t;		/* Type of resource counts (LFS).  */
+typedef __u_long __rlim_t;		/* Type of resource counts.  */
+typedef __u_quad_t __rlim64_t;		/* Type of resource counts (LFS).  */
 typedef __u_int __id_t;			/* General type for ID.  */
 
 typedef struct