Reformat all C files.

I'll push a formatting guide at some point. There may still be
outstanding changes, but please feel free to resolve those as you arrive
a them.

To the best of my knowledge, there is no changes to the actual code
content, but the formatter does have the occasional bug. If you run into
an issue, please fix it!
This commit is contained in:
Sean Hunt
2015-05-09 13:43:16 -04:00
parent 167800afdf
commit 97d6fade74
270 changed files with 182649 additions and 173878 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 ioctl.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.6 ioctl.c $NHDT-Date: 1431192779 2015/05/09 17:32:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */
/* NetHack 3.6 ioctl.c $Date: 2011/06/16 15:10:14 $ $Revision: 1.8 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -10,63 +10,65 @@
#include "hack.h"
#if defined(BSD_JOB_CONTROL) || defined(_BULL_SOURCE)
# ifdef HPUX
#ifdef HPUX
#include <bsdtty.h>
# else
# if defined(AIX_31) && !defined(_ALL_SOURCE)
# define _ALL_SOURCE /* causes struct winsize to be present */
# ifdef _AIX32
# include <sys/ioctl.h>
# endif
# endif
# if defined(_BULL_SOURCE)
# include <termios.h>
#else
#if defined(AIX_31) && !defined(_ALL_SOURCE)
#define _ALL_SOURCE /* causes struct winsize to be present */
#ifdef _AIX32
#include <sys/ioctl.h>
#endif
#endif
#if defined(_BULL_SOURCE)
#include <termios.h>
struct termios termio;
# undef TIMEOUT /* defined in you.h and sys/tty.h */
# include <sys/tty.h> /* define winsize */
# include <sys/ttold.h> /* define struct ltchars */
# include <sys/bsdioctl.h> /* define TIOGWINSZ */
# else
# ifdef LINUX
# include <bsd/sgtty.h>
# else
# include <sgtty.h>
# endif
# endif
# endif
#undef TIMEOUT /* defined in you.h and sys/tty.h */
#include <sys/tty.h> /* define winsize */
#include <sys/ttold.h> /* define struct ltchars */
#include <sys/bsdioctl.h> /* define TIOGWINSZ */
#else
#ifdef LINUX
#include <bsd/sgtty.h>
#else
#include <sgtty.h>
#endif
#endif
#endif
struct ltchars ltchars;
struct ltchars ltchars0 = { -1, -1, -1, -1, -1, -1 }; /* turn all off */
#else
# ifdef POSIX_TYPES
#ifdef POSIX_TYPES
#include <termios.h>
struct termios termio;
# if defined(BSD) || defined(_AIX32) || defined(__linux__)
# if defined(_AIX32) && !defined(_ALL_SOURCE)
# define _ALL_SOURCE
# endif
#if defined(BSD) || defined(_AIX32) || defined(__linux__)
#if defined(_AIX32) && !defined(_ALL_SOURCE)
#define _ALL_SOURCE
#endif
#include <sys/ioctl.h>
# endif
# else
#include <termio.h> /* also includes part of <sgtty.h> */
# if defined(TCSETS) && !defined(AIX_31)
#endif
#else
#include <termio.h> /* also includes part of <sgtty.h> */
#if defined(TCSETS) && !defined(AIX_31)
struct termios termio;
# else
#else
struct termio termio;
# endif
# endif
# if defined(AMIX) || defined(__APPLE__)
#endif
#endif
#if defined(AMIX) || defined(__APPLE__)
#include <sys/ioctl.h>
# endif /* AMIX */
#endif /* AMIX */
#endif
#ifdef SUSPEND /* BSD isn't alone anymore... */
#include <signal.h>
#ifdef SUSPEND /* BSD isn't alone anymore... */
#include <signal.h>
#endif
#if defined(TIOCGWINSZ) && (defined(BSD) || defined(ULTRIX) || defined(AIX_31) || defined(_BULL_SOURCE) || defined(SVR4))
#if defined(TIOCGWINSZ) \
&& (defined(BSD) || defined(ULTRIX) || defined(AIX_31) \
|| defined(_BULL_SOURCE) || defined(SVR4))
#define USE_WIN_IOCTL
#include "tcap.h" /* for LI and CO */
#include "tcap.h" /* for LI and CO */
#endif
#ifdef _M_UNIX
@@ -97,15 +99,15 @@ getwindowsz()
*/
struct winsize ttsz;
if (ioctl(fileno(stdin), (int)TIOCGWINSZ, (char *)&ttsz) != -1) {
/*
* Use the kernel's values for lines and columns if it has
* any idea.
*/
if (ttsz.ws_row)
LI = ttsz.ws_row;
if (ttsz.ws_col)
CO = ttsz.ws_col;
if (ioctl(fileno(stdin), (int) TIOCGWINSZ, (char *) &ttsz) != -1) {
/*
* Use the kernel's values for lines and columns if it has
* any idea.
*/
if (ttsz.ws_row)
LI = ttsz.ws_row;
if (ttsz.ws_col)
CO = ttsz.ws_col;
}
#endif
}
@@ -114,22 +116,22 @@ void
getioctls()
{
#ifdef BSD_JOB_CONTROL
(void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) &ltchars);
(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars0);
(void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) &ltchars);
(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars0);
#else
# ifdef POSIX_TYPES
(void) tcgetattr(fileno(stdin), &termio);
# else
# if defined(TCSETS) && !defined(AIX_31)
(void) ioctl(fileno(stdin), (int) TCGETS, &termio);
# else
(void) ioctl(fileno(stdin), (int) TCGETA, &termio);
# endif
# endif
#ifdef POSIX_TYPES
(void) tcgetattr(fileno(stdin), &termio);
#else
#if defined(TCSETS) && !defined(AIX_31)
(void) ioctl(fileno(stdin), (int) TCGETS, &termio);
#else
(void) ioctl(fileno(stdin), (int) TCGETA, &termio);
#endif
getwindowsz();
#endif
#endif
getwindowsz();
#ifdef AUX
( void ) signal ( SIGTSTP , catch_stp ) ;
(void) signal(SIGTSTP, catch_stp);
#endif
}
@@ -137,62 +139,60 @@ void
setioctls()
{
#ifdef BSD_JOB_CONTROL
(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars);
(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars);
#else
# ifdef POSIX_TYPES
(void) tcsetattr(fileno(stdin), TCSADRAIN, &termio);
# else
# if defined(TCSETS) && !defined(AIX_31)
(void) ioctl(fileno(stdin), (int) TCSETSW, &termio);
# else
(void) ioctl(fileno(stdin), (int) TCSETAW, &termio);
# endif
# endif
#ifdef POSIX_TYPES
(void) tcsetattr(fileno(stdin), TCSADRAIN, &termio);
#else
#if defined(TCSETS) && !defined(AIX_31)
(void) ioctl(fileno(stdin), (int) TCSETSW, &termio);
#else
(void) ioctl(fileno(stdin), (int) TCSETAW, &termio);
#endif
#endif
#endif
}
#ifdef SUSPEND /* No longer implies BSD */
#ifdef SUSPEND /* No longer implies BSD */
int
dosuspend()
{
#ifdef SYSCF
/* NB: check_user_string() is port-specific. */
if( !sysopt.shellers
|| !sysopt.shellers[0]
|| !check_user_string(sysopt.shellers)
){
Norep("Suspend command not available.");
return 0;
}
/* NB: check_user_string() is port-specific. */
if (!sysopt.shellers || !sysopt.shellers[0]
|| !check_user_string(sysopt.shellers)) {
Norep("Suspend command not available.");
return 0;
}
#endif
# if defined(SIGTSTP) && !defined(NO_SIGNAL)
if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) {
suspend_nhwindows((char *)0);
# ifdef _M_UNIX
sco_mapon();
# endif
# ifdef __linux__
linux_mapon();
# endif
(void) signal(SIGTSTP, SIG_DFL);
# ifdef AUX
( void ) kill ( 0 , SIGSTOP ) ;
# else
(void) kill(0, SIGTSTP);
# endif
# ifdef _M_UNIX
sco_mapoff();
# endif
# ifdef __linux__
linux_mapoff();
# endif
resume_nhwindows();
} else {
pline("I don't think your shell has job control.");
}
# else
pline("Sorry, it seems we have no SIGTSTP here. Try ! or S.");
# endif
return(0);
#if defined(SIGTSTP) && !defined(NO_SIGNAL)
if (signal(SIGTSTP, SIG_IGN) == SIG_DFL) {
suspend_nhwindows((char *) 0);
#ifdef _M_UNIX
sco_mapon();
#endif
#ifdef __linux__
linux_mapon();
#endif
(void) signal(SIGTSTP, SIG_DFL);
#ifdef AUX
(void) kill(0, SIGSTOP);
#else
(void) kill(0, SIGTSTP);
#endif
#ifdef _M_UNIX
sco_mapoff();
#endif
#ifdef __linux__
linux_mapoff();
#endif
resume_nhwindows();
} else {
pline("I don't think your shell has job control.");
}
#else
pline("Sorry, it seems we have no SIGTSTP here. Try ! or S.");
#endif
return (0);
}
#endif /* SUSPEND */