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
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
CXXFLAGS?=$(OPTLEVEL)
CFLAGS?=$(OPTLEVEL)
CFLAGS:=$(CFLAGS) -Wall -Wextra
CPPFLAGS:=$(CPPFLAGS) -DVERSIONSTR=\"$(VERSION)\"
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
BINARY=init
@ -19,10 +19,10 @@ all: $(BINARY)
.PHONY: all install clean
$(BINARY): $(OBJS)
$(CXX) $(OBJS) -o $(BINARY) $(CXXFLAGS) -lmount $(LIBS)
$(CC) $(CFLAGS) $(OBJS) -o $(BINARY) -lmount $(LIBS)
%.o: %.c++
$(CXX) -std=gnu++11 $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
%.o: %.c
$(CC) -std=gnu11 $(CFLAGS) $(CPPFLAGS) -c $< -o $@
install: all
mkdir -p $(DESTDIR)$(SBINDIR)

View File

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