#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#define getpid() GetCurrentProcessId()
#ifndef _
/* This is for other GNU distributions with internationalized messages.
When compiling libc, the _ macro is predefined. */
#ifdef NEVER_HAVE_LIBINTL_H
# include <libintl.h>
# define _(msgid) gettext (msgid)
#else
# define _(msgid) (msgid)
#endif
#endif
/* This version of `getopt' appears to the caller like standard Unix `getopt'
but it behaves differently for the user, since it allows the user
to intersperse the options with the other arguments.
As `getopt' works, it permutes the elements of ARGV so that,
when it is done, all the options precede everything else. Thus
all application programs are extended to handle flexible argument order.
Setting the environment variable POSIXLY_CORRECT disables permutation.
Then the behavior is completely standard.
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
#include "getopt.h"
/* 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. */
char *optarg = NULL;
/* 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. */
/* 1003.2 says this must be 1 before any call. */
int optind = 1;
/* Formerly, initialization of getopt depended on optind==0, which
causes problems with re-calling getopt as programs generally don't
know that. */
int __getopt_initialized = 0;
/* The next char to be scanned in the option-element
in which the last option character we returned was found.
This allows us to pick up the scan where we left off.
If this is zero, or a null string, it means resume the scan
by advancing to the next ARGV-element. */
static char *nextchar;
/* Callers store zero here to inhibit the error message
for unrecognized options. */
int opterr = 1;
/* Set to an option character which was unrecognized.
This must be initialized on some systems to avoid linking in the
system's own getopt implementation. */
int optopt = '?';
/* Describe how to deal with options that follow non-option ARGV-elements.
If the caller did not specify anything,
the default is REQUIRE_ORDER if the environment variable
POSIXLY_CORRECT is defined, PERMUTE otherwise.
REQUIRE_ORDER means don't recognize them as options;
stop option processing when the first non-option is seen.
This is what Unix does.
This mode of operation is selected by either setting the environment
variable POSIXLY_CORRECT, or using `+' as the first character
of the list of option characters.
PERMUTE is the default. We permute the contents of ARGV as we scan,
so that eventually all the non-options are at the end. This allows options
to be given in any order, even with programs that were not written to
expect this.
RETURN_IN_ORDER is an option available to programs that were written
to expect options and other ARGV-elements in any order and that care about
the ordering of the two. We describe each non-option ARGV-element
as if it were the argument of an option with character code 1.
Using `-' as the first character of the list of option characters
selects this mode of operation.
The special argument `--' forces an end of option-scanning regardless
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
`--' can cause `getopt' to return -1 with `optind' != ARGC. */
static enum
{
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
} ordering;
/* Value of POSIXLY_CORRECT environment variable. */
static char *posixly_correct;
/* Avoid depending on library functions or files
whose names are inconsistent. */
char *getenv ();
static char *
my_index (const char *str,int chr)
{
while (*str)
{
if (*str == chr)
return (char *) str;
str++;
}
return 0;
}
/* Handle permutation of arguments. */
/* Describe the part of ARGV that contains non-options that have
been skipped. `first_nonopt' is the index in ARGV of the first of them;
`last_nonopt' is the index after the last of them. */
static int first_nonopt;
static int last_nonopt;
# define SWAP_FLAGS(ch1, ch2)
/* Exchange two adjacent subsequences of ARGV.
One subsequence is elements [first_nonopt,last_nonopt)
which contains all the non-options that have been skipped so far.
The other is elements [last_nonopt,optind), which contains all
the options processed since those non-options were skipped.
`first_nonopt' and `last_nonopt' are relocated so that they describe
the new indices of the non-options in ARGV after they are moved. */
static void
exchange (char **argv)
{
int bottom = first_nonopt;
int middle = last_nonopt;
int top = optind;
char *tem;
/* Exchange the shorter segment with the far end of the longer segment.
That puts the shorter segment into the right place.
It leaves the longer segment in the right place overall,
but it consists of two parts that need to be swapped next. */
while (top > middle && middle > bottom)
{
if (top - middle > middle - bottom)
{
/* Bottom segment is the short one. */
int len = middle - bottom;
register int i;
/* Swap it with the top part of the top segment. */
for (i = 0; i < len; i++)
{
tem = argv[bottom + i];
argv[bottom + i] = argv[top - (middle - bottom) + i];
argv[top - (middle - bottom) + i] = tem;
SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
}
/* Exclude the moved bottom segment from further swapping. */
top -= len;
}
else
{
/* Top segment is the short one. */
int len = top - middle;
register int i;
/* Swap it with the bottom part of the bottom segment. */
for (i = 0; i < len; i++)
{
tem = argv[bottom + i];
argv[bottom + i] = argv[middle + i];
argv[middle + i] = tem;
SWAP_FLAGS (bottom + i, middle + i);
}
/* Exclude the moved top segment from further swapping. */
bottom += len;
}
}
/* Update records for the slots the non-options now occupy. */
first_nonopt += (optind - last_nonopt);
last_nonopt = optind;
}
/* Initialize the internal data when the first call is made. */
static const char *
_getopt_initialize (int argc,
char *const *argv,
const char *optstring)
{
/* Start processing options with ARGV-element 1 (since ARGV-element 0
is the program name); the sequence of previously skipped
non-option ARGV-elements is empty. */
first_nonopt = last_nonopt = optind;
nextchar = NULL;
// posixly_correct = getenv ("POSIXLY_CORRECT");
/* Determine how to handle the ordering of options and nonoptions. */
if (optstring[0] == '-')
{
ordering = RETURN_IN_ORDER;
++optstring;
}
else if (optstring[0] == '+')
{
ordering = REQUIRE_ORDER;
++optstring;
}
没有合适的资源?快使用搜索试试~ 我知道了~
TGA转PNG代码,可将指定目录下的TGA文件转换为PNG文件,支持命令行模式
共182个文件
svn-base:92个
h:26个
tlog:22个
需积分: 42 70 下载量 117 浏览量
2017-06-27
13:01:46
上传
评论
收藏 11.05MB ZIP 举报
温馨提示
可将指定目录下的TGA文件转换为PNG文件,支持命令行模式
资源推荐
资源详情
资源评论
收起资源包目录
TGA转PNG代码,可将指定目录下的TGA文件转换为PNG文件,支持命令行模式 (182个子文件)
getopt.cpp 26KB
tga2png.cpp 3KB
wc.db 89KB
entries 3B
tga2png.exe 3.07MB
tga2png.exp 28KB
tga2png.vcxproj.filters 3KB
format 3B
ximage.h 31KB
ximajpg.h 9KB
ximagif.h 8KB
stdint.h 8KB
ximaiter.h 7KB
ximawmf.h 5KB
ximadef.h 4KB
ximaraw.h 3KB
ximapsd.h 3KB
getopt.h 3KB
xiofile.h 3KB
ximapng.h 3KB
xfile.h 3KB
ximajas.h 3KB
ximabmp.h 3KB
ximapcx.h 2KB
ximatif.h 2KB
ximatga.h 2KB
ximamng.h 2KB
ximacfg.h 2KB
ximaico.h 2KB
ximawbmp.h 1KB
ximajbg.h 1KB
ximaska.h 1KB
xmemfile.h 1KB
ximath.h 802B
vc110.idb 803KB
tga2png.ilk 2.36MB
000001.jpg 11KB
tga2png.lastbuildstate 53B
tga2png.lastbuildstate 51B
cximage.lib 2.57MB
jasper.lib 2.31MB
mng.lib 1.53MB
Tiff.lib 1.42MB
libpsd.lib 1.17MB
png.lib 983KB
Jpeg.lib 938KB
libdcr.lib 655KB
zlib.lib 205KB
jbig.lib 106KB
tga2png.lib 47KB
tga2png.log 46KB
tga2png.log 46KB
tga2png.Build.CppClean.log 1KB
tga2png.Build.CppClean.log 590B
tga2png.obj 794KB
tga2png.obj 251KB
getopt.obj 90KB
getopt.obj 42KB
tga2png.opensdf 48B
tga2png.pdb 1.65MB
vc110.pdb 444KB
vc110.pdb 404KB
000001.png 24KB
tga2png.sln 888B
25bbf2b2d424cdcb751722e233956d830b2a15ce.svn-base 2.57MB
7794799a954581c88464a2cc5f386f5f4ef3b4a7.svn-base 2.31MB
39fd0fb9241b3d4ebbd80312fdc26d22f6947c63.svn-base 1.53MB
953ef5925165507183a3753e890c465e69972a30.svn-base 1.42MB
3766fa8fef93da7eb680611ddacf4d472e7bd8ed.svn-base 1.17MB
3eed0f14ba10236c88c4a015c71b0ded0596e20f.svn-base 1MB
65b1e9d253984f873e4b22195ddbd4ef1a3f5977.svn-base 1MB
1bd13c6aed8d0b6169fbd79e33957e8c31a604ed.svn-base 983KB
e8a0b79634f6c6ef3ec691eb605aed7ca7c6b3bc.svn-base 938KB
8fab4005c9a5e335a67f5704a4cf8ec1600eb982.svn-base 803KB
a0623ffdde26f18aed0cc41652b2d1473b1d5b04.svn-base 803KB
cbe9c3584ddc7a9d2881bc39e64c180db13cef1b.svn-base 794KB
07f2012e787333a48b731cd93453c34b5758fd82.svn-base 655KB
c53f49bea331c1fb53e3dbf67465935590948a23.svn-base 444KB
36a293ee6d40ce7b4809773ec5e48ae6af945404.svn-base 444KB
7787bfba2cd98ecca1133f175c452da671499a62.svn-base 404KB
3616262fe5bb25cecc895b38b84c82471dcadba4.svn-base 276KB
7401a0da57cb70c0f09fc53051d0696fff07ab69.svn-base 251KB
9f03976c72bfd3414592de9e16a574bd0a0aef43.svn-base 251KB
bdaefc0c33489379600022ebee37d8f20628c565.svn-base 205KB
9c7622565aa58a5bb46fcd09bff7a68963231d48.svn-base 106KB
d8d4c12fbd246320607e41f45f46f92921746500.svn-base 90KB
fcfebf346dc79ee04a90bf70d074ea7c7602d4e5.svn-base 90KB
f2ee59ca8ffcb9ecfdaa90bf35d2e81c39f0aa49.svn-base 46KB
e590c9e2ea6db613961e2e9607d8c62a6a5a7fda.svn-base 46KB
5d6f7556635fd79d9cefb6cea7b300b58c11fcb7.svn-base 46KB
68b768ecc4014d894b0a007680bb868ee1760d83.svn-base 42KB
e93ae3e62de58057cacc2cc883e350f3c0f11967.svn-base 42KB
ea23f382b00588fd16ed295d1ce44e3170aecb60.svn-base 40KB
d5aca0c51928162baecd2580158114bfb32936b6.svn-base 40KB
38f3af6133bd9634021f041adc4b0effb951b9bc.svn-base 35KB
7d85a58753891f02415dd9518be2a6acaafe0eca.svn-base 31KB
a25ea3b7a2c7ecf787e545d17c0629c395b93d8e.svn-base 26KB
75fab7614ab5a0ba02ae45ed2e36d201f17c691c.svn-base 24KB
3a0af6d730e056780f475d383941d0249bd3e9a2.svn-base 18KB
cabbadacc5868a228a037609874b4b7f7526398e.svn-base 11KB
共 182 条
- 1
- 2
资源评论
reven1983
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功