History log of /openbsd-current/usr.bin/mg/tty.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.40 08-Mar-2023 guenther

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.39 20-Mar-2021 lum

Add a 'batch' mode to mg via the '-b' command line option which will
initialise a pty, run the specified file of mg commands and then exit.

This is to facilitate mg fitting into the OpenBSD regress test
framework and be able to run via a cron job.


# 1.38 01-Mar-2021 lum

Put the hardcoded '\n' character which is found throughout mg into a
buffer specific variable. The diff should not produce any behavourial
changes in mg.


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.37 09-Feb-2020 florian

Do not define variables in def.h since this will lead to duplicate definitions
in every source file that includes def.h
Found by gcc10 in portable in gentoo and fedora.
Patch from Ulrich Mueller (ulm AT gentoo.org) via Han Boetes, thanks!
Ok tb


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.36 18-Nov-2015 jasper

shrink differences between ttinsl/ttdell


Revision tags: OPENBSD_5_8_BASE
# 1.35 19-Mar-2015 bcallah

More unifdef cleanup:
-UDIRED_XMAPS and -UFUND_XMAPS: you can't build mg the other way.
-DTIOCGWINSZ: you have this if you have term.h
Remove a #define TERMCAP which isn't being used.

Remove defines for NDIRED_XMAPS, NFUND_XMAPS, and IMAPEXT. They are all
defined to be 0 and are only ever used in addition. We don't need to add 0.
Simply lines that were using those defines.
ok florian@


# 1.34 19-Mar-2015 bcallah

Clean up the includes in mg.
This does the following:
Moves all POSIX headers from sysdef.h into the individual .c files so that
each file now only includes what it needs. All headers are properly sorted.
Moves the remainder of sysdef.h to other files (mostly def.h) and deletes
sysdef.h now that it's no longer contains anything.
Tweak a comment that references sysdef.h so that it no longer does that.
ok florian@


# 1.33 17-Mar-2015 bcallah

It is impossible to build mg without both -DFKEYS and -DXKEYS. So let's
enforce that and remove the options.
Mostly mechanical diff from unifdef with bonus removal of comments that no
longer have any relevance.
ok florian@


Revision tags: OPENBSD_5_7_BASE
# 1.32 16-Nov-2014 guenther

scroll_fwd should be const char *

from Kamil Rytarowski (n54 (at) gmx.com)


# 1.31 16-Nov-2014 guenther

constipate charcost()

from Kamil Rytarowski (n54 (at) gmx.com)


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.30 15-Sep-2008 kjell

Enable dirty buffer detection in mg.
Emulate the emacs behavior: after suspend/resume, buffer switch,
or at save time, warn (prompt) the user if the file has been modified
on disk in the interim.
This has already saved my butt numerous times.
ok phessler


Revision tags: OPENBSD_4_4_BASE
# 1.29 11-Jun-2008 tobias

Let curses handle the setup of terminal instead of doing it on our own
and leaving terminal in an inusable state if setupterm failed.

ok kjell


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.28 01-Aug-2006 jason

