Revision | 18513eba15c8188b04234b7f3bddb7482d0b9f84 (tree) |
---|---|
Time | 2019-07-03 13:11:16 |
Author | tfuruka1 <tfuruka1@nift...> |
Commiter | tfuruka1 |
(refs #50804)
MinGWでbuildするように修正しました。
@@ -1,2 +1,2 @@ | ||
1 | -このファイルは不要なファイルです。ディレクトリを保持する為だけの目的で | |
2 | -作成したファイルです。 | |
\ No newline at end of file | ||
1 | +縺薙?繝輔ぃ繧、繝ォ縺ッ荳崎ヲ√↑繝輔ぃ繧、繝ォ縺ァ縺吶?ゅョ繧」繝ャ繧ッ繝医Μ繧剃ソ晄戟縺吶k轤コ縺?縺代?逶ョ逧?〒 | |
2 | +菴懈?縺励◆繝輔ぃ繧、繝ォ縺ァ縺吶? |
@@ -1,17 +1,17 @@ | ||
1 | -私の環境以外で確実に修正が必要なmakefile | |
1 | +遘√?迺ー蠅?サ・螟悶〒遒コ螳溘↓菫ョ豁」縺悟ソ?ヲ√↑makefile | |
2 | 2 | |
3 | 3 | src/lha32/makefile |
4 | 4 | |
5 | - UNLHA32.DLLのヘッダファイルとライブラリファイルを使用しています。 | |
6 | - これらのファイルが別途必要になります。 | |
5 | + UNLHA32.DLL縺ョ繝倥ャ繝?繝輔ぃ繧、繝ォ縺ィ繝ゥ繧、繝悶Λ繝ェ繝輔ぃ繧、繝ォ繧剃スソ逕ィ縺励※縺?∪縺吶? | |
6 | + 縺薙l繧峨?繝輔ぃ繧、繝ォ縺悟挨騾泌ソ?ヲ√↓縺ェ繧翫∪縺吶? | |
7 | 7 | |
8 | 8 | http://www2.nsknet.or.jp/~micco/ |
9 | 9 | |
10 | - 等から別途入手して下さい。そして、当該ファイルの先頭付近の | |
10 | + 遲峨°繧牙挨騾泌?謇九@縺ヲ荳九&縺??ゅ◎縺励※縲∝ス楢ゥイ繝輔ぃ繧、繝ォ縺ョ蜈磯?ュ莉倩ソ代? | |
11 | 11 | |
12 | 12 | UNLHA_BASE_DIR=../../../other-c-apis/unlha32 |
13 | 13 | INC_DIR=$(UNLHA_BASE_DIR) |
14 | 14 | LIBS_DIR=$(UNLHA_BASE_DIR) |
15 | 15 | |
16 | - の部分を適切に書換えて下さい。 | |
16 | + 縺ョ驛ィ蛻?r驕ゥ蛻?↓譖ク謠帙∴縺ヲ荳九&縺?? | |
17 | 17 |
@@ -0,0 +1,228 @@ | ||
1 | +/* $Id: main.c 1313 2013-03-19 00:10:02Z tfuruka1 $ | |
2 | + * | |
3 | + * CPU 使用率を100%にするツール | |
4 | + * | |
5 | + * CPU使用率を100%にしますが、システムの負荷は軽いです。 | |
6 | + */ | |
7 | +#include <windows.h> | |
8 | +#include <stdio.h> | |
9 | + | |
10 | +#define VERSION "R0.1.0.0 ($Rev: 1313 $)" | |
11 | + | |
12 | +#define LINE_STR "━━━━━━━━━━━━━━━━━"\ | |
13 | + "━━━━━━━━━━━━━━━━━━" | |
14 | + | |
15 | +BOOL (WINAPI *lpGetSystemTimes)(LPFILETIME lpIdleTime, | |
16 | + LPFILETIME lpKernelTime, | |
17 | + LPFILETIME lpUserTime); | |
18 | + | |
19 | +static LPCTSTR | |
20 | +GetProcessorArchitectureStr(WORD wPA) | |
21 | +{ | |
22 | + static char szBuf[256]; | |
23 | + | |
24 | + switch (wPA) { | |
25 | + case PROCESSOR_ARCHITECTURE_INTEL: | |
26 | + strcpy(szBuf, "INTEL"); | |
27 | + break; | |
28 | + case PROCESSOR_ARCHITECTURE_MIPS: | |
29 | + strcpy(szBuf, "MIPS"); | |
30 | + break; | |
31 | + case PROCESSOR_ARCHITECTURE_ALPHA: | |
32 | + strcpy(szBuf, "ALPHA"); | |
33 | + break; | |
34 | + case PROCESSOR_ARCHITECTURE_PPC: | |
35 | + strcpy(szBuf, "POWER-PC"); | |
36 | + break; | |
37 | + case PROCESSOR_ARCHITECTURE_SHX: | |
38 | + strcpy(szBuf, "SH"); | |
39 | + break; | |
40 | + case PROCESSOR_ARCHITECTURE_ARM: | |
41 | + strcpy(szBuf, "ARM"); | |
42 | + break; | |
43 | + case PROCESSOR_ARCHITECTURE_IA64: | |
44 | + strcpy(szBuf, "INTEL-64"); | |
45 | + break; | |
46 | + case PROCESSOR_ARCHITECTURE_ALPHA64: | |
47 | + strcpy(szBuf, "ALPHA-64"); | |
48 | + break; | |
49 | + case PROCESSOR_ARCHITECTURE_UNKNOWN: | |
50 | + strcpy(szBuf, "UNKNOWN"); | |
51 | + break; | |
52 | + default: | |
53 | + sprintf(szBuf, "UNKNOWN: %x", wPA); | |
54 | + break; | |
55 | + } | |
56 | + return szBuf; | |
57 | +} | |
58 | + | |
59 | +static LPCTSTR | |
60 | +GetProcessorTypeStr(DWORD dwPt) | |
61 | +{ | |
62 | + static char szBuf[256]; | |
63 | + | |
64 | + switch (dwPt) { | |
65 | + case PROCESSOR_INTEL_386: | |
66 | + sprintf(szBuf, "INTEL386(%lu)", dwPt); | |
67 | + break; | |
68 | + case PROCESSOR_INTEL_486: | |
69 | + sprintf(szBuf, "INTEL486(%lu)", dwPt); | |
70 | + break; | |
71 | + case PROCESSOR_INTEL_PENTIUM: | |
72 | + sprintf(szBuf, "INTEL PENTIUM(%lu)", dwPt); | |
73 | + break; | |
74 | + case PROCESSOR_MIPS_R4000: | |
75 | + sprintf(szBuf, "MIPS R4000(%lu", dwPt); | |
76 | + break; | |
77 | + case PROCESSOR_ALPHA_21064: | |
78 | + sprintf(szBuf, "ALPHA 21064(%lu)", dwPt); | |
79 | + break; | |
80 | + default: | |
81 | + sprintf(szBuf, "UNKNOWn(%lu)", dwPt); | |
82 | + break; | |
83 | + } | |
84 | + return szBuf; | |
85 | +} | |
86 | + | |
87 | +static LPCTSTR | |
88 | +GetActiveProcessorMaskStr(DWORD dwAPM) | |
89 | +{ | |
90 | + static char szBuf[36]; | |
91 | + int i; | |
92 | + | |
93 | + szBuf[0] = '\0'; | |
94 | + for (i = 0; i < 32; i++) { | |
95 | + strcat(szBuf, ((dwAPM >> i) & 1) ? "*" : "."); | |
96 | + } | |
97 | + return szBuf; | |
98 | +} | |
99 | + | |
100 | +static DWORD WINAPI | |
101 | +ThreadFunc(LPVOID lpPara) | |
102 | +{ | |
103 | + printf("CPU %d 占有開始...\n", *(int *) lpPara); | |
104 | + while (TRUE) { | |
105 | + } | |
106 | + return 0; | |
107 | +} | |
108 | + | |
109 | +static void | |
110 | +selfLoop() | |
111 | +{ | |
112 | + unsigned char kaiten[] = "―\|/"; | |
113 | + | |
114 | + unsigned char wk[4]; | |
115 | + unsigned int i = 0; | |
116 | + unsigned int j; | |
117 | + unsigned int iSleep = 1000; | |
118 | + | |
119 | + LONGLONG ftOldIdle = 0; | |
120 | + LONGLONG ftOldKernel = 0; | |
121 | + LONGLONG ftOldUser = 0; | |
122 | + | |
123 | + LONGLONG ftIdle; | |
124 | + LONGLONG ftKernel; | |
125 | + LONGLONG ftUser; | |
126 | + | |
127 | + HANDLE lpLib = LoadLibrary("kernel32.dll"); | |
128 | + printf("Library Handle: %lx\n", (ULONG) lpLib); | |
129 | + if (!lpLib) { | |
130 | + return; | |
131 | + } | |
132 | + lpGetSystemTimes = GetProcAddress(lpLib, "GetSystemTimes"); | |
133 | + | |
134 | + printf("GetSystemTimes API Address: %lx\n", (ULONG) lpGetSystemTimes); | |
135 | + if (!lpGetSystemTimes) { | |
136 | + return; | |
137 | + } | |
138 | + printf("終了する場合は CTRL-C を押下して下さい。\n\n"); | |
139 | + | |
140 | + while (TRUE) { | |
141 | + j = i++ % 4; | |
142 | + wk[0] = kaiten[j * 2]; | |
143 | + wk[1] = kaiten[j * 2 + 1]; | |
144 | + wk[2] = '\0'; | |
145 | + | |
146 | + lpGetSystemTimes((LPFILETIME)&ftIdle, | |
147 | + (LPFILETIME)&ftKernel, | |
148 | + (LPFILETIME)&ftUser); | |
149 | + if (0 != ftOldIdle) { | |
150 | + LONGLONG llIdle = ftIdle - ftOldIdle; | |
151 | + LONGLONG llKernel = ftKernel - ftOldKernel; | |
152 | + LONGLONG llUser = ftUser - ftOldUser; | |
153 | + LONGLONG llTotal = llIdle + llKernel + llUser; | |
154 | + TCHAR szBuf[1024]; | |
155 | + | |
156 | + sprintf(szBuf, | |
157 | + "[%s] %5.1f%% user, %5.1f%% system, %5.1f%% idle", | |
158 | + wk, | |
159 | + ((LONGLONG) 1000 * llUser / llTotal) / 10.0, | |
160 | + ((LONGLONG) 1000 * llKernel / llTotal) / 10.0, | |
161 | + ((LONGLONG) 1000 * llIdle / llTotal) / 10.0); | |
162 | + printf("\r%s", szBuf); | |
163 | + fflush(stdout); | |
164 | + | |
165 | + SetConsoleTitle(szBuf); | |
166 | + } | |
167 | + ftOldIdle = ftIdle; | |
168 | + ftOldKernel = ftKernel; | |
169 | + ftOldUser = ftUser; | |
170 | + | |
171 | + Sleep(iSleep); | |
172 | + if (50 < iSleep) { | |
173 | + iSleep -= 1; | |
174 | + } | |
175 | + } | |
176 | +} | |
177 | + | |
178 | +int | |
179 | +main(int argc, char *argv[]) | |
180 | +{ | |
181 | + SYSTEM_INFO si; | |
182 | + int i; | |
183 | + | |
184 | + GetSystemInfo(&si); | |
185 | + | |
186 | + printf("$Id: main.c 1313 2013-03-19 00:10:02Z tfuruka1 $\n"); | |
187 | + printf("CPU使用率100%% %s[Build:" __DATE__ " " __TIME__ "]\n", VERSION); | |
188 | + printf(LINE_STR "\n"); | |
189 | + printf("OEM-ID : %lx\n", si.dwOemId); | |
190 | + printf("Processor architecture : %s\n", | |
191 | + GetProcessorArchitectureStr(si.wProcessorArchitecture)); | |
192 | + printf("Page size : %ld\n", si.dwPageSize); | |
193 | + printf("Minimun application address: %lx\n", | |
194 | + (ULONG) si.lpMinimumApplicationAddress); | |
195 | + printf("Maximum application address: %lx\n", | |
196 | + (ULONG) si.lpMaximumApplicationAddress); | |
197 | + printf("Active processor mask : 0123456789*123456789*123456789*1\n"); | |
198 | + printf(" : %s\n", | |
199 | + GetActiveProcessorMaskStr(si.dwActiveProcessorMask)); | |
200 | + printf("Number of processors : %ld\n", si.dwNumberOfProcessors); | |
201 | + printf("Processor type : %s\n", | |
202 | + GetProcessorTypeStr(si.dwProcessorType)); | |
203 | + printf("Allocation granularity : %ld\n", si.dwAllocationGranularity); | |
204 | + printf("Processor level : %d\n", si.wProcessorLevel); | |
205 | + printf("Processor revision : %x.%x\n", | |
206 | + (si.wProcessorRevision >> 8) & 0xff, | |
207 | + si.wProcessorRevision & 0xff); | |
208 | + printf(LINE_STR "\n"); | |
209 | + | |
210 | + for (i = 0; i < si.dwNumberOfProcessors; i++) { | |
211 | + DWORD dwThreadId; | |
212 | + HANDLE hThread = CreateThread(NULL, 0, ThreadFunc, (LPVOID) &i, 0, | |
213 | + &dwThreadId); | |
214 | + // ハンドルは使用しないのでクローズ | |
215 | + CloseHandle(hThread); | |
216 | + Sleep(1000); | |
217 | + } | |
218 | + selfLoop(); | |
219 | + | |
220 | + return 0; | |
221 | +} | |
222 | + | |
223 | +/* | |
224 | + * Local Variables: | |
225 | + * mode: c | |
226 | + * coding: utf-8 | |
227 | + * End: | |
228 | + */ |
@@ -0,0 +1,10 @@ | ||
1 | +# $Id: makefile 1313 2013-03-19 00:10:02Z tfuruka1 $ | |
2 | +CC = x86_64-w64-mingw32-gcc | |
3 | +CC = i686-w64-mingw32-gcc | |
4 | +CFLAGS=-g -Wall --exec-charset=cp932 --input-charset=utf-8 | |
5 | + | |
6 | +cpu100.exe : main.o makefile | |
7 | + $(CC) $(CFLAGS) -o $@ main.o | |
8 | + strip $@ | |
9 | +clean : | |
10 | + -rm -f *.o *~ |
@@ -1,12 +1,12 @@ | ||
1 | -/* -*- mode: c++; coding:sjis; -*- | |
1 | +/* -*- mode: c++; coding: utf-8; -*- | |
2 | 2 | * $Id: main.c,v 1.1 2006/11/15 12:08:03 tfuruka1 Exp $ |
3 | 3 | * $Name: $ |
4 | 4 | * |
5 | - * 俗に言うスリープ | |
5 | + * 菫励↓險?縺?せ繝ェ繝シ繝 | |
6 | 6 | * |
7 | 7 | * $Log: main.c,v $ |
8 | 8 | * Revision 1.1 2006/11/15 12:08:03 tfuruka1 |
9 | - * 新規追加 | |
9 | + * 譁ー隕剰ソス蜉? | |
10 | 10 | * |
11 | 11 | */ |
12 | 12 | #include <windows.h> |
@@ -29,7 +29,7 @@ main(int argc, char *argv[]) | ||
29 | 29 | if (0 == strnicmp(argv[i], OPT_FEEDBACK, strlen(OPT_FEEDBACK))) { |
30 | 30 | nFeedBack = atoi(strchr(argv[i], '=') + 1); |
31 | 31 | } |
32 | - // オプションは後で | |
32 | + // 繧ェ繝励す繝ァ繝ウ縺ッ蠕後〒 | |
33 | 33 | } |
34 | 34 | if (!argv[i]) { |
35 | 35 | return 0; |
@@ -7,17 +7,19 @@ | ||
7 | 7 | # Revision 1.1 2006/11/15 12:08:03 tfuruka1 |
8 | 8 | # 新規追加 |
9 | 9 | # |
10 | -O = obj | |
10 | +CC = x86_64-w64-mingw32-gcc | |
11 | +CC = i686-w64-mingw32-gcc | |
12 | +CFLAGS=-g -Wall --exec-charset=cp932 --input-charset=utf-8 | |
13 | + | |
14 | +O = o | |
11 | 15 | EXE = ExSleep.exe |
12 | 16 | OBJS = main.$(O) |
13 | -CFLAGS = /W3 /Zi | |
14 | -LDFLAGS = /link /debug user32.lib | |
15 | 17 | |
16 | 18 | ../../bin/$(EXE) : $(EXE) |
17 | 19 | cp $(EXE) ../../bin/. |
18 | 20 | |
19 | 21 | $(EXE) : $(OBJS) |
20 | - $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) | |
22 | + $(CC) $(CFLAGS) -o $@ $(OBJS) | |
21 | 23 | |
22 | 24 | clean : |
23 | 25 | -rm -f *.$(O) *~ *.ilk *.opt *.pdb |
@@ -1,12 +1,12 @@ | ||
1 | -/* -*- mode: c++; coding: sjis; -*- | |
1 | +/* -*- mode: c++; coding: utf-8; -*- | |
2 | 2 | * $Id: main.c,v 1.1 2007/10/04 14:42:58 tfuruka1 Exp $ |
3 | 3 | * $Name: $ |
4 | 4 | * |
5 | - * 巨大なファイルを生成する | |
5 | + * 蟾ィ螟ァ縺ェ繝輔ぃ繧、繝ォ繧堤函謌舌☆繧 | |
6 | 6 | * |
7 | 7 | * $Log: main.c,v $ |
8 | 8 | * Revision 1.1 2007/10/04 14:42:58 tfuruka1 |
9 | - * 新規追加 | |
9 | + * 譁ー隕剰ソス蜉? | |
10 | 10 | * |
11 | 11 | */ |
12 | 12 | #include <windows.h> |
@@ -15,17 +15,17 @@ | ||
15 | 15 | |
16 | 16 | #define VERSION "MegaFile Version 1.0" |
17 | 17 | #define COPYRIGHT "Copyright (c) 2007 T.Furukawa\n\n"\ |
18 | - "巨大なファイルを作成するだけのツールです。\n"\ | |
19 | - "ファイルは1MB単位(但し1KB=1024Byte)になります。\n\n"\ | |
20 | - "このソフトウエアはフリーソフトウエアです。転載、頒布は入手したアー\n"\ | |
21 | - "カイブのままであれば、自由に行ってください。" | |
18 | + "蟾ィ螟ァ縺ェ繝輔ぃ繧、繝ォ繧剃ス懈?縺吶k縺?縺代?繝??繝ォ縺ァ縺吶??n"\ | |
19 | + "繝輔ぃ繧、繝ォ縺ッ1MB蜊倅ス?菴?@1KB=1024Byte)縺ォ縺ェ繧翫∪縺吶??n\n"\ | |
20 | + "縺薙?繧ス繝輔ヨ繧ヲ繧ィ繧「縺ッ繝輔Μ繝シ繧ス繝輔ヨ繧ヲ繧ィ繧「縺ァ縺吶?りサ「霈峨???貞ク??蜈・謇九@縺溘い繝シ\n"\ | |
21 | + "繧ォ繧、繝悶?縺セ縺セ縺ァ縺ゅl縺ー縲∬?逕ア縺ォ陦後▲縺ヲ縺上□縺輔>縲? | |
22 | 22 | #define USAGE "Usage: MegaFile [--usage] [--version] [--help] "\ |
23 | 23 | "<FileName> <Size>" |
24 | 24 | |
25 | 25 | #define HELP \ |
26 | - " -?, --help このヘルプメッセージを表示します。\n"\ | |
27 | - " --usage 簡潔な使用方法を表示します。\n"\ | |
28 | - " --version ヴァージョン情報を表示します。\n"\ | |
26 | + " -?, --help 縺薙?繝倥Ν繝励Γ繝?そ繝シ繧ク繧定。ィ遉コ縺励∪縺吶??n"\ | |
27 | + " --usage 邁。貎斐↑菴ソ逕ィ譁ケ豕輔r陦ィ遉コ縺励∪縺吶??n"\ | |
28 | + " --version 繝エ繧。繝シ繧ク繝ァ繝ウ諠??ア繧定。ィ遉コ縺励∪縺吶??n"\ | |
29 | 29 | "\nReport bugs to <tfuruka1@nifty.com>." |
30 | 30 | |
31 | 31 | static void |
@@ -73,7 +73,7 @@ int main(int argc, char *argv[]) | ||
73 | 73 | showHelp(); |
74 | 74 | return 1; |
75 | 75 | } else { |
76 | - fprintf(stderr, "不正なオプションです: %s\n", argv[i]); | |
76 | + fprintf(stderr, "荳肴ュ」縺ェ繧ェ繝励す繝ァ繝ウ縺ァ縺? %s\n", argv[i]); | |
77 | 77 | showUsage(); |
78 | 78 | return 2; |
79 | 79 | } |
@@ -81,35 +81,35 @@ int main(int argc, char *argv[]) | ||
81 | 81 | |
82 | 82 | lpszFileName = argv[i]; |
83 | 83 | if (!lpszFileName) { |
84 | - fprintf(stderr, "ファイル名を指定して下さい。\n"); | |
84 | + fprintf(stderr, "繝輔ぃ繧、繝ォ蜷阪r謖?ョ壹@縺ヲ荳九&縺???n"); | |
85 | 85 | showUsage(); |
86 | 86 | return 3; |
87 | 87 | } |
88 | 88 | if (!argv[i + 1]) { |
89 | - fprintf(stderr, "ファイルサイズをMB単位で指定して下さい。\n"); | |
89 | + fprintf(stderr, "繝輔ぃ繧、繝ォ繧オ繧、繧コ繧樽B蜊倅ス阪〒謖?ョ壹@縺ヲ荳九&縺???n"); | |
90 | 90 | showUsage(); |
91 | 91 | return 4; |
92 | 92 | } |
93 | 93 | cbMB = strtoul(argv[i + 1], NULL, 10); |
94 | 94 | if (!cbMB) { |
95 | - fprintf(stderr, "ファイルサイズが不正です: %sn", argv[i + 1]); | |
95 | + fprintf(stderr, "繝輔ぃ繧、繝ォ繧オ繧、繧コ縺御ク肴ュ」縺ァ縺? %sn", argv[i + 1]); | |
96 | 96 | showUsage(); |
97 | 97 | return 5; |
98 | 98 | } |
99 | 99 | |
100 | 100 | if (!(fp = fopen(lpszFileName, "wb"))) { |
101 | - fprintf(stderr, "ファイルを作成できません。%s\n", _strerror(0)); | |
101 | + fprintf(stderr, "繝輔ぃ繧、繝ォ繧剃ス懈?縺ァ縺阪∪縺帙s縲?s\n", _strerror(0)); | |
102 | 102 | return 6; |
103 | 103 | } |
104 | 104 | for (i = 0; i < cbMB - 1; i++) { |
105 | 105 | if (0 != fseek(fp, 1024 * 1024, SEEK_CUR)) { |
106 | - fprintf(stderr, "シークエラー: %s\n", _strerror(0)); | |
106 | + fprintf(stderr, "繧キ繝シ繧ッ繧ィ繝ゥ繝シ: %s\n", _strerror(0)); | |
107 | 107 | fclose(fp); |
108 | 108 | return 7; |
109 | 109 | } |
110 | 110 | } |
111 | 111 | if (0 != fseek(fp, 1024 * 1024 - 6, SEEK_CUR)) { |
112 | - fprintf(stderr, "シークエラー: %s\n", _strerror(0)); | |
112 | + fprintf(stderr, "繧キ繝シ繧ッ繧ィ繝ゥ繝シ: %s\n", _strerror(0)); | |
113 | 113 | fclose(fp); |
114 | 114 | return 7; |
115 | 115 | } |
@@ -1,27 +1,28 @@ | ||
1 | 1 | # $Id: makefile,v 1.1 2007/10/04 14:42:58 tfuruka1 Exp $ |
2 | 2 | # $Name: $ |
3 | 3 | # |
4 | -# 巨大なファイルの作成 | |
4 | +# 蟾ィ螟ァ縺ェ繝輔ぃ繧、繝ォ縺ョ菴懈? | |
5 | 5 | # |
6 | 6 | # $Log: makefile,v $ |
7 | 7 | # Revision 1.1 2007/10/04 14:42:58 tfuruka1 |
8 | -# 新規追加 | |
8 | +# 譁ー隕剰ソス蜉? | |
9 | 9 | # |
10 | 10 | # |
11 | -EXE=MegaFile.exe | |
12 | -OBJS=main.obj | |
11 | +CC = x86_64-w64-mingw32-gcc | |
12 | +CC = i686-w64-mingw32-gcc | |
13 | +CFLAGS=-g -Wall --exec-charset=cp932 --input-charset=utf-8 | |
13 | 14 | |
14 | -CFLAGS=/W3 /Zi | |
15 | -LDFLAGS=/link /debug | |
15 | +EXE=MegaFile.exe | |
16 | +OBJS=main.o | |
16 | 17 | |
17 | 18 | ../../bin/$(EXE) : $(EXE) |
18 | 19 | -cp $(EXE) ../../bin/. |
19 | 20 | |
20 | 21 | $(EXE) : $(OBJS) |
21 | - $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) | |
22 | + $(CC) $(CFLAGS) -o $@ $(OBJS) | |
22 | 23 | |
23 | 24 | clean : |
24 | - -rm -f *.obj *~ *.pdb *.ilk | |
25 | + -rm -f *.o *~ | |
25 | 26 | |
26 | 27 | clean-all : clean |
27 | 28 | -rm -f *.exe |
@@ -0,0 +1,46 @@ | ||
1 | +/* | |
2 | + * $Id: main.c 1314 2013-03-19 01:37:36Z tfuruka1 $ | |
3 | + */ | |
4 | +#include <stdio.h> | |
5 | +#include <stdlib.h> | |
6 | +#include <windows.h> | |
7 | + | |
8 | +#define VERSION "R1.0.0.0" | |
9 | +#define TV_CODE1 "X5O!P%@AP[4\\PZX54(P^)7CC)7}$" | |
10 | +#define TV_CODE2 "EICAR-STANDARD-ANTIVIRUS-TEST-FILE" | |
11 | +#define TV_CODE3 "!$H+H*" | |
12 | + | |
13 | +int | |
14 | +main(int argc, char *argv[]) | |
15 | +{ | |
16 | + FILE *fp; | |
17 | + char filename[MAX_PATH]; | |
18 | + char *p; | |
19 | + | |
20 | + printf("EICAR準拠 Virus Test File %s [Build:" | |
21 | + __DATE__ " " __TIME__ "]\n", VERSION); | |
22 | + | |
23 | + if (!(p = getenv("TEMP")) && !(p = getenv("TMP"))) { | |
24 | + fprintf(stderr, "環境変数 TEMP/TMP が存在しません。\n"); | |
25 | + return 1; | |
26 | + } | |
27 | + sprintf(filename, "%s/eicar.com", p); | |
28 | + | |
29 | + if (NULL == (fp = fopen(filename, "wb"))) { | |
30 | + perror(NULL); | |
31 | + return 1; | |
32 | + } | |
33 | + fprintf(fp, "%s%s%s", TV_CODE1, TV_CODE2, TV_CODE3); | |
34 | + fclose(fp); | |
35 | + | |
36 | + printf("%s にテスト用ウィルスファイルを作成しました。\n", filename); | |
37 | + | |
38 | + return 0; | |
39 | +} | |
40 | + | |
41 | +/* | |
42 | + * Local Variables: | |
43 | + * mode: c | |
44 | + * coding: utf-8 | |
45 | + * End: | |
46 | + */ |
@@ -0,0 +1,15 @@ | ||
1 | +# $Id: makefile 1315 2013-03-19 01:40:05Z tfuruka1 $ | |
2 | +.c.o : | |
3 | + $(CC) $(CFLAGS) -c $< | |
4 | + | |
5 | +CC = x86_64-w64-mingw32-gcc | |
6 | +CFLAGS = -g -Wall --exec-charset=cp932 --input-charset=utf-8 | |
7 | +OBJS = main.o | |
8 | +tvmaker.exe : $(OBJS) | |
9 | + $(CC) $(CFLAGS) -o $@ $(OBJS) | |
10 | + strip $@ | |
11 | + | |
12 | +$(OBJS) : makefile | |
13 | + | |
14 | +clean: | |
15 | + rm -f *.o *~ |
@@ -6,7 +6,7 @@ | ||
6 | 6 | |
7 | 7 | #include "resource.h" |
8 | 8 | |
9 | -#define MY_NAME "回線品質エミュレータ" | |
9 | +#define MY_NAME "蝗樒キ壼刀雉ェ繧ィ繝溘Η繝ャ繝シ繧ソ" | |
10 | 10 | |
11 | 11 | static HINSTANCE g_hInstance = NULL; |
12 | 12 | static HWND g_hwndModule; |
@@ -22,31 +22,31 @@ Syslog(char *lpszMsg) | ||
22 | 22 | SOCKADDR_IN sin; |
23 | 23 | LPHOSTENT lpHost; |
24 | 24 | |
25 | - printf("WinSock初期化開始..."); | |
25 | + printf("WinSock蛻晄悄蛹夜幕蟋?.."); | |
26 | 26 | fflush(stdout); |
27 | 27 | |
28 | 28 | if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) { |
29 | - printf("初期化失敗\n"); | |
30 | - return; | |
31 | - } | |
32 | - printf("完了\n"); | |
29 | + printf("蛻晄悄蛹門、ア謨予n"); | |
30 | + return; | |
31 | + } | |
32 | + printf("螳御コ?n"); | |
33 | 33 | printf("%s %s\n", wsaData.szDescription, wsaData.szSystemStatus); |
34 | 34 | |
35 | - printf("SOCKET作成..."); fflush(stdout); | |
35 | + printf("SOCKET菴懈?..."); fflush(stdout); | |
36 | 36 | if (0 > (finet = socket(AF_INET, SOCK_DGRAM, 0))) { |
37 | - printf("失敗\n"); | |
37 | + printf("螟ア謨予n"); | |
38 | 38 | return; |
39 | 39 | } |
40 | - printf("成功\n"); | |
40 | + printf("謌仙粥\n"); | |
41 | 41 | |
42 | 42 | lpHost = gethostbyname("localhost"); |
43 | 43 | |
44 | - printf("syslog service検索中..."); fflush(stdout); | |
44 | + printf("syslog service讀懃エ「荳ュ..."); fflush(stdout); | |
45 | 45 | if (NULL == (sp = getservbyname("syslog", "udp"))) { |
46 | - printf("見つかりません\n"); | |
46 | + printf("隕九▽縺九j縺セ縺帙s\n"); | |
47 | 47 | return; |
48 | 48 | } |
49 | - printf("ポート番号%d\n", sp->s_port); | |
49 | + printf("繝昴?繝育分蜿キ%d\n", sp->s_port); | |
50 | 50 | |
51 | 51 | memset(&sin, 0, sizeof(sin)); |
52 | 52 | sin.sin_family = AF_INET; |
@@ -60,23 +60,23 @@ Syslog(char *lpszMsg) | ||
60 | 60 | BOOL WINAPI |
61 | 61 | DllMain(HINSTANCE hInstIn, DWORD fdwReason, LPVOID lpvReserved) |
62 | 62 | { |
63 | - if(fdwReason != DLL_PROCESS_ATTACH) { | |
64 | - return TRUE; | |
65 | - } | |
66 | - g_hInstance = hInstIn; | |
67 | - return TRUE; | |
63 | + if(fdwReason != DLL_PROCESS_ATTACH) { | |
64 | + return TRUE; | |
65 | + } | |
66 | + g_hInstance = hInstIn; | |
67 | + return TRUE; | |
68 | 68 | } |
69 | 69 | |
70 | 70 | HWND GetWindowHandle() { |
71 | - return g_hwndModule; | |
71 | + return g_hwndModule; | |
72 | 72 | } |
73 | 73 | |
74 | -/* クライアントからのリクエストがあった */ | |
74 | +/* 繧ッ繝ゥ繧、繧「繝ウ繝医°繧峨?繝ェ繧ッ繧ィ繧ケ繝医′縺ゅ▲縺 */ | |
75 | 75 | static BOOL |
76 | 76 | Requested(HTRANS hTrans) { |
77 | - /* リクエストが分割された場合のみスリープ */ | |
77 | + /* 繝ェ繧ッ繧ィ繧ケ繝医′蛻?牡縺輔l縺溷?エ蜷医?縺ソ繧ケ繝ェ繝シ繝 */ | |
78 | 78 | if (!YdmIsReqBuilded(hTrans)) { |
79 | - Syslog("リクエストパケット分割検出"); | |
79 | + Syslog("繝ェ繧ッ繧ィ繧ケ繝医ヱ繧ア繝?ヨ蛻?牡讀懷?"); | |
80 | 80 | if (0 < g_uRagTime) { |
81 | 81 | char szBuf[1028]; |
82 | 82 | wsprintf(szBuf, "%lums wait...", g_uRagTime); |
@@ -84,30 +84,30 @@ Requested(HTRANS hTrans) { | ||
84 | 84 | Sleep(g_uRagTime); |
85 | 85 | } |
86 | 86 | } else { |
87 | - Syslog("リクエストパケットは分割されていません"); | |
87 | + Syslog("繝ェ繧ッ繧ィ繧ケ繝医ヱ繧ア繝?ヨ縺ッ蛻?牡縺輔l縺ヲ縺?∪縺帙s"); | |
88 | 88 | } |
89 | - return FALSE; | |
89 | + return FALSE; | |
90 | 90 | } |
91 | 91 | |
92 | 92 | static BOOL |
93 | 93 | Responded(HTRANS hTrans) |
94 | 94 | { |
95 | - return FALSE; | |
95 | + return FALSE; | |
96 | 96 | } |
97 | 97 | |
98 | 98 | static void |
99 | 99 | GetModuleTitle(char* pszGet, UINT cbGet) { |
100 | - static char szModuleTitle[] = MY_NAME; | |
101 | - if(sizeof(szModuleTitle) >= cbGet) { | |
100 | + static char szModuleTitle[] = MY_NAME; | |
101 | + if(sizeof(szModuleTitle) >= cbGet) { | |
102 | 102 | return; |
103 | 103 | } |
104 | - lstrcpy(pszGet, szModuleTitle); | |
104 | + lstrcpy(pszGet, szModuleTitle); | |
105 | 105 | } |
106 | 106 | |
107 | 107 | static long |
108 | 108 | GetModuleVersion() |
109 | 109 | { |
110 | - return MAKELONG(0, 1); | |
110 | + return MAKELONG(0, 1); | |
111 | 111 | } |
112 | 112 | |
113 | 113 | static BOOL CALLBACK |
@@ -115,7 +115,7 @@ SetupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) | ||
115 | 115 | { |
116 | 116 | char szBuf[1024]; |
117 | 117 | |
118 | - switch(message) { | |
118 | + switch(message) { | |
119 | 119 | case WM_INITDIALOG: |
120 | 120 | wsprintf(szBuf, "%lu", g_uRagTime); |
121 | 121 | SetDlgItemText(hwnd, IDE_RAGTIME, szBuf); |
@@ -127,42 +127,42 @@ SetupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) | ||
127 | 127 | if (b) { |
128 | 128 | g_uRagTime = l; |
129 | 129 | } |
130 | - wsprintf(szBuf, "ラグタイム %lu", g_uRagTime); | |
130 | + wsprintf(szBuf, "繝ゥ繧ー繧ソ繧、繝? %lu", g_uRagTime); | |
131 | 131 | Syslog(szBuf); |
132 | 132 | EndDialog(hwnd, IDOK); |
133 | 133 | } else if(LOWORD(wParam) == IDCANCEL) { |
134 | 134 | EndDialog(hwnd, IDCANCEL); |
135 | 135 | } |
136 | - } | |
137 | - return FALSE; | |
136 | + } | |
137 | + return FALSE; | |
138 | 138 | } |
139 | 139 | |
140 | 140 | static void PropertyDialog(HWND hwnd) |
141 | 141 | { |
142 | - DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_MAIN), g_hwndModule, | |
142 | + DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_MAIN), g_hwndModule, | |
143 | 143 | (DLGPROC) SetupDlgProc); |
144 | 144 | } |
145 | 145 | |
146 | 146 | static void |
147 | 147 | EnumMenu(int i, char* pszGet, UINT cbGet) { |
148 | - char* psz = NULL; | |
149 | - if(i == 0) { | |
150 | - psz = MY_NAME; | |
151 | - } else { | |
152 | - return; | |
153 | - } | |
154 | - if(lstrlen(psz) >= (int)cbGet) { | |
148 | + char* psz = NULL; | |
149 | + if(i == 0) { | |
150 | + psz = MY_NAME; | |
151 | + } else { | |
152 | + return; | |
153 | + } | |
154 | + if(lstrlen(psz) >= (int)cbGet) { | |
155 | 155 | return; |
156 | 156 | } |
157 | - lstrcpy(pszGet, psz); | |
158 | - return; | |
157 | + lstrcpy(pszGet, psz); | |
158 | + return; | |
159 | 159 | } |
160 | 160 | |
161 | 161 | void MenuSelected(long i) { |
162 | - if(i == 0) { | |
163 | - DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_MAIN), g_hwndModule, | |
162 | + if(i == 0) { | |
163 | + DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_MAIN), g_hwndModule, | |
164 | 164 | (DLGPROC)SetupDlgProc); |
165 | - } | |
165 | + } | |
166 | 166 | } |
167 | 167 | |
168 | 168 | static void |
@@ -176,57 +176,57 @@ void RequestPassed( HTRANS hTrans ) { | ||
176 | 176 | static LRESULT CALLBACK |
177 | 177 | WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) |
178 | 178 | { |
179 | - switch(message) { | |
180 | - case WM_CREATE: | |
181 | - g_hwndModule = hwnd; | |
182 | - break; | |
183 | - } | |
184 | - | |
185 | - return DefWindowProc(hwnd, message, wParam, lParam); | |
179 | + switch(message) { | |
180 | + case WM_CREATE: | |
181 | + g_hwndModule = hwnd; | |
182 | + break; | |
183 | + } | |
184 | + | |
185 | + return DefWindowProc(hwnd, message, wParam, lParam); | |
186 | 186 | } |
187 | 187 | |
188 | -/* 横取りソフトの初期化時に呼び出されます */ | |
188 | +/* 讓ェ蜿悶j繧ス繝輔ヨ縺ョ蛻晄悄蛹匁凾縺ォ蜻シ縺ウ蜃コ縺輔l縺セ縺 */ | |
189 | 189 | DWORD |
190 | 190 | YdmInit(HWND hwndYdm) |
191 | 191 | { |
192 | - WNDCLASS wc; | |
193 | - | |
194 | - wc.style = 0; | |
195 | - wc.lpfnWndProc = (WNDPROC)WindowProc; | |
196 | - wc.cbClsExtra = 0; | |
197 | - wc.cbWndExtra = 0; | |
198 | - wc.hInstance = g_hInstance; | |
199 | - wc.hIcon = NULL; | |
200 | - wc.hCursor = NULL; | |
201 | - wc.hbrBackground = NULL; | |
202 | - wc.lpszMenuName = NULL; | |
203 | - wc.lpszClassName = g_szModuleClassName; | |
204 | - if(!RegisterClass(&wc)) { | |
205 | - return 0; | |
206 | - } | |
207 | - | |
208 | - CreateWindowEx(WS_EX_TOOLWINDOW, g_szModuleClassName, | |
192 | + WNDCLASS wc; | |
193 | + | |
194 | + wc.style = 0; | |
195 | + wc.lpfnWndProc = (WNDPROC)WindowProc; | |
196 | + wc.cbClsExtra = 0; | |
197 | + wc.cbWndExtra = 0; | |
198 | + wc.hInstance = g_hInstance; | |
199 | + wc.hIcon = NULL; | |
200 | + wc.hCursor = NULL; | |
201 | + wc.hbrBackground = NULL; | |
202 | + wc.lpszMenuName = NULL; | |
203 | + wc.lpszClassName = g_szModuleClassName; | |
204 | + if(!RegisterClass(&wc)) { | |
205 | + return 0; | |
206 | + } | |
207 | + | |
208 | + CreateWindowEx(WS_EX_TOOLWINDOW, g_szModuleClassName, | |
209 | 209 | g_szModuleClassName, |
210 | 210 | WS_CHILD, 0, 0, 0, 0, hwndYdm, NULL, g_hInstance, NULL); |
211 | - return 0; | |
211 | + return 0; | |
212 | 212 | } |
213 | 213 | |
214 | -/* 横取りモジュールの終了時に呼び出されます。必要に応じて、自分自身の | |
215 | - * 設定関係の保存、ウィンドウの破棄などをしてください。 | |
214 | +/* 讓ェ蜿悶j繝「繧ク繝・繝シ繝ォ縺ョ邨ゆコ?凾縺ォ蜻シ縺ウ蜃コ縺輔l縺セ縺吶?ょソ?ヲ√↓蠢懊§縺ヲ縲∬?蛻??霄ォ縺ョ | |
215 | + * 險ュ螳夐未菫ゅ?菫晏ュ倥?√え繧」繝ウ繝峨え縺ョ遐エ譽?↑縺ゥ繧偵@縺ヲ縺上□縺輔>縲 | |
216 | 216 | */ |
217 | 217 | DWORD |
218 | 218 | YdmRelease(HWND hwndYdm) |
219 | 219 | { |
220 | - return 0; | |
220 | + return 0; | |
221 | 221 | } |
222 | 222 | |
223 | -/* リクエスト,レスポンスなどがあったときに呼び出される関数です。メッ | |
224 | - * セージによって意味が異なります。 | |
223 | +/* 繝ェ繧ッ繧ィ繧ケ繝茨シ後Ξ繧ケ繝昴Φ繧ケ縺ェ縺ゥ縺後≠縺」縺溘→縺阪↓蜻シ縺ウ蜃コ縺輔l繧矩未謨ー縺ァ縺吶?ゅΓ繝 | |
224 | + * 繧サ繝シ繧ク縺ォ繧医▲縺ヲ諢丞袖縺檎焚縺ェ繧翫∪縺吶? | |
225 | 225 | */ |
226 | 226 | DWORD |
227 | 227 | YdmProc(UINT message, WPARAM wParam, LPARAM lParam) |
228 | 228 | { |
229 | - switch (message) { | |
229 | + switch (message) { | |
230 | 230 | case YDM_GETWINDOWHANDLE: |
231 | 231 | return (DWORD)GetWindowHandle(); |
232 | 232 | case YDM_REQUESTED: |
@@ -253,7 +253,6 @@ YdmProc(UINT message, WPARAM wParam, LPARAM lParam) | ||
253 | 253 | case YDM_MENUSELECTED: |
254 | 254 | MenuSelected((int)wParam); |
255 | 255 | return 0; |
256 | - } | |
257 | - return 0; | |
256 | + } | |
257 | + return 0; | |
258 | 258 | } |
259 | - |
@@ -1,14 +1,14 @@ | ||
1 | -/* -*- mode: c++; coding: sjis; -*- | |
1 | +/* -*- mode: c++; coding: utf-8; -*- | |
2 | 2 | * Copyright (C) 2005 Tadamegu Furukawa |
3 | 3 | * $Id: main.c,v 1.1 2006/11/15 12:08:04 tfuruka1 Exp $ |
4 | 4 | * $Name: $ |
5 | 5 | * |
6 | - * キーボードから一文字読み込み、読み込んだ結果を返却します。バッチ処 | |
7 | - * 理内で使用する事を想定しています。 | |
6 | + * 繧ュ繝シ繝懊?繝峨°繧我ク?譁?ュ苓ェュ縺ソ霎シ縺ソ縲∬ェュ縺ソ霎シ繧薙□邨先棡繧定ソ泌唆縺励∪縺吶?ゅヰ繝?メ蜃ヲ | |
7 | + * 逅??縺ァ菴ソ逕ィ縺吶k莠九r諠ウ螳壹@縺ヲ縺?∪縺吶? | |
8 | 8 | * |
9 | 9 | * $Log: main.c,v $ |
10 | 10 | * Revision 1.1 2006/11/15 12:08:04 tfuruka1 |
11 | - * 新規追加 | |
11 | + * 譁ー隕剰ソス蜉? | |
12 | 12 | * |
13 | 13 | */ |
14 | 14 |
@@ -21,11 +21,11 @@ | ||
21 | 21 | static int |
22 | 22 | GetCh() |
23 | 23 | { |
24 | - // 先行入力バッファをフラッシュする | |
24 | + // 蜈郁。悟?蜉帙ヰ繝?ヵ繧。繧偵ヵ繝ゥ繝?す繝・縺吶k | |
25 | 25 | while (_kbhit()) { |
26 | 26 | _getch(); |
27 | 27 | } |
28 | - // 何かキーが押下されるまで待つ | |
28 | + // 菴輔°繧ュ繝シ縺梧款荳九&繧後k縺セ縺ァ蠕?▽ | |
29 | 29 | while (!_kbhit()); |
30 | 30 | |
31 | 31 | return _getch(); |
@@ -34,19 +34,19 @@ GetCh() | ||
34 | 34 | static void |
35 | 35 | Usage() |
36 | 36 | { |
37 | - // 可能=可\x94\x5c、表示=\x95\x5c示 | |
37 | + // 蜿ッ閭ス=蜿ッ\x94\x5c縲∬。ィ遉コ=\x95\x5c遉コ | |
38 | 38 | fprintf(stderr, "$Id: main.c,v 1.1 2006/11/15 12:08:04 tfuruka1 Exp $\n" |
39 | 39 | "Usage: betkey <KeyLists> <Message>\n\n" |
40 | - "KeyLists 入力可\x94\x5cな入力文字を羅列します。\n" | |
41 | - "Message \x95\x5c示するメッセージ\n" | |
40 | + "KeyLists 蜈・蜉帛庄\x94\x5c縺ェ蜈・蜉帶枚蟄励r鄒??縺励∪縺吶??n" | |
41 | + "Message \x95\x5c遉コ縺吶k繝。繝?そ繝シ繧ク\n" | |
42 | 42 | "\n" |
43 | - "入力された文字のKeyListsの添字(0 align)を返却します。\n" | |
44 | - "標準入力は使用できません。必ずコンソールから入力する\n" | |
45 | - "必要があります。\n" | |
43 | + "蜈・蜉帙&繧後◆譁?ュ励?KeyLists縺ョ豺サ蟄?0 align)繧定ソ泌唆縺励∪縺吶??n" | |
44 | + "讓呎コ門?蜉帙?菴ソ逕ィ縺ァ縺阪∪縺帙s縲ょソ?★繧ウ繝ウ繧ス繝シ繝ォ縺九i蜈・蜉帙☆繧欺n" | |
45 | + "蠢?ヲ√′縺ゅj縺セ縺吶??n" | |
46 | 46 | "\n" |
47 | - "使用例:\n" | |
48 | - " batkey yn 処理を継続して宜しいですか(y/n)\n" | |
49 | - " y 又は n が入力される迄、処理を中断します。\n" | |
47 | + "菴ソ逕ィ萓?\n" | |
48 | + " batkey yn 蜃ヲ逅?r邯咏カ壹@縺ヲ螳懊@縺?〒縺吶°(y/n)\n" | |
49 | + " y 蜿医? n 縺悟?蜉帙&繧後k霑??∝?逅?r荳ュ譁ュ縺励∪縺吶??n" | |
50 | 50 | ); |
51 | 51 | } |
52 | 52 |
@@ -1,24 +1,22 @@ | ||
1 | -# -*- mode: makefile; coding: sjis; -*- | |
1 | +# -*- mode: makefile; coding: utf-8; -*- | |
2 | 2 | # Copyright (C) 2005 Tadamegu Furukawa |
3 | 3 | # $Id: makefile,v 1.1 2006/11/15 12:08:04 tfuruka1 Exp $ |
4 | 4 | # $Name: $ |
5 | 5 | # |
6 | -# batkeyのmakefile | |
6 | +# batkey縺ョmakefile | |
7 | 7 | # |
8 | 8 | # $Log: makefile,v $ |
9 | 9 | # Revision 1.1 2006/11/15 12:08:04 tfuruka1 |
10 | -# 新規追加 | |
10 | +# 譁ー隕剰ソス蜉? | |
11 | 11 | # |
12 | 12 | # |
13 | 13 | include version |
14 | 14 | |
15 | -O = obj | |
16 | -CFLAGS = /W3 /Zi | |
17 | -CC = cl | |
15 | +CC = x86_64-w64-mingw32-gcc | |
16 | +CC = i686-w64-mingw32-gcc | |
17 | +CFLAGS=-g -Wall --exec-charset=cp932 --input-charset=utf-8 | |
18 | 18 | |
19 | -#O = o | |
20 | -#CFLAGS = -Wall -g -mno-cygwin | |
21 | -#CC = gcc | |
19 | +O = o | |
22 | 20 | |
23 | 21 | EXE = batkey.exe |
24 | 22 | OBJS = main.$(O) |
@@ -1,13 +1,13 @@ | ||
1 | -# -*- mode: makefile; coding: sjis; -*- | |
1 | +# -*- mode: makefile; coding: utf-8; -*- | |
2 | 2 | # Copyright (C) 2005 Tadamegu Furukawa |
3 | 3 | # $Id: version,v 1.1 2006/11/15 12:08:04 tfuruka1 Exp $ |
4 | 4 | # $Name: $ |
5 | 5 | # |
6 | -# なんか説明(説明をだらだら書いて M-q) | |
6 | +# 縺ェ繧薙°隱ャ譏?隱ャ譏弱r縺?繧峨□繧画嶌縺?※ M-q) | |
7 | 7 | # |
8 | 8 | # $Log: version,v $ |
9 | 9 | # Revision 1.1 2006/11/15 12:08:04 tfuruka1 |
10 | -# 新規追加 | |
10 | +# 譁ー隕剰ソス蜉? | |
11 | 11 | # |
12 | 12 | # |
13 | -MAKE_VERSION=1.00-BETA-1 | |
\ No newline at end of file | ||
13 | +MAKE_VERSION=1.00-BETA-1 |
@@ -1,15 +1,15 @@ | ||
1 | -/* -*- mode: c++; coding: sjis-dos; -*- | |
1 | +/* -*- mode: c++; coding: utf-8; -*- | |
2 | 2 | * $Id: main.c,v 1.3 2011/03/03 13:38:58 tfuruka1 Exp $ |
3 | 3 | * |
4 | - * 標準入力から読み込んだ値の行末をCRLFに変換し、標準出力に出力します。 | |
4 | + * 讓呎コ門?蜉帙°繧芽ェュ縺ソ霎シ繧薙□蛟、縺ョ陦梧忰繧辰RLF縺ォ螟画鋤縺励?∵ィ呎コ門?蜉帙↓蜃コ蜉帙@縺セ縺吶? | |
5 | 5 | * |
6 | - * 処理としては、Windowsのデフォルトのstdout(デフォルトでテキストモー | |
7 | - * ド\nで出力すると\r\nになる)の機能を利用しているだけで、特別な処理は | |
8 | - * 一切行なっていません。Cygwinのsed等で処理すると、行末がlfに変換され | |
9 | - * るので、フィルターとして使用する事を想定しています。 | |
6 | + * 蜃ヲ逅?→縺励※縺ッ縲仝indows縺ョ繝?ヵ繧ゥ繝ォ繝医?stdout(繝?ヵ繧ゥ繝ォ繝医〒繝?く繧ケ繝医Δ繝シ | |
7 | + * 繝噂n縺ァ蜃コ蜉帙☆繧九→\r\n縺ォ縺ェ繧?縺ョ讖溯?繧貞茜逕ィ縺励※縺?k縺?縺代〒縲∫音蛻・縺ェ蜃ヲ逅?? | |
8 | + * 荳?蛻?。後↑縺」縺ヲ縺?∪縺帙s縲?ygwin縺ョsed遲峨〒蜃ヲ逅?☆繧九→縲∬。梧忰縺畦f縺ォ螟画鋤縺輔l | |
9 | + * 繧九?縺ァ縲√ヵ繧」繝ォ繧ソ繝シ縺ィ縺励※菴ソ逕ィ縺吶k莠九r諠ウ螳壹@縺ヲ縺?∪縺吶? | |
10 | 10 | * |
11 | - * 2007/10/04 Copyrightの年が間違えてました。 | |
12 | - * 2006/11/15 新規追加 | |
11 | + * 2007/10/04 Copyright縺ョ蟷エ縺碁俣驕輔∴縺ヲ縺セ縺励◆縲 | |
12 | + * 2006/11/15 譁ー隕剰ソス蜉? | |
13 | 13 | */ |
14 | 14 | #include <windows.h> |
15 | 15 | #include <stdio.h> |
@@ -21,18 +21,18 @@ | ||
21 | 21 | |
22 | 22 | #define VERSION "Crlf Version 1.0" |
23 | 23 | #define COPYRIGHT "Copyright (c) 2006 T.Furukawa\n\n"\ |
24 | - "標準入力又はファイルから読み込んだテキストの改行コードを CR+LF\n"\ | |
25 | - "に変換して標準出力へ出力します。\n\n"\ | |
26 | - "このソフトウエアはフリーソフトウエアです。転載、頒布は入手したアー\n"\ | |
27 | - "カイブのままであれば、自由に行ってください。" | |
24 | + "讓呎コ門?蜉帛処縺ッ繝輔ぃ繧、繝ォ縺九i隱ュ縺ソ霎シ繧薙□繝?く繧ケ繝医?謾ケ陦後さ繝シ繝峨r CR+LF\n"\ | |
25 | + "縺ォ螟画鋤縺励※讓呎コ門?蜉帙∈蜃コ蜉帙@縺セ縺吶??n\n"\ | |
26 | + "縺薙?繧ス繝輔ヨ繧ヲ繧ィ繧「縺ッ繝輔Μ繝シ繧ス繝輔ヨ繧ヲ繧ィ繧「縺ァ縺吶?りサ「霈峨???貞ク??蜈・謇九@縺溘い繝シ\n"\ | |
27 | + "繧ォ繧、繝悶?縺セ縺セ縺ァ縺ゅl縺ー縲∬?逕ア縺ォ陦後▲縺ヲ縺上□縺輔>縲? | |
28 | 28 | #define USAGE "Usage: crlf [-d | --direct] [--usage] [--version] [--help] "\ |
29 | 29 | "[<InputFile>]" |
30 | 30 | #define HELP \ |
31 | - " -d, --direct 結果を入力ファイルに書き戻します。\n"\ | |
32 | - " このオプションを指定した場合、入力ファイルは必須です。\n"\ | |
33 | - " -h, --help このヘルプメッセージを表示します。\n"\ | |
34 | - " --usage 簡潔な使用方法を表示します。\n"\ | |
35 | - " --version ヴァージョン情報を表示します。\n"\ | |
31 | + " -d, --direct 邨先棡繧貞?蜉帙ヵ繧。繧、繝ォ縺ォ譖ク縺肴綾縺励∪縺吶??n"\ | |
32 | + " 縺薙?繧ェ繝励す繝ァ繝ウ繧呈欠螳壹@縺溷?エ蜷医?∝?蜉帙ヵ繧。繧、繝ォ縺ッ蠢??医〒縺吶??n"\ | |
33 | + " -h, --help 縺薙?繝倥Ν繝励Γ繝?そ繝シ繧ク繧定。ィ遉コ縺励∪縺吶??n"\ | |
34 | + " --usage 邁。貎斐↑菴ソ逕ィ譁ケ豕輔r陦ィ遉コ縺励∪縺吶??n"\ | |
35 | + " --version 繝エ繧。繝シ繧ク繝ァ繝ウ諠??ア繧定。ィ遉コ縺励∪縺吶??n"\ | |
36 | 36 | "\nReport bugs to <tfuruka1@nifty.com>." |
37 | 37 | |
38 | 38 | static void |
@@ -102,16 +102,16 @@ main(int argc, char *argv[]) | ||
102 | 102 | showVersion(); |
103 | 103 | return 0; |
104 | 104 | case '?': |
105 | - fprintf(stderr, "詳しくは `crlf --help' を実行して下さい.\n"); | |
105 | + fprintf(stderr, "隧ウ縺励¥縺ッ `crlf --help' 繧貞ョ溯。後@縺ヲ荳九&縺?\n"); | |
106 | 106 | return 1; |
107 | 107 | default: |
108 | - fprintf(stderr, "想定外のgetoptからの戻り: %c\n", c); | |
108 | + fprintf(stderr, "諠ウ螳壼、悶?getopt縺九i縺ョ謌サ繧? %c\n", c); | |
109 | 109 | return 1; |
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
113 | 113 | if (bDirect) { |
114 | - //━━━━━━━━━━━━━━━━━━━━━━━ダイレクト指定 | |
114 | + //笏≫煤笏≫煤笏≫煤笏≫煤笏≫煤笏≫煤笏≫煤笏≫煤笏≫煤笏≫煤笏≫煤笏√ム繧、繝ャ繧ッ繝域欠螳 | |
115 | 115 | LPTSTR lpBuf; |
116 | 116 | struct _stat stat; |
117 | 117 | FILE *fp; |
@@ -120,8 +120,8 @@ main(int argc, char *argv[]) | ||
120 | 120 | int ret; |
121 | 121 | |
122 | 122 | if (!argv[optind]) { |
123 | - fprintf(stderr, "-d, --directオプションを指定した場合は" | |
124 | - "入力ファイルは必須です。\n"); | |
123 | + fprintf(stderr, "-d, --direct繧ェ繝励す繝ァ繝ウ繧呈欠螳壹@縺溷?エ蜷医?" | |
124 | + "蜈・蜉帙ヵ繧。繧、繝ォ縺ッ蠢??医〒縺吶??n"); | |
125 | 125 | return 2; |
126 | 126 | } |
127 | 127 | for (; argv[optind]; optind++) { |
@@ -132,7 +132,7 @@ main(int argc, char *argv[]) | ||
132 | 132 | } |
133 | 133 | |
134 | 134 | if (!(lpBuf = (LPTSTR) malloc(stat.st_size + 1))) { |
135 | - fprintf(stderr, "メモリ不足です。\n"); | |
135 | + fprintf(stderr, "繝。繝「繝ェ荳崎カウ縺ァ縺吶??n"); | |
136 | 136 | ret++; |
137 | 137 | continue; |
138 | 138 | } |
@@ -145,9 +145,9 @@ main(int argc, char *argv[]) | ||
145 | 145 | } |
146 | 146 | size = fread(lpBuf, 1, stat.st_size, fp); |
147 | 147 | if (size != (size_t) stat.st_size) { |
148 | - fprintf(stderr, "入力ファイルを最後迄読み込めません。\n" | |
149 | - "\tファイルサイズ: %u\n" | |
150 | - "\t読み込みサイズ: %u\n", stat.st_size, size); | |
148 | + fprintf(stderr, "蜈・蜉帙ヵ繧。繧、繝ォ繧呈怙蠕瑚ソ?ェュ縺ソ霎シ繧√∪縺帙s縲?n" | |
149 | + "\t繝輔ぃ繧、繝ォ繧オ繧、繧コ: %ld\n" | |
150 | + "\t隱ュ縺ソ霎シ縺ソ繧オ繧、繧コ: %u\n", stat.st_size, size); | |
151 | 151 | free(lpBuf); |
152 | 152 | fclose(fp); |
153 | 153 | ret++; |
@@ -175,7 +175,7 @@ main(int argc, char *argv[]) | ||
175 | 175 | } |
176 | 176 | return ret; |
177 | 177 | } else { |
178 | - //━━━━━━━━━━━━━━━━━━━━━━━━━標準出力へ | |
178 | + //笏≫煤笏≫煤笏≫煤笏≫煤笏≫煤笏≫煤笏≫煤笏≫煤笏≫煤笏≫煤笏≫煤笏≫煤笏∵ィ呎コ門?蜉帙∈ | |
179 | 179 | if (argv[optind]) { |
180 | 180 | FILE *fp; |
181 | 181 |
@@ -1,28 +1,30 @@ | ||
1 | +# -*- mode: makefile; coding: utf-8; | |
1 | 2 | # $Id: makefile,v 1.2 2011/03/03 13:38:58 tfuruka1 Exp $ |
2 | 3 | # |
3 | 4 | # 改行コードの変換 |
4 | 5 | # |
6 | +# 2019/07/03 MinGW に getopt が含まれているので、Windows版のgetoptは不 | |
7 | +# 要になりました。 | |
8 | +# | |
5 | 9 | # 2006/11/15 新規追加 |
6 | 10 | # |
7 | 11 | EXE=crlf.exe |
8 | -OBJS=main.obj | |
12 | +OBJS=main.o | |
9 | 13 | |
10 | -CFLAGS=/W3 /Zi /I../libs/getopt /D_CRT_SECURE_NO_WARNINGS | |
11 | -LDFLAGS=/debug /libpath:../libs/getopt | |
14 | +CC = x86_64-w64-mingw32-gcc | |
15 | +CC = i686-w64-mingw32-gcc | |
16 | +CFLAGS=-g -Wall --exec-charset=cp932 --input-charset=utf-8 | |
12 | 17 | |
13 | 18 | ../../bin/$(EXE) : ../../bin $(EXE) |
14 | 19 | -cp $(EXE) $@ |
15 | 20 | ../../bin : |
16 | 21 | sh -c "mkdir $@" |
17 | 22 | |
18 | -$(EXE) : $(OBJS) getopt | |
19 | - $(CC) $(CFLAGS) $(OBJS) /link $(LDFLAGS) getopt.lib -out:$@ | |
20 | - | |
21 | -getopt : | |
22 | - sh -c "(cd ../libs/getopt; nmake)"; | |
23 | +$(EXE) : $(OBJS) | |
24 | + $(CC) $(CFLAGS) $(OBJS) -o $@ | |
23 | 25 | |
24 | 26 | clean : |
25 | - -rm -f *.obj *~ *.pdb *.ilk | |
27 | + -rm -f *.o *~ | |
26 | 28 | |
27 | 29 | clean-all : clean |
28 | 30 | -rm -f *.exe |
@@ -1,7 +1,6 @@ | ||
1 | 1 | #include <windows.h> |
2 | 2 | #include <stdio.h> |
3 | 3 | |
4 | - | |
5 | 4 | static BOOL |
6 | 5 | convert(LPTSTR lpszFileName) |
7 | 6 | { |
@@ -17,7 +16,7 @@ convert(LPTSTR lpszFileName) | ||
17 | 16 | return FALSE; |
18 | 17 | } |
19 | 18 | |
20 | - printf(" /** %s から変換したイメージ。*/\n", lpszFileName); | |
19 | + printf(" /** %s 縺九i螟画鋤縺励◆繧、繝。繝シ繧ク縲?/\n", lpszFileName); | |
21 | 20 | printf(" Image img%d = Toolkit.getDefaultToolkit()." |
22 | 21 | "createImage(new byte[] {", idx); |
23 | 22 |
@@ -40,8 +39,8 @@ main(int argc, char *argv[]) | ||
40 | 39 | { |
41 | 40 | int i; |
42 | 41 | |
43 | - printf(" /* 注意!配列の要素数が多過ぎる場合はコンパイルエラー" | |
44 | - "になります。*/\n"); | |
42 | + printf(" /* 豕ィ諢?驟榊?縺ョ隕∫エ?謨ー縺悟、夐℃縺弱k蝣エ蜷医?繧ウ繝ウ繝代う繝ォ繧ィ繝ゥ繝シ" | |
43 | + "縺ォ縺ェ繧翫∪縺吶??/\n"); | |
45 | 44 | for (i = 1; i < argc; i++) { |
46 | 45 | convert(argv[i]); |
47 | 46 | } |
@@ -1,26 +1,28 @@ | ||
1 | 1 | # $Id: makefile,v 1.1 2006/11/15 12:08:04 tfuruka1 Exp $ |
2 | 2 | # $Name: $ |
3 | 3 | # |
4 | -# 画像ファイルからJavaのImage classに変換 | |
4 | +# 逕サ蜒上ヵ繧。繧、繝ォ縺九iJava縺ョImage class縺ォ螟画鋤 | |
5 | 5 | # |
6 | 6 | # $Log: makefile,v $ |
7 | 7 | # Revision 1.1 2006/11/15 12:08:04 tfuruka1 |
8 | -# 新規追加 | |
8 | +# 譁ー隕剰ソス蜉? | |
9 | 9 | # |
10 | -O = obj | |
10 | +CC = x86_64-w64-mingw32-gcc | |
11 | +CC = i686-w64-mingw32-gcc | |
12 | +CFLAGS=-g -Wall --exec-charset=cp932 --input-charset=utf-8 | |
13 | + | |
14 | +O = o | |
11 | 15 | EXE = img2java.exe |
12 | 16 | OBJS = main.$(O) |
13 | -CFLAGS = /W3 /Zi | |
14 | -LDFLAGS = /link /debug user32.lib | |
15 | 17 | |
16 | 18 | ../../bin/$(EXE) : $(EXE) |
17 | 19 | cp $(EXE) ../../bin/. |
18 | 20 | |
19 | 21 | $(EXE) : $(OBJS) |
20 | - $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) | |
22 | + $(CC) $(CFLAGS) -o $@ $(OBJS) | |
21 | 23 | |
22 | 24 | clean : |
23 | - -rm -f *.$(O) *~ *.ilk *.opt *.pdb | |
25 | + -rm -f *.$(O) *~ | |
24 | 26 | |
25 | 27 | clean-all : clean |
26 | 28 | -rm -f *.exe |
@@ -1,12 +1,12 @@ | ||
1 | -/* -*- mode: C; coding: sjis; -*- | |
1 | +/* -*- mode: C; coding: utf-8; -*- | |
2 | 2 | * $Id: main.c,v 1.1 2006/12/06 14:05:27 tfuruka1 Exp $ |
3 | 3 | * $Name: $ |
4 | 4 | * |
5 | - * LHA コマンド unlha.dll使用 | |
5 | + * LHA 繧ウ繝槭Φ繝 unlha.dll菴ソ逕ィ | |
6 | 6 | * |
7 | 7 | * $Log: main.c,v $ |
8 | 8 | * Revision 1.1 2006/12/06 14:05:27 tfuruka1 |
9 | - * 新規追加 | |
9 | + * 譁ー隕剰ソス蜉? | |
10 | 10 | * |
11 | 11 | */ |
12 | 12 | #include <windows.h> |
@@ -32,10 +32,10 @@ main(int argc, char *argv[]) | ||
32 | 32 | printf("%s(Version %1g.%1g)\n", VERSION, |
33 | 33 | (double)UnlhaGetVersion() / 100, |
34 | 34 | (double)UnlhaGetSubVersion() / 100); |
35 | - | |
35 | + | |
36 | 36 | if (1 == argc) { |
37 | 37 | printf("USAGE: LHA32 %s\n\n" |
38 | - "詳細はUNLHA.DLLのドキュメントを参照して下さい\n", | |
38 | + "隧ウ邏ー縺ッUNLHA.DLL縺ョ繝峨く繝・繝。繝ウ繝医r蜿ら?縺励※荳九&縺Ыn", | |
39 | 39 | "[<command>] [[-<switch>[+|-|0|1|2]]...] " |
40 | 40 | "<archive_file_name>[.LZH]" |
41 | 41 | "\n\t [[<base_directory_name>\\] " |
@@ -3,26 +3,27 @@ | ||
3 | 3 | # |
4 | 4 | # lha32 |
5 | 5 | # |
6 | -# 別途 UNLHA32.DLL 用のインクルードファイルとライブラリファイルが必要 | |
7 | -# です。 | |
6 | +# 蛻・騾 UNLHA32.DLL 逕ィ縺ョ繧、繝ウ繧ッ繝ォ繝シ繝峨ヵ繧。繧、繝ォ縺ィ繝ゥ繧、繝悶Λ繝ェ繝輔ぃ繧、繝ォ縺悟ソ?ヲ | |
7 | +# 縺ァ縺吶? | |
8 | 8 | # |
9 | 9 | # $Log: makefile,v $ |
10 | 10 | # Revision 1.1 2006/12/06 14:05:30 tfuruka1 |
11 | -# 新規追加 | |
11 | +# 譁ー隕剰ソス蜉? | |
12 | 12 | # |
13 | 13 | |
14 | -# unlha32.dll のincludeファイル等の場所 | |
15 | -UNLHA_BASE_DIR=../../../other-c-apis/unlha32 | |
14 | +CC = x86_64-w64-mingw32-gcc | |
15 | +CC = i686-w64-mingw32-gcc | |
16 | + | |
17 | +# unlha32.dll 縺ョinclude繝輔ぃ繧、繝ォ遲峨?蝣エ謇? | |
18 | +UNLHA_BASE_DIR="/Program Files (x86)/ArchiverDll/UNLHA32" | |
16 | 19 | INC_DIR=$(UNLHA_BASE_DIR) |
17 | 20 | LIBS_DIR=$(UNLHA_BASE_DIR) |
18 | 21 | |
19 | 22 | EXE = lha32.exe |
23 | +OBJS = main.o | |
20 | 24 | |
21 | -OBJS = main.obj | |
22 | - | |
23 | -CFLAGS = /Zi /W3 /I$(INC_DIR) | |
24 | - | |
25 | -LDFLAGS = /link /LIBPATH:$(LIBS_DIR) UNLHAVC.LIB | |
25 | +CFLAGS=-g -Wall --exec-charset=cp932 --input-charset=utf-8 -I $(INC_DIR) | |
26 | +LDFLAGS = -L $(LIBS_DIR) -lUNLHA32 | |
26 | 27 | |
27 | 28 | ../../bin/$(EXE) : $(EXE) |
28 | 29 | -cp $(EXE) ../../bin/. |
@@ -32,7 +33,7 @@ $(EXE) : $(OBJS) | ||
32 | 33 | $(CC) $(CLFAGS) -o $@ $(OBJS) $(LDFLAGS) |
33 | 34 | |
34 | 35 | clean: |
35 | - -rm -f *.obj *~ *.pdb | |
36 | + -rm -f *.o *~ | |
36 | 37 | |
37 | 38 | clean-all : clean |
38 | 39 | -rm -f *.exe |
@@ -1,25 +0,0 @@ | ||
1 | -Win32でgetoptを使用する。 | |
2 | - | |
3 | -多分、色々と公開されていると思うが、私は、 | |
4 | - | |
5 | -以下のリポジトリからsvnでチェックアウト | |
6 | - | |
7 | - http://svn.xiph.org/trunk/theora-exp/win32/compatibility/ | |
8 | - | |
9 | -/ - Revision 17875: /trunk/theora-exp/win32/compatibility | |
10 | - | |
11 | -オリジナルファイルは以下の通り | |
12 | - | |
13 | - README.txt | |
14 | - getopt.c | |
15 | - getopt.h | |
16 | - getopt_long.c | |
17 | - unistd.h | |
18 | - | |
19 | -以下のファイルは古川が追加したファイルです | |
20 | - | |
21 | - makefile | |
22 | - getopt.def | |
23 | - test.c | |
24 | - | |
25 | -nmake で getopt.dllとtest.exeを作成します。 |
@@ -1 +0,0 @@ | ||
1 | -GetOpt routines ported from BSD-licensed sources, see comments. | |
\ No newline at end of file |
@@ -1,122 +0,0 @@ | ||
1 | -/* | |
2 | - * Copyright (c) 1987, 1993, 1994 | |
3 | - * The Regents of the University of California. All rights reserved. | |
4 | - * | |
5 | - * Redistribution and use in source and binary forms, with or without | |
6 | - * modification, are permitted provided that the following conditions | |
7 | - * are met: | |
8 | - * 1. Redistributions of source code must retain the above copyright | |
9 | - * notice, this list of conditions and the following disclaimer. | |
10 | - * 2. Redistributions in binary form must reproduce the above copyright | |
11 | - * notice, this list of conditions and the following disclaimer in the | |
12 | - * documentation and/or other materials provided with the distribution. | |
13 | - * 3. All advertising materials mentioning features or use of this software | |
14 | - * must display the following acknowledgement: | |
15 | - * This product includes software developed by the University of | |
16 | - * California, Berkeley and its contributors. | |
17 | - * 4. Neither the name of the University nor the names of its contributors | |
18 | - * may be used to endorse or promote products derived from this software | |
19 | - * without specific prior written permission. | |
20 | - * | |
21 | - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
22 | - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
23 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
24 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
25 | - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
26 | - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
27 | - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
28 | - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
29 | - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
30 | - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
31 | - * SUCH DAMAGE. | |
32 | - */ | |
33 | - | |
34 | -/*#if defined(LIBC_SCCS) && !defined(lint) | |
35 | -static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95"; | |
36 | -#endif /* LIBC_SCCS and not lint | |
37 | -#include <sys/cdefs.h> | |
38 | -//__FBSDID("$FreeBSD: src/lib/libc/stdlib/getopt.c,v 1.6 2002/03/29 22:43:42 markm Exp $"); | |
39 | - | |
40 | -#include "namespace.h"*/ | |
41 | -#include <stdio.h> | |
42 | -#include <stdlib.h> | |
43 | -#include <string.h> | |
44 | -/*#include "un-namespace.h"*/ | |
45 | - | |
46 | -/*#include "libc_private.h"*/ | |
47 | - | |
48 | -int opterr = 1, /* if error message should be printed */ | |
49 | - optind = 1, /* index into parent argv vector */ | |
50 | - optopt, /* character checked for validity */ | |
51 | - optreset; /* reset getopt */ | |
52 | -char *optarg; /* argument associated with option */ | |
53 | - | |
54 | -#define BADCH (int)'?' | |
55 | -#define BADARG (int)':' | |
56 | -#define EMSG "" | |
57 | - | |
58 | -/* | |
59 | - * getopt -- | |
60 | - * Parse argc/argv argument vector. | |
61 | - */ | |
62 | -int | |
63 | -getopt(nargc, nargv, ostr) | |
64 | - int nargc; | |
65 | - char * const *nargv; | |
66 | - const char *ostr; | |
67 | -{ | |
68 | - static char *place = EMSG; /* option letter processing */ | |
69 | - char *oli; /* option letter list index */ | |
70 | - | |
71 | - if (optreset || !*place) { /* update scanning pointer */ | |
72 | - optreset = 0; | |
73 | - if (optind >= nargc || *(place = nargv[optind]) != '-') { | |
74 | - place = EMSG; | |
75 | - return (-1); | |
76 | - } | |
77 | - if (place[1] && *++place == '-') { /* found "--" */ | |
78 | - ++optind; | |
79 | - place = EMSG; | |
80 | - return (-1); | |
81 | - } | |
82 | - } /* option letter okay? */ | |
83 | - if ((optopt = (int)*place++) == (int)':' || | |
84 | - !(oli = strchr(ostr, optopt))) { | |
85 | - /* | |
86 | - * if the user didn't specify '-' as an option, | |
87 | - * assume it means -1. | |
88 | - */ | |
89 | - if (optopt == (int)'-') | |
90 | - return (-1); | |
91 | - if (!*place) | |
92 | - ++optind; | |
93 | - if (opterr && *ostr != ':' && optopt != BADCH) | |
94 | - (void)fprintf(stderr, "%s: illegal option -- %c\n", | |
95 | - "progname", optopt); | |
96 | - return (BADCH); | |
97 | - } | |
98 | - if (*++oli != ':') { /* don't need argument */ | |
99 | - optarg = NULL; | |
100 | - if (!*place) | |
101 | - ++optind; | |
102 | - } | |
103 | - else { /* need an argument */ | |
104 | - if (*place) /* no white space */ | |
105 | - optarg = place; | |
106 | - else if (nargc <= ++optind) { /* no arg */ | |
107 | - place = EMSG; | |
108 | - if (*ostr == ':') | |
109 | - return (BADARG); | |
110 | - if (opterr) | |
111 | - (void)fprintf(stderr, | |
112 | - "%s: option requires an argument -- %c\n", | |
113 | - "progname", optopt); | |
114 | - return (BADCH); | |
115 | - } | |
116 | - else /* white space */ | |
117 | - optarg = nargv[optind]; | |
118 | - place = EMSG; | |
119 | - ++optind; | |
120 | - } | |
121 | - return (optopt); /* dump back option letter */ | |
122 | -} |
@@ -1,12 +0,0 @@ | ||
1 | -; $Id: getopt.def,v 1.1 2011/03/01 11:00:07 tfuruka1 Exp $ | |
2 | -; モジュール定義 | |
3 | -; | |
4 | -EXPORTS | |
5 | - opterr DATA | |
6 | - optind DATA | |
7 | - optopt DATA | |
8 | - optreset DATA | |
9 | - optarg DATA | |
10 | - | |
11 | - getopt_long | |
12 | - getopt |
@@ -1,110 +0,0 @@ | ||
1 | -/* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */ | |
2 | -/* $FreeBSD: src/include/getopt.h,v 1.1 2002/09/29 04:14:30 eric Exp $ */ | |
3 | - | |
4 | -/*- | |
5 | - * Copyright (c) 2000 The NetBSD Foundation, Inc. | |
6 | - * All rights reserved. | |
7 | - * | |
8 | - * This code is derived from software contributed to The NetBSD Foundation | |
9 | - * by Dieter Baron and Thomas Klausner. | |
10 | - * | |
11 | - * Redistribution and use in source and binary forms, with or without | |
12 | - * modification, are permitted provided that the following conditions | |
13 | - * are met: | |
14 | - * 1. Redistributions of source code must retain the above copyright | |
15 | - * notice, this list of conditions and the following disclaimer. | |
16 | - * 2. Redistributions in binary form must reproduce the above copyright | |
17 | - * notice, this list of conditions and the following disclaimer in the | |
18 | - * documentation and/or other materials provided with the distribution. | |
19 | - * 3. All advertising materials mentioning features or use of this software | |
20 | - * must display the following acknowledgement: | |
21 | - * This product includes software developed by the NetBSD | |
22 | - * Foundation, Inc. and its contributors. | |
23 | - * 4. Neither the name of The NetBSD Foundation nor the names of its | |
24 | - * contributors may be used to endorse or promote products derived | |
25 | - * from this software without specific prior written permission. | |
26 | - * | |
27 | - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
28 | - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
29 | - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
30 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
31 | - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
32 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
33 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
34 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
35 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
36 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
37 | - * POSSIBILITY OF SUCH DAMAGE. | |
38 | - */ | |
39 | - | |
40 | -#ifndef _GETOPT_H_ | |
41 | -#define _GETOPT_H_ | |
42 | - | |
43 | -#ifdef _WIN32 | |
44 | -/* from <sys/cdefs.h> */ | |
45 | -# ifdef __cplusplus | |
46 | -# define __BEGIN_DECLS extern "C" { | |
47 | -# define __END_DECLS } | |
48 | -# else | |
49 | -# define __BEGIN_DECLS | |
50 | -# define __END_DECLS | |
51 | -# endif | |
52 | -# define __P(args) args | |
53 | -#endif | |
54 | - | |
55 | -/*#ifndef _WIN32 | |
56 | -#include <sys/cdefs.h> | |
57 | -#include <unistd.h> | |
58 | -#endif*/ | |
59 | - | |
60 | -#ifdef _WIN32 | |
61 | -# if !defined(GETOPT_API) | |
62 | -# define GETOPT_API __declspec(dllimport) | |
63 | -# endif | |
64 | -#endif | |
65 | - | |
66 | -/* | |
67 | - * Gnu like getopt_long() and BSD4.4 getsubopt()/optreset extensions | |
68 | - */ | |
69 | -#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) | |
70 | -#define no_argument 0 | |
71 | -#define required_argument 1 | |
72 | -#define optional_argument 2 | |
73 | - | |
74 | -struct option { | |
75 | - /* name of long option */ | |
76 | - const char *name; | |
77 | - /* | |
78 | - * one of no_argument, required_argument, and optional_argument: | |
79 | - * whether option takes an argument | |
80 | - */ | |
81 | - int has_arg; | |
82 | - /* if not NULL, set *flag to val when option found */ | |
83 | - int *flag; | |
84 | - /* if flag not NULL, value to set *flag to; else return value */ | |
85 | - int val; | |
86 | -}; | |
87 | - | |
88 | -__BEGIN_DECLS | |
89 | -GETOPT_API int getopt_long __P((int, char * const *, const char *, | |
90 | - const struct option *, int *)); | |
91 | -__END_DECLS | |
92 | -#endif | |
93 | - | |
94 | -#ifdef _WIN32 | |
95 | -/* These are global getopt variables */ | |
96 | -__BEGIN_DECLS | |
97 | - | |
98 | -GETOPT_API extern int opterr, /* if error message should be printed */ | |
99 | - optind, /* index into parent argv vector */ | |
100 | - optopt, /* character checked for validity */ | |
101 | - optreset; /* reset getopt */ | |
102 | -GETOPT_API extern char* optarg; /* argument associated with option */ | |
103 | - | |
104 | -/* Original getopt */ | |
105 | -GETOPT_API int getopt __P((int, char * const *, const char *)); | |
106 | - | |
107 | -__END_DECLS | |
108 | -#endif | |
109 | - | |
110 | -#endif /* !_GETOPT_H_ */ |
@@ -1,547 +0,0 @@ | ||
1 | -/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ | |
2 | -/* $FreeBSD: src/lib/libc/stdlib/getopt_long.c,v 1.2 2002/10/16 22:18:42 alfred Exp $ */ | |
3 | - | |
4 | -/*- | |
5 | - * Copyright (c) 2000 The NetBSD Foundation, Inc. | |
6 | - * All rights reserved. | |
7 | - * | |
8 | - * This code is derived from software contributed to The NetBSD Foundation | |
9 | - * by Dieter Baron and Thomas Klausner. | |
10 | - * | |
11 | - * Redistribution and use in source and binary forms, with or without | |
12 | - * modification, are permitted provided that the following conditions | |
13 | - * are met: | |
14 | - * 1. Redistributions of source code must retain the above copyright | |
15 | - * notice, this list of conditions and the following disclaimer. | |
16 | - * 2. Redistributions in binary form must reproduce the above copyright | |
17 | - * notice, this list of conditions and the following disclaimer in the | |
18 | - * documentation and/or other materials provided with the distribution. | |
19 | - * 3. All advertising materials mentioning features or use of this software | |
20 | - * must display the following acknowledgement: | |
21 | - * This product includes software developed by the NetBSD | |
22 | - * Foundation, Inc. and its contributors. | |
23 | - * 4. Neither the name of The NetBSD Foundation nor the names of its | |
24 | - * contributors may be used to endorse or promote products derived | |
25 | - * from this software without specific prior written permission. | |
26 | - * | |
27 | - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
28 | - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
29 | - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
30 | - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
31 | - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
32 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
33 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
34 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
35 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
36 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
37 | - * POSSIBILITY OF SUCH DAMAGE. | |
38 | - */ | |
39 | - | |
40 | - | |
41 | -#include <getopt.h> | |
42 | -#include <stdlib.h> | |
43 | -#include <string.h> | |
44 | - | |
45 | -#ifdef _WIN32 | |
46 | - | |
47 | -/* Windows needs warnx(). We change the definition though: | |
48 | - * 1. (another) global is defined, opterrmsg, which holds the error message | |
49 | - * 2. errors are always printed out on stderr w/o the program name | |
50 | - * Note that opterrmsg always gets set no matter what opterr is set to. The | |
51 | - * error message will not be printed if opterr is 0 as usual. | |
52 | - */ | |
53 | - | |
54 | -#include <stdio.h> | |
55 | -#include <stdarg.h> | |
56 | - | |
57 | -GETOPT_API extern char opterrmsg[128]; | |
58 | -char opterrmsg[128]; /* last error message is stored here */ | |
59 | - | |
60 | -static void warnx(int print_error, const char *fmt, ...) | |
61 | -{ | |
62 | - va_list ap; | |
63 | - va_start(ap, fmt); | |
64 | - if (fmt != NULL) | |
65 | - _vsnprintf(opterrmsg, 128, fmt, ap); | |
66 | - else | |
67 | - opterrmsg[0]='\0'; | |
68 | - va_end(ap); | |
69 | - if (print_error) { | |
70 | - fprintf(stderr, opterrmsg); | |
71 | - fprintf(stderr, "\n"); | |
72 | - } | |
73 | -} | |
74 | - | |
75 | -#endif /*_WIN32*/ | |
76 | - | |
77 | -/* not part of the original file */ | |
78 | -#ifndef _DIAGASSERT | |
79 | -#define _DIAGASSERT(X) | |
80 | -#endif | |
81 | - | |
82 | -#if HAVE_CONFIG_H && !HAVE_GETOPT_LONG && !HAVE_DECL_OPTIND | |
83 | -#define REPLACE_GETOPT | |
84 | -#endif | |
85 | - | |
86 | -#ifdef REPLACE_GETOPT | |
87 | -#ifdef __weak_alias | |
88 | -__weak_alias(getopt,_getopt) | |
89 | -#endif | |
90 | -int opterr = 1; /* if error message should be printed */ | |
91 | -int optind = 1; /* index into parent argv vector */ | |
92 | -int optopt = '?'; /* character checked for validity */ | |
93 | -int optreset; /* reset getopt */ | |
94 | -char *optarg; /* argument associated with option */ | |
95 | -#elif HAVE_CONFIG_H && !HAVE_DECL_OPTRESET | |
96 | -static int optreset; | |
97 | -#endif | |
98 | - | |
99 | -#ifdef __weak_alias | |
100 | -__weak_alias(getopt_long,_getopt_long) | |
101 | -#endif | |
102 | - | |
103 | -#if !HAVE_GETOPT_LONG | |
104 | -#define IGNORE_FIRST (*options == '-' || *options == '+') | |
105 | -#define PRINT_ERROR ((opterr) && ((*options != ':') \ | |
106 | - || (IGNORE_FIRST && options[1] != ':'))) | |
107 | -#define IS_POSIXLY_CORRECT (getenv("POSIXLY_CORRECT") != NULL) | |
108 | -#define PERMUTE (!IS_POSIXLY_CORRECT && !IGNORE_FIRST) | |
109 | -/* XXX: GNU ignores PC if *options == '-' */ | |
110 | -#define IN_ORDER (!IS_POSIXLY_CORRECT && *options == '-') | |
111 | - | |
112 | -/* return values */ | |
113 | -#define BADCH (int)'?' | |
114 | -#define BADARG ((IGNORE_FIRST && options[1] == ':') \ | |
115 | - || (*options == ':') ? (int)':' : (int)'?') | |
116 | -#define INORDER (int)1 | |
117 | - | |
118 | -#define EMSG "" | |
119 | - | |
120 | -static int getopt_internal(int, char * const *, const char *); | |
121 | -static int gcd(int, int); | |
122 | -static void permute_args(int, int, int, char * const *); | |
123 | - | |
124 | -static char *place = EMSG; /* option letter processing */ | |
125 | - | |
126 | -/* XXX: set optreset to 1 rather than these two */ | |
127 | -static int nonopt_start = -1; /* first non option argument (for permute) */ | |
128 | -static int nonopt_end = -1; /* first option after non options (for permute) */ | |
129 | - | |
130 | -/* Error messages */ | |
131 | -static const char recargchar[] = "option requires an argument -- %c"; | |
132 | -static const char recargstring[] = "option requires an argument -- %s"; | |
133 | -static const char ambig[] = "ambiguous option -- %.*s"; | |
134 | -static const char noarg[] = "option doesn't take an argument -- %.*s"; | |
135 | -static const char illoptchar[] = "unknown option -- %c"; | |
136 | -static const char illoptstring[] = "unknown option -- %s"; | |
137 | - | |
138 | - | |
139 | -/* | |
140 | - * Compute the greatest common divisor of a and b. | |
141 | - */ | |
142 | -static int | |
143 | -gcd(a, b) | |
144 | - int a; | |
145 | - int b; | |
146 | -{ | |
147 | - int c; | |
148 | - | |
149 | - c = a % b; | |
150 | - while (c != 0) { | |
151 | - a = b; | |
152 | - b = c; | |
153 | - c = a % b; | |
154 | - } | |
155 | - | |
156 | - return b; | |
157 | -} | |
158 | - | |
159 | -/* | |
160 | - * Exchange the block from nonopt_start to nonopt_end with the block | |
161 | - * from nonopt_end to opt_end (keeping the same order of arguments | |
162 | - * in each block). | |
163 | - */ | |
164 | -static void | |
165 | -permute_args(panonopt_start, panonopt_end, opt_end, nargv) | |
166 | - int panonopt_start; | |
167 | - int panonopt_end; | |
168 | - int opt_end; | |
169 | - char * const *nargv; | |
170 | -{ | |
171 | - int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos; | |
172 | - char *swap; | |
173 | - | |
174 | - _DIAGASSERT(nargv != NULL); | |
175 | - | |
176 | - /* | |
177 | - * compute lengths of blocks and number and size of cycles | |
178 | - */ | |
179 | - nnonopts = panonopt_end - panonopt_start; | |
180 | - nopts = opt_end - panonopt_end; | |
181 | - ncycle = gcd(nnonopts, nopts); | |
182 | - cyclelen = (opt_end - panonopt_start) / ncycle; | |
183 | - | |
184 | - for (i = 0; i < ncycle; i++) { | |
185 | - cstart = panonopt_end+i; | |
186 | - pos = cstart; | |
187 | - for (j = 0; j < cyclelen; j++) { | |
188 | - if (pos >= panonopt_end) | |
189 | - pos -= nnonopts; | |
190 | - else | |
191 | - pos += nopts; | |
192 | - swap = nargv[pos]; | |
193 | - /* LINTED const cast */ | |
194 | - ((char **) nargv)[pos] = nargv[cstart]; | |
195 | - /* LINTED const cast */ | |
196 | - ((char **)nargv)[cstart] = swap; | |
197 | - } | |
198 | - } | |
199 | -} | |
200 | - | |
201 | -/* | |
202 | - * getopt_internal -- | |
203 | - * Parse argc/argv argument vector. Called by user level routines. | |
204 | - * Returns -2 if -- is found (can be long option or end of options marker). | |
205 | - */ | |
206 | -static int | |
207 | -getopt_internal(nargc, nargv, options) | |
208 | - int nargc; | |
209 | - char * const *nargv; | |
210 | - const char *options; | |
211 | -{ | |
212 | - char *oli; /* option letter list index */ | |
213 | - int optchar; | |
214 | - | |
215 | - _DIAGASSERT(nargv != NULL); | |
216 | - _DIAGASSERT(options != NULL); | |
217 | - | |
218 | - optarg = NULL; | |
219 | - | |
220 | - /* | |
221 | - * XXX Some programs (like rsyncd) expect to be able to | |
222 | - * XXX re-initialize optind to 0 and have getopt_long(3) | |
223 | - * XXX properly function again. Work around this braindamage. | |
224 | - */ | |
225 | - if (optind == 0) | |
226 | - optind = 1; | |
227 | - | |
228 | - if (optreset) | |
229 | - nonopt_start = nonopt_end = -1; | |
230 | -start: | |
231 | - if (optreset || !*place) { /* update scanning pointer */ | |
232 | - optreset = 0; | |
233 | - if (optind >= nargc) { /* end of argument vector */ | |
234 | - place = EMSG; | |
235 | - if (nonopt_end != -1) { | |
236 | - /* do permutation, if we have to */ | |
237 | - permute_args(nonopt_start, nonopt_end, | |
238 | - optind, nargv); | |
239 | - optind -= nonopt_end - nonopt_start; | |
240 | - } | |
241 | - else if (nonopt_start != -1) { | |
242 | - /* | |
243 | - * If we skipped non-options, set optind | |
244 | - * to the first of them. | |
245 | - */ | |
246 | - optind = nonopt_start; | |
247 | - } | |
248 | - nonopt_start = nonopt_end = -1; | |
249 | - return -1; | |
250 | - } | |
251 | - if ((*(place = nargv[optind]) != '-') | |
252 | - || (place[1] == '\0')) { /* found non-option */ | |
253 | - place = EMSG; | |
254 | - if (IN_ORDER) { | |
255 | - /* | |
256 | - * GNU extension: | |
257 | - * return non-option as argument to option 1 | |
258 | - */ | |
259 | - optarg = nargv[optind++]; | |
260 | - return INORDER; | |
261 | - } | |
262 | - if (!PERMUTE) { | |
263 | - /* | |
264 | - * if no permutation wanted, stop parsing | |
265 | - * at first non-option | |
266 | - */ | |
267 | - return -1; | |
268 | - } | |
269 | - /* do permutation */ | |
270 | - if (nonopt_start == -1) | |
271 | - nonopt_start = optind; | |
272 | - else if (nonopt_end != -1) { | |
273 | - permute_args(nonopt_start, nonopt_end, | |
274 | - optind, nargv); | |
275 | - nonopt_start = optind - | |
276 | - (nonopt_end - nonopt_start); | |
277 | - nonopt_end = -1; | |
278 | - } | |
279 | - optind++; | |
280 | - /* process next argument */ | |
281 | - goto start; | |
282 | - } | |
283 | - if (nonopt_start != -1 && nonopt_end == -1) | |
284 | - nonopt_end = optind; | |
285 | - if (place[1] && *++place == '-') { /* found "--" */ | |
286 | - place++; | |
287 | - return -2; | |
288 | - } | |
289 | - } | |
290 | - if ((optchar = (int)*place++) == (int)':' || | |
291 | - (oli = strchr(options + (IGNORE_FIRST ? 1 : 0), optchar)) == NULL) { | |
292 | - /* option letter unknown or ':' */ | |
293 | - if (!*place) | |
294 | - ++optind; | |
295 | -#ifndef _WIN32 | |
296 | - if (PRINT_ERROR) | |
297 | - warnx(illoptchar, optchar); | |
298 | -#else | |
299 | - warnx(PRINT_ERROR, illoptchar, optchar); | |
300 | -#endif | |
301 | - optopt = optchar; | |
302 | - return BADCH; | |
303 | - } | |
304 | - if (optchar == 'W' && oli[1] == ';') { /* -W long-option */ | |
305 | - /* XXX: what if no long options provided (called by getopt)? */ | |
306 | - if (*place) | |
307 | - return -2; | |
308 | - | |
309 | - if (++optind >= nargc) { /* no arg */ | |
310 | - place = EMSG; | |
311 | -#ifndef _WIN32 | |
312 | - if (PRINT_ERROR) | |
313 | - warnx(recargchar, optchar); | |
314 | -#else | |
315 | - warnx(PRINT_ERROR, recargchar, optchar); | |
316 | -#endif | |
317 | - optopt = optchar; | |
318 | - return BADARG; | |
319 | - } else /* white space */ | |
320 | - place = nargv[optind]; | |
321 | - /* | |
322 | - * Handle -W arg the same as --arg (which causes getopt to | |
323 | - * stop parsing). | |
324 | - */ | |
325 | - return -2; | |
326 | - } | |
327 | - if (*++oli != ':') { /* doesn't take argument */ | |
328 | - if (!*place) | |
329 | - ++optind; | |
330 | - } else { /* takes (optional) argument */ | |
331 | - optarg = NULL; | |
332 | - if (*place) /* no white space */ | |
333 | - optarg = place; | |
334 | - /* XXX: disable test for :: if PC? (GNU doesn't) */ | |
335 | - else if (oli[1] != ':') { /* arg not optional */ | |
336 | - if (++optind >= nargc) { /* no arg */ | |
337 | - place = EMSG; | |
338 | -#ifndef _WIN32 | |
339 | - if (PRINT_ERROR) | |
340 | - warnx(recargchar, optchar); | |
341 | -#else | |
342 | - warnx(PRINT_ERROR, recargchar, optchar); | |
343 | -#endif | |
344 | - optopt = optchar; | |
345 | - return BADARG; | |
346 | - } else | |
347 | - optarg = nargv[optind]; | |
348 | - } | |
349 | - place = EMSG; | |
350 | - ++optind; | |
351 | - } | |
352 | - /* dump back option letter */ | |
353 | - return optchar; | |
354 | -} | |
355 | - | |
356 | -#ifdef REPLACE_GETOPT | |
357 | -/* | |
358 | - * getopt -- | |
359 | - * Parse argc/argv argument vector. | |
360 | - * | |
361 | - * [eventually this will replace the real getopt] | |
362 | - */ | |
363 | -int | |
364 | -getopt(nargc, nargv, options) | |
365 | - int nargc; | |
366 | - char * const *nargv; | |
367 | - const char *options; | |
368 | -{ | |
369 | - int retval; | |
370 | - | |
371 | - _DIAGASSERT(nargv != NULL); | |
372 | - _DIAGASSERT(options != NULL); | |
373 | - | |
374 | - if ((retval = getopt_internal(nargc, nargv, options)) == -2) { | |
375 | - ++optind; | |
376 | - /* | |
377 | - * We found an option (--), so if we skipped non-options, | |
378 | - * we have to permute. | |
379 | - */ | |
380 | - if (nonopt_end != -1) { | |
381 | - permute_args(nonopt_start, nonopt_end, optind, | |
382 | - nargv); | |
383 | - optind -= nonopt_end - nonopt_start; | |
384 | - } | |
385 | - nonopt_start = nonopt_end = -1; | |
386 | - retval = -1; | |
387 | - } | |
388 | - return retval; | |
389 | -} | |
390 | -#endif | |
391 | - | |
392 | -/* | |
393 | - * getopt_long -- | |
394 | - * Parse argc/argv argument vector. | |
395 | - */ | |
396 | -int | |
397 | -getopt_long(nargc, nargv, options, long_options, idx) | |
398 | - int nargc; | |
399 | - char * const *nargv; | |
400 | - const char *options; | |
401 | - const struct option *long_options; | |
402 | - int *idx; | |
403 | -{ | |
404 | - int retval; | |
405 | - | |
406 | - _DIAGASSERT(nargv != NULL); | |
407 | - _DIAGASSERT(options != NULL); | |
408 | - _DIAGASSERT(long_options != NULL); | |
409 | - /* idx may be NULL */ | |
410 | - | |
411 | - if ((retval = getopt_internal(nargc, nargv, options)) == -2) { | |
412 | - char *current_argv, *has_equal; | |
413 | - size_t current_argv_len; | |
414 | - int i, match; | |
415 | - | |
416 | - current_argv = place; | |
417 | - match = -1; | |
418 | - | |
419 | - optind++; | |
420 | - place = EMSG; | |
421 | - | |
422 | - if (*current_argv == '\0') { /* found "--" */ | |
423 | - /* | |
424 | - * We found an option (--), so if we skipped | |
425 | - * non-options, we have to permute. | |
426 | - */ | |
427 | - if (nonopt_end != -1) { | |
428 | - permute_args(nonopt_start, nonopt_end, | |
429 | - optind, nargv); | |
430 | - optind -= nonopt_end - nonopt_start; | |
431 | - } | |
432 | - nonopt_start = nonopt_end = -1; | |
433 | - return -1; | |
434 | - } | |
435 | - if ((has_equal = strchr(current_argv, '=')) != NULL) { | |
436 | - /* argument found (--option=arg) */ | |
437 | - current_argv_len = has_equal - current_argv; | |
438 | - has_equal++; | |
439 | - } else | |
440 | - current_argv_len = strlen(current_argv); | |
441 | - | |
442 | - for (i = 0; long_options[i].name; i++) { | |
443 | - /* find matching long option */ | |
444 | - if (strncmp(current_argv, long_options[i].name, | |
445 | - current_argv_len)) | |
446 | - continue; | |
447 | - | |
448 | - if (strlen(long_options[i].name) == | |
449 | - (unsigned)current_argv_len) { | |
450 | - /* exact match */ | |
451 | - match = i; | |
452 | - break; | |
453 | - } | |
454 | - if (match == -1) /* partial match */ | |
455 | - match = i; | |
456 | - else { | |
457 | - /* ambiguous abbreviation */ | |
458 | -#ifndef _WIN32 | |
459 | - if (PRINT_ERROR) | |
460 | - warnx(ambig, (int)current_argv_len, | |
461 | - current_argv); | |
462 | -#else | |
463 | - warnx(PRINT_ERROR, ambig, (int)current_argv_len, | |
464 | - current_argv); | |
465 | -#endif | |
466 | - optopt = 0; | |
467 | - return BADCH; | |
468 | - } | |
469 | - } | |
470 | - if (match != -1) { /* option found */ | |
471 | - if (long_options[match].has_arg == no_argument | |
472 | - && has_equal) { | |
473 | -#ifndef _WIN32 | |
474 | - if (PRINT_ERROR) | |
475 | - warnx(noarg, (int)current_argv_len, | |
476 | - current_argv); | |
477 | -#else | |
478 | - warnx(PRINT_ERROR, noarg, (int)current_argv_len, | |
479 | - current_argv); | |
480 | -#endif | |
481 | - /* | |
482 | - * XXX: GNU sets optopt to val regardless of | |
483 | - * flag | |
484 | - */ | |
485 | - if (long_options[match].flag == NULL) | |
486 | - optopt = long_options[match].val; | |
487 | - else | |
488 | - optopt = 0; | |
489 | - return BADARG; | |
490 | - } | |
491 | - if (long_options[match].has_arg == required_argument || | |
492 | - long_options[match].has_arg == optional_argument) { | |
493 | - if (has_equal) | |
494 | - optarg = has_equal; | |
495 | - else if (long_options[match].has_arg == | |
496 | - required_argument) { | |
497 | - /* | |
498 | - * optional argument doesn't use | |
499 | - * next nargv | |
500 | - */ | |
501 | - optarg = nargv[optind++]; | |
502 | - } | |
503 | - } | |
504 | - if ((long_options[match].has_arg == required_argument) | |
505 | - && (optarg == NULL)) { | |
506 | - /* | |
507 | - * Missing argument; leading ':' | |
508 | - * indicates no error should be generated | |
509 | - */ | |
510 | -#ifndef _WIN32 | |
511 | - if (PRINT_ERROR) | |
512 | - warnx(recargstring, current_argv); | |
513 | -#else | |
514 | - warnx(PRINT_ERROR, recargstring, current_argv); | |
515 | -#endif | |
516 | - /* | |
517 | - * XXX: GNU sets optopt to val regardless | |
518 | - * of flag | |
519 | - */ | |
520 | - if (long_options[match].flag == NULL) | |
521 | - optopt = long_options[match].val; | |
522 | - else | |
523 | - optopt = 0; | |
524 | - --optind; | |
525 | - return BADARG; | |
526 | - } | |
527 | - } else { /* unknown option */ | |
528 | -#ifndef _WIN32 | |
529 | - if (PRINT_ERROR) | |
530 | - warnx(illoptstring, current_argv); | |
531 | -#else | |
532 | - warnx(PRINT_ERROR, illoptstring, current_argv); | |
533 | -#endif | |
534 | - optopt = 0; | |
535 | - return BADCH; | |
536 | - } | |
537 | - if (long_options[match].flag) { | |
538 | - *long_options[match].flag = long_options[match].val; | |
539 | - retval = 0; | |
540 | - } else | |
541 | - retval = long_options[match].val; | |
542 | - if (idx) | |
543 | - *idx = match; | |
544 | - } | |
545 | - return retval; | |
546 | -} | |
547 | -#endif /* !GETOPT_LONG */ |
@@ -1,31 +0,0 @@ | ||
1 | -# -*- mode:makefile; coding:shift_jis-unix -*- | |
2 | -# $Id: makefile,v 1.2 2011/03/03 13:38:58 tfuruka1 Exp $ | |
3 | - | |
4 | -SHELL=/bin/sh | |
5 | -O=obj | |
6 | -DLL=getopt.dll | |
7 | -OBJS=getopt.$(O) getopt_long.$(O) | |
8 | -CFLAGS=/Zi /DGETOPT_API=__declspec(dllexport) /W3\ | |
9 | - /I. /D_CRT_SECURE_NO_WARNINGS | |
10 | - | |
11 | -LDFLAGS=/DLL /debug | |
12 | - | |
13 | -../../../bin/$(DLL) : ../../../bin $(DLL) test.exe | |
14 | - cp $(DLL) $@ | |
15 | - | |
16 | -../../../bin : | |
17 | - sh -c "mkdir $@" | |
18 | - | |
19 | -$(DLL) : $(OBJS) | |
20 | - $(CC) $(CFLAGS) $(OBJS) /link $(LDFLAGS) /def:getopt.def /OUT:$@ | |
21 | - | |
22 | -$(OBJS) : makefile | |
23 | - | |
24 | -test.exe : test.c | |
25 | - $(CC) test.c /link getopt.lib /OUT:$@ | |
26 | - | |
27 | -clean: | |
28 | - -rm -f *.obj *.o *.pdb *~ *.ilk *.exp *.cache | |
29 | - | |
30 | -clean-all: clean | |
31 | - -rm -f *.dll *.lib *.exe |
@@ -1,73 +0,0 @@ | ||
1 | -#include <stdio.h> /* for printf */ | |
2 | -#include <stdlib.h> /* for exit */ | |
3 | -#include "getopt.h" | |
4 | -int | |
5 | -main (int argc, char **argv) | |
6 | -{ | |
7 | - int c; | |
8 | - int digit_optind = 0; | |
9 | - while (1) { | |
10 | - int this_option_optind = optind ? optind : 1; | |
11 | - int option_index = 0; | |
12 | - static struct option long_options[] = { | |
13 | - {"add", required_argument, NULL, 0}, | |
14 | - {"append", no_argument, NULL, 0}, | |
15 | - {"delete", required_argument, NULL, 0}, | |
16 | - {"verbose", no_argument, NULL, 0}, | |
17 | - {"create", required_argument, NULL, 'c'}, | |
18 | - {"file", required_argument, NULL, 0}, | |
19 | - {NULL, 0, NULL, 0} | |
20 | - }; | |
21 | - c = getopt_long (argc, argv, "abc:d:012", | |
22 | - long_options, &option_index); | |
23 | - if (c == -1) { | |
24 | - break; | |
25 | - } | |
26 | - switch (c) { | |
27 | - case 0: | |
28 | - // ロングオプションのみの場合 | |
29 | - printf("option %s ", long_options[option_index].name); | |
30 | - if (optarg) { | |
31 | - printf("with arg %s", optarg); | |
32 | - } | |
33 | - printf("\n"); | |
34 | - break; | |
35 | - case '0': | |
36 | - case '1': | |
37 | - case '2': | |
38 | - if (digit_optind != 0 && digit_optind != this_option_optind) { | |
39 | - printf ("digits occur in two different argv-elements.\n"); | |
40 | - } | |
41 | - digit_optind = this_option_optind; | |
42 | - printf("option %c\n", c); | |
43 | - break; | |
44 | - case 'a': | |
45 | - printf("option a\n"); | |
46 | - break; | |
47 | - case 'b': | |
48 | - printf("option b\n"); | |
49 | - break; | |
50 | - case 'c': | |
51 | - // create ロングオプションは此方で処理される | |
52 | - printf("option c with value '%s'\n", optarg); | |
53 | - break; | |
54 | - case 'd': | |
55 | - printf("option d with value '%s'\n", optarg); | |
56 | - break; | |
57 | - case '?': | |
58 | - printf("メッセージは getopt内で出力\n"); | |
59 | - break; | |
60 | - default: | |
61 | - printf("?? getopt returned character code 0%o ??\n", c); | |
62 | - } | |
63 | - } | |
64 | - if (optind < argc) { | |
65 | - printf("non-option ARGV-elements: "); | |
66 | - while (optind < argc) { | |
67 | - printf("%s ", argv[optind++]); | |
68 | - } | |
69 | - printf("\n"); | |
70 | - } | |
71 | - exit(0); | |
72 | -} | |
73 | - |
@@ -7,6 +7,11 @@ | ||
7 | 7 | # Revision 1.7 2011/03/03 13:38:58 tfuruka1 |
8 | 8 | # getoptに対応等 |
9 | 9 | # |
10 | +# MinGWについて | |
11 | +# * 横取り丸については、現在は保留 | |
12 | +# | |
13 | +# 2019/07/03 MinGWへ変更。getopt は最早不要となりました。CPU100, | |
14 | +# TVMaker を追加。 | |
10 | 15 | # 2011/03/01 teeコマンドを新規追加 |
11 | 16 | # 2007/10/04 MegaFileを追加 |
12 | 17 | # 2006/12/06 単純なコーディングミスを修正しました。 |
@@ -16,26 +21,28 @@ | ||
16 | 21 | # |
17 | 22 | |
18 | 23 | all : |
19 | - sh -c "(cd libs/getopt; nmake)" | |
20 | - sh -c "(cd batkey; nmake)" | |
21 | - sh -c "(cd crlf; nmake)" | |
22 | - sh -c "(cd ExSleep; nmake)" | |
23 | - sh -c "(cd img2java; nmake)" | |
24 | - sh -c "(cd lha32; nmake)" | |
25 | - sh -c "(cd MegaFile; nmake)" | |
26 | - sh -c "(cd wlsfonts; nmake)" | |
27 | - sh -c "(cd YdmPoorLineEmu; nmake)" | |
28 | - sh -c "(cd tee; nmake)" | |
24 | + cd batkey; make | |
25 | + cd CPU100; make | |
26 | + cd crlf; make | |
27 | + cd ExSleep; make | |
28 | + cd img2java; make | |
29 | + cd lha32; make | |
30 | + cd MegaFile; make | |
31 | + cd TVMaker; make | |
32 | + cd tee; make | |
33 | + cd wlsfonts; make | |
34 | +# cd YdmPoorLineEmu; make | |
29 | 35 | |
30 | 36 | clean : |
31 | - sh -c "(cd libs/getopt; nmake clean)" | |
32 | - sh -c "(cd batkey; nmake clean)" | |
33 | - sh -c "(cd crlf; nmake clean)" | |
34 | - sh -c "(cd ExSleep; nmake clean)" | |
35 | - sh -c "(cd img2java; nmake clean)" | |
36 | - sh -c "(cd lha32; nmake clean)" | |
37 | - sh -c "(cd MegaFile; nmake clean)" | |
38 | - sh -c "(cd wlsfonts; nmake clean)" | |
39 | - sh -c "(cd YdmPoorLineEmu; nmake clean)" | |
40 | - sh -c "(cd tee; nmake clean)" | |
41 | - -rm -fr ../bin | |
37 | + cd batkey; make clean | |
38 | + cd CPU100; make clean | |
39 | + cd crlf; make clean | |
40 | + cd ExSleep; make clean | |
41 | + cd img2java; make clean | |
42 | + cd lha32; make clean | |
43 | + cd MegaFile; make clean | |
44 | + cd TVMaker; make clean | |
45 | + cd tee; make clean | |
46 | + cd wlsfonts; make clean | |
47 | +# cd YdmPoorLineEmu; make clean | |
48 | + -rm -f ../bin/*.exe ../bin/*.cmd ../bin/*.dll |
@@ -1,8 +1,8 @@ | ||
1 | 1 | /* $Id: main.c,v 1.1 2011/03/01 11:00:07 tfuruka1 Exp $ |
2 | 2 | * |
3 | - * teeコマンドのクローン | |
3 | + * tee繧ウ繝槭Φ繝峨?繧ッ繝ュ繝シ繝ウ | |
4 | 4 | * |
5 | - * teeコマンドを使用できない環境の場合にコンパイルして使用する。 | |
5 | + * tee繧ウ繝槭Φ繝峨r菴ソ逕ィ縺ァ縺阪↑縺?腸蠅??蝣エ蜷医↓繧ウ繝ウ繝代う繝ォ縺励※菴ソ逕ィ縺吶k縲 | |
6 | 6 | */ |
7 | 7 | #include <stdio.h> |
8 | 8 | #include <stdarg.h> |
@@ -32,8 +32,8 @@ | ||
32 | 32 | |
33 | 33 | typedef struct _list { |
34 | 34 | struct _list *next; |
35 | - int fd; /* ファイル記述子 */ | |
36 | - char *name; /* argvから取得したファイル名 */ | |
35 | + int fd; /* 繝輔ぃ繧、繝ォ險倩ソー蟄 */ | |
36 | + char *name; /* argv縺九i蜿門セ励@縺溘ヵ繧。繧、繝ォ蜷 */ | |
37 | 37 | } LIST; |
38 | 38 | LIST *head; |
39 | 39 |
@@ -42,27 +42,27 @@ showVersion() | ||
42 | 42 | { |
43 | 43 | printf("tee (clone) %s\n" |
44 | 44 | "Copyright (C) 2011 T.Furukawa.\n" |
45 | - "teeコマンドのクローンです。\n", | |
45 | + "tee繧ウ繝槭Φ繝峨?繧ッ繝ュ繝シ繝ウ縺ァ縺吶??n", | |
46 | 46 | VERSION); |
47 | 47 | } |
48 | 48 | |
49 | 49 | static void |
50 | 50 | showHelp() |
51 | 51 | { |
52 | - printf("使用法: tee [オプション]... [ファイル]...\n" | |
53 | - "標準入力を各々のファイルにコピーし, 標準出力にも出力.\n" | |
52 | + printf("菴ソ逕ィ豕? tee [繧ェ繝励す繝ァ繝ウ]... [繝輔ぃ繧、繝ォ]...\n" | |
53 | + "讓呎コ門?蜉帙r蜷????繝輔ぃ繧、繝ォ縺ォ繧ウ繝斐?縺? 讓呎コ門?蜉帙↓繧ょ?蜉?\n" | |
54 | 54 | "\n" |
55 | - " -a, --append 指定されたファイルに追加し," | |
56 | - " 上書きしない\n" | |
57 | - " -i, --ignore-interrupts 割込みシグナルを無視\n" | |
58 | - " --help この使い方を表示して終了\n" | |
59 | - " --version バージョン情報を表示して終了\n" | |
55 | + " -a, --append 謖?ョ壹&繧後◆繝輔ぃ繧、繝ォ縺ォ霑ス蜉?縺?" | |
56 | + " 荳頑嶌縺阪@縺ェ縺Ыn" | |
57 | + " -i, --ignore-interrupts 蜑イ霎シ縺ソ繧キ繧ー繝翫Ν繧堤┌隕暴n" | |
58 | + " --help 縺薙?菴ソ縺?婿繧定。ィ遉コ縺励※邨ゆコ?n" | |
59 | + " --version 繝舌?繧ク繝ァ繝ウ諠??ア繧定。ィ遉コ縺励※邨ゆコ?n" | |
60 | 60 | "\n" |
61 | - "ファイルに - を指定した場合は、再度、標準出力に出力します.\n" | |
61 | + "繝輔ぃ繧、繝ォ縺ォ - 繧呈欠螳壹@縺溷?エ蜷医?縲∝?蠎ヲ縲∵ィ呎コ門?蜉帙↓蜃コ蜉帙@縺セ縺?\n" | |
62 | 62 | "\n" |
63 | - "本コマンドはオリジナルのteeコマンドの挙動と同様になるように" | |
64 | - "T.Furukawaが実装したものです。" | |
65 | - "従って、オリジナルと異なる部分もあるかもしれません。\n"); | |
63 | + "譛ャ繧ウ繝槭Φ繝峨?繧ェ繝ェ繧ク繝翫Ν縺ョtee繧ウ繝槭Φ繝峨?謖吝虚縺ィ蜷梧ァ倥↓縺ェ繧九h縺?↓" | |
64 | + "T.Furukawa縺悟ョ溯」?@縺溘b縺ョ縺ァ縺吶?? | |
65 | + "蠕薙▲縺ヲ縲√が繝ェ繧ク繝翫Ν縺ィ逡ー縺ェ繧矩Κ蛻?b縺ゅk縺九b縺励l縺セ縺帙s縲?n"); | |
66 | 66 | } |
67 | 67 | |
68 | 68 | static void |
@@ -75,11 +75,11 @@ err(int exitCode, char *msg) | ||
75 | 75 | static void |
76 | 76 | warn(char *lpFmt, ...) |
77 | 77 | { |
78 | - va_list args; // 引数展開用 | |
78 | + va_list args; // 蠑墓焚螻暮幕逕ィ | |
79 | 79 | |
80 | 80 | fprintf(stderr, "tee: "); |
81 | 81 | |
82 | - // 文字列を書式に合せて整形する | |
82 | + // 譁?ュ怜?繧呈嶌蠑上↓蜷医○縺ヲ謨エ蠖「縺吶k | |
83 | 83 | va_start(args, lpFmt); |
84 | 84 | vfprintf(stderr, lpFmt, args); |
85 | 85 | va_end(args); |
@@ -130,28 +130,28 @@ main(int argc, char *argv[]) | ||
130 | 130 | showVersion(); |
131 | 131 | return 0; |
132 | 132 | } else { |
133 | - fprintf(stderr, "処理がありません: %s", | |
133 | + fprintf(stderr, "蜃ヲ逅?′縺ゅj縺セ縺帙s: %s", | |
134 | 134 | options[option_index].name); |
135 | 135 | return 1; |
136 | 136 | } |
137 | 137 | case 'a': |
138 | - /* ファイルへ追記する */ | |
138 | + /* 繝輔ぃ繧、繝ォ縺ク霑ス險倥☆繧 */ | |
139 | 139 | append = 1; |
140 | 140 | break; |
141 | 141 | case 'i': |
142 | - /* SIGINTを無視する */ | |
142 | + /* SIGINT繧堤┌隕悶☆繧 */ | |
143 | 143 | signal(SIGINT, SIG_IGN); |
144 | 144 | break; |
145 | 145 | case '?': |
146 | - fprintf(stderr, "詳しくは `tee --help' を実行して下さい.\n"); | |
146 | + fprintf(stderr, "隧ウ縺励¥縺ッ `tee --help' 繧貞ョ溯。後@縺ヲ荳九&縺?\n"); | |
147 | 147 | return 1; |
148 | 148 | default: |
149 | - fprintf(stderr, "想定外のgetoptからの戻り: %c\n", c); | |
149 | + fprintf(stderr, "諠ウ螳壼、悶?getopt縺九i縺ョ謌サ繧? %c\n", c); | |
150 | 150 | return 1; |
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | - /* バッファ領域の確保 */ | |
154 | + /* 繝舌ャ繝輔ぃ鬆伜沺縺ョ遒コ菫 */ | |
155 | 155 | if (NULL == (buf = malloc((size_t)BSIZE))) { |
156 | 156 | err(1, "malloc"); |
157 | 157 | } |
@@ -195,7 +195,7 @@ main(int argc, char *argv[]) | ||
195 | 195 | |
196 | 196 | for (p = head; p; p = p->next) { |
197 | 197 | if (STDOUT_FILENO == p->fd) { |
198 | - // 標準出力は複数回使用できるので、ここでは閉じない。 | |
198 | + // 讓呎コ門?蜉帙?隍?焚蝗樔スソ逕ィ縺ァ縺阪k縺ョ縺ァ縲√%縺薙〒縺ッ髢峨§縺ェ縺?? | |
199 | 199 | continue; |
200 | 200 | } |
201 | 201 | if (_close(p->fd) == -1) { |
@@ -1,22 +1,23 @@ | ||
1 | 1 | # $Id: makefile,v 1.1 2011/03/01 11:00:07 tfuruka1 Exp $ |
2 | 2 | # |
3 | -# teeコマンド | |
3 | +# tee繧ウ繝槭Φ繝 | |
4 | 4 | # |
5 | 5 | # |
6 | -EXE=tee.exe | |
7 | -OBJS=main.obj | |
6 | +CC = x86_64-w64-mingw32-gcc | |
7 | +CC = i686-w64-mingw32-gcc | |
8 | +CFLAGS=-g -Wall --exec-charset=cp932 --input-charset=utf-8 | |
8 | 9 | |
9 | -CFLAGS=/W3 /Zi /D_CRT_SECURE_NO_WARNINGS /I../libs/getopt | |
10 | -LDFLAGS=/debug ../libs/getopt/getopt.lib | |
10 | +EXE=tee.exe | |
11 | +OBJS=main.o | |
11 | 12 | |
12 | 13 | ../../bin/$(EXE) : $(EXE) |
13 | 14 | -cp $(EXE) $@ |
14 | 15 | |
15 | 16 | $(EXE) : $(OBJS) |
16 | - $(CC) $(CFLAGS) $(OBJS) /link $(LDFLAGS) -out:$@ | |
17 | + $(CC) $(CFLAGS) -o $@ $(OBJS) | |
17 | 18 | |
18 | 19 | clean : |
19 | - -rm -f *.obj *~ *.pdb *.ilk *.suo *.exp *.lib | |
20 | + -rm -f *.o *~ | |
20 | 21 | |
21 | 22 | clean-all : clean |
22 | 23 | -rm -f *.exe |
@@ -1,18 +1,17 @@ | ||
1 | -/* -*- mode: c; coding: sjis -*- | |
2 | - * Time-stamp: <2006-11-15 20:24:45 tfuruka1> | |
1 | +/* -*- mode: c; coding: utf-8 -*- | |
3 | 2 | * Copyright (C) 2002, 2003, 2006 Tadamegu Furukawa |
4 | 3 | * $Id: main.c,v 1.1 2006/11/15 12:08:04 tfuruka1 Exp $ |
5 | 4 | * $Name: $ |
6 | 5 | * |
7 | - * フォントを表示するだけです。 | |
6 | + * 繝輔か繝ウ繝医r陦ィ遉コ縺吶k縺?縺代〒縺吶? | |
7 | + * | |
8 | + * 蠢?ヲ√↑繝ゥ繧、繝悶Λ繝ェ: gdi32 | |
8 | 9 | * |
9 | - * 必要なライブラリ: gdi32 | |
10 | - * | |
11 | 10 | * cl /W3 lsfont.c /link gdi32.lib |
12 | 11 | * |
13 | 12 | * $Log: main.c,v $ |
14 | 13 | * Revision 1.1 2006/11/15 12:08:04 tfuruka1 |
15 | - * 新規追加 | |
14 | + * 譁ー隕剰ソス蜉? | |
16 | 15 | * |
17 | 16 | */ |
18 | 17 | #include <windows.h> |
@@ -43,22 +42,22 @@ int CALLBACK EnumFontFamProc( | ||
43 | 42 | if (bLongFormat) { |
44 | 43 | lpLf = &lpelf->elfLogFont; |
45 | 44 | |
46 | - printf(", %d, ", lpLf->lfHeight); | |
47 | - printf("%d, ", lpLf->lfWidth); | |
48 | - printf("%d, ", lpLf->lfEscapement); | |
49 | - printf("%d, ", lpLf->lfOrientation); | |
50 | - printf("%d, ", lpLf->lfWeight); | |
45 | + printf(", %d, ", (int) lpLf->lfHeight); | |
46 | + printf("%d, ", (int) lpLf->lfWidth); | |
47 | + printf("%d, ", (int) lpLf->lfEscapement); | |
48 | + printf("%d, ", (int) lpLf->lfOrientation); | |
49 | + printf("%d, ", (int) lpLf->lfWeight); | |
51 | 50 | printf("%s, ", lpLf->lfItalic ? "true" : "false"); |
52 | 51 | printf("%s, ", lpLf->lfUnderline ? "true" : "false"); |
53 | 52 | printf("%s, ", lpLf->lfStrikeOut ? "true" : "false"); |
54 | - //-- 文字セット | |
53 | + //-- 譁?ュ励そ繝?ヨ | |
55 | 54 | printf("%x - ", lpLf->lfCharSet); |
56 | 55 | printf("%s, ", ANSI_CHARSET == lpLf->lfCharSet ? "ANSI" : |
57 | 56 | (OEM_CHARSET == lpLf->lfCharSet ? "OEM" : |
58 | 57 | (SYMBOL_CHARSET == lpLf->lfCharSet ? "SYMBOL" : |
59 | 58 | (DEFAULT_CHARSET == lpLf->lfCharSet ? "DEFAULT" : |
60 | 59 | (SHIFTJIS_CHARSET == lpLf->lfCharSet ? "SJIS" : |
61 | - "不明"))))); | |
60 | + "荳肴?"))))); | |
62 | 61 | //-- |
63 | 62 | printf("%x, ", lpLf->lfOutPrecision); |
64 | 63 | printf("%x, ", lpLf->lfClipPrecision); |
@@ -71,7 +70,8 @@ int CALLBACK EnumFontFamProc( | ||
71 | 70 | return 1; |
72 | 71 | } |
73 | 72 | |
74 | -int main(int argc, char *argv[]) | |
73 | +int | |
74 | +main(int argc, char *argv[]) | |
75 | 75 | { |
76 | 76 | int i; |
77 | 77 | HDC hDC = CreateDC("DISPLAY", NULL, NULL, NULL); |
@@ -89,11 +89,11 @@ int main(int argc, char *argv[]) | ||
89 | 89 | break; |
90 | 90 | } |
91 | 91 | } |
92 | - printf("フォント名, スタイル, 種類"); | |
92 | + printf("繝輔か繝ウ繝亥錐, 繧ケ繧ソ繧、繝ォ, 遞ョ鬘?); | |
93 | 93 | if (bLongFormat) { |
94 | - printf(", 高さ, 幅, 行角度, ベースライン角度, 太さ, " | |
95 | - "斜体, 下線, 打消, 文字セット, 出力精度, クリッピング精度, " | |
96 | - "出力品質, ピッチとファミリ, 書体名"); | |
94 | + printf(", 鬮倥&, 蟷? 陦瑚ァ貞コヲ, 繝吶?繧ケ繝ゥ繧、繝ウ隗貞コヲ, 螟ェ縺? " | |
95 | + "譁應ス? 荳狗キ? 謇捺カ? 譁?ュ励そ繝?ヨ, 蜃コ蜉帷イセ蠎ヲ, 繧ッ繝ェ繝?ヴ繝ウ繧ー邊セ蠎ヲ, " | |
96 | + "蜃コ蜉帛刀雉ェ, 繝斐ャ繝√→繝輔ぃ繝溘Μ, 譖ク菴灘錐"); | |
97 | 97 | } |
98 | 98 | printf("\n"); |
99 | 99 | EnumFontFamilies(hDC, argv[i] ? argv[i] : NULL, |
@@ -1,28 +1,33 @@ | ||
1 | -# -*- mode: makefile; coding: shift_jisx0213; -*- | |
1 | +# -*- mode: makefile; coding: utf-8; -*- | |
2 | 2 | # Copyright (C) 2006 Tadamegu Furukawa |
3 | 3 | # $Id: makefile,v 1.1 2006/11/15 12:08:04 tfuruka1 Exp $ |
4 | 4 | # $Name: $ |
5 | 5 | # |
6 | -# フォントの一覧表示 | |
6 | +# 繝輔か繝ウ繝医?荳?隕ァ陦ィ遉コ | |
7 | 7 | # |
8 | 8 | # $Log: makefile,v $ |
9 | 9 | # Revision 1.1 2006/11/15 12:08:04 tfuruka1 |
10 | -# 新規追加 | |
10 | +# 譁ー隕剰ソス蜉? | |
11 | 11 | # |
12 | 12 | # |
13 | + | |
14 | +CC = x86_64-w64-mingw32-gcc | |
15 | +#CC = i686-w64-mingw32-gcc | |
16 | + | |
13 | 17 | EXE = wlsfonts.exe |
14 | -OBJS = main.obj | |
15 | -CFLAGS = /W3 /Zi | |
16 | -LDFLAGS = /link /debug gdi32.lib | |
18 | +OBJS = main.o | |
19 | +CFLAGS = -g -Wall --exec-charset=cp932 --input-charset=utf-8 | |
20 | +LDFLAGS = -lgdi32 | |
17 | 21 | |
18 | 22 | ../../bin/$(EXE) : $(EXE) |
23 | + mkdir -pv ../../bin | |
19 | 24 | cp $(EXE) ../../bin/. |
20 | 25 | |
21 | 26 | $(EXE) : $(OBJS) |
22 | 27 | $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) |
23 | 28 | |
24 | 29 | clean : |
25 | - rm -f *.obj *~ *.ilk *.pdb | |
30 | + rm -f *.o *~ | |
26 | 31 | |
27 | 32 | clean-all : clean |
28 | 33 | rm -f *.exe |