mirror of
https://github.com/rfivet/uemacs.git
synced 2025-04-22 02:42:18 -04:00
Recompile under MinGW32 with base framework for implementing kbd/screen (mingw32 + wscreen).
This commit is contained in:
parent
45981e8793
commit
3be85dec65
22
Makefile
22
Makefile
@ -1,8 +1,8 @@
|
|||||||
# Makefile for emacs, updated Thu, Oct 10, 2013 1:03:16 PM
|
# Makefile for emacs, updated Wed, Jun 18, 2014 2:24:32 PM
|
||||||
|
|
||||||
SRC=ansi.c basic.c bind.c bindable.c buffer.c crypt.c display.c ebind.c eval.c exec.c execute.c file.c fileio.c flook.c ibmpc.c input.c isearch.c line.c lock.c log.c main.c names.c pklock.c posix.c random.c region.c search.c spawn.c tcap.c termio.c utf8.c vmsvt.c vt52.c window.c word.c wrapper.c
|
SRC=ansi.c basic.c bind.c bindable.c buffer.c crypt.c display.c ebind.c eval.c exec.c execute.c file.c fileio.c flook.c ibmpc.c input.c isearch.c line.c lock.c log.c main.c mingw32.c names.c pklock.c posix.c random.c region.c search.c spawn.c tcap.c termio.c utf8.c vmsvt.c vt52.c window.c word.c wrapper.c wscreen.c
|
||||||
OBJ=ansi.o basic.o bind.o bindable.o buffer.o crypt.o display.o ebind.o eval.o exec.o execute.o file.o fileio.o flook.o ibmpc.o input.o isearch.o line.o lock.o log.o main.o names.o pklock.o posix.o random.o region.o search.o spawn.o tcap.o termio.o utf8.o vmsvt.o vt52.o window.o word.o wrapper.o
|
OBJ=ansi.o basic.o bind.o bindable.o buffer.o crypt.o display.o ebind.o eval.o exec.o execute.o file.o fileio.o flook.o ibmpc.o input.o isearch.o line.o lock.o log.o main.o mingw32.o names.o pklock.o posix.o random.o region.o search.o spawn.o tcap.o termio.o utf8.o vmsvt.o vt52.o window.o word.o wrapper.o wscreen.o
|
||||||
HDR=basic.h bind.h bindable.h buffer.h crypt.h defines.h display.h ebind.h estruct.h eval.h exec.h execute.h file.h fileio.h flook.h input.h isearch.h line.h lock.h log.h names.h pklock.h random.h region.h retcode.h search.h spawn.h terminal.h termio.h utf8.h version.h window.h word.h wrapper.h
|
HDR=basic.h bind.h bindable.h buffer.h crypt.h defines.h display.h ebind.h estruct.h eval.h exec.h execute.h file.h fileio.h flook.h input.h isearch.h line.h lock.h log.h names.h pklock.h random.h region.h retcode.h search.h spawn.h terminal.h termio.h utf8.h version.h window.h word.h wrapper.h wscreen.h
|
||||||
|
|
||||||
# DO NOT ADD OR MODIFY ANY LINES ABOVE THIS -- make source creates them
|
# DO NOT ADD OR MODIFY ANY LINES ABOVE THIS -- make source creates them
|
||||||
|
|
||||||
@ -40,13 +40,19 @@ ifeq ($(uname_S),Darwin)
|
|||||||
endif
|
endif
|
||||||
ifeq ($(uname_S),CYGWIN_NT-6.1-WOW64)
|
ifeq ($(uname_S),CYGWIN_NT-6.1-WOW64)
|
||||||
DEFINES=-DAUTOCONF -DCYGWIN -DPROGRAM=$(PROGRAM)
|
DEFINES=-DAUTOCONF -DCYGWIN -DPROGRAM=$(PROGRAM)
|
||||||
|
LIBS=-lcurses # SYSV
|
||||||
endif
|
endif
|
||||||
ifeq ($(uname_S),CYGWIN_NT-6.1)
|
ifeq ($(uname_S),CYGWIN_NT-6.1)
|
||||||
DEFINES=-DAUTOCONF -DCYGWIN -DPROGRAM=$(PROGRAM)
|
DEFINES=-DAUTOCONF -DCYGWIN -DPROGRAM=$(PROGRAM)
|
||||||
|
LIBS=-lcurses # SYSV
|
||||||
|
endif
|
||||||
|
ifeq ($(uname_S),MINGW32_NT-6.1)
|
||||||
|
DEFINES=-DAUTOCONF -DSYSV -DMINGW32 -DPROGRAM=$(PROGRAM)
|
||||||
|
LIBS=
|
||||||
endif
|
endif
|
||||||
#DEFINES=-DAUTOCONF
|
#DEFINES=-DAUTOCONF
|
||||||
#LIBS=-ltermcap # BSD
|
#LIBS=-ltermcap # BSD
|
||||||
LIBS=-lcurses # SYSV
|
#LIBS=-lcurses # SYSV
|
||||||
#LIBS=-ltermlib
|
#LIBS=-ltermlib
|
||||||
#LIBS=-L/usr/lib/termcap -ltermcap
|
#LIBS=-L/usr/lib/termcap -ltermcap
|
||||||
LFLAGS=-hbx
|
LFLAGS=-hbx
|
||||||
@ -152,8 +158,8 @@ exec.o: exec.c exec.h retcode.h buffer.h crypt.h line.h utf8.h bind.h \
|
|||||||
display.h estruct.h eval.h file.h flook.h input.h random.h window.h \
|
display.h estruct.h eval.h file.h flook.h input.h random.h window.h \
|
||||||
defines.h
|
defines.h
|
||||||
execute.o: execute.c execute.h estruct.h bind.h random.h display.h file.h \
|
execute.o: execute.c execute.h estruct.h bind.h random.h display.h file.h \
|
||||||
crypt.h retcode.h buffer.h line.h utf8.h terminal.h defines.h window.h
|
buffer.h crypt.h line.h utf8.h retcode.h terminal.h defines.h window.h
|
||||||
file.o: file.c file.h crypt.h retcode.h buffer.h line.h utf8.h defines.h \
|
file.o: file.c file.h buffer.h crypt.h line.h utf8.h retcode.h defines.h \
|
||||||
estruct.h execute.h fileio.h input.h bind.h lock.h log.h window.h
|
estruct.h execute.h fileio.h input.h bind.h lock.h log.h window.h
|
||||||
fileio.o: fileio.c fileio.h crypt.h retcode.h defines.h
|
fileio.o: fileio.c fileio.h crypt.h retcode.h defines.h
|
||||||
flook.o: flook.c flook.h retcode.h defines.h fileio.h crypt.h
|
flook.o: flook.c flook.h retcode.h defines.h fileio.h crypt.h
|
||||||
@ -170,6 +176,7 @@ log.o: log.c log.h retcode.h
|
|||||||
main.o: main.c estruct.h basic.h bind.h bindable.h buffer.h crypt.h \
|
main.o: main.c estruct.h basic.h bind.h bindable.h buffer.h crypt.h \
|
||||||
line.h utf8.h display.h eval.h execute.h file.h retcode.h input.h lock.h \
|
line.h utf8.h display.h eval.h execute.h file.h retcode.h input.h lock.h \
|
||||||
log.h random.h search.h terminal.h defines.h termio.h version.h window.h
|
log.h random.h search.h terminal.h defines.h termio.h version.h window.h
|
||||||
|
mingw32.o: mingw32.c
|
||||||
names.o: names.c names.h basic.h bind.h bindable.h buffer.h crypt.h \
|
names.o: names.c names.h basic.h bind.h bindable.h buffer.h crypt.h \
|
||||||
line.h utf8.h display.h eval.h exec.h retcode.h file.h isearch.h \
|
line.h utf8.h display.h eval.h exec.h retcode.h file.h isearch.h \
|
||||||
region.h random.h search.h spawn.h window.h defines.h word.h
|
region.h random.h search.h spawn.h window.h defines.h word.h
|
||||||
@ -197,6 +204,7 @@ window.o: window.c window.h defines.h buffer.h crypt.h line.h utf8.h \
|
|||||||
word.o: word.c word.h basic.h buffer.h crypt.h line.h utf8.h estruct.h \
|
word.o: word.c word.h basic.h buffer.h crypt.h line.h utf8.h estruct.h \
|
||||||
log.h retcode.h random.h region.h window.h defines.h
|
log.h retcode.h random.h region.h window.h defines.h
|
||||||
wrapper.o: wrapper.c wrapper.h
|
wrapper.o: wrapper.c wrapper.h
|
||||||
|
wscreen.o: wscreen.c wscreen.h
|
||||||
|
|
||||||
# DEPENDENCIES MUST END AT END OF FILE
|
# DEPENDENCIES MUST END AT END OF FILE
|
||||||
# IF YOU PUT STUFF HERE IT WILL GO AWAY
|
# IF YOU PUT STUFF HERE IT WILL GO AWAY
|
||||||
|
6
buffer.c
6
buffer.c
@ -46,7 +46,7 @@ static const char modecode[] = "WCSEVOMYAUD" ; /* letters to represent modes */
|
|||||||
|
|
||||||
static int makelist( int iflag) ;
|
static int makelist( int iflag) ;
|
||||||
static int addline( char *text) ;
|
static int addline( char *text) ;
|
||||||
static void ltoa( char *buf, int width, long num) ;
|
static void l_to_a( char *buf, int width, long num) ;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -385,7 +385,7 @@ static int makelist( int iflag)
|
|||||||
nbytes += (long) llength(lp) + 1L;
|
nbytes += (long) llength(lp) + 1L;
|
||||||
lp = lforw(lp);
|
lp = lforw(lp);
|
||||||
}
|
}
|
||||||
ltoa( b, sizeof b, nbytes) ; /* 8 digits string buffer size. */
|
l_to_a( b, sizeof b, nbytes) ; /* 8 digits string buffer size. */
|
||||||
cp2 = &b[0];
|
cp2 = &b[0];
|
||||||
while ((c = *cp2++) != 0)
|
while ((c = *cp2++) != 0)
|
||||||
*cp1++ = c;
|
*cp1++ = c;
|
||||||
@ -411,7 +411,7 @@ static int makelist( int iflag)
|
|||||||
return TRUE; /* All done */
|
return TRUE; /* All done */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ltoa(char *buf, int width, long num)
|
static void l_to_a(char *buf, int width, long num)
|
||||||
{
|
{
|
||||||
buf[ --width] = 0 ; /* End of string. */
|
buf[ --width] = 0 ; /* End of string. */
|
||||||
while (num >= 10) { /* Conditional digits. */
|
while (num >= 10) { /* Conditional digits. */
|
||||||
|
@ -87,7 +87,9 @@ static void modeline(struct window *wp);
|
|||||||
static void mlputi(int i, int r);
|
static void mlputi(int i, int r);
|
||||||
static void mlputli(long l, int r);
|
static void mlputli(long l, int r);
|
||||||
static void mlputf(int s);
|
static void mlputf(int s);
|
||||||
|
#if SIGWINCH
|
||||||
static int newscreensize(int h, int w);
|
static int newscreensize(int h, int w);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if RAINBOW
|
#if RAINBOW
|
||||||
static void putline(int row, int col, char *buf);
|
static void putline(int row, int col, char *buf);
|
||||||
|
11
estruct.h
11
estruct.h
@ -106,6 +106,17 @@
|
|||||||
#define TERMCAP 0 /* Use TERMCAP */
|
#define TERMCAP 0 /* Use TERMCAP */
|
||||||
#define IBMPC 1 /* IBM-PC CGA/MONO/EGA driver */
|
#define IBMPC 1 /* IBM-PC CGA/MONO/EGA driver */
|
||||||
|
|
||||||
|
#elif defined( MINGW32)
|
||||||
|
|
||||||
|
#define VT220 (UNIX | VMS)
|
||||||
|
#define VT100 0
|
||||||
|
|
||||||
|
#define ANSI 0
|
||||||
|
#define VMSVT 0
|
||||||
|
#define VT52 0
|
||||||
|
#define TERMCAP 0
|
||||||
|
#define IBMPC 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define VT220 (UNIX | VMS)
|
#define VT220 (UNIX | VMS)
|
||||||
|
84
eval.c
84
eval.c
@ -348,17 +348,17 @@ char *gtfun(char *fname)
|
|||||||
/* and now evaluate it! */
|
/* and now evaluate it! */
|
||||||
switch (fnum) {
|
switch (fnum) {
|
||||||
case UFADD:
|
case UFADD:
|
||||||
return itoa(atoi(arg1) + atoi(arg2));
|
return i_to_a(atoi(arg1) + atoi(arg2));
|
||||||
case UFSUB:
|
case UFSUB:
|
||||||
return itoa(atoi(arg1) - atoi(arg2));
|
return i_to_a(atoi(arg1) - atoi(arg2));
|
||||||
case UFTIMES:
|
case UFTIMES:
|
||||||
return itoa(atoi(arg1) * atoi(arg2));
|
return i_to_a(atoi(arg1) * atoi(arg2));
|
||||||
case UFDIV:
|
case UFDIV:
|
||||||
return itoa(atoi(arg1) / atoi(arg2));
|
return i_to_a(atoi(arg1) / atoi(arg2));
|
||||||
case UFMOD:
|
case UFMOD:
|
||||||
return itoa(atoi(arg1) % atoi(arg2));
|
return i_to_a(atoi(arg1) % atoi(arg2));
|
||||||
case UFNEG:
|
case UFNEG:
|
||||||
return itoa(-atoi(arg1));
|
return i_to_a(-atoi(arg1));
|
||||||
case UFCAT:
|
case UFCAT:
|
||||||
strcpy(result, arg1);
|
strcpy(result, arg1);
|
||||||
return strcat(result, arg2);
|
return strcat(result, arg2);
|
||||||
@ -391,7 +391,7 @@ char *gtfun(char *fname)
|
|||||||
case UFOR:
|
case UFOR:
|
||||||
return ltos(stol(arg1) || stol(arg2));
|
return ltos(stol(arg1) || stol(arg2));
|
||||||
case UFLENGTH:
|
case UFLENGTH:
|
||||||
return itoa(strlen(arg1));
|
return i_to_a(strlen(arg1));
|
||||||
case UFUPPER:
|
case UFUPPER:
|
||||||
return mkupper(arg1);
|
return mkupper(arg1);
|
||||||
case UFLOWER:
|
case UFLOWER:
|
||||||
@ -399,7 +399,7 @@ char *gtfun(char *fname)
|
|||||||
case UFTRUTH:
|
case UFTRUTH:
|
||||||
return ltos(atoi(arg1) == 42);
|
return ltos(atoi(arg1) == 42);
|
||||||
case UFASCII:
|
case UFASCII:
|
||||||
return itoa((int) arg1[0]);
|
return i_to_a((int) arg1[0]);
|
||||||
case UFCHR:
|
case UFCHR:
|
||||||
result[0] = atoi(arg1);
|
result[0] = atoi(arg1);
|
||||||
result[1] = 0;
|
result[1] = 0;
|
||||||
@ -409,11 +409,11 @@ char *gtfun(char *fname)
|
|||||||
result[1] = 0;
|
result[1] = 0;
|
||||||
return result;
|
return result;
|
||||||
case UFRND:
|
case UFRND:
|
||||||
return itoa((ernd() % abs(atoi(arg1))) + 1);
|
return i_to_a((ernd() % abs(atoi(arg1))) + 1);
|
||||||
case UFABS:
|
case UFABS:
|
||||||
return itoa(abs(atoi(arg1)));
|
return i_to_a(abs(atoi(arg1)));
|
||||||
case UFSINDEX:
|
case UFSINDEX:
|
||||||
return itoa(sindex(arg1, arg2));
|
return i_to_a(sindex(arg1, arg2));
|
||||||
case UFENV:
|
case UFENV:
|
||||||
#if ENVFUNC
|
#if ENVFUNC
|
||||||
tsp = getenv(arg1);
|
tsp = getenv(arg1);
|
||||||
@ -429,13 +429,13 @@ char *gtfun(char *fname)
|
|||||||
tsp = flook(arg1, TRUE);
|
tsp = flook(arg1, TRUE);
|
||||||
return tsp == NULL ? "" : tsp;
|
return tsp == NULL ? "" : tsp;
|
||||||
case UFBAND:
|
case UFBAND:
|
||||||
return itoa(atoi(arg1) & atoi(arg2));
|
return i_to_a(atoi(arg1) & atoi(arg2));
|
||||||
case UFBOR:
|
case UFBOR:
|
||||||
return itoa(atoi(arg1) | atoi(arg2));
|
return i_to_a(atoi(arg1) | atoi(arg2));
|
||||||
case UFBXOR:
|
case UFBXOR:
|
||||||
return itoa(atoi(arg1) ^ atoi(arg2));
|
return i_to_a(atoi(arg1) ^ atoi(arg2));
|
||||||
case UFBNOT:
|
case UFBNOT:
|
||||||
return itoa(~atoi(arg1));
|
return i_to_a(~atoi(arg1));
|
||||||
case UFXLATE:
|
case UFXLATE:
|
||||||
return xlat(arg1, arg2, arg3);
|
return xlat(arg1, arg2, arg3);
|
||||||
}
|
}
|
||||||
@ -497,19 +497,19 @@ char *gtenv(char *vname)
|
|||||||
/* otherwise, fetch the appropriate value */
|
/* otherwise, fetch the appropriate value */
|
||||||
switch (vnum) {
|
switch (vnum) {
|
||||||
case EVFILLCOL:
|
case EVFILLCOL:
|
||||||
return itoa(fillcol);
|
return i_to_a(fillcol);
|
||||||
case EVPAGELEN:
|
case EVPAGELEN:
|
||||||
return itoa(term.t_nrow + 1);
|
return i_to_a(term.t_nrow + 1);
|
||||||
case EVCURCOL:
|
case EVCURCOL:
|
||||||
return itoa(getccol(FALSE));
|
return i_to_a(getccol(FALSE));
|
||||||
case EVCURLINE:
|
case EVCURLINE:
|
||||||
return itoa(getcline());
|
return i_to_a(getcline());
|
||||||
case EVRAM:
|
case EVRAM:
|
||||||
return itoa((int) (envram / 1024l));
|
return i_to_a((int) (envram / 1024l));
|
||||||
case EVFLICKER:
|
case EVFLICKER:
|
||||||
return ltos(flickcode);
|
return ltos(flickcode);
|
||||||
case EVCURWIDTH:
|
case EVCURWIDTH:
|
||||||
return itoa(term.t_ncol);
|
return i_to_a(term.t_ncol);
|
||||||
case EVCBUFNAME:
|
case EVCBUFNAME:
|
||||||
return curbp->b_bname;
|
return curbp->b_bname;
|
||||||
case EVCFNAME:
|
case EVCFNAME:
|
||||||
@ -527,15 +527,15 @@ char *gtenv(char *vname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case EVASAVE:
|
case EVASAVE:
|
||||||
return itoa(gasave);
|
return i_to_a(gasave);
|
||||||
case EVACOUNT:
|
case EVACOUNT:
|
||||||
return itoa(gacount);
|
return i_to_a(gacount);
|
||||||
case EVLASTKEY:
|
case EVLASTKEY:
|
||||||
return itoa(lastkey);
|
return i_to_a(lastkey);
|
||||||
case EVCURCHAR:
|
case EVCURCHAR:
|
||||||
return (curwp->w_dotp->l_used ==
|
return (curwp->w_dotp->l_used ==
|
||||||
curwp->w_doto ? itoa('\n') :
|
curwp->w_doto ? i_to_a('\n') :
|
||||||
itoa(lgetc(curwp->w_dotp, curwp->w_doto)));
|
i_to_a(lgetc(curwp->w_dotp, curwp->w_doto)));
|
||||||
case EVDISCMD:
|
case EVDISCMD:
|
||||||
return ltos(discmd);
|
return ltos(discmd);
|
||||||
case EVVERSION:
|
case EVVERSION:
|
||||||
@ -543,16 +543,16 @@ char *gtenv(char *vname)
|
|||||||
case EVPROGNAME:
|
case EVPROGNAME:
|
||||||
return PROGRAM_NAME_LONG;
|
return PROGRAM_NAME_LONG;
|
||||||
case EVSEED:
|
case EVSEED:
|
||||||
return itoa(seed);
|
return i_to_a(seed);
|
||||||
case EVDISINP:
|
case EVDISINP:
|
||||||
return ltos(disinp);
|
return ltos(disinp);
|
||||||
case EVWLINE:
|
case EVWLINE:
|
||||||
return itoa(curwp->w_ntrows);
|
return i_to_a(curwp->w_ntrows);
|
||||||
case EVCWLINE:
|
case EVCWLINE:
|
||||||
return itoa(getwpos());
|
return i_to_a(getwpos());
|
||||||
case EVTARGET:
|
case EVTARGET:
|
||||||
saveflag = lastflag;
|
saveflag = lastflag;
|
||||||
return itoa(curgoal);
|
return i_to_a(curgoal);
|
||||||
case EVSEARCH:
|
case EVSEARCH:
|
||||||
return pat;
|
return pat;
|
||||||
case EVREPLACE:
|
case EVREPLACE:
|
||||||
@ -562,11 +562,11 @@ char *gtenv(char *vname)
|
|||||||
case EVKILL:
|
case EVKILL:
|
||||||
return getkill();
|
return getkill();
|
||||||
case EVCMODE:
|
case EVCMODE:
|
||||||
return itoa(curbp->b_mode);
|
return i_to_a(curbp->b_mode);
|
||||||
case EVGMODE:
|
case EVGMODE:
|
||||||
return itoa(gmode);
|
return i_to_a(gmode);
|
||||||
case EVTPAUSE:
|
case EVTPAUSE:
|
||||||
return itoa(term.t_pause);
|
return i_to_a(term.t_pause);
|
||||||
case EVPENDING:
|
case EVPENDING:
|
||||||
#if TYPEAH
|
#if TYPEAH
|
||||||
return ltos(typahead());
|
return ltos(typahead());
|
||||||
@ -574,19 +574,19 @@ char *gtenv(char *vname)
|
|||||||
return falsem;
|
return falsem;
|
||||||
#endif
|
#endif
|
||||||
case EVLWIDTH:
|
case EVLWIDTH:
|
||||||
return itoa(llength(curwp->w_dotp));
|
return i_to_a(llength(curwp->w_dotp));
|
||||||
case EVLINE:
|
case EVLINE:
|
||||||
return getctext();
|
return getctext();
|
||||||
case EVGFLAGS:
|
case EVGFLAGS:
|
||||||
return itoa(gflags);
|
return i_to_a(gflags);
|
||||||
case EVRVAL:
|
case EVRVAL:
|
||||||
return itoa(rval);
|
return i_to_a(rval);
|
||||||
case EVTAB:
|
case EVTAB:
|
||||||
return itoa(tabmask + 1);
|
return i_to_a(tabmask + 1);
|
||||||
case EVOVERLAP:
|
case EVOVERLAP:
|
||||||
return itoa(overlap);
|
return i_to_a(overlap);
|
||||||
case EVSCROLLCOUNT:
|
case EVSCROLLCOUNT:
|
||||||
return itoa(scrollcount);
|
return i_to_a(scrollcount);
|
||||||
#if SCROLLCODE
|
#if SCROLLCODE
|
||||||
case EVSCROLL:
|
case EVSCROLL:
|
||||||
return ltos(term.t_scroll != NULL);
|
return ltos(term.t_scroll != NULL);
|
||||||
@ -632,7 +632,7 @@ int setvar(int f, int n)
|
|||||||
|
|
||||||
/* get the value for that variable */
|
/* get the value for that variable */
|
||||||
if (f == TRUE)
|
if (f == TRUE)
|
||||||
strcpy(value, itoa(n));
|
strcpy(value, i_to_a(n));
|
||||||
else {
|
else {
|
||||||
status = mlreply("Value: ", &value[0], NSTRING);
|
status = mlreply("Value: ", &value[0], NSTRING);
|
||||||
if (status != TRUE)
|
if (status != TRUE)
|
||||||
@ -929,13 +929,13 @@ static int svar(struct variable_description *var, char *value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* itoa:
|
* i_to_a:
|
||||||
* integer to ascii string.......... This is too
|
* integer to ascii string.......... This is too
|
||||||
* inconsistant to use the system's
|
* inconsistant to use the system's
|
||||||
*
|
*
|
||||||
* int i; integer to translate to a string
|
* int i; integer to translate to a string
|
||||||
*/
|
*/
|
||||||
char *itoa(int i)
|
char *i_to_a(int i)
|
||||||
{
|
{
|
||||||
#define INTWIDTH sizeof( int) * 3
|
#define INTWIDTH sizeof( int) * 3
|
||||||
|
|
||||||
|
2
eval.h
2
eval.h
@ -43,7 +43,7 @@ char *gtfun( char *fname) ;
|
|||||||
char *gtusr( char *vname) ;
|
char *gtusr( char *vname) ;
|
||||||
char *gtenv( char *vname) ;
|
char *gtenv( char *vname) ;
|
||||||
int setvar( int f, int n) ;
|
int setvar( int f, int n) ;
|
||||||
char *itoa( int i) ;
|
char *i_to_a( int i) ;
|
||||||
char *getval( char *token) ;
|
char *getval( char *token) ;
|
||||||
int stol( char *val) ;
|
int stol( char *val) ;
|
||||||
char *mkupper( char *str) ;
|
char *mkupper( char *str) ;
|
||||||
|
2
exec.c
2
exec.c
@ -629,7 +629,7 @@ static int dobuf(struct buffer *bp)
|
|||||||
strcat(outline, ":");
|
strcat(outline, ":");
|
||||||
|
|
||||||
/* debug if levels */
|
/* debug if levels */
|
||||||
strcat(outline, itoa(execlevel));
|
strcat(outline, i_to_a(execlevel));
|
||||||
strcat(outline, ":");
|
strcat(outline, ":");
|
||||||
|
|
||||||
/* and lastly the line */
|
/* and lastly the line */
|
||||||
|
2
main.c
2
main.c
@ -296,7 +296,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if UNIX
|
#if UNIX
|
||||||
|
#ifdef SIGHUP
|
||||||
signal(SIGHUP, emergencyexit);
|
signal(SIGHUP, emergencyexit);
|
||||||
|
#endif
|
||||||
signal(SIGTERM, emergencyexit);
|
signal(SIGTERM, emergencyexit);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
2
spawn.c
2
spawn.c
@ -102,7 +102,7 @@ int spawncli(int f, int n)
|
|||||||
system("exec /bin/sh");
|
system("exec /bin/sh");
|
||||||
#endif
|
#endif
|
||||||
sgarbf = TRUE;
|
sgarbf = TRUE;
|
||||||
sleep(2);
|
usleep( 2000000L) ;
|
||||||
TTopen();
|
TTopen();
|
||||||
TTkopen();
|
TTkopen();
|
||||||
#ifdef SIGWINCH
|
#ifdef SIGWINCH
|
||||||
|
2
tcap.c
2
tcap.c
@ -19,6 +19,7 @@
|
|||||||
#define USE_BROKEN_OPTIMIZATION 0
|
#define USE_BROKEN_OPTIMIZATION 0
|
||||||
#define termdef 1 /* Don't define "term" external. */
|
#define termdef 1 /* Don't define "term" external. */
|
||||||
|
|
||||||
|
#ifndef MINGW32
|
||||||
#ifdef CYGWIN
|
#ifdef CYGWIN
|
||||||
#include <ncurses/curses.h>
|
#include <ncurses/curses.h>
|
||||||
#include <ncurses/term.h>
|
#include <ncurses/term.h>
|
||||||
@ -26,6 +27,7 @@
|
|||||||
#include <curses.h>
|
#include <curses.h>
|
||||||
#include <term.h>
|
#include <term.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "estruct.h"
|
#include "estruct.h"
|
||||||
|
540
termio.c
540
termio.c
@ -1,15 +1,15 @@
|
|||||||
#include "termio.h"
|
#include "termio.h"
|
||||||
|
|
||||||
/* TERMIO.C
|
/* TERMIO.C
|
||||||
*
|
*
|
||||||
* The functions in this file negotiate with the operating system for
|
* The functions in this file negotiate with the operating system for
|
||||||
* characters, and write characters in a barely buffered fashion on the display.
|
* characters, and write characters in a barely buffered fashion on the display.
|
||||||
* All operating systems.
|
* All operating systems.
|
||||||
*
|
*
|
||||||
* modified by Petri Kutvonen
|
* modified by Petri Kutvonen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef POSIX
|
#if !defined( POSIX) && !defined( MINGW32)
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -23,8 +23,8 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
int ttrow = HUGE ; /* Row location of HW cursor */
|
int ttrow = HUGE ; /* Row location of HW cursor */
|
||||||
int ttcol = HUGE ; /* Column location of HW cursor */
|
int ttcol = HUGE ; /* Column location of HW cursor */
|
||||||
|
|
||||||
#if VMS
|
#if VMS
|
||||||
#include <stsdef.h>
|
#include <stsdef.h>
|
||||||
@ -32,76 +32,76 @@ int ttcol = HUGE ; /* Column location of HW cursor */
|
|||||||
#include <descrip.h>
|
#include <descrip.h>
|
||||||
#include <iodef.h>
|
#include <iodef.h>
|
||||||
#include <ttdef.h>
|
#include <ttdef.h>
|
||||||
#include <tt2def.h>
|
#include <tt2def.h>
|
||||||
|
|
||||||
#define NIBUF 128 /* Input buffer size */
|
#define NIBUF 128 /* Input buffer size */
|
||||||
#define NOBUF 1024 /* MM says bug buffers win! */
|
#define NOBUF 1024 /* MM says bug buffers win! */
|
||||||
#define EFN 0 /* Event flag */
|
#define EFN 0 /* Event flag */
|
||||||
|
|
||||||
char obuf[NOBUF]; /* Output buffer */
|
char obuf[NOBUF]; /* Output buffer */
|
||||||
int nobuf; /* # of bytes in above */
|
int nobuf; /* # of bytes in above */
|
||||||
char ibuf[NIBUF]; /* Input buffer */
|
char ibuf[NIBUF]; /* Input buffer */
|
||||||
int nibuf; /* # of bytes in above */
|
int nibuf; /* # of bytes in above */
|
||||||
int ibufi; /* Read index */
|
int ibufi; /* Read index */
|
||||||
int oldmode[3]; /* Old TTY mode bits */
|
int oldmode[3]; /* Old TTY mode bits */
|
||||||
int newmode[3]; /* New TTY mode bits */
|
int newmode[3]; /* New TTY mode bits */
|
||||||
short iochan; /* TTY I/O channel */
|
short iochan; /* TTY I/O channel */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MSDOS & (MSC | TURBO)
|
#if MSDOS & (MSC | TURBO)
|
||||||
union REGS rg; /* cpu register for use of DOS calls */
|
union REGS rg; /* cpu register for use of DOS calls */
|
||||||
int nxtchar = -1; /* character held from type ahead */
|
int nxtchar = -1; /* character held from type ahead */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USG /* System V */
|
#if USG /* System V */
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <termio.h>
|
#include <termio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
int kbdflgs; /* saved keyboard fd flags */
|
int kbdflgs; /* saved keyboard fd flags */
|
||||||
int kbdpoll; /* in O_NDELAY mode */
|
int kbdpoll; /* in O_NDELAY mode */
|
||||||
int kbdqp; /* there is a char in kbdq */
|
int kbdqp; /* there is a char in kbdq */
|
||||||
char kbdq; /* char we've already read */
|
char kbdq; /* char we've already read */
|
||||||
struct termio otermio; /* original terminal characteristics */
|
struct termio otermio; /* original terminal characteristics */
|
||||||
struct termio ntermio; /* charactoristics to use inside */
|
struct termio ntermio; /* charactoristics to use inside */
|
||||||
#if XONXOFF
|
#if XONXOFF
|
||||||
#define XXMASK 0016000
|
#define XXMASK 0016000
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if V7 | BSD
|
#if V7 | BSD
|
||||||
#include <sgtty.h> /* for stty/gtty functions */
|
#include <sgtty.h> /* for stty/gtty functions */
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
struct sgttyb ostate; /* saved tty state */
|
struct sgttyb ostate; /* saved tty state */
|
||||||
struct sgttyb nstate; /* values for editor mode */
|
struct sgttyb nstate; /* values for editor mode */
|
||||||
struct tchars otchars; /* Saved terminal special character set */
|
struct tchars otchars; /* Saved terminal special character set */
|
||||||
#if XONXOFF
|
#if XONXOFF
|
||||||
struct tchars ntchars = { 0xff, 0xff, 0x11, 0x13, 0xff, 0xff };
|
struct tchars ntchars = { 0xff, 0xff, 0x11, 0x13, 0xff, 0xff };
|
||||||
|
|
||||||
/* A lot of nothing and XON/XOFF */
|
/* A lot of nothing and XON/XOFF */
|
||||||
#else
|
#else
|
||||||
struct tchars ntchars = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
struct tchars ntchars = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||||
|
|
||||||
/* A lot of nothing */
|
/* A lot of nothing */
|
||||||
#endif
|
#endif
|
||||||
#if BSD & PKCODE
|
#if BSD & PKCODE
|
||||||
struct ltchars oltchars; /* Saved terminal local special character set */
|
struct ltchars oltchars; /* Saved terminal local special character set */
|
||||||
struct ltchars nltchars = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
struct ltchars nltchars = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||||
|
|
||||||
/* A lot of nothing */
|
/* A lot of nothing */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BSD
|
#if BSD
|
||||||
#include <sys/ioctl.h> /* to get at the typeahead */
|
#include <sys/ioctl.h> /* to get at the typeahead */
|
||||||
extern int rtfrmshell(); /* return from suspended shell */
|
extern int rtfrmshell(); /* return from suspended shell */
|
||||||
#define TBUFSIZ 128
|
#define TBUFSIZ 128
|
||||||
char tobuf[TBUFSIZ]; /* terminal output buffer */
|
char tobuf[TBUFSIZ]; /* terminal output buffer */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __hpux | SVR4
|
#if __hpux | SVR4
|
||||||
extern int rtfrmshell(); /* return from suspended shell */
|
extern int rtfrmshell(); /* return from suspended shell */
|
||||||
#define TBUFSIZ 128
|
#define TBUFSIZ 128
|
||||||
char tobuf[TBUFSIZ]; /* terminal output buffer */
|
char tobuf[TBUFSIZ]; /* terminal output buffer */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -112,121 +112,121 @@ char tobuf[TBUFSIZ]; /* terminal output buffer */
|
|||||||
void ttopen(void)
|
void ttopen(void)
|
||||||
{
|
{
|
||||||
#if VMS
|
#if VMS
|
||||||
struct dsc$descriptor idsc;
|
struct dsc$descriptor idsc;
|
||||||
struct dsc$descriptor odsc;
|
struct dsc$descriptor odsc;
|
||||||
char oname[40];
|
char oname[40];
|
||||||
int iosb[2];
|
int iosb[2];
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
odsc.dsc$a_pointer = "TT";
|
odsc.dsc$a_pointer = "TT";
|
||||||
odsc.dsc$w_length = strlen(odsc.dsc$a_pointer);
|
odsc.dsc$w_length = strlen(odsc.dsc$a_pointer);
|
||||||
odsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
odsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||||
odsc.dsc$b_class = DSC$K_CLASS_S;
|
odsc.dsc$b_class = DSC$K_CLASS_S;
|
||||||
idsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
idsc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||||
idsc.dsc$b_class = DSC$K_CLASS_S;
|
idsc.dsc$b_class = DSC$K_CLASS_S;
|
||||||
do {
|
do {
|
||||||
idsc.dsc$a_pointer = odsc.dsc$a_pointer;
|
idsc.dsc$a_pointer = odsc.dsc$a_pointer;
|
||||||
idsc.dsc$w_length = odsc.dsc$w_length;
|
idsc.dsc$w_length = odsc.dsc$w_length;
|
||||||
odsc.dsc$a_pointer = &oname[0];
|
odsc.dsc$a_pointer = &oname[0];
|
||||||
odsc.dsc$w_length = sizeof(oname);
|
odsc.dsc$w_length = sizeof(oname);
|
||||||
status = LIB$SYS_TRNLOG(&idsc, &odsc.dsc$w_length, &odsc);
|
status = LIB$SYS_TRNLOG(&idsc, &odsc.dsc$w_length, &odsc);
|
||||||
if (status != SS$_NORMAL && status != SS$_NOTRAN)
|
if (status != SS$_NORMAL && status != SS$_NOTRAN)
|
||||||
exit(status);
|
exit(status);
|
||||||
if (oname[0] == 0x1B) {
|
if (oname[0] == 0x1B) {
|
||||||
odsc.dsc$a_pointer += 4;
|
odsc.dsc$a_pointer += 4;
|
||||||
odsc.dsc$w_length -= 4;
|
odsc.dsc$w_length -= 4;
|
||||||
}
|
}
|
||||||
} while (status == SS$_NORMAL);
|
} while (status == SS$_NORMAL);
|
||||||
status = SYS$ASSIGN(&odsc, &iochan, 0, 0);
|
status = SYS$ASSIGN(&odsc, &iochan, 0, 0);
|
||||||
if (status != SS$_NORMAL)
|
if (status != SS$_NORMAL)
|
||||||
exit(status);
|
exit(status);
|
||||||
status = SYS$QIOW(EFN, iochan, IO$_SENSEMODE, iosb, 0, 0,
|
status = SYS$QIOW(EFN, iochan, IO$_SENSEMODE, iosb, 0, 0,
|
||||||
oldmode, sizeof(oldmode), 0, 0, 0, 0);
|
oldmode, sizeof(oldmode), 0, 0, 0, 0);
|
||||||
if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
|
if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
|
||||||
exit(status);
|
exit(status);
|
||||||
newmode[0] = oldmode[0];
|
newmode[0] = oldmode[0];
|
||||||
newmode[1] = oldmode[1] | TT$M_NOECHO;
|
newmode[1] = oldmode[1] | TT$M_NOECHO;
|
||||||
#if XONXOFF
|
#if XONXOFF
|
||||||
#else
|
#else
|
||||||
newmode[1] &= ~(TT$M_TTSYNC | TT$M_HOSTSYNC);
|
newmode[1] &= ~(TT$M_TTSYNC | TT$M_HOSTSYNC);
|
||||||
#endif
|
#endif
|
||||||
newmode[2] = oldmode[2] | TT2$M_PASTHRU;
|
newmode[2] = oldmode[2] | TT2$M_PASTHRU;
|
||||||
status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
|
status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
|
||||||
newmode, sizeof(newmode), 0, 0, 0, 0);
|
newmode, sizeof(newmode), 0, 0, 0, 0);
|
||||||
if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
|
if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
|
||||||
exit(status);
|
exit(status);
|
||||||
term.t_nrow = (newmode[1] >> 24) - 1;
|
term.t_nrow = (newmode[1] >> 24) - 1;
|
||||||
term.t_ncol = newmode[0] >> 16;
|
term.t_ncol = newmode[0] >> 16;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MSDOS & (TURBO | (PKCODE & MSC))
|
#if MSDOS & (TURBO | (PKCODE & MSC))
|
||||||
/* kill the CONTROL-break interupt */
|
/* kill the CONTROL-break interupt */
|
||||||
rg.h.ah = 0x33; /* control-break check dos call */
|
rg.h.ah = 0x33; /* control-break check dos call */
|
||||||
rg.h.al = 1; /* set the current state */
|
rg.h.al = 1; /* set the current state */
|
||||||
rg.h.dl = 0; /* set it OFF */
|
rg.h.dl = 0; /* set it OFF */
|
||||||
intdos(&rg, &rg); /* go for it! */
|
intdos(&rg, &rg); /* go for it! */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USG
|
#if USG
|
||||||
ioctl(0, TCGETA, &otermio); /* save old settings */
|
ioctl(0, TCGETA, &otermio); /* save old settings */
|
||||||
ntermio.c_iflag = 0; /* setup new settings */
|
ntermio.c_iflag = 0; /* setup new settings */
|
||||||
#if XONXOFF
|
#if XONXOFF
|
||||||
ntermio.c_iflag = otermio.c_iflag & XXMASK; /* save XON/XOFF P.K. */
|
ntermio.c_iflag = otermio.c_iflag & XXMASK; /* save XON/XOFF P.K. */
|
||||||
#endif
|
#endif
|
||||||
ntermio.c_oflag = 0;
|
ntermio.c_oflag = 0;
|
||||||
ntermio.c_cflag = otermio.c_cflag;
|
ntermio.c_cflag = otermio.c_cflag;
|
||||||
ntermio.c_lflag = 0;
|
ntermio.c_lflag = 0;
|
||||||
ntermio.c_line = otermio.c_line;
|
ntermio.c_line = otermio.c_line;
|
||||||
ntermio.c_cc[VMIN] = 1;
|
ntermio.c_cc[VMIN] = 1;
|
||||||
ntermio.c_cc[VTIME] = 0;
|
ntermio.c_cc[VTIME] = 0;
|
||||||
#if PKCODE
|
#if PKCODE
|
||||||
ioctl(0, TCSETAW, &ntermio); /* and activate them */
|
ioctl(0, TCSETAW, &ntermio); /* and activate them */
|
||||||
#else
|
#else
|
||||||
ioctl(0, TCSETA, &ntermio); /* and activate them */
|
ioctl(0, TCSETA, &ntermio); /* and activate them */
|
||||||
#endif
|
#endif
|
||||||
kbdflgs = fcntl(0, F_GETFL, 0);
|
kbdflgs = fcntl(0, F_GETFL, 0);
|
||||||
kbdpoll = FALSE;
|
kbdpoll = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if V7 | BSD
|
#if V7 | BSD
|
||||||
gtty(0, &ostate); /* save old state */
|
gtty(0, &ostate); /* save old state */
|
||||||
gtty(0, &nstate); /* get base of new state */
|
gtty(0, &nstate); /* get base of new state */
|
||||||
#if XONXOFF
|
#if XONXOFF
|
||||||
nstate.sg_flags |= (CBREAK | TANDEM);
|
nstate.sg_flags |= (CBREAK | TANDEM);
|
||||||
#else
|
#else
|
||||||
nstate.sg_flags |= RAW;
|
nstate.sg_flags |= RAW;
|
||||||
#endif
|
#endif
|
||||||
nstate.sg_flags &= ~(ECHO | CRMOD); /* no echo for now... */
|
nstate.sg_flags &= ~(ECHO | CRMOD); /* no echo for now... */
|
||||||
stty(0, &nstate); /* set mode */
|
stty(0, &nstate); /* set mode */
|
||||||
ioctl(0, TIOCGETC, &otchars); /* Save old characters */
|
ioctl(0, TIOCGETC, &otchars); /* Save old characters */
|
||||||
ioctl(0, TIOCSETC, &ntchars); /* Place new character into K */
|
ioctl(0, TIOCSETC, &ntchars); /* Place new character into K */
|
||||||
#if BSD & PKCODE
|
#if BSD & PKCODE
|
||||||
ioctl(0, TIOCGLTC, &oltchars); /* Save old local characters */
|
ioctl(0, TIOCGLTC, &oltchars); /* Save old local characters */
|
||||||
ioctl(0, TIOCSLTC, &nltchars); /* New local characters */
|
ioctl(0, TIOCSLTC, &nltchars); /* New local characters */
|
||||||
#endif
|
#endif
|
||||||
#if BSD
|
#if BSD
|
||||||
/* provide a smaller terminal output buffer so that
|
/* provide a smaller terminal output buffer so that
|
||||||
the type ahead detection works better (more often) */
|
the type ahead detection works better (more often) */
|
||||||
setbuffer(stdout, &tobuf[0], TBUFSIZ);
|
setbuffer(stdout, &tobuf[0], TBUFSIZ);
|
||||||
signal(SIGTSTP, SIG_DFL); /* set signals so that we can */
|
signal(SIGTSTP, SIG_DFL); /* set signals so that we can */
|
||||||
signal(SIGCONT, rtfrmshell); /* suspend & restart emacs */
|
signal(SIGCONT, rtfrmshell); /* suspend & restart emacs */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __hpux | SVR4
|
#if __hpux | SVR4
|
||||||
/* provide a smaller terminal output buffer so that
|
/* provide a smaller terminal output buffer so that
|
||||||
the type ahead detection works better (more often) */
|
the type ahead detection works better (more often) */
|
||||||
setvbuf(stdout, &tobuf[0], _IOFBF, TBUFSIZ);
|
setvbuf(stdout, &tobuf[0], _IOFBF, TBUFSIZ);
|
||||||
signal(SIGTSTP, SIG_DFL); /* set signals so that we can */
|
signal(SIGTSTP, SIG_DFL); /* set signals so that we can */
|
||||||
signal(SIGCONT, rtfrmshell); /* suspend & restart emacs */
|
signal(SIGCONT, rtfrmshell); /* suspend & restart emacs */
|
||||||
TTflush();
|
TTflush();
|
||||||
#endif /* __hpux */
|
#endif /* __hpux */
|
||||||
|
|
||||||
/* on all screens we are not sure of the initial position
|
/* on all screens we are not sure of the initial position
|
||||||
of the cursor */
|
of the cursor */
|
||||||
ttrow = 999;
|
ttrow = 999;
|
||||||
ttcol = 999;
|
ttcol = 999;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -237,40 +237,40 @@ void ttopen(void)
|
|||||||
void ttclose(void)
|
void ttclose(void)
|
||||||
{
|
{
|
||||||
#if VMS
|
#if VMS
|
||||||
int status;
|
int status;
|
||||||
int iosb[1];
|
int iosb[1];
|
||||||
|
|
||||||
ttflush();
|
ttflush();
|
||||||
status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
|
status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
|
||||||
oldmode, sizeof(oldmode), 0, 0, 0, 0);
|
oldmode, sizeof(oldmode), 0, 0, 0, 0);
|
||||||
if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
|
if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
|
||||||
exit(status);
|
exit(status);
|
||||||
status = SYS$DASSGN(iochan);
|
status = SYS$DASSGN(iochan);
|
||||||
if (status != SS$_NORMAL)
|
if (status != SS$_NORMAL)
|
||||||
exit(status);
|
exit(status);
|
||||||
#endif
|
#endif
|
||||||
#if MSDOS & (TURBO | (PKCODE & MSC))
|
#if MSDOS & (TURBO | (PKCODE & MSC))
|
||||||
/* restore the CONTROL-break interupt */
|
/* restore the CONTROL-break interupt */
|
||||||
rg.h.ah = 0x33; /* control-break check dos call */
|
rg.h.ah = 0x33; /* control-break check dos call */
|
||||||
rg.h.al = 1; /* set the current state */
|
rg.h.al = 1; /* set the current state */
|
||||||
rg.h.dl = 1; /* set it ON */
|
rg.h.dl = 1; /* set it ON */
|
||||||
intdos(&rg, &rg); /* go for it! */
|
intdos(&rg, &rg); /* go for it! */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USG
|
#if USG
|
||||||
#if PKCODE
|
#if PKCODE
|
||||||
ioctl(0, TCSETAW, &otermio); /* restore terminal settings */
|
ioctl(0, TCSETAW, &otermio); /* restore terminal settings */
|
||||||
#else
|
#else
|
||||||
ioctl(0, TCSETA, &otermio); /* restore terminal settings */
|
ioctl(0, TCSETA, &otermio); /* restore terminal settings */
|
||||||
#endif
|
#endif
|
||||||
fcntl(0, F_SETFL, kbdflgs);
|
fcntl(0, F_SETFL, kbdflgs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if V7 | BSD
|
#if V7 | BSD
|
||||||
stty(0, &ostate);
|
stty(0, &ostate);
|
||||||
ioctl(0, TIOCSETC, &otchars); /* Place old character into K */
|
ioctl(0, TIOCSETC, &otchars); /* Place old character into K */
|
||||||
#if BSD & PKCODE
|
#if BSD & PKCODE
|
||||||
ioctl(0, TIOCSLTC, &oltchars); /* Place old local character into K */
|
ioctl(0, TIOCSLTC, &oltchars); /* Place old local character into K */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -283,23 +283,23 @@ void ttclose(void)
|
|||||||
*/
|
*/
|
||||||
int ttputc( int c) {
|
int ttputc( int c) {
|
||||||
#if VMS
|
#if VMS
|
||||||
if (nobuf >= NOBUF)
|
if (nobuf >= NOBUF)
|
||||||
ttflush();
|
ttflush();
|
||||||
obuf[nobuf++] = c;
|
obuf[nobuf++] = c;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MSDOS & ~IBMPC
|
#if MSDOS & ~IBMPC
|
||||||
bdos(6, c, 0);
|
bdos(6, c, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if V7 | USG | BSD
|
#if V7 | USG | BSD
|
||||||
char utf8[6];
|
char utf8[6];
|
||||||
int bytes;
|
int bytes;
|
||||||
|
|
||||||
bytes = unicode_to_utf8(c, utf8);
|
bytes = unicode_to_utf8(c, utf8);
|
||||||
fwrite(utf8, 1, bytes, stdout);
|
fwrite(utf8, 1, bytes, stdout);
|
||||||
#endif
|
#endif
|
||||||
return 0 ;
|
return 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -308,19 +308,19 @@ int ttputc( int c) {
|
|||||||
*/
|
*/
|
||||||
void ttflush( void) {
|
void ttflush( void) {
|
||||||
#if VMS
|
#if VMS
|
||||||
int status;
|
int status;
|
||||||
int iosb[2];
|
int iosb[2];
|
||||||
|
|
||||||
status = SS$_NORMAL;
|
status = SS$_NORMAL;
|
||||||
if (nobuf != 0) {
|
if (nobuf != 0) {
|
||||||
status =
|
status =
|
||||||
SYS$QIOW(EFN, iochan, IO$_WRITELBLK | IO$M_NOFORMAT,
|
SYS$QIOW(EFN, iochan, IO$_WRITELBLK | IO$M_NOFORMAT,
|
||||||
iosb, 0, 0, obuf, nobuf, 0, 0, 0, 0);
|
iosb, 0, 0, obuf, nobuf, 0, 0, 0, 0);
|
||||||
if (status == SS$_NORMAL)
|
if (status == SS$_NORMAL)
|
||||||
status = iosb[0] & 0xFFFF;
|
status = iosb[0] & 0xFFFF;
|
||||||
nobuf = 0;
|
nobuf = 0;
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MSDOS
|
#if MSDOS
|
||||||
@ -339,13 +339,13 @@ void ttflush( void) {
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
status = fflush(stdout);
|
status = fflush(stdout);
|
||||||
|
|
||||||
if (status != 0 && errno != EAGAIN) {
|
if (status != 0 && errno != EAGAIN) {
|
||||||
exit(errno);
|
exit(errno);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,111 +356,111 @@ void ttflush( void) {
|
|||||||
*/
|
*/
|
||||||
int ttgetc( void) {
|
int ttgetc( void) {
|
||||||
#if VMS
|
#if VMS
|
||||||
int status;
|
int status;
|
||||||
int iosb[2];
|
int iosb[2];
|
||||||
int term[2];
|
int term[2];
|
||||||
|
|
||||||
while (ibufi >= nibuf) {
|
while (ibufi >= nibuf) {
|
||||||
ibufi = 0;
|
ibufi = 0;
|
||||||
term[0] = 0;
|
term[0] = 0;
|
||||||
term[1] = 0;
|
term[1] = 0;
|
||||||
status = SYS$QIOW(EFN, iochan, IO$_READLBLK | IO$M_TIMED,
|
status = SYS$QIOW(EFN, iochan, IO$_READLBLK | IO$M_TIMED,
|
||||||
iosb, 0, 0, ibuf, NIBUF, 0, term, 0, 0);
|
iosb, 0, 0, ibuf, NIBUF, 0, term, 0, 0);
|
||||||
if (status != SS$_NORMAL)
|
if (status != SS$_NORMAL)
|
||||||
exit(status);
|
exit(status);
|
||||||
status = iosb[0] & 0xFFFF;
|
status = iosb[0] & 0xFFFF;
|
||||||
if (status != SS$_NORMAL && status != SS$_TIMEOUT &&
|
if (status != SS$_NORMAL && status != SS$_TIMEOUT &&
|
||||||
status != SS$_DATAOVERUN)
|
status != SS$_DATAOVERUN)
|
||||||
exit(status);
|
exit(status);
|
||||||
nibuf = (iosb[0] >> 16) + (iosb[1] >> 16);
|
nibuf = (iosb[0] >> 16) + (iosb[1] >> 16);
|
||||||
if (nibuf == 0) {
|
if (nibuf == 0) {
|
||||||
status = SYS$QIOW(EFN, iochan, IO$_READLBLK,
|
status = SYS$QIOW(EFN, iochan, IO$_READLBLK,
|
||||||
iosb, 0, 0, ibuf, 1, 0, term, 0,
|
iosb, 0, 0, ibuf, 1, 0, term, 0,
|
||||||
0);
|
0);
|
||||||
if (status != SS$_NORMAL
|
if (status != SS$_NORMAL
|
||||||
|| (status = (iosb[0] & 0xFFFF)) != SS$_NORMAL)
|
|| (status = (iosb[0] & 0xFFFF)) != SS$_NORMAL)
|
||||||
if (status != SS$_DATAOVERUN)
|
if (status != SS$_DATAOVERUN)
|
||||||
exit(status);
|
exit(status);
|
||||||
nibuf = (iosb[0] >> 16) + (iosb[1] >> 16);
|
nibuf = (iosb[0] >> 16) + (iosb[1] >> 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ibuf[ibufi++] & 0xFF; /* Allow multinational */
|
return ibuf[ibufi++] & 0xFF; /* Allow multinational */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MSDOS & (MSC | TURBO)
|
#if MSDOS & (MSC | TURBO)
|
||||||
int c; /* character read */
|
int c; /* character read */
|
||||||
|
|
||||||
/* if a char already is ready, return it */
|
/* if a char already is ready, return it */
|
||||||
if (nxtchar >= 0) {
|
if (nxtchar >= 0) {
|
||||||
c = nxtchar;
|
c = nxtchar;
|
||||||
nxtchar = -1;
|
nxtchar = -1;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call the dos to get a char */
|
/* call the dos to get a char */
|
||||||
rg.h.ah = 7; /* dos Direct Console Input call */
|
rg.h.ah = 7; /* dos Direct Console Input call */
|
||||||
intdos(&rg, &rg);
|
intdos(&rg, &rg);
|
||||||
c = rg.h.al; /* grab the char */
|
c = rg.h.al; /* grab the char */
|
||||||
return c & 255;
|
return c & 255;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if V7 | BSD
|
#if V7 | BSD
|
||||||
return 255 & fgetc(stdin); /* 8BIT P.K. */
|
return 255 & fgetc(stdin); /* 8BIT P.K. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USG
|
#if USG
|
||||||
if (kbdqp)
|
if (kbdqp)
|
||||||
kbdqp = FALSE;
|
kbdqp = FALSE;
|
||||||
else {
|
else {
|
||||||
if (kbdpoll && fcntl(0, F_SETFL, kbdflgs) < 0)
|
if (kbdpoll && fcntl(0, F_SETFL, kbdflgs) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
kbdpoll = FALSE;
|
kbdpoll = FALSE;
|
||||||
while (read(0, &kbdq, 1) != 1);
|
while (read(0, &kbdq, 1) != 1);
|
||||||
}
|
}
|
||||||
return kbdq & 255;
|
return kbdq & 255;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TYPEAH
|
#if TYPEAH
|
||||||
/* typahead: Check to see if any characters are already in the
|
/* typahead: Check to see if any characters are already in the
|
||||||
keyboard buffer
|
keyboard buffer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int typahead( void)
|
int typahead( void)
|
||||||
{
|
{
|
||||||
#if MSDOS & (MSC | TURBO)
|
#if MSDOS & (MSC | TURBO)
|
||||||
if (kbhit() != 0)
|
if (kbhit() != 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BSD
|
#if BSD
|
||||||
int x; /* holds # of pending chars */
|
int x; /* holds # of pending chars */
|
||||||
|
|
||||||
return (ioctl(0, FIONREAD, &x) < 0) ? 0 : x;
|
return (ioctl(0, FIONREAD, &x) < 0) ? 0 : x;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PKCODE & VMS
|
#if PKCODE & VMS
|
||||||
return ibufi < nibuf;
|
return ibufi < nibuf;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USG
|
#if USG
|
||||||
if (!kbdqp) {
|
if (!kbdqp) {
|
||||||
if (!kbdpoll && fcntl(0, F_SETFL, kbdflgs | O_NDELAY) < 0)
|
if (!kbdpoll && fcntl(0, F_SETFL, kbdflgs | O_NDELAY) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#if PKCODE
|
#if PKCODE
|
||||||
kbdpoll = 1;
|
kbdpoll = 1;
|
||||||
#endif
|
#endif
|
||||||
kbdqp = (1 == read(0, &kbdq, 1));
|
kbdqp = (1 == read(0, &kbdq, 1));
|
||||||
}
|
}
|
||||||
return kbdqp;
|
return kbdqp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !UNIX & !VMS & !MSDOS
|
#if !UNIX & !VMS & !MSDOS
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* not POSIX */
|
#endif /* not POSIX */
|
||||||
|
@ -6,6 +6,12 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#ifdef MINGW32
|
||||||
|
int mkstemp( char *template) {
|
||||||
|
return -1 ;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void die( const char *err) {
|
static void die( const char *err) {
|
||||||
fprintf( stderr, "fatal: %s\n", err) ;
|
fprintf( stderr, "fatal: %s\n", err) ;
|
||||||
exit( EXIT_FAILURE) ;
|
exit( EXIT_FAILURE) ;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user