Imported Upstream version 4.6.0
[debian/atlc] / tools / src / myfilelength.c
1 /*
2 atlc - arbitrary transmission line calculator, for the analysis of
3 transmission lines are directional couplers. 
4
5 Copyright (C) 2002. Dr. David Kirkby, PhD (G8WRB).
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either package_version 2
10 of the License, or (at your option) any later package_version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
20 USA.
21
22 Dr. David Kirkby, e-mail drkirkby@ntlworld.com 
23
24 */
25
26 #include "config.h"
27
28 #ifdef HAVE_STDIO_H
29 #include <stdio.h>
30 #endif
31
32 #ifdef HAVE_STDLIB_H
33 #include <stdlib.h>
34 #endif
35
36 #include "../../src/non_gui/exit_codes.h"
37 #include "../../src/non_gui/definitions.h"
38
39 int main(int argc, char **argv)
40 {
41   FILE *fp;
42   int length;
43
44   if(argc!=2)
45   {
46     printf("-1\n"); /* Length is considered -1 */
47     exit(1);
48   }
49   if ( (fp=fopen(argv[1],"rb")) == NULL)
50   {
51     printf("-1\n"); /* Length is considered -1 */
52     exit(1);
53   }
54   fseek(fp,0,SEEK_END);
55   length=ftell(fp);
56   printf("%d\n",length);
57   return(OKAY); 
58 }