mirror of
https://github.com/love2d/love-android.git
synced 2026-08-21 21:15:34 +02:00
added dependencies and build files (loosely inspired by Sebastian Dorda's love-native-android)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
########################################################################
|
||||
# This is a GNU makefile - tested on CYGWIN and Linux
|
||||
#
|
||||
# You may need to compile or install libmng before compiling this.
|
||||
# Libmng also requires zlib, jpeg and lcms
|
||||
#
|
||||
|
||||
TARGET = makemng
|
||||
# These flags are needed to get it to compile with libmng.dll on CYGWIN
|
||||
# CYGWINFLAGS = -DMNG_USE_DLL
|
||||
CYGWINFLAGS =
|
||||
MNGFLAGS = -I. -DMNG_SKIP_LCMS -DMNG_SKIP_IJG6B \
|
||||
-DMNG_SUPPORT_READ -DMNG_SUPPORT_WRITE -DMNG_SUPPORT_DISPLAY \
|
||||
-DMNG_ACCESS_CHUNKS
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -W -Wall -O0 # -g
|
||||
LIBS = -L/usr/local/lib -lmng -lm -lz -ljpeg -llcms
|
||||
LDFLAGS=
|
||||
|
||||
BINS = $(TARGET) $(TARGET).exe
|
||||
SRCS = makemng.c filelist.c
|
||||
OBJS = makemng.o filelist.o
|
||||
|
||||
.SUFFIXES: .c .o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) -o $@ $*.c $(MNGFLAGS) $(CYGWINFLAGS)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(CC) -o $(TARGET) $(OBJS) $(LIBS) $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f $(BINS) *.o
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
MAKEMNG - Jan 10, 2003
|
||||
|
||||
A simple MNG encoder. MAKEMNG takes a bunch of still frames (PNGs)
|
||||
as input, computes delta images and stuffs it all into an MNG, thus
|
||||
creating an animation.
|
||||
|
||||
You will need zlib to compile and run this app.
|
||||
The included Makefile should work on Linux and CYGWIN.
|
||||
The MSVC project will most likely need modifications for your
|
||||
environment.
|
||||
|
||||
usage: makemng [-v] [-f rate] [-r] [-s size] [-o outputfile] <png-in-mask>
|
||||
produces an MNG animation from a bunch of frame images
|
||||
options:
|
||||
-v : be verbose, explains things no human should know
|
||||
-f rate : sets the framerate; rate is 1..100 per second (default 5)
|
||||
-b : auto-select background frame (instead of frame0)
|
||||
-r : split delta frames into full rectangles only
|
||||
-s size : enable sector cleanup and set sector size (8..64)
|
||||
diagnostical options:
|
||||
-d : generate delta-mask PNGs (form: mask_FRM1_FRM2.png)
|
||||
|
||||
-------------
|
||||
Alex Volkov <codepro@usa.net>
|
||||
@@ -0,0 +1,276 @@
|
||||
/*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* This file contains two versions of make_file_list(); one for Windows, and
|
||||
* one for other systems (POSIX).
|
||||
*/
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
|
||||
char**
|
||||
make_file_list (const char* pattern, int* pnum_entries)
|
||||
{
|
||||
int num_entries, length;
|
||||
char** StringTable;
|
||||
char** lpLastOffs;
|
||||
|
||||
num_entries = 0;
|
||||
StringTable = 0;
|
||||
do
|
||||
{
|
||||
int slen;
|
||||
long handle;
|
||||
struct _finddata_t f;
|
||||
|
||||
if (num_entries == 0)
|
||||
length = 0;
|
||||
else
|
||||
{
|
||||
slen = (num_entries + 1) * sizeof (char*);
|
||||
StringTable = (char**) malloc (slen + length);
|
||||
if (StringTable == 0)
|
||||
break;
|
||||
|
||||
lpLastOffs = StringTable;
|
||||
*lpLastOffs = (char*)StringTable + slen;
|
||||
|
||||
num_entries = 0;
|
||||
length = slen;
|
||||
}
|
||||
|
||||
handle = _findfirst (pattern, &f);
|
||||
if (handle != -1)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (f.attrib & (_A_HIDDEN | _A_SUBDIR | _A_SYSTEM))
|
||||
continue;
|
||||
|
||||
slen = strlen (f.name) + 1;
|
||||
length += slen;
|
||||
|
||||
if (StringTable)
|
||||
{
|
||||
char *lpStr;
|
||||
char **lpLo, **lpHi;
|
||||
|
||||
lpLo = StringTable;
|
||||
lpHi = lpLastOffs - 1;
|
||||
while (lpLo <= lpHi)
|
||||
{
|
||||
char c1, c2;
|
||||
char *pStr;
|
||||
int LocLen;
|
||||
char **lpMid;
|
||||
|
||||
lpMid = lpLo + ((lpHi - lpLo) >> 1);
|
||||
|
||||
LocLen = lpMid[1] - lpMid[0];
|
||||
if (LocLen > slen)
|
||||
LocLen = slen;
|
||||
|
||||
lpStr = lpMid[0];
|
||||
pStr = f.name;
|
||||
while (LocLen--
|
||||
&& (c1 = toupper (*lpStr++))
|
||||
== (c2 = toupper (*pStr++)))
|
||||
;
|
||||
|
||||
if (c1 <= c2)
|
||||
lpLo = lpMid + 1;
|
||||
else
|
||||
lpHi = lpMid - 1;
|
||||
}
|
||||
|
||||
lpStr = lpLo[0];
|
||||
memmove (lpStr + slen, lpStr, lpLastOffs[0] - lpLo[0]);
|
||||
strcpy (lpStr, f.name);
|
||||
|
||||
for (lpHi = lpLastOffs++; lpHi >= lpLo; --lpHi)
|
||||
lpHi[1] = lpHi[0] + slen;
|
||||
}
|
||||
|
||||
++num_entries;
|
||||
|
||||
} while (_findnext (handle, &f) == 0);
|
||||
|
||||
_findclose (handle);
|
||||
}
|
||||
} while (num_entries && StringTable == 0);
|
||||
|
||||
if (StringTable == 0)
|
||||
*pnum_entries = 0;
|
||||
else
|
||||
*pnum_entries = num_entries;
|
||||
|
||||
return StringTable;
|
||||
}
|
||||
|
||||
#else /* ! defined(WIN32) */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <fnmatch.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
|
||||
char**
|
||||
make_file_list (const char* pattern, int* pnum_entries)
|
||||
{
|
||||
size_t num_entries, length;
|
||||
char** StringTable;
|
||||
char** lpLastOffs;
|
||||
char* slash; // Pointer inside pattern to the last /
|
||||
char path[PATH_MAX]; // buffer for a filename with path
|
||||
char* file; // Pointer inside path to the filename
|
||||
size_t pathlen; // length of path, excluding last / and filename
|
||||
|
||||
slash = (char*) strrchr ((const char *) pattern, '/');
|
||||
if (slash == NULL)
|
||||
{
|
||||
pathlen = 1;
|
||||
path[0] = '.';
|
||||
}
|
||||
else
|
||||
{
|
||||
pathlen = slash - pattern;
|
||||
memcpy (path, pattern, pathlen);
|
||||
pattern = slash + 1;
|
||||
}
|
||||
file = path + pathlen + 1;
|
||||
|
||||
num_entries = 0;
|
||||
StringTable = 0;
|
||||
do
|
||||
{
|
||||
int slen;
|
||||
DIR *handle;
|
||||
|
||||
if (num_entries == 0)
|
||||
length = 0;
|
||||
else
|
||||
{
|
||||
slen = (num_entries + 1) * sizeof (char*);
|
||||
StringTable = (char**) malloc (slen + length);
|
||||
if (StringTable == 0)
|
||||
break;
|
||||
|
||||
lpLastOffs = StringTable;
|
||||
*lpLastOffs = (char*)StringTable + slen;
|
||||
|
||||
num_entries = 0;
|
||||
length = slen;
|
||||
}
|
||||
|
||||
path[pathlen] = '\0'; // strip any file part
|
||||
handle = opendir((const char *) path);
|
||||
if (handle != NULL)
|
||||
{
|
||||
path[pathlen] = '/';
|
||||
// change the 0 char to a slash; a filename will be
|
||||
// attached here.
|
||||
while (1)
|
||||
{
|
||||
struct dirent *de;
|
||||
struct stat sb;
|
||||
|
||||
de = readdir(handle);
|
||||
if (de == NULL)
|
||||
break;
|
||||
if (de->d_name[0] == '.')
|
||||
continue;
|
||||
strcpy (file, de->d_name);
|
||||
// attach the filename to path
|
||||
if (stat(path, &sb) == -1)
|
||||
continue;
|
||||
if (!S_ISREG(sb.st_mode))
|
||||
continue;
|
||||
if (fnmatch(pattern, de->d_name, 0) != 0)
|
||||
continue;
|
||||
|
||||
slen = strlen (de->d_name) + 1;
|
||||
length += slen;
|
||||
|
||||
if (StringTable)
|
||||
{
|
||||
char *lpStr;
|
||||
char **lpLo, **lpHi;
|
||||
|
||||
lpLo = StringTable;
|
||||
lpHi = lpLastOffs - 1;
|
||||
while (lpLo <= lpHi)
|
||||
{
|
||||
char c1, c2;
|
||||
char *pStr;
|
||||
int LocLen;
|
||||
char **lpMid;
|
||||
|
||||
lpMid = lpLo + ((lpHi - lpLo) >> 1);
|
||||
|
||||
LocLen = lpMid[1] - lpMid[0];
|
||||
if (LocLen > slen)
|
||||
LocLen = slen;
|
||||
|
||||
lpStr = lpMid[0];
|
||||
pStr = de->d_name;
|
||||
while (LocLen--
|
||||
&& (c1 = toupper (*lpStr++))
|
||||
== (c2 = toupper (*pStr++)))
|
||||
;
|
||||
|
||||
if (c1 <= c2)
|
||||
lpLo = lpMid + 1;
|
||||
else
|
||||
lpHi = lpMid - 1;
|
||||
}
|
||||
|
||||
lpStr = lpLo[0];
|
||||
memmove (lpStr + slen, lpStr, lpLastOffs[0] - lpLo[0]);
|
||||
strcpy (lpStr, de->d_name);
|
||||
|
||||
for (lpHi = lpLastOffs++; lpHi >= lpLo; --lpHi)
|
||||
lpHi[1] = lpHi[0] + slen;
|
||||
}
|
||||
|
||||
++num_entries;
|
||||
}
|
||||
closedir(handle);
|
||||
}
|
||||
} while (num_entries && StringTable == 0);
|
||||
|
||||
if (StringTable == 0)
|
||||
*pnum_entries = 0;
|
||||
else
|
||||
*pnum_entries = num_entries;
|
||||
|
||||
return StringTable;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
free_file_list (char** list)
|
||||
{
|
||||
if (list)
|
||||
free(list);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,180 @@
|
||||
/* Declarations for getopt.
|
||||
Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#ifndef _GETOPT_H
|
||||
|
||||
#ifndef __need_getopt
|
||||
# define _GETOPT_H 1
|
||||
#endif
|
||||
|
||||
/* If __GNU_LIBRARY__ is not already defined, either we are being used
|
||||
standalone, or this is the first header included in the source file.
|
||||
If we are being used with glibc, we need to include <features.h>, but
|
||||
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
|
||||
not defined, include <ctype.h>, which will pull in <features.h> for us
|
||||
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
|
||||
doesn't flood the namespace with stuff the way some other headers do.) */
|
||||
#if !defined __GNU_LIBRARY__
|
||||
# include <ctype.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* For communication from `getopt' to the caller.
|
||||
When `getopt' finds an option that takes an argument,
|
||||
the argument value is returned here.
|
||||
Also, when `ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
extern char *optarg;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
and for communication between successive calls to `getopt'.
|
||||
|
||||
On entry to `getopt', zero means this is the first call; initialize.
|
||||
|
||||
When `getopt' returns -1, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, `optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
extern int optind;
|
||||
|
||||
/* Callers store zero here to inhibit the error message `getopt' prints
|
||||
for unrecognized options. */
|
||||
|
||||
extern int opterr;
|
||||
|
||||
/* Set to an option character which was unrecognized. */
|
||||
|
||||
extern int optopt;
|
||||
|
||||
#ifndef __need_getopt
|
||||
/* Describe the long-named options requested by the application.
|
||||
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
||||
of `struct option' terminated by an element containing a name which is
|
||||
zero.
|
||||
|
||||
The field `has_arg' is:
|
||||
no_argument (or 0) if the option does not take an argument,
|
||||
required_argument (or 1) if the option requires an argument,
|
||||
optional_argument (or 2) if the option takes an optional argument.
|
||||
|
||||
If the field `flag' is not NULL, it points to a variable that is set
|
||||
to the value given in the field `val' when the option is found, but
|
||||
left unchanged if the option is not found.
|
||||
|
||||
To have a long-named option do something other than set an `int' to
|
||||
a compiled-in constant, such as set a value from `optarg', set the
|
||||
option's `flag' field to zero and its `val' field to a nonzero
|
||||
value (the equivalent single-letter option character, if there is
|
||||
one). For long options that have a zero `flag' field, `getopt'
|
||||
returns the contents of the `val' field. */
|
||||
|
||||
struct option
|
||||
{
|
||||
# if (defined __STDC__ && __STDC__) || defined __cplusplus
|
||||
const char *name;
|
||||
# else
|
||||
char *name;
|
||||
# endif
|
||||
/* has_arg can't be an enum because some compilers complain about
|
||||
type mismatches in all the code that assumes it is an int. */
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
/* Names for the values of the `has_arg' field of `struct option'. */
|
||||
|
||||
# define no_argument 0
|
||||
# define required_argument 1
|
||||
# define optional_argument 2
|
||||
#endif /* need getopt */
|
||||
|
||||
|
||||
/* Get definitions and prototypes for functions to process the
|
||||
arguments in ARGV (ARGC of them, minus the program name) for
|
||||
options given in OPTS.
|
||||
|
||||
Return the option character from OPTS just read. Return -1 when
|
||||
there are no more options. For unrecognized options, or options
|
||||
missing arguments, `optopt' is set to the option letter, and '?' is
|
||||
returned.
|
||||
|
||||
The OPTS string is a list of characters which are recognized option
|
||||
letters, optionally followed by colons, specifying that that letter
|
||||
takes an argument, to be placed in `optarg'.
|
||||
|
||||
If a letter in OPTS is followed by two colons, its argument is
|
||||
optional. This behavior is specific to the GNU `getopt'.
|
||||
|
||||
The argument `--' causes premature termination of argument
|
||||
scanning, explicitly telling `getopt' that there are no more
|
||||
options.
|
||||
|
||||
If OPTS begins with `--', then non-option arguments are treated as
|
||||
arguments to the option '\0'. This behavior is specific to the GNU
|
||||
`getopt'. */
|
||||
|
||||
#if (defined __STDC__ && __STDC__) || defined __cplusplus
|
||||
# ifdef __GNU_LIBRARY__
|
||||
/* Many other libraries have conflicting prototypes for getopt, with
|
||||
differences in the consts, in stdlib.h. To avoid compilation
|
||||
errors, only prototype getopt for the GNU C library. */
|
||||
extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
|
||||
# else /* not __GNU_LIBRARY__ */
|
||||
extern int getopt ();
|
||||
# endif /* __GNU_LIBRARY__ */
|
||||
|
||||
# ifndef __need_getopt
|
||||
extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind);
|
||||
extern int getopt_long_only (int __argc, char *const *__argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind);
|
||||
|
||||
/* Internal only. Users should not call this directly. */
|
||||
extern int _getopt_internal (int __argc, char *const *__argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind,
|
||||
int __long_only);
|
||||
# endif
|
||||
#else /* not __STDC__ */
|
||||
extern int getopt ();
|
||||
# ifndef __need_getopt
|
||||
extern int getopt_long ();
|
||||
extern int getopt_long_only ();
|
||||
|
||||
extern int _getopt_internal ();
|
||||
# endif
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Make sure we later can get all the definitions and declarations. */
|
||||
#undef __need_getopt
|
||||
|
||||
#endif /* getopt.h */
|
||||
@@ -0,0 +1,189 @@
|
||||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifndef HAVE_GETOPT_H
|
||||
#include "getopt.h"
|
||||
|
||||
#if !defined __STDC__ || !__STDC__
|
||||
/* This is a separate conditional since some stdc systems
|
||||
reject `defined (const)'. */
|
||||
#ifndef const
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#define GETOPT_INTERFACE_VERSION 2
|
||||
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
|
||||
#include <gnu-versions.h>
|
||||
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
|
||||
#define ELIDE_CODE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ELIDE_CODE
|
||||
|
||||
|
||||
/* This needs to come after some library #include
|
||||
to get __GNU_LIBRARY__ defined. */
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
int
|
||||
getopt_long (argc, argv, options, long_options, opt_index)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *options;
|
||||
const struct option *long_options;
|
||||
int *opt_index;
|
||||
{
|
||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
|
||||
}
|
||||
|
||||
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
||||
If an option that starts with '-' (not '--') doesn't match a long option,
|
||||
but does match a short option, it is parsed as a short option
|
||||
instead. */
|
||||
|
||||
int
|
||||
getopt_long_only (argc, argv, options, long_options, opt_index)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *options;
|
||||
const struct option *long_options;
|
||||
int *opt_index;
|
||||
{
|
||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
|
||||
}
|
||||
|
||||
|
||||
#endif /* Not ELIDE_CODE. */
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int c;
|
||||
int digit_optind = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int this_option_optind = optind ? optind : 1;
|
||||
int option_index = 0;
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"add", 1, 0, 0},
|
||||
{"append", 0, 0, 0},
|
||||
{"delete", 1, 0, 0},
|
||||
{"verbose", 0, 0, 0},
|
||||
{"create", 0, 0, 0},
|
||||
{"file", 1, 0, 0},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
c = getopt_long (argc, argv, "abc:d:0123456789",
|
||||
long_options, &option_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
printf ("option %s", long_options[option_index].name);
|
||||
if (optarg)
|
||||
printf (" with arg %s", optarg);
|
||||
printf ("\n");
|
||||
break;
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
||||
printf ("digits occur in two different argv-elements.\n");
|
||||
digit_optind = this_option_optind;
|
||||
printf ("option %c\n", c);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
printf ("option a\n");
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
printf ("option b\n");
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
printf ("option c with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
printf ("option d with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("?? getopt returned character code 0%o ??\n", c);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
printf ("non-option ARGV-elements: ");
|
||||
while (optind < argc)
|
||||
printf ("%s ", argv[optind++]);
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
||||
|
||||
#endif /* HAVE_GETOPT_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,114 @@
|
||||
# Microsoft Developer Studio Project File - Name="makemng" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=makemng - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "makemng.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "makemng.mak" CFG="makemng - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "makemng - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "makemng - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=xicl6.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "makemng - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "." /I "..\..\src" /I "..\..\src\msvc++" /I "..\..\src\getopt" /D "NDEBUG" /D "WINDOWS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MNG_USE_DLL" /D "MNG_SKIP_LCMS" /D "MNG_SKIP_IJG6B" /D "ZLIB_DLL" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=xilink6.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib zlib.lib libmng.lib /nologo /subsystem:console /machine:I386 /libpath:"."
|
||||
|
||||
!ELSEIF "$(CFG)" == "makemng - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "..\..\src" /I "..\..\src\msvc++" /I "..\..\src\getopt" /D "_DEBUG" /D "ZLIB_DLL" /D "WINDOWS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MNG_USE_DLL" /D "MNG_SKIP_LCMS" /D "MNG_SKIP_IJG6B" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=xilink6.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib zlib.lib libmng.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"."
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "makemng - Win32 Release"
|
||||
# Name "makemng - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\filelist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\getopt\getopt.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\makemng.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\getopt.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "makemng"=.\makemng.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Reference in New Issue
Block a user