Package: iraf-fitsutil / 2018.07.06-3

Include-used-standard-header.patch Patch series | download
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
From: Ole Streicher <olebole@debian.org>
Date: Fri, 17 Aug 2018 11:33:06 +0200
Subject: Include used standard header

---
 src/fgread.c  | 31 ++++++-------------------------
 src/fgwrite.c |  2 ++
 src/kwdb.c    | 11 ++++++-----
 3 files changed, 14 insertions(+), 30 deletions(-)

diff --git a/src/fgread.c b/src/fgread.c
index c93f64c..cb849e8 100644
--- a/src/fgread.c
+++ b/src/fgread.c
@@ -1,25 +1,19 @@
 /* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
  */
 
+#define _XOPEN_SOURCE
 #include <stdio.h>
 #include <unistd.h>
+#include <stdlib.h>
 #include <ctype.h>
+#include <sys/stat.h>
 #include <sys/types.h>
+#include <fcntl.h>
 #include <string.h>
 #include <pwd.h>
 #include <utime.h>
-/* #include <time.h> */
-
-#ifdef SYSV
 #include <time.h>
-#else
-#include <sys/time.h>
-#include <sys/timeb.h>
-#endif
 
-#if defined(MACOSX) || defined(__linux)
-#include <time.h>
-#endif
 
 #include "kwdb.h"
 static  long get_timezone();
@@ -245,7 +239,7 @@ char	*argv[];
 			    fprintf (stderr, "missing filename argument\n");
 			    exit (1);
 			}
-			in = open (*argp, 0);
+			in = open (*argp, O_RDONLY);
 			if (in == ERR) {
 			    fprintf (stderr, "cannot open `%s'\n", *argp);
 			    exit (1);
@@ -613,7 +607,7 @@ char    *type;			/* Foreign extension type, (bin, text..) */
 
 	tp = ctime (&fh->mtime);
 
-	fprintf (out, "%-4d %-10.10s %9d %-12.12s %-4.4s %s",
+	fprintf (out, "%-4d %-10.10s %9ld %-12.12s %-4.4s %s",
 	    count,type, fh->size, tp + 4, tp + 20, fh->name);
 	if (fh->linkflag && *fh->linkname) {
 	    fprintf (out, " -> %s ", fh->linkname);
@@ -889,21 +883,8 @@ int	ftype;
 static long
 get_timezone()
 {
-#ifdef SYSV
         extern  long timezone;
         tzset();
         return (timezone);
-#else
-#ifdef MACOSX
-        struct tm *tm;
-        time_t clock = time(NULL);
-        tm = localtime (&clock);
-        return (-(tm->tm_gmtoff));
-#else
-        struct timeb time_info;
-        ftime (&time_info);
-        return (time_info.timezone * 60);
-#endif
-#endif
 }
 
diff --git a/src/fgwrite.c b/src/fgwrite.c
index 9e5bbd9..78a46ce 100644
--- a/src/fgwrite.c
+++ b/src/fgwrite.c
@@ -3,6 +3,8 @@
 
 #include <stdio.h>
 #include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
 #include <fcntl.h>
 #include <time.h>
 #include <strings.h>
diff --git a/src/kwdb.c b/src/kwdb.c
index aaeeefa..2355ec1 100644
--- a/src/kwdb.c
+++ b/src/kwdb.c
@@ -1,5 +1,9 @@
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
 #include <fcntl.h>
+#include <ctype.h>
 #include "kwdb.h"
 
 /*
@@ -146,14 +150,11 @@ struct kwdb {
 	Item *itab;		/* pointer to itab array */
 	char *sbuf;		/* pointer to string buffer */
 	int hashtbl[NTHREADS];	/* hash table */
-	int (*read)();		/* private file read function */
-	int (*write)();		/* private file write function */
+	ssize_t (*read)();		/* private file read function */
+	ssize_t (*write)();		/* private file write function */
 };
 typedef struct kwdb KWDB;
 
-extern char *mkstemp();
-extern int read(), write();
-
 static int hash();
 static int addstr();
 static int streq();