commit bash-20200807 snapshot

This commit is contained in:
Chet Ramey
2020-08-12 14:39:05 -04:00
parent 216762309c
commit 7a257517b7
109 changed files with 11698 additions and 10810 deletions
+10 -1
View File
@@ -62,6 +62,7 @@
#include <stdio.h>
#include <ctype.h>
#include <time.h>
#include <errno.h>
#if defined(TM_IN_SYS_TIME)
#include <sys/types.h>
@@ -80,6 +81,10 @@
#undef strchr /* avoid AIX weirdness */
#if !defined (errno)
extern int errno;
#endif
#if defined (SHELL)
extern char *get_string_value (const char *);
#endif
@@ -172,7 +177,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
char *start = s;
auto char tbuf[100];
long off;
int i, w;
int i, w, oerrno;
long y;
static short first = 1;
#ifdef POSIX_SEMANTICS
@@ -217,6 +222,8 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
};
static const char *ampm[] = { "AM", "PM", };
oerrno = errno;
if (s == NULL || format == NULL || timeptr == NULL || maxsize == 0)
return 0;
@@ -716,6 +723,8 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
out:
if (s < endp && *format == '\0') {
*s = '\0';
if (s == start)
errno = oerrno;
return (s - start);
} else
return 0;