mbpfan-josie

Changes to be committed: modified: AUTHORS Updated personal info.

modified:   Makefile
Beginning work to clean up Makefile. The original makefile appeared
to be checking if the system was Windows NT. Since this is for GNU/
Linux, that was removed. Also all of the code is C, but the
Makefile was calling the C++ compiler to hide bool issues and
missing typedefs (which C++ is ok with but C is not).

	modified:   src/daemon.c
Added structs, added stdbool.h

	modified:   src/main.c
Added stdbool.h

	modified:   src/mbpfan.c
Added stdbool.h

	modified:   src/minunit.c
Added stdbool.h

a99aaad680dde54974b73d208933b96c1bdb614b
Robert Musial <rmmm@gnu.org> · 2017-03-19T13:43 · browse files at this commit

parents: f9f39cf

diff --git a/AUTHORS b/AUTHORS
index ae03d37..a2898c8 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -12,7 +12,7 @@ Olivier Tilmans
 Yamakaky                <yamakaky AT gmail DOT com>
 Yi Yang                 <ahyangyi AT gmail DOT com>
 Herminio Hernandez Jr   <herminio.hernandezjr AT gmail DOT com>
-Robert Musial           <rmusial AT fastmail DOT com>
+Robert Musial           <rmmm AT gnu DOT org>
 
 
 ORIGINARY AUTHORS
diff --git a/Makefile b/Makefile
index fe02a4a..169c62d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,60 +1,38 @@
-COMPILER=G++
+COMPILER=cc
 
-# todo: object files into output path, processing c / c++ files in the same time (?), nested directories for source files (?)
 C = c
 OUTPUT_PATH = bin/
 SOURCE_PATH = src/
-EXE = bin/mbpfan
+BIN = bin/mbpfan
 CONF = mbpfan.conf
 DOC = README.md
 MAN = mbpfan.8.gz
 
-ifeq ($(COMPILER), G++)
-  ifeq ($(OS),Windows_NT)
-    OBJ = obj
-  else
-    OBJ = o
-  endif
-  COPT = 
-  CCMD = g++
-  OBJFLAG = -o
-  EXEFLAG = -o
-# INCLUDES = -I../.includes
-  INCLUDES =
-# LIBS = -lgc
-  LIBS = -lm
-# LIBPATH = -L../gc/.libs
-  LIBPATH =
-  CPPFLAGS +=  $(COPT) -g $(INCLUDES) #-Wall
-  LDFLAGS += $(LIBPATH) -g $(LIBS) #-Wall
-  DEP = dep
-else
-  OBJ = obj
-  COPT = /O2
-  CCMD = cl
-  OBJFLAG = /Fo
-  EXEFLAG = /Fe
-# INCLUDES = /I..\\.includes
-  INCLUDES =
-# LIBS = ..\\.libs\\libgc.lib
-  LIBS =
-  CPPFLAGS = $(COPT) /DEBUG $(INCLUDES)
-  LDFLAGS = /DEBUG
-endif
+COPT = 
+CC = cc
+OBJFLAG = -o
+BINFLAG = -o
+INCLUDES =
+LIBS = -lm
+LIBPATH =
+CFLAGS +=  $(COPT) -g $(INCLUDES) #-Wall
+LDFLAGS += $(LIBPATH) -g $(LIBS) #-Wall
+DEP = dep
+
 
 OBJS := $(patsubst %.$(C),%.$(OBJ),$(wildcard $(SOURCE_PATH)*.$(C)))
 
 %.$(OBJ):%.$(C)
 	mkdir -p bin
 	@echo Compiling $(basename $<)...
-	$(CCMD) -c $(CPPFLAGS) $(CXXFLAGS) $< $(OBJFLAG)$@
+	$(CC) -c $(CFLAGS) $< $(OBJFLAG)$@
 
 all: $(OBJS)
 	@echo Linking...
-	$(CCMD) $(LDFLAGS) $^ $(LIBS) $(EXEFLAG) $(EXE)
+	$(CC) $(LDFLAGS) $^ $(LIBS) $(BINFLAG) $(BIN)
 
 clean:
