Skip to content

Commit

Permalink
Some more #ifdef cleanups
Browse files Browse the repository at this point in the history
src/cmd/ksh93/edit/edit.c,
src/cmd/ksh93/edit/history.c,
src/cmd/ksh93/sh/deparse.c:
- Remove experimental code protected by '#ifdef future'.
  No one is going to do anything with this, it's just clutter.

src/lib/libast/sfio/sfcvt.c:
- In 2021, it might be time to actually start using some C99
  features were available. Change two checks for a _c99_in_the_wild
  macro to actual checks for C99, enabling the use of fpclassify().

Resolves: ksh93#219
  • Loading branch information
McDutchie committed Mar 21, 2021
1 parent 0b814b5 commit 38f2b94
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 60 deletions.
22 changes: 0 additions & 22 deletions src/cmd/ksh93/edit/edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ static char KILL_LINE[20] = { ESC, '[', 'J', 0 };
# define _POSIX_DISABLE 0
#endif

#ifdef future
static int compare(const char*, const char*, int);
#endif /* future */
#define ttyparm (ep->e_ttyparm)
#define nttyparm (ep->e_nttyparm)
static const char bellchr[] = "\a"; /* bell char */
Expand Down Expand Up @@ -212,10 +209,6 @@ int tty_set(int fd, int action, struct termios *tty)
register Edit_t *ep = (Edit_t*)(shgd->ed_context);
if(fd >=0)
{
#ifdef future
if(ep->e_savefd>=0 && compare(&ep->e_savetty,tty,sizeof(struct termios)))
return(0);
#endif
while(tcsetattr(fd, action, tty) == SYSERR)
{
if(errno !=EINTR)
Expand Down Expand Up @@ -1522,21 +1515,6 @@ int ed_genlen(register const genchar *str)
}
#endif /* (SHOPT_ESH || SHOPT_VSH) && SHOPT_MULTIBYTE */

#ifdef future
/*
* returns 1 when <n> bytes starting at <a> and <b> are equal
*/
static int compare(register const char *a,register const char *b,register int n)
{
while(n-->0)
{
if(*a++ != *b++)
return(0);
}
return(1);
}
#endif

#if SHOPT_OLDTERMIO

# include <sys/termio.h>
Expand Down
24 changes: 0 additions & 24 deletions src/cmd/ksh93/edit/history.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,6 @@ int sh_histinit(void *sh_context)
stakseek(offset);
histname = stakptr(offset);
}
#ifdef future
if(hp=wasopen)
{
/* reuse history file if same name */
wasopen = 0;
shgd->hist_ptr = hist_ptr = hp;
if(strcmp(histname,hp->histname)==0)
return(1);
else
hist_free();
}
#endif
retry:
cp = path_relative(shp,histname);
if(!histinit)
Expand Down Expand Up @@ -641,18 +629,6 @@ void hist_eof(register History_t *hp)
{
count += (cp-first);
n = hist_ind(hp, ++hp->histind);
#ifdef future
if(count==hp->histcmds[n])
{
sfprintf(sfstderr,"count match n=%d\n",n);
if(histinit)
{
histinit = 0;
return;
}
}
else if(n>=histinit)
#endif
hp->histcmds[n] = count;
first = cp;
}
Expand Down
12 changes: 0 additions & 12 deletions src/cmd/ksh93/sh/deparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,15 +476,8 @@ static void p_redirect(register const struct ionod *iop)
if(iop->iodelim)
{
/* here document */
#ifdef xxx
iop->iolink = (char*)here_doc;
#endif
here_doc = iop;
io_op[2] = '<';
#ifdef future
if(iof&IOSTRIP)
io_op[3] = '-';
#endif
}
sfputr(outfile,cp,' ');
if(iop->ionxt)
Expand Down Expand Up @@ -586,11 +579,6 @@ static void p_switch(register const struct regnod *reg)
static void here_body(register const struct ionod *iop)
{
Sfio_t *infile;
#ifdef xxx
if(iop->iolink)
here_body((struct inode*)iop->iolink);
iop->iolink = 0;
#endif
if(iop->iofile&IOSTRG)
infile = sfnew((Sfio_t*)0,iop->ioname,iop->iosize,-1,SF_STRING|SF_READ);
else
Expand Down
4 changes: 2 additions & 2 deletions src/lib/libast/sfio/sfcvt.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ int format; /* conversion format */
return SF_INF;
}
#endif
# if _c99_in_the_wild
# if __STDC_VERSION__ >= 199901L
# if _lib_signbit
if (signbit(f))
# else
Expand Down Expand Up @@ -338,7 +338,7 @@ int format; /* conversion format */
return SF_INF;
}
#endif
#if _c99_in_the_wild
#if __STDC_VERSION__ >= 199901L
# if _lib_signbit
if (signbit(f))
# else
Expand Down

0 comments on commit 38f2b94

Please sign in to comment.