mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Next round of minor tweaks and cleanups
Notable changes: - Tie up some loose ends re:3de4da5aand7ba2c685. - comp/omitted.c: Header include fix for Cygwin. - misc/optget.c: - args(): When printing options for the uage line, use a local pointer for the 'if' block instead of reusing the 'b' pointer. That variable is used to output blanks later. - The above fix allows re-enabling the AST translation-aware macros and deleting the astsa fallback without causing usage message corruption in multibyte locales. Maybe someday we'll make ksh actually translatable. - Remove code to reinitialise _error_infop_ and _opt_info_ 'because these are not initialised by all DLLs'. In 2022, hopefully the buggy dynamic linkers are fixed. If not, we're not going to find out by keeping the workaround. I suspect that those bugs may have been triggered by the Microsoft/Cygwin import/export obfuscation removed in3de4da5a. - ksh93: - Remove unused sh.st.var_local variable. This was a leftover of a 93v- attempt to implement the bash 'local' command. It used static scoping, so it's not actually compatible. - Add a few regression tests for miscellaneous breakage that I caused in experiments (the breakage never made it to git; the tests are just to keep it that way).
This commit is contained in:
parent
3de4da5afb
commit
ce3cc66d58
15 changed files with 55 additions and 89 deletions
|
|
@ -2832,6 +2832,7 @@ make install
|
|||
done FEATURE/omitted generated
|
||||
prev include/tm.h implicit
|
||||
prev include/error.h implicit
|
||||
prev ast_stdio.h implicit
|
||||
prev include/ast.h implicit
|
||||
prev FEATURE/float implicit
|
||||
done comp/omitted.c
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#define utimes ______utimes
|
||||
|
||||
#include <ast.h>
|
||||
#include <ast_stdio.h>
|
||||
#include <error.h>
|
||||
#include <tm.h>
|
||||
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
|
||||
#if __CYGWIN__
|
||||
#include <ast_windows.h>
|
||||
#include <sys/cygwin.h>
|
||||
#if _win32_botch_execve || _lib_spawn_mode
|
||||
#define CONVERT 1
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -47,12 +47,9 @@
|
|||
/*
|
||||
* 2007-03-19 move error_info from _error_info_ to (*_error_infop_)
|
||||
* to allow future Error_info_t growth
|
||||
* by 2009 _error_info_ can be static
|
||||
*/
|
||||
|
||||
extern Error_info_t _error_info_;
|
||||
|
||||
Error_info_t _error_info_ =
|
||||
static Error_info_t _error_info_ =
|
||||
{
|
||||
2, exit, write,
|
||||
0,0,0,0,0,0,0,0,
|
||||
|
|
@ -64,8 +61,7 @@ Error_info_t _error_info_ =
|
|||
translate,
|
||||
0 /* catalog */
|
||||
};
|
||||
|
||||
extern Error_info_t* _error_infop_ = &_error_info_;
|
||||
Error_info_t* _error_infop_ = &_error_info_;
|
||||
|
||||
/*
|
||||
* these should probably be in error_info
|
||||
|
|
@ -356,10 +352,8 @@ errorv(const char* id, int level, va_list ap)
|
|||
int line;
|
||||
char* file;
|
||||
|
||||
#if !_PACKAGE_astsa
|
||||
unsigned long d;
|
||||
struct tms us;
|
||||
#endif
|
||||
|
||||
if (!error_info.init)
|
||||
{
|
||||
|
|
@ -466,14 +460,12 @@ errorv(const char* id, int level, va_list ap)
|
|||
sfprintf(stkstd, "%s %d: ", ERROR_translate(NiL, NiL, ast.id, "line"), error_info.line);
|
||||
}
|
||||
}
|
||||
#if !_PACKAGE_astsa
|
||||
if (error_info.time)
|
||||
{
|
||||
if ((d = times(&us)) < error_info.time || error_info.time == 1)
|
||||
error_info.time = d;
|
||||
sfprintf(stkstd, " %05lu.%05lu.%05lu ", d - error_info.time, (unsigned long)us.tms_utime, (unsigned long)us.tms_stime);
|
||||
}
|
||||
#endif
|
||||
switch (level)
|
||||
{
|
||||
case 0:
|
||||
|
|
|
|||
|
|
@ -176,8 +176,6 @@ static unsigned char map[UCHAR_MAX];
|
|||
|
||||
static Optstate_t state;
|
||||
|
||||
#if 0 /* #if !_PACKAGE_astsa // this somehow corrupts "Or:" usage messages, e.g. in 'typeset -\?' */
|
||||
|
||||
#define ID ast.id
|
||||
|
||||
#define C(s) ERROR_catalog(s)
|
||||
|
|
@ -200,18 +198,6 @@ translate(const char* cmd, const char* cat, const char* msg)
|
|||
return errorx(NiL, cmd, cat, msg);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static char ID[] = "ast";
|
||||
|
||||
#define C(s) s
|
||||
#define D(s) (state.msgdict && dtmatch(state.msgdict, (s)))
|
||||
#define T(i,c,m) m
|
||||
#define X(c) 0
|
||||
#define Z(x) C(x),sizeof(x)-1
|
||||
|
||||
#endif
|
||||
|
||||
static const List_t help_head[] =
|
||||
{
|
||||
'-', 0,
|
||||
|
|
@ -337,17 +323,9 @@ static Msg_t C_LC_MESSAGES_libast[] =
|
|||
/*
|
||||
* 2007-03-19 move opt_info from _opt_info_ to (*_opt_data_)
|
||||
* to allow future Opt_t growth
|
||||
* by 2009 _opt_info_ can be static
|
||||
*/
|
||||
|
||||
extern Opt_t _opt_info_;
|
||||
|
||||
Opt_t _opt_info_ = { 0,0,0,0,0,0,0,{0},{0},0,0,0,{0},{0},&state };
|
||||
|
||||
extern Opt_t _opt_info_;
|
||||
|
||||
extern Opt_t* _opt_infop_;
|
||||
|
||||
static Opt_t _opt_info_ = { 0,0,0,0,0,0,0,{0},{0},0,0,0,{0},{0},&state };
|
||||
Opt_t* _opt_infop_ = &_opt_info_;
|
||||
|
||||
Optstate_t*
|
||||
|
|
@ -925,10 +903,8 @@ init(register char* s, Optpass_t* p)
|
|||
if (!state.localized)
|
||||
{
|
||||
state.localized = 1;
|
||||
#if !_PACKAGE_astsa
|
||||
if (!ast.locale.serial)
|
||||
setlocale(LC_ALL, "");
|
||||
#endif
|
||||
state.xp = sfstropen();
|
||||
if (!map[OPT_FLAGS[0]])
|
||||
for (n = 0, t = OPT_FLAGS; *t; t++)
|
||||
|
|
@ -1650,9 +1626,10 @@ args(register Sfio_t* sp, register char* p, register int n, int flags, int style
|
|||
sfputr(sp, b, -1);
|
||||
if (X(catalog))
|
||||
{
|
||||
char *cp;
|
||||
sfwrite(ip, p, i);
|
||||
if (b = sfstruse(ip))
|
||||
sfputr(sp, T(id, catalog, b), -1);
|
||||
if (cp = sfstruse(ip))
|
||||
sfputr(sp, T(id, catalog, cp), -1);
|
||||
else
|
||||
sfwrite(sp, p, i);
|
||||
}
|
||||
|
|
@ -4283,19 +4260,6 @@ optget(register char** argv, const char* oopts)
|
|||
Optcache_t* pcache;
|
||||
Optpass_t* pass;
|
||||
|
||||
#if !_PACKAGE_astsa && !_YOU_FIGURED_OUT_HOW_TO_GET_ALL_DLLS_TO_DO_THIS_
|
||||
/*
|
||||
* these are not initialized by all dlls!
|
||||
*/
|
||||
|
||||
extern Error_info_t _error_info_;
|
||||
extern Opt_t _opt_info_;
|
||||
|
||||
if (!_error_infop_)
|
||||
_error_infop_ = &_error_info_;
|
||||
if (!_opt_infop_)
|
||||
_opt_infop_ = &_opt_info_;
|
||||
#endif
|
||||
if (!oopts)
|
||||
return 0;
|
||||
state.pindex = opt_info.index;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1985-2012 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* Copyright (c) 2020-2022 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
|
|
@ -34,9 +34,7 @@
|
|||
#include <ctype.h>
|
||||
|
||||
#include <ccode.h>
|
||||
#if !_PACKAGE_astsa
|
||||
#include <regex.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
chrexp(register const char* s, char** p, int* m, register int flags)
|
||||
|
|
|
|||
|
|
@ -56,14 +56,6 @@ int sys_nerr = 0;
|
|||
extern char* strerror(int);
|
||||
#endif
|
||||
|
||||
#if _PACKAGE_astsa
|
||||
|
||||
#define fmtbuf(n) ((n),tmp)
|
||||
|
||||
static char tmp[32];
|
||||
|
||||
#endif
|
||||
|
||||
char*
|
||||
_ast_strerror(int err)
|
||||
{
|
||||
|
|
@ -82,7 +74,6 @@ _ast_strerror(int err)
|
|||
#endif
|
||||
if (msg)
|
||||
{
|
||||
#if !_PACKAGE_astsa
|
||||
if (ERROR_translating())
|
||||
{
|
||||
#if _lib_strerror
|
||||
|
|
@ -125,7 +116,6 @@ _ast_strerror(int err)
|
|||
#endif
|
||||
return ERROR_translate(NiL, NiL, "errlist", msg);
|
||||
}
|
||||
#endif
|
||||
return msg;
|
||||
}
|
||||
msg = fmtbuf(z = 32);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue