Convert carray to C.

This commit is contained in:
Jonas 'Sortie' Termansen 2016-02-28 16:46:24 +01:00
parent 08ec6cafc8
commit 238f0cca0b
2 changed files with 12 additions and 6 deletions

View File

@ -4,10 +4,14 @@ include ../build-aux/version.mak
include ../build-aux/dirs.mak
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
CXXFLAGS?=$(OPTLEVEL)
CFLAGS?=$(OPTLEVEL)
CPPFLAGS:=$(CPPFLAGS) -DVERSIONSTR=\"$(VERSION)\"
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
CFLAGS:=$(CFLAGS) -Wall -Wextra
ifeq ($(HOST_IS_SORTIX),0)
CPPFLAGS+=-D_GNU_SOURCE
endif
BINARY:=carray
@ -19,8 +23,8 @@ install: all
mkdir -p $(DESTDIR)$(BINDIR)
install $(BINARY) $(DESTDIR)$(BINDIR)
%: %.c++
$(CXX) -std=gnu++11 $(CPPFLAGS) $(CXXFLAGS) $< -o $@
%: %.c
$(CC) -std=gnu11 $(CFLAGS) $(CPPFLAGS) $< -o $@
clean:
rm -f $(BINARY) *.o

View File

@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
carray.c++
carray.c
Convert a binary file to a C array.
*******************************************************************************/
@ -23,6 +23,7 @@
#include <errno.h>
#include <error.h>
#include <locale.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -159,7 +160,8 @@ int main(int argc, char* argv[])
break;
if ( arg[1] != '-' )
{
while ( char c = *++arg ) switch ( c )
char c;
while ( (c = *++arg) ) switch ( c )
{
case 'c': flag_const = true; break;
case 'e': flag_extern = true; break;