-	rm -rf $(SOURCE_PATH)*.$(OBJ) $(EXE)
+	rm -rf $(SOURCE_PATH)*.$(OBJ) $(BIN)
 
 tests:
 	make install
@@ -73,7 +51,7 @@ install:
 	install -d $(DESTDIR)/etc
 	install -d $(DESTDIR)/lib/systemd/system
 	install -d $(DESTDIR)/usr/share/doc/mbpfan
-	install $(EXE) $(DESTDIR)/usr/sbin
+	install $(BIN) $(DESTDIR)/usr/sbin
 	install -m644 $(CONF) $(DESTDIR)/etc
 	install -m644 $(DOC) $(DESTDIR)/usr/share/doc/mbpfan
 	install -d $(DESTDIR)/usr/share/man/man8
diff --git a/src/daemon.c b/src/daemon.c
index de11a27..27a0e9d 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -2,6 +2,7 @@
  *  Copyright (C) 2012  Peter Lombardo <http://peterlombardo.wikidot.com/linux-daemon-in-c>
  *  Modifications (2012) by Ismail Khatib <ikhatib@gmail.com>
  *  Modifications (2012-present) by Daniel Graziotin <daniel@ineed.coffee>
+ *  Modifications (2017-present) by Robert Musial <rmmm@gnu.org>
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -20,6 +21,7 @@
 #include <sys/stat.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdbool.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <syslog.h>
@@ -77,7 +79,7 @@ static void cleanup_and_exit(int exit_code)
 	delete_pid();
 	set_fans_auto(fans);
 	
-	s_fans *next_fan;
+	struct s_fans *next_fan;
 	while (fans != NULL) {
 		next_fan = fans->next;
 		free(fans->fan_output_path);
@@ -86,7 +88,7 @@ static void cleanup_and_exit(int exit_code)
 		fans = next_fan;
 	}
 
-	s_sensors *next_sensor;
+	struct s_sensors *next_sensor;
 	while (sensors != NULL) {
 		next_sensor = sensors->next;
 		free(sensors->path);
diff --git a/src/main.c b/src/main.c
index 7bd14df..0a4cc99 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,5 +1,6 @@
 /**
  *  Copyright (C) (2012-present) Daniel Graziotin <daniel@ineed.coffee>
+ *  Modifications (2017-present) by Robert Musial <rmmm@gnu.org>
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -21,6 +22,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <syslog.h>
+#include <stdbool.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <errno.h>
@@ -145,4 +147,4 @@ int main(int argc, char *argv[])
     void (*fan_control)() = mbpfan;
     go_daemon(fan_control);
     exit(EXIT_SUCCESS);
-}
\ No newline at end of file
+}
diff --git a/src/mbpfan.c b/src/mbpfan.c
index 7870055..ad57e1c 100644
--- a/src/mbpfan.c
+++ b/src/mbpfan.c
@@ -4,6 +4,7 @@
  *  Modifications by Rafael Vega <rvega@elsoftwarehamuerto.org>
  *  Modifications (2012) by Ismail Khatib <ikhatib@gmail.com>
  *  Modifications (2012-present) by Daniel Graziotin <daniel@ineed.coffee> [CURRENT MAINTAINER]
+ *  Modifications (2017-present) by Robert Musial <rmmm@gnu.org>
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -32,6 +33,7 @@
 #include <string.h>
 #include <math.h>
 #include <syslog.h>
+#include <stdbool.h>
 #include <sys/utsname.h>
 #include <sys/errno.h>
 #include "mbpfan.h"
diff --git a/src/minunit.c b/src/minunit.c
index 1042cf8..3653309 100644
--- a/src/minunit.c
+++ b/src/minunit.c
@@ -4,6 +4,7 @@
 #include <time.h>
 #include <limits.h>
 #include <signal.h>
+#include <stdbool.h>
 #include <sys/utsname.h>
 #include "global.h"
 #include "mbpfan.h"