mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-11 14:10:49 +02:00
Bash-5.3-alpha release
This commit is contained in:
+15
-34
@@ -3,7 +3,7 @@
|
||||
/* See Makefile for compilation details. */
|
||||
|
||||
/*
|
||||
Copyright (C) 2016,2022 Free Software Foundation, Inc.
|
||||
Copyright (C) 2016,2022-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash.
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
@@ -80,17 +80,14 @@ static char *arraysubs[] =
|
||||
static char *stattime (time_t, const char *);
|
||||
|
||||
static int
|
||||
getstat (fname, flags, sp)
|
||||
const char *fname;
|
||||
int flags;
|
||||
struct stat *sp;
|
||||
getstat (const char *fname, int flags, struct stat *sp)
|
||||
{
|
||||
intmax_t lfd;
|
||||
int fd, r;
|
||||
|
||||
if (strncmp (fname, "/dev/fd/", 8) == 0)
|
||||
{
|
||||
if ((legal_number(fname + 8, &lfd) == 0) || (int)lfd != lfd)
|
||||
if ((valid_number(fname + 8, &lfd) == 0) || (int)lfd != lfd)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
@@ -109,9 +106,7 @@ getstat (fname, flags, sp)
|
||||
}
|
||||
|
||||
static char *
|
||||
statlink (fname, sp)
|
||||
char *fname;
|
||||
struct stat *sp;
|
||||
statlink (char *fname, struct stat *sp)
|
||||
{
|
||||
#if defined (HAVE_READLINK)
|
||||
char linkbuf[PATH_MAX];
|
||||
@@ -128,8 +123,7 @@ statlink (fname, sp)
|
||||
}
|
||||
|
||||
static char *
|
||||
octalperms (m)
|
||||
int m;
|
||||
octalperms (int m)
|
||||
{
|
||||
int operms;
|
||||
char *ret;
|
||||
@@ -170,8 +164,7 @@ octalperms (m)
|
||||
}
|
||||
|
||||
static char *
|
||||
statperms (m)
|
||||
int m;
|
||||
statperms (int m)
|
||||
{
|
||||
char ubits[4], gbits[4], obits[4]; /* u=rwx,g=rwx,o=rwx */
|
||||
int i;
|
||||
@@ -217,8 +210,7 @@ statperms (m)
|
||||
}
|
||||
|
||||
static char *
|
||||
statmode(mode)
|
||||
int mode;
|
||||
statmode(int mode)
|
||||
{
|
||||
char *modestr, *m;
|
||||
|
||||
@@ -260,9 +252,7 @@ statmode(mode)
|
||||
}
|
||||
|
||||
static char *
|
||||
stattime (t, timefmt)
|
||||
time_t t;
|
||||
const char *timefmt;
|
||||
stattime (time_t t, const char *timefmt)
|
||||
{
|
||||
char *tbuf, *ret;
|
||||
const char *fmt;
|
||||
@@ -271,6 +261,8 @@ stattime (t, timefmt)
|
||||
|
||||
fmt = timefmt ? timefmt : DEFTIMEFMT;
|
||||
tm = localtime (&t);
|
||||
if (tm == 0)
|
||||
return (itos (t));
|
||||
|
||||
ret = xmalloc (TIMELEN_MAX);
|
||||
|
||||
@@ -282,12 +274,7 @@ stattime (t, timefmt)
|
||||
}
|
||||
|
||||
static char *
|
||||
statval (which, fname, flags, fmt, sp)
|
||||
int which;
|
||||
char *fname;
|
||||
int flags;
|
||||
char *fmt;
|
||||
struct stat *sp;
|
||||
statval (int which, char *fname, int flags, char *fmt, struct stat *sp)
|
||||
{
|
||||
int temp;
|
||||
|
||||
@@ -332,13 +319,7 @@ statval (which, fname, flags, fmt, sp)
|
||||
}
|
||||
|
||||
static int
|
||||
loadstat (vname, var, fname, flags, fmt, sp)
|
||||
char *vname;
|
||||
SHELL_VAR *var;
|
||||
char *fname;
|
||||
int flags;
|
||||
char *fmt;
|
||||
struct stat *sp;
|
||||
loadstat (char *vname, SHELL_VAR *var, char *fname, int flags, char *fmt, struct stat *sp)
|
||||
{
|
||||
int i;
|
||||
char *key, *value;
|
||||
@@ -349,13 +330,13 @@ loadstat (vname, var, fname, flags, fmt, sp)
|
||||
key = savestring (arraysubs[i]);
|
||||
value = statval (i, fname, flags, fmt, sp);
|
||||
v = bind_assoc_variable (var, vname, key, value, ASS_FORCE);
|
||||
free (value);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
stat_builtin (list)
|
||||
WORD_LIST *list;
|
||||
stat_builtin (WORD_LIST *list)
|
||||
{
|
||||
int opt, flags;
|
||||
char *aname, *fname, *timefmt;
|
||||
@@ -390,7 +371,7 @@ stat_builtin (list)
|
||||
}
|
||||
}
|
||||
|
||||
if (legal_identifier (aname) == 0)
|
||||
if (valid_identifier (aname) == 0)
|
||||
{
|
||||
sh_invalidid (aname);
|
||||
return (EXECUTION_FAILURE);
|
||||
|
||||
Reference in New Issue
Block a user