-
Notifications
You must be signed in to change notification settings - Fork 4
/
gamslxi-import.c
93 lines (66 loc) · 2.18 KB
/
gamslxi-import.c
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
/*
gamslxi-import.c C program for importing the content of the LXI file.
Copyright (C) 2009 Shiro Takeda <[email protected]>
Version: 1.0
$Id: gamslxi-import.c,v 1.1 2009/06/15 17:13:18 st Exp $
Time-stamp: <2017-11-11 12:45:19 st>
Author: Shiro Takeda
Maintainer: Shiro Takeda
First Created: Wed Dec 10 2008
Copyright (C) 2008-2009 Shiro Takeda
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
A copy of the GNU General Public License can be obtained from this
program's author (send electronic mail to
[email protected]) or from the Free Software Foundation,
Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Description:
This program is used for importing the content of the LST file.
Compilation etc.:
The binary file (gamslxi-import.exe) is compiled with embarcadero C++Builder
command line tool on MS Windows 10
% bcc32 -w -O2 gamslxi-import.c
Embarcadero C++Builder command line tool (bcc32.exe) is included in
"C++Compiler" downloadable from
https://www.embarcadero.com/free-tools
I have tested this program only on Windows 10. I don't know if the binary
works on other Windows platforms.
Usage:
gamslxi-import.exe beg end input_file
beg:
end:
input_file:
*/
#include <stdio.h>
#include <string.h> /* For strlen */
#include <stdlib.h> /* atoi */
#define PAGEW 256
int main(int argc, char *argv[]){
char line[PAGEW];
FILE *fin;
FILE *fout;
int linum = 0;
int beg;
int end;
fin = fopen(argv[3],"r");
fout = stdout;
beg = atoi(argv[1]);
end = atoi(argv[2]);
while (NULL != fgets(line, PAGEW, fin)) {
linum++;
if ((linum >= beg) && (linum <= end)) {
fprintf(fout,"%s", line);
} else if (linum > end) {
break;
}
}
fclose(fin);
fclose(fout);
return (0);
}