• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

oga's tools


Commit MetaInfo

Revisão2787374bb17d56a696bca26ead6f196415ce434d (tree)
Hora2013-12-29 21:27:11
Autoroga <oga@mxg....>
Commiteroga

Mensagem de Log

add ht.c

Mudança Sumário

Diff

--- /dev/null
+++ b/ht.c
@@ -0,0 +1,46 @@
1+/*
2+ * ht : %nn%nn%nn => <0xnn><0xnn><0xnn>...
3+ * =nn=nn=nn => <0xnn><0xnn><0xnn>...
4+ *
5+ * 2001/04/25 V1.01 fix memset by oga.
6+ * 2007/05/11 V1.02 support QUOTED-PRINTABLE
7+ * 2009/06/02 V1.03 exit on fopen error
8+ *
9+ */
10+#include <stdio.h>
11+#include <stdlib.h>
12+#include <string.h>
13+
14+main(a,b)
15+int a;
16+char *b[];
17+{
18+ FILE *fp;
19+ int c;
20+ int i;
21+ char buf[10];
22+
23+ memset (buf, 0, sizeof(buf));
24+
25+ if (a == 1) {
26+ fp = stdin;
27+ } else {
28+ if ((fp = fopen(b[1],"rb")) == 0) {
29+ perror(b[0]);
30+ exit(1);
31+ }
32+ }
33+
34+ c = getc(fp);
35+ while (c != EOF) {
36+ if (c == '%' || c == '=') { /* V1.02-C */
37+ strcpy(buf,"0x");
38+ buf[2]= getc(fp);
39+ buf[3]= getc(fp);
40+ c = strtol(buf,(char **)NULL,0);
41+ }
42+ putchar(c);
43+ /* printf("DATA=[0x%08x]\n",c); */
44+ c = getc(fp);
45+ }
46+}