Move a few prototypes and static'ed a few functions 97/head
authorBob Little <Bob.Little@aeronix.com>
Sat, 17 Jun 2017 22:19:09 +0000 (18:19 -0400)
committerBob Little <Bob.Little@aeronix.com>
Sat, 17 Jun 2017 22:19:09 +0000 (18:19 -0400)
Moved prototypes for initialise() and action() from main.c to advent.h
Made the following functions static, so they wouldn't require prototypes:
   sig_handler (main.c)
   spotted_by_pirate (main.c)
   light (actions.c)

Makefile
actions.c
advent.h
main.c

index 08ec4884744d28ac0cd2de5d512bc0eba59b5494..b0b06b95c7f24896df0d99cafd81848fcbc9c88b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,8 @@ VERS=1.0
 
 CC?=gcc
 CCFLAGS+=-std=c99 -D _DEFAULT_SOURCE -Wall -Wpedantic -Wextra -g
 
 CC?=gcc
 CCFLAGS+=-std=c99 -D _DEFAULT_SOURCE -Wall -Wpedantic -Wextra -g
+CCFLAGS+=-Wstrict-prototypes
+CCFLAGS+=-Wmissing-prototypes
 LIBS=
 UNAME_S := $(shell uname -s)
 ifeq ($(UNAME_S),Linux)
 LIBS=
 UNAME_S := $(shell uname -s)
 ifeq ($(UNAME_S),Linux)
@@ -75,6 +77,7 @@ clean:
        rm -f newdb.c newdb.h
        rm -f README advent.6 MANIFEST *.tar.gz
        rm -f *~
        rm -f newdb.c newdb.h
        rm -f README advent.6 MANIFEST *.tar.gz
        rm -f *~
+       rm -f .*~
        cd tests; $(MAKE) --quiet clean
 
 check: advent
        cd tests; $(MAKE) --quiet clean
 
 check: advent
index 2132a9ac7e4561b94cecb3de82cc81760d120f45..aa63f6c83bfe09eafe2c61704fcfb151fd999e45 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -633,7 +633,7 @@ static int inven(void)
     return GO_CLEAROBJ;
 }
 
     return GO_CLEAROBJ;
 }
 
-int light(token_t verb, token_t obj)
+static int light(token_t verb, token_t obj)
 /*  Light.  Applicable only to lamp and urn. */
 {
     int spk = ACTSPK[verb];
 /*  Light.  Applicable only to lamp and urn. */
 {
     int spk = ACTSPK[verb];
index 2044cc265f51c05707df9365cd17667f0ec825d3..1cc87842240974bfe9ad4d0c7db339d84712c1d9 100644 (file)
--- a/advent.h
+++ b/advent.h
@@ -171,6 +171,9 @@ extern long AMBER, ATTACK, AXE, BACK, BATTER, BEAR,
 
 enum speechpart {unknown, intransitive, transitive};
 
 
 enum speechpart {unknown, intransitive, transitive};
 
+void initialise(void);
+int action(FILE *input, enum speechpart part, long verb, token_t obj);
+
 /* Phase codes for action returns. 
  * These were at one time FORTRAN line numbers.
  * The values don't matter, but perturb their order at your peril.
 /* Phase codes for action returns. 
  * These were at one time FORTRAN line numbers.
  * The values don't matter, but perturb their order at your peril.
diff --git a/main.c b/main.c
index 3a7c7db1d0131903a8015733c5763fc97cd02073..3d23c968f7b8fe531c5c7decbc9d1a1699b57284 100644 (file)
--- a/main.c
+++ b/main.c
@@ -48,10 +48,7 @@ bool oldstyle = false;
 bool editline = true;
 bool prompt = true;
 
 bool editline = true;
 bool prompt = true;
 
-extern void initialise();
-extern int action(FILE *, long, long, long);
-
-void sig_handler(int signo)
+static void sig_handler(int signo)
 {
     if (signo == SIGINT){
        if (logfp != NULL)
 {
     if (signo == SIGINT){
        if (logfp != NULL)
@@ -268,7 +265,7 @@ static void checkhints(FILE *cmdin)
     }
 }
 
     }
 }
 
-bool spotted_by_pirate(int i)
+static bool spotted_by_pirate(int i)
 {
     if (i != PIRATE) 
        return false;
 {
     if (i != PIRATE) 
        return false;