* move sys/queue.h inclusion to sysdef.h (it's system specific)
* add <signal.h> to sysdef.h (needed for sig_atomic_t on linux, and
we get it by accident on OpenBSD)
* remove <signal.h> from tty.c/spawn.c (not needed now that it's in sysdef.h)
ok beck


# 1.27 03-Apr-2006 deraadt

lint love; ok kjell


Revision tags: OPENBSD_3_9_BASE
# 1.26 25-Feb-2006 otto

Fix a coredump occurring when the terminal is resized while mg is
suspended. Problem reported and fixed tested by reyk@; tweak by
kjell@; ok kjell@


# 1.25 13-Dec-2005 kjell

Fix a typo (introduced in rev 1.6) that utterly broke cost calculations.
In theory, mg should now be much more efficient on slow displays (hello,
zaurus).

Spotted by lint. ok millert.


# 1.24 13-Dec-2005 kjell

More name-clash delinting


# 1.23 19-Nov-2005 kjell

Clean up some lint.


Revision tags: OPENBSD_3_8_BASE
# 1.22 14-Jun-2005 kjell

Add explicit public domain notices to all public domain files.
ok millert@, deraadt@


# 1.21 03-Apr-2005 db

This is a no binary change which does:

- spelling, punctuation fixes
- variable declaration lineup
- use parentheses for return and sizeof
- K&R function declarations -> ANSI
- other minor code beautification

ok henning@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.20 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.19 28-Aug-2002 art

ANSIfication uncovers function argument bugs. How unusual.


# 1.18 23-Aug-2002 vincent

ansi


# 1.17 01-Jul-2002 vincent

just make vtresize return TRUE/FALSE instead of 0/-1, for consistency with
the rest of the mg code. + some KNF.

adapted from diff by zyrnix.


Revision tags: OPENBSD_3_1_BASE
# 1.16 21-Feb-2002 deraadt

remove a wrapper around getenv()


# 1.15 21-Feb-2002 deraadt

signal-safe window size changing


# 1.14 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.13 14-Feb-2002 deraadt

some KNF


# 1.12 05-Feb-2002 art

Get rid of signal race (and handling of SIGWINCH).
New code is almost done, but not really tested yet.


# 1.11 18-Jan-2002 art

Remove the NROW and NCOL limits. The static arrays are now replaced with
dynamically allocated memory.
Code written by Vincent Labrecque <limitln@Psyfreaks.CA> with some minor
tweaks by me.


# 1.10 10-Jan-2002 art

Clean up tty resizing code.
Catch SIGWINCH and resize and refresh the screen.


Revision tags: OPENBSD_3_0_BASE
# 1.9 24-May-2001 mickey

spaces


# 1.8 23-May-2001 art

remove VOID. We're way beyond the point where this could build with an
ancient compiler.


Revision tags: OPENBSD_2_9_BASE
# 1.7 29-Jan-2001 niklas

$OpenBSD$


Revision tags: OPENBSD_2_8_BASE
# 1.6 01-Sep-2000 millert

More -Wall anmd KNF, from op2@tomahawk.SQUiSH.org


Revision tags: OPENBSD_2_7_BASE
# 1.5 13-Apr-2000 millert

The start of KNF + -Wall. The code has been run through indent but
needs hand fixup. I stopped at keymap.c...


# 1.4 03-Mar-2000 millert

Reverse rutgers change (attachtoparent vs. spawncli)

New ttreinit function that enters application mode, enables the keypad
and resets the tty size.

New spawn module that calls tttidy() to exit application mode (and cleanup)
then calls ttreinit() after resume to get back into application mode. Assumes
we have job control. This takes advantage of the xterm 'alternate screen'.


# 1.3 27-Feb-2000 millert

Call setttysize() from ttinit() not ttopen() since we haven't
run setupterm() until ttinit() is called.
Remove a tgetnum() I missed in the termcap -> terminfo cleanup.
Merge parts of the BSD ttyio.c. The termios stuff here could use a
cleanup, possibly including the flow control hack from the BSD ttyio.c.


# 1.2 26-Feb-2000 millert

change WINDOW -> MGWIN to avoid curses type conflict
convert to terminfo in tty*.c
add support for some keypad function keys (arrows, pgup, pgdown)


# 1.1 25-Feb-2000 deraadt

initial import of mg2a


# 1.39 20-Mar-2021 lum

Add a 'batch' mode to mg via the '-b' command line option which will
initialise a pty, run the specified file of mg commands and then exit.

This is to facilitate mg fitting into the OpenBSD regress test
framework and be able to run via a cron job.


# 1.38 01-Mar-2021 lum

Put the hardcoded '\n' character which is found throughout mg into a
buffer specific variable. The diff should not produce any behavourial
changes in mg.


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.37 09-Feb-2020 florian

Do not define variables in def.h since this will lead to duplicate definitions
in every source file that includes def.h
Found by gcc10 in portable in gentoo and fedora.
Patch from Ulrich Mueller (ulm AT gentoo.org) via Han Boetes, thanks!
Ok tb


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.36 18-Nov-2015 jasper

shrink differences between ttinsl/ttdell


Revision tags: OPENBSD_5_8_BASE
# 1.35 19-Mar-2015 bcallah

More unifdef cleanup:
-UDIRED_XMAPS and -UFUND_XMAPS: you can't build mg the other way.
-DTIOCGWINSZ: you have this if you have term.h
Remove a #define TERMCAP which isn't being used.

Remove defines for NDIRED_XMAPS, NFUND_XMAPS, and IMAPEXT. They are all
defined to be 0 and are only ever used in addition. We don't need to add 0.
Simply lines that were using those defines.
ok florian@


# 1.34 19-Mar-2015 bcallah

Clean up the includes in mg.
This does the following:
Moves all POSIX headers from sysdef.h into the individual .c files so that
each file now only includes what it needs. All headers are properly sorted.
Moves the remainder of sysdef.h to other files (mostly def.h) and deletes
sysdef.h now that it's no longer contains anything.
Tweak a comment that references sysdef.h so that it no longer does that.
ok florian@


# 1.33 17-Mar-2015 bcallah

It is impossible to build mg without both -DFKEYS and -DXKEYS. So let's
enforce that and remove the options.
Mostly mechanical diff from unifdef with bonus removal of comments that no
longer have any relevance.
ok florian@


Revision tags: OPENBSD_5_7_BASE
# 1.32 16-Nov-2014 guenther

scroll_fwd should be const char *

from Kamil Rytarowski (n54 (at) gmx.com)


# 1.31 16-Nov-2014 guenther

constipate charcost()

from Kamil Rytarowski (n54 (at) gmx.com)


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.30 15-Sep-2008 kjell

Enable dirty buffer detection in mg.
Emulate the emacs behavior: after suspend/resume, buffer switch,
or at save time, warn (prompt) the user if the file has been modified
on disk in the interim.
This has already saved my butt numerous times.
ok phessler


Revision tags: OPENBSD_4_4_BASE
# 1.29 11-Jun-2008 tobias

Let curses handle the setup of terminal instead of doing it on our own
and leaving terminal in an inusable state if setupterm failed.

ok kjell


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.28 01-Aug-2006 jason

* move sys/queue.h inclusion to sysdef.h (it's system specific)
* add <signal.h> to sysdef.h (needed for sig_atomic_t on linux, and
we get it by accident on OpenBSD)
* remove <signal.h> from tty.c/spawn.c (not needed now that it's in sysdef.h)
ok beck


# 1.27 03-Apr-2006 deraadt

lint love; ok kjell


Revision tags: OPENBSD_3_9_BASE
# 1.26 25-Feb-2006 otto

Fix a coredump occurring when the terminal is resized while mg is
suspended. Problem reported and fixed tested by reyk@; tweak by
kjell@; ok kjell@


# 1.25 13-Dec-2005 kjell

Fix a typo (introduced in rev 1.6) that utterly broke cost calculations.
In theory, mg should now be much more efficient on slow displays (hello,
zaurus).

Spotted by lint. ok millert.


# 1.24 13-Dec-2005 kjell

More name-clash delinting


# 1.23 19-Nov-2005 kjell

Clean up some lint.


Revision tags: OPENBSD_3_8_BASE
# 1.22 14-Jun-2005 kjell

Add explicit public domain notices to all public domain files.
ok millert@, deraadt@


# 1.21 03-Apr-2005 db

This is a no binary change which does:

- spelling, punctuation fixes
- variable declaration lineup
- use parentheses for return and sizeof
- K&R function declarations -> ANSI
- other minor code beautification

ok henning@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.20 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.19 28-Aug-2002 art

ANSIfication uncovers function argument bugs. How unusual.


# 1.18 23-Aug-2002 vincent

ansi


# 1.17 01-Jul-2002 vincent

just make vtresize return TRUE/FALSE instead of 0/-1, for consistency with
the rest of the mg code. + some KNF.

adapted from diff by zyrnix.


Revision tags: OPENBSD_3_1_BASE
# 1.16 21-Feb-2002 deraadt

remove a wrapper around getenv()


# 1.15 21-Feb-2002 deraadt

signal-safe window size changing


# 1.14 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.13 14-Feb-2002 deraadt

some KNF


# 1.12 05-Feb-2002 art

Get rid of signal race (and handling of SIGWINCH).
New code is almost done, but not really tested yet.


# 1.11 18-Jan-2002 art

Remove the NROW and NCOL limits. The static arrays are now replaced with
dynamically allocated memory.
Code written by Vincent Labrecque <limitln@Psyfreaks.CA> with some minor
tweaks by me.


# 1.10 10-Jan-2002 art

Clean up tty resizing code.
Catch SIGWINCH and resize and refresh the screen.


Revision tags: OPENBSD_3_0_BASE
# 1.9 24-May-2001 mickey

spaces


# 1.8 23-May-2001 art

remove VOID. We're way beyond the point where this could build with an
ancient compiler.


Revision tags: OPENBSD_2_9_BASE
# 1.7 29-Jan-2001 niklas

$OpenBSD$


Revision tags: OPENBSD_2_8_BASE
# 1.6 01-Sep-2000 millert

More -Wall anmd KNF, from op2@tomahawk.SQUiSH.org


Revision tags: OPENBSD_2_7_BASE
# 1.5 13-Apr-2000 millert

The start of KNF + -Wall. The code has been run through indent but
needs hand fixup. I stopped at keymap.c...


# 1.4 03-Mar-2000 millert

Reverse rutgers change (attachtoparent vs. spawncli)

New ttreinit function that enters application mode, enables the keypad
and resets the tty size.

New spawn module that calls tttidy() to exit application mode (and cleanup)
then calls ttreinit() after resume to get back into application mode. Assumes
we have job control. This takes advantage of the xterm 'alternate screen'.


# 1.3 27-Feb-2000 millert

Call setttysize() from ttinit() not ttopen() since we haven't
run setupterm() until ttinit() is called.
Remove a tgetnum() I missed in the termcap -> terminfo cleanup.
Merge parts of the BSD ttyio.c. The termios stuff here could use a
cleanup, possibly including the flow control hack from the BSD ttyio.c.


# 1.2 26-Feb-2000 millert

change WINDOW -> MGWIN to avoid curses type conflict
convert to terminfo in tty*.c
add support for some keypad function keys (arrows, pgup, pgdown)


# 1.1 25-Feb-2000 deraadt

initial import of mg2a


# 1.38 01-Mar-2021 lum

Put the hardcoded '\n' character which is found throughout mg into a
buffer specific variable. The diff should not produce any behavourial
changes in mg.


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.37 09-Feb-2020 florian

Do not define variables in def.h since this will lead to duplicate definitions
in every source file that includes def.h
Found by gcc10 in portable in gentoo and fedora.
Patch from Ulrich Mueller (ulm AT gentoo.org) via Han Boetes, thanks!
Ok tb


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.36 18-Nov-2015 jasper

shrink differences between ttinsl/ttdell


Revision tags: OPENBSD_5_8_BASE
# 1.35 19-Mar-2015 bcallah

More unifdef cleanup:
-UDIRED_XMAPS and -UFUND_XMAPS: you can't build mg the other way.
-DTIOCGWINSZ: you have this if you have term.h
Remove a #define TERMCAP which isn't being used.

Remove defines for NDIRED_XMAPS, NFUND_XMAPS, and IMAPEXT. They are all
defined to be 0 and are only ever used in addition. We don't need to add 0.
Simply lines that were using those defines.
ok florian@


# 1.34 19-Mar-2015 bcallah

Clean up the includes in mg.
This does the following:
Moves all POSIX headers from sysdef.h into the individual .c files so that
each file now only includes what it needs. All headers are properly sorted.
Moves the remainder of sysdef.h to other files (mostly def.h) and deletes
sysdef.h now that it's no longer contains anything.
Tweak a comment that references sysdef.h so that it no longer does that.
ok florian@


# 1.33 17-Mar-2015 bcallah

It is impossible to build mg without both -DFKEYS and -DXKEYS. So let's
enforce that and remove the options.
Mostly mechanical diff from unifdef with bonus removal of comments that no
longer have any relevance.
ok florian@


Revision tags: OPENBSD_5_7_BASE
# 1.32 16-Nov-2014 guenther

scroll_fwd should be const char *

from Kamil Rytarowski (n54 (at) gmx.com)


# 1.31 16-Nov-2014 guenther

constipate charcost()

from Kamil Rytarowski (n54 (at) gmx.com)


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.30 15-Sep-2008 kjell

Enable dirty buffer detection in mg.
Emulate the emacs behavior: after suspend/resume, buffer switch,
or at save time, warn (prompt) the user if the file has been modified
on disk in the interim.
This has already saved my butt numerous times.
ok phessler


Revision tags: OPENBSD_4_4_BASE
# 1.29 11-Jun-2008 tobias

Let curses handle the setup of terminal instead of doing it on our own
and leaving terminal in an inusable state if setupterm failed.

ok kjell


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.28 01-Aug-2006 jason

* move sys/queue.h inclusion to sysdef.h (it's system specific)
* add <signal.h> to sysdef.h (needed for sig_atomic_t on linux, and
we get it by accident on OpenBSD)
* remove <signal.h> from tty.c/spawn.c (not needed now that it's in sysdef.h)
ok beck


# 1.27 03-Apr-2006 deraadt

lint love; ok kjell


Revision tags: OPENBSD_3_9_BASE
# 1.26 25-Feb-2006 otto

Fix a coredump occurring when the terminal is resized while mg is
suspended. Problem reported and fixed tested by reyk@; tweak by
kjell@; ok kjell@


# 1.25 13-Dec-2005 kjell

Fix a typo (introduced in rev 1.6) that utterly broke cost calculations.
In theory, mg should now be much more efficient on slow displays (hello,
zaurus).

Spotted by lint. ok millert.


# 1.24 13-Dec-2005 kjell

More name-clash delinting


# 1.23 19-Nov-2005 kjell

Clean up some lint.


Revision tags: OPENBSD_3_8_BASE
# 1.22 14-Jun-2005 kjell

Add explicit public domain notices to all public domain files.
ok millert@, deraadt@


# 1.21 03-Apr-2005 db

This is a no binary change which does:

- spelling, punctuation fixes
- variable declaration lineup
- use parentheses for return and sizeof
- K&R function declarations -> ANSI
- other minor code beautification

ok henning@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.20 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.19 28-Aug-2002 art

ANSIfication uncovers function argument bugs. How unusual.


# 1.18 23-Aug-2002 vincent

ansi


# 1.17 01-Jul-2002 vincent

just make vtresize return TRUE/FALSE instead of 0/-1, for consistency with
the rest of the mg code. + some KNF.

adapted from diff by zyrnix.


Revision tags: OPENBSD_3_1_BASE
# 1.16 21-Feb-2002 deraadt

remove a wrapper around getenv()


# 1.15 21-Feb-2002 deraadt

signal-safe window size changing


# 1.14 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.13 14-Feb-2002 deraadt

some KNF


# 1.12 05-Feb-2002 art

Get rid of signal race (and handling of SIGWINCH).
New code is almost done, but not really tested yet.


# 1.11 18-Jan-2002 art

Remove the NROW and NCOL limits. The static arrays are now replaced with
dynamically allocated memory.
Code written by Vincent Labrecque <limitln@Psyfreaks.CA> with some minor
tweaks by me.


# 1.10 10-Jan-2002 art

Clean up tty resizing code.
Catch SIGWINCH and resize and refresh the screen.


Revision tags: OPENBSD_3_0_BASE
# 1.9 24-May-2001 mickey

spaces


# 1.8 23-May-2001 art

remove VOID. We're way beyond the point where this could build with an
ancient compiler.


Revision tags: OPENBSD_2_9_BASE
# 1.7 29-Jan-2001 niklas

$OpenBSD$


Revision tags: OPENBSD_2_8_BASE
# 1.6 01-Sep-2000 millert

More -Wall anmd KNF, from op2@tomahawk.SQUiSH.org


Revision tags: OPENBSD_2_7_BASE
# 1.5 13-Apr-2000 millert

The start of KNF + -Wall. The code has been run through indent but
needs hand fixup. I stopped at keymap.c...


# 1.4 03-Mar-2000 millert

Reverse rutgers change (attachtoparent vs. spawncli)

New ttreinit function that enters application mode, enables the keypad
and resets the tty size.

New spawn module that calls tttidy() to exit application mode (and cleanup)
then calls ttreinit() after resume to get back into application mode. Assumes
we have job control. This takes advantage of the xterm 'alternate screen'.


# 1.3 27-Feb-2000 millert

Call setttysize() from ttinit() not ttopen() since we haven't
run setupterm() until ttinit() is called.
Remove a tgetnum() I missed in the termcap -> terminfo cleanup.
Merge parts of the BSD ttyio.c. The termios stuff here could use a
cleanup, possibly including the flow control hack from the BSD ttyio.c.


# 1.2 26-Feb-2000 millert

change WINDOW -> MGWIN to avoid curses type conflict
convert to terminfo in tty*.c
add support for some keypad function keys (arrows, pgup, pgdown)


# 1.1 25-Feb-2000 deraadt

initial import of mg2a


# 1.37 09-Feb-2020 florian

Do not define variables in def.h since this will lead to duplicate definitions
in every source file that includes def.h
Found by gcc10 in portable in gentoo and fedora.
Patch from Ulrich Mueller (ulm AT gentoo.org) via Han Boetes, thanks!
Ok tb


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.36 18-Nov-2015 jasper

shrink differences between ttinsl/ttdell


Revision tags: OPENBSD_5_8_BASE
# 1.35 19-Mar-2015 bcallah

More unifdef cleanup:
-UDIRED_XMAPS and -UFUND_XMAPS: you can't build mg the other way.
-DTIOCGWINSZ: you have this if you have term.h
Remove a #define TERMCAP which isn't being used.

Remove defines for NDIRED_XMAPS, NFUND_XMAPS, and IMAPEXT. They are all
defined to be 0 and are only ever used in addition. We don't need to add 0.
Simply lines that were using those defines.
ok florian@


# 1.34 19-Mar-2015 bcallah

Clean up the includes in mg.
This does the following:
Moves all POSIX headers from sysdef.h into the individual .c files so that
each file now only includes what it needs. All headers are properly sorted.
Moves the remainder of sysdef.h to other files (mostly def.h) and deletes
sysdef.h now that it's no longer contains anything.
Tweak a comment that references sysdef.h so that it no longer does that.
ok florian@


# 1.33 17-Mar-2015 bcallah

It is impossible to build mg without both -DFKEYS and -DXKEYS. So let's
enforce that and remove the options.
Mostly mechanical diff from unifdef with bonus removal of comments that no
longer have any relevance.
ok florian@


Revision tags: OPENBSD_5_7_BASE
# 1.32 16-Nov-2014 guenther

scroll_fwd should be const char *

from Kamil Rytarowski (n54 (at) gmx.com)


# 1.31 16-Nov-2014 guenther

constipate charcost()

from Kamil Rytarowski (n54 (at) gmx.com)


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.30 15-Sep-2008 kjell

Enable dirty buffer detection in mg.
Emulate the emacs behavior: after suspend/resume, buffer switch,
or at save time, warn (prompt) the user if the file has been modified
on disk in the interim.
This has already saved my butt numerous times.
ok phessler


Revision tags: OPENBSD_4_4_BASE
# 1.29 11-Jun-2008 tobias

Let curses handle the setup of terminal instead of doing it on our own
and leaving terminal in an inusable state if setupterm failed.

ok kjell


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.28 01-Aug-2006 jason

* move sys/queue.h inclusion to sysdef.h (it's system specific)
* add <signal.h> to sysdef.h (needed for sig_atomic_t on linux, and
we get it by accident on OpenBSD)
* remove <signal.h> from tty.c/spawn.c (not needed now that it's in sysdef.h)
ok beck


# 1.27 03-Apr-2006 deraadt

lint love; ok kjell


Revision tags: OPENBSD_3_9_BASE
# 1.26 25-Feb-2006 otto

Fix a coredump occurring when the terminal is resized while mg is
suspended. Problem reported and fixed tested by reyk@; tweak by
kjell@; ok kjell@


# 1.25 13-Dec-2005 kjell

Fix a typo (introduced in rev 1.6) that utterly broke cost calculations.
In theory, mg should now be much more efficient on slow displays (hello,
zaurus).

Spotted by lint. ok millert.


# 1.24 13-Dec-2005 kjell

More name-clash delinting


# 1.23 19-Nov-2005 kjell

Clean up some lint.


Revision tags: OPENBSD_3_8_BASE
# 1.22 14-Jun-2005 kjell

Add explicit public domain notices to all public domain files.
ok millert@, deraadt@


# 1.21 03-Apr-2005 db

This is a no binary change which does:

- spelling, punctuation fixes
- variable declaration lineup
- use parentheses for return and sizeof
- K&R function declarations -> ANSI
- other minor code beautification

ok henning@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.20 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.19 28-Aug-2002 art

ANSIfication uncovers function argument bugs. How unusual.


# 1.18 23-Aug-2002 vincent

ansi


# 1.17 01-Jul-2002 vincent

just make vtresize return TRUE/FALSE instead of 0/-1, for consistency with
the rest of the mg code. + some KNF.

adapted from diff by zyrnix.


Revision tags: OPENBSD_3_1_BASE
# 1.16 21-Feb-2002 deraadt

remove a wrapper around getenv()


# 1.15 21-Feb-2002 deraadt

signal-safe window size changing


# 1.14 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.13 14-Feb-2002 deraadt

some KNF


# 1.12 05-Feb-2002 art

Get rid of signal race (and handling of SIGWINCH).
New code is almost done, but not really tested yet.


# 1.11 18-Jan-2002 art

Remove the NROW and NCOL limits. The static arrays are now replaced with
dynamically allocated memory.
Code written by Vincent Labrecque <limitln@Psyfreaks.CA> with some minor
tweaks by me.


# 1.10 10-Jan-2002 art

Clean up tty resizing code.
Catch SIGWINCH and resize and refresh the screen.


Revision tags: OPENBSD_3_0_BASE
# 1.9 24-May-2001 mickey

spaces


# 1.8 23-May-2001 art

remove VOID. We're way beyond the point where this could build with an
ancient compiler.


Revision tags: OPENBSD_2_9_BASE
# 1.7 29-Jan-2001 niklas

$OpenBSD$


Revision tags: OPENBSD_2_8_BASE
# 1.6 01-Sep-2000 millert

More -Wall anmd KNF, from op2@tomahawk.SQUiSH.org


Revision tags: OPENBSD_2_7_BASE
# 1.5 13-Apr-2000 millert

The start of KNF + -Wall. The code has been run through indent but
needs hand fixup. I stopped at keymap.c...


# 1.4 03-Mar-2000 millert

Reverse rutgers change (attachtoparent vs. spawncli)

New ttreinit function that enters application mode, enables the keypad
and resets the tty size.

New spawn module that calls tttidy() to exit application mode (and cleanup)
then calls ttreinit() after resume to get back into application mode. Assumes
we have job control. This takes advantage of the xterm 'alternate screen'.


# 1.3 27-Feb-2000 millert

Call setttysize() from ttinit() not ttopen() since we haven't
run setupterm() until ttinit() is called.
Remove a tgetnum() I missed in the termcap -> terminfo cleanup.
Merge parts of the BSD ttyio.c. The termios stuff here could use a
cleanup, possibly including the flow control hack from the BSD ttyio.c.


# 1.2 26-Feb-2000 millert

change WINDOW -> MGWIN to avoid curses type conflict
convert to terminfo in tty*.c
add support for some keypad function keys (arrows, pgup, pgdown)


# 1.1 25-Feb-2000 deraadt

initial import of mg2a


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.36 18-Nov-2015 jasper

shrink differences between ttinsl/ttdell


Revision tags: OPENBSD_5_8_BASE
# 1.35 19-Mar-2015 bcallah

More unifdef cleanup:
-UDIRED_XMAPS and -UFUND_XMAPS: you can't build mg the other way.
-DTIOCGWINSZ: you have this if you have term.h
Remove a #define TERMCAP which isn't being used.

Remove defines for NDIRED_XMAPS, NFUND_XMAPS, and IMAPEXT. They are all
defined to be 0 and are only ever used in addition. We don't need to add 0.
Simply lines that were using those defines.
ok florian@


# 1.34 19-Mar-2015 bcallah

Clean up the includes in mg.
This does the following:
Moves all POSIX headers from sysdef.h into the individual .c files so that
each file now only includes what it needs. All headers are properly sorted.
Moves the remainder of sysdef.h to other files (mostly def.h) and deletes
sysdef.h now that it's no longer contains anything.
Tweak a comment that references sysdef.h so that it no longer does that.
ok florian@


# 1.33 17-Mar-2015 bcallah

It is impossible to build mg without both -DFKEYS and -DXKEYS. So let's
enforce that and remove the options.
Mostly mechanical diff from unifdef with bonus removal of comments that no
longer have any relevance.
ok florian@


Revision tags: OPENBSD_5_7_BASE
# 1.32 16-Nov-2014 guenther

scroll_fwd should be const char *

from Kamil Rytarowski (n54 (at) gmx.com)


# 1.31 16-Nov-2014 guenther

constipate charcost()

from Kamil Rytarowski (n54 (at) gmx.com)


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.30 15-Sep-2008 kjell

Enable dirty buffer detection in mg.
Emulate the emacs behavior: after suspend/resume, buffer switch,
or at save time, warn (prompt) the user if the file has been modified
on disk in the interim.
This has already saved my butt numerous times.
ok phessler


Revision tags: OPENBSD_4_4_BASE
# 1.29 11-Jun-2008 tobias

Let curses handle the setup of terminal instead of doing it on our own
and leaving terminal in an inusable state if setupterm failed.

ok kjell


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.28 01-Aug-2006 jason

* move sys/queue.h inclusion to sysdef.h (it's system specific)
* add <signal.h> to sysdef.h (needed for sig_atomic_t on linux, and
we get it by accident on OpenBSD)
* remove <signal.h> from tty.c/spawn.c (not needed now that it's in sysdef.h)
ok beck


# 1.27 03-Apr-2006 deraadt

lint love; ok kjell


Revision tags: OPENBSD_3_9_BASE
# 1.26 25-Feb-2006 otto

Fix a coredump occurring when the terminal is resized while mg is
suspended. Problem reported and fixed tested by reyk@; tweak by
kjell@; ok kjell@


# 1.25 13-Dec-2005 kjell

Fix a typo (introduced in rev 1.6) that utterly broke cost calculations.
In theory, mg should now be much more efficient on slow displays (hello,
zaurus).

Spotted by lint. ok millert.


# 1.24 13-Dec-2005 kjell

More name-clash delinting


# 1.23 19-Nov-2005 kjell

Clean up some lint.


Revision tags: OPENBSD_3_8_BASE
# 1.22 14-Jun-2005 kjell

Add explicit public domain notices to all public domain files.
ok millert@, deraadt@


# 1.21 03-Apr-2005 db

This is a no binary change which does:

- spelling, punctuation fixes
- variable declaration lineup
- use parentheses for return and sizeof
- K&R function declarations -> ANSI
- other minor code beautification

ok henning@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.20 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.19 28-Aug-2002 art

ANSIfication uncovers function argument bugs. How unusual.


# 1.18 23-Aug-2002 vincent

ansi


# 1.17 01-Jul-2002 vincent

just make vtresize return TRUE/FALSE instead of 0/-1, for consistency with
the rest of the mg code. + some KNF.

adapted from diff by zyrnix.


Revision tags: OPENBSD_3_1_BASE
# 1.16 21-Feb-2002 deraadt

remove a wrapper around getenv()


# 1.15 21-Feb-2002 deraadt

signal-safe window size changing


# 1.14 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.13 14-Feb-2002 deraadt

some KNF


# 1.12 05-Feb-2002 art

Get rid of signal race (and handling of SIGWINCH).
New code is almost done, but not really tested yet.


# 1.11 18-Jan-2002 art

Remove the NROW and NCOL limits. The static arrays are now replaced with
dynamically allocated memory.
Code written by Vincent Labrecque <limitln@Psyfreaks.CA> with some minor
tweaks by me.


# 1.10 10-Jan-2002 art

Clean up tty resizing code.
Catch SIGWINCH and resize and refresh the screen.


Revision tags: OPENBSD_3_0_BASE
# 1.9 24-May-2001 mickey

spaces


# 1.8 23-May-2001 art

remove VOID. We're way beyond the point where this could build with an
ancient compiler.


Revision tags: OPENBSD_2_9_BASE
# 1.7 29-Jan-2001 niklas

$OpenBSD$


Revision tags: OPENBSD_2_8_BASE
# 1.6 01-Sep-2000 millert

More -Wall anmd KNF, from op2@tomahawk.SQUiSH.org


Revision tags: OPENBSD_2_7_BASE
# 1.5 13-Apr-2000 millert

The start of KNF + -Wall. The code has been run through indent but
needs hand fixup. I stopped at keymap.c...


# 1.4 03-Mar-2000 millert

Reverse rutgers change (attachtoparent vs. spawncli)

New ttreinit function that enters application mode, enables the keypad
and resets the tty size.

New spawn module that calls tttidy() to exit application mode (and cleanup)
then calls ttreinit() after resume to get back into application mode. Assumes
we have job control. This takes advantage of the xterm 'alternate screen'.


# 1.3 27-Feb-2000 millert

Call setttysize() from ttinit() not ttopen() since we haven't
run setupterm() until ttinit() is called.
Remove a tgetnum() I missed in the termcap -> terminfo cleanup.
Merge parts of the BSD ttyio.c. The termios stuff here could use a
cleanup, possibly including the flow control hack from the BSD ttyio.c.


# 1.2 26-Feb-2000 millert

change WINDOW -> MGWIN to avoid curses type conflict
convert to terminfo in tty*.c
add support for some keypad function keys (arrows, pgup, pgdown)


# 1.1 25-Feb-2000 deraadt

initial import of mg2a