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:
+40
-37
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 mgetline.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
||||
/* NetHack 3.6 mgetline.c $NHDT-Date: 1431192785 2015/05/09 17:33:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
|
||||
/* NetHack 3.6 mgetline.c $Date: 2009/05/06 10:49:18 $ $Revision: 1.6 $ */
|
||||
/* SCCS Id: @(#)getline.c 3.5 1990/22/02 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
@@ -10,38 +10,38 @@
|
||||
#include "macpopup.h"
|
||||
#include "func_tab.h"
|
||||
|
||||
extern int NDECL(extcmd_via_menu); /* cmd.c */
|
||||
extern int NDECL(extcmd_via_menu); /* cmd.c */
|
||||
|
||||
typedef Boolean FDECL ((* key_func), (unsigned char));
|
||||
typedef Boolean FDECL((*key_func), (unsigned char));
|
||||
|
||||
int
|
||||
get_line_from_key_queue (char * bufp) {
|
||||
* bufp = 0;
|
||||
if (try_key_queue (bufp)) {
|
||||
while (* bufp) {
|
||||
if (* bufp == 10 || * bufp == 13) {
|
||||
* bufp = 0;
|
||||
}
|
||||
bufp ++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
get_line_from_key_queue(char *bufp)
|
||||
{
|
||||
*bufp = 0;
|
||||
if (try_key_queue(bufp)) {
|
||||
while (*bufp) {
|
||||
if (*bufp == 10 || *bufp == 13) {
|
||||
*bufp = 0;
|
||||
}
|
||||
bufp++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
topl_getlin(const char *query, char *bufp, Boolean ext) {
|
||||
if (get_line_from_key_queue (bufp))
|
||||
return;
|
||||
topl_getlin(const char *query, char *bufp, Boolean ext)
|
||||
{
|
||||
if (get_line_from_key_queue(bufp))
|
||||
return;
|
||||
|
||||
enter_topl_mode((char *) query);
|
||||
while (topl_key(nhgetch(), ext))
|
||||
;
|
||||
leave_topl_mode(bufp);
|
||||
enter_topl_mode((char *) query);
|
||||
while (topl_key(nhgetch(), ext))
|
||||
;
|
||||
leave_topl_mode(bufp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Read a line closed with '\n' into the array char bufp[BUFSZ].
|
||||
* (The '\n' is not stored. The string is closed with a '\0'.)
|
||||
@@ -49,28 +49,31 @@ topl_getlin(const char *query, char *bufp, Boolean ext) {
|
||||
* resulting string is "\033".
|
||||
*/
|
||||
void
|
||||
mac_getlin(const char *query, char *bufp) {
|
||||
topl_getlin (query, bufp, false);
|
||||
mac_getlin(const char *query, char *bufp)
|
||||
{
|
||||
topl_getlin(query, bufp, false);
|
||||
}
|
||||
|
||||
|
||||
/* Read in an extended command - doing command line completion for
|
||||
* when enough characters have been entered to make a unique command.
|
||||
* This is just a modified getlin() followed by a lookup. -jsb
|
||||
*/
|
||||
int
|
||||
mac_get_ext_cmd() {
|
||||
char bufp[BUFSZ];
|
||||
int i;
|
||||
mac_get_ext_cmd()
|
||||
{
|
||||
char bufp[BUFSZ];
|
||||
int i;
|
||||
|
||||
if (iflags.extmenu) return extcmd_via_menu();
|
||||
topl_getlin("# ", bufp, true);
|
||||
for (i = 0; extcmdlist[i].ef_txt != (char *)0; i++)
|
||||
if (!strcmp(bufp, extcmdlist[i].ef_txt)) break;
|
||||
if (extcmdlist[i].ef_txt == (char *)0) i = -1; /* not found */
|
||||
if (iflags.extmenu)
|
||||
return extcmd_via_menu();
|
||||
topl_getlin("# ", bufp, true);
|
||||
for (i = 0; extcmdlist[i].ef_txt != (char *) 0; i++)
|
||||
if (!strcmp(bufp, extcmdlist[i].ef_txt))
|
||||
break;
|
||||
if (extcmdlist[i].ef_txt == (char *) 0)
|
||||
i = -1; /* not found */
|
||||
|
||||
return i;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
/* macgetline.c */
|
||||
|
||||
Reference in New Issue
Block a user