Convert carray to C.
This commit is contained in:
parent
08ec6cafc8
commit
238f0cca0b
|
@ -4,10 +4,14 @@ 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)
|
||||||
|
|
||||||
CPPFLAGS:=$(CPPFLAGS) -DVERSIONSTR=\"$(VERSION)\"
|
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
|
BINARY:=carray
|
||||||
|
|
||||||
|
@ -19,8 +23,8 @@ install: all
|
||||||
mkdir -p $(DESTDIR)$(BINDIR)
|
mkdir -p $(DESTDIR)$(BINDIR)
|
||||||
install $(BINARY) $(DESTDIR)$(BINDIR)
|
install $(BINARY) $(DESTDIR)$(BINDIR)
|
||||||
|
|
||||||
%: %.c++
|
%: %.c
|
||||||
$(CXX) -std=gnu++11 $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
$(CC) -std=gnu11 $(CFLAGS) $(CPPFLAGS) $< -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(BINARY) *.o
|
rm -f $(BINARY) *.o
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
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/>.
|
||||||
|
|
||||||
carray.c++
|
carray.c
|
||||||
Convert a binary file to a C array.
|
Convert a binary file to a C array.
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <error.h>
|
#include <error.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -159,7 +160,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 )
|
||||||
{
|
{
|
||||||
case 'c': flag_const = true; break;
|
case 'c': flag_const = true; break;
|
||||||
case 'e': flag_extern = true; break;
|
case 'e': flag_extern = true; break;
|
Loading…
Reference in New Issue