Convert init to C.

This commit is contained in:
Jonas 'Sortie' Termansen 2016-02-28 22:14:17 +01:00
parent f0470869a9
commit f16a7693d6
2 changed files with 9 additions and 10 deletions

View File

@ -4,10 +4,10 @@ include ../build-aux/version.mak
include ../build-aux/dirs.mak include ../build-aux/dirs.mak
OPTLEVEL?=$(DEFAULT_OPTLEVEL) OPTLEVEL?=$(DEFAULT_OPTLEVEL)
CXXFLAGS?=$(OPTLEVEL) CFLAGS?=$(OPTLEVEL)
CFLAGS:=$(CFLAGS) -Wall -Wextra
CPPFLAGS:=$(CPPFLAGS) -DVERSIONSTR=\"$(VERSION)\" CPPFLAGS:=$(CPPFLAGS) -DVERSIONSTR=\"$(VERSION)\"
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
BINARY=init BINARY=init
@ -19,10 +19,10 @@ all: $(BINARY)
.PHONY: all install clean .PHONY: all install clean
$(BINARY): $(OBJS) $(BINARY): $(OBJS)
$(CXX) $(OBJS) -o $(BINARY) $(CXXFLAGS) -lmount $(LIBS) $(CC) $(CFLAGS) $(OBJS) -o $(BINARY) -lmount $(LIBS)
%.o: %.c++ %.o: %.c
$(CXX) -std=gnu++11 $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ $(CC) -std=gnu11 $(CFLAGS) $(CPPFLAGS) -c $< -o $@
install: all install: all
mkdir -p $(DESTDIR)$(SBINDIR) mkdir -p $(DESTDIR)$(SBINDIR)

View File

@ -15,14 +15,11 @@
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>. this program. If not, see <http://www.gnu.org/licenses/>.
init.c++ init.c
Start the operating system. Start the operating system.
*******************************************************************************/ *******************************************************************************/
#define __STDC_CONSTANT_MACROS
#define __STDC_LIMIT_MACROS
#include <sys/display.h> #include <sys/display.h>
#include <sys/mount.h> #include <sys/mount.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -41,6 +38,7 @@
#include <pwd.h> #include <pwd.h>
#include <signal.h> #include <signal.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -973,7 +971,8 @@ int main(int argc, char* argv[])
break; break;
if ( arg[1] != '-' ) if ( arg[1] != '-' )
{ {
while ( char c = *++arg ) switch ( c ) char c;
while ( (c = *++arg) ) switch ( c )
{ {
default: default:
fprintf(stderr, "%s: unknown option -- '%c'\n", argv0, c); fprintf(stderr, "%s: unknown option -- '%c'\n", argv0, c);