-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAIIB.c
More file actions
103 lines (79 loc) · 3.19 KB
/
AIIB.c
File metadata and controls
103 lines (79 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//---------------------------------------------------------------------------| AIIB by Dietmar SCHRAUSSER 2009
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "SCHRAUSSER_CODES.h"
void _profil ();
void _head();
FILE *inStream, *outStream;
int index=1, dez_1, z1, f_len, mode_, form_;
char name[30], zei_[10], code[20], z_0[1], dmy[5], LF;
main(int argc, char *argv[])
{
if (argc != 2){ printf("\ncheck arguments!\n");_profil();}
inStream = fopen( argv[1], "r" );if (inStream == 0) { printf("\ncheck file %s!\n", argv[1]); _profil();}
fscanf(inStream,"%s%i%i%i\n", name, &mode_, &form_, &f_len);
if(mode_ < 1 || mode_ > 4 && mode_ != 6){ printf("\ncheck *.bii fileformat!\n");_profil();}
_head();
outStream = fopen( name, "wb" );
if(mode_ ==1) strcpy(code, "SCHRAUSSER CODE cd01");
if(mode_ ==2) strcpy(code, "SCHRAUSSER CODE cd02");
if(mode_ ==3) strcpy(code, "SCHRAUSSER CODE cd03");
if(mode_ ==4) strcpy(code, "SCHRAUSSER CODE cd04");
if(mode_ ==6) strcpy(code, "Decimal");
do
{
if(index>1) fputc(dez_1,outStream); //um 1 zeichen versetzte ausgabe
// fprintf(outStream,"%i\n",dez_1); // zur zeichenvergleichsprüfung
if(mode_==1 || mode_==3) //cd01, cd03
{
zei_1=fgetc(inStream);
zei_2=fgetc(inStream);
if(mode_==3) zei_3=fgetc(inStream);
if(form_==1) LF=fgetc(inStream);
if(mode_==1) FnCodeAB_cd01( );
if(mode_==3) FnCodeAB_cd03( );
dez_1= dez_;
}
if(mode_==2 || mode_==4) //cd02, cd04
{
zei_1=fgetc(inStream); sprintf(z_0, "%c", zei_1 );
z1= atoi(z_0);
if((mode_== 2 &&
(z1>=1 && z1<=8)) ||
(mode_== 4 &&
(z1>=1 && z1<=2)) ) zei_2=fgetc(inStream);
if(form_==1) LF=fgetc(inStream);
if(mode_==2) FnCodeAB_cd02( z1);
if(mode_==4) FnCodeAB_cd04( z1);
dez_1= dez_;
}
if(mode_==6) //dezimal
{
fscanf(inStream,"%s", zei_);
dez_1=atoi(zei_);
}
printf("\rdecoding AIIB: %s c(%i) ", code, f_len-index);
index++;
}while (feof (inStream) == 0);
printf("\n");
fclose( inStream );fclose( outStream );
return 0;
}
void _profil()
{
printf("-----------------------------------------\n");
printf("Usage: AIIB [input]\n");
printf("[input] .... SCHRAUSSER CODE file (*.bii)\n");
printf("-----------------------------------------\n");
printf("AIIB by Dietmar Schrausser\n");
printf("compiled on %s @ %s\n", __DATE__, __TIME__);
exit(0);
}
void _head()
{
printf("\nAIIB by Dietmar Schrausser\n");
printf("compiled on %s @ %s\n", __DATE__, __TIME__);
printf("decoding AIIB:");
}