File: 01-getline.diff

package info (click to toggle)
nn 6.7.3-16.1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 3,688 kB
  • sloc: ansic: 32,039; sh: 1,491; awk: 138; makefile: 80
file content (115 lines) | stat: -rw-r--r-- 2,437 bytes parent folder | download | duplicates (2)
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
Description: Rename local getline func to local_getline
Author: Stefan Potyra <sistpoty@ubuntu.com>
Bug-Debian: https://bugs.debian.org/548461
--- a/aux.c
+++ b/aux.c
@@ -507,7 +507,7 @@
 		prompt_line = Lines - 1;
 		prompt("To: ");
 		unset_raw();
-		if (getline(&cc[0], sizeof(cc)) == 0)
+		if (local_getline(&cc[0], sizeof(cc)) == 0)
 		    cc[0] = CR;
 		nn_raw();
 		if (cc[0] != CR)
--- a/format.awk
+++ b/format.awk
@@ -16,7 +16,7 @@
 
 	printf("From: %s\nSubject:", progname);
 	if ($2 == "NAME") {
-		getline
+		local_getline
 		for (i = 2; i <= NF; i++) printf(" %s", $i);
 		printf("\n\n")
 		print
@@ -73,7 +73,7 @@
 
 	printf("\n")
 
-	getline; linebuf = $0
+	local_getline; linebuf = $0
 	indent = "     "
 	curcol = indcol = 5
 	if (length(linebuf) >= 5) {
--- a/global.c
+++ b/global.c
@@ -1186,6 +1186,23 @@
 #endif
 }
 
+#ifdef NEED_STRDUP
+char *strdup(const char *s)
+{
+    char *t   = NULL;
+    int   len = 0;
+
+    if (!s)
+      return NULL;
+
+    len = strlen(s)+1;
+    t   = newstr(len);
+    strncpy(t, s, len);
+    return t;
+}
+#endif
+
+
 /* Should really have some sort of configure file and use strdup().. */
 char           *
 strsave(char *s)
@@ -1307,12 +1324,12 @@
 }
 
 /*
- *	getline - gets a line from stdin
+ *	local_getline - gets a line from stdin
  *			returns the length of the line
  */
 
 int
-getline(char *line, int max)
+local_getline(char *line, int max)
 {
     if (fgets(line, max, stdin) == NULL)
 	return 0;
--- a/global.h
+++ b/global.h
@@ -42,6 +42,18 @@
 
 /* misc macros */
 
+#ifdef __GNUC__
+#define INLINE inline
+#else
+#define INLINE
+#endif
+
+#define HEXDIGIT(c) ( \
+    ((c) >= '0' && (c) <= '9') ? ((c)-'0') : \
+    (((c) >= 'A' && (c) <= 'F') ? ((c) - 'A' + 10) : \
+     (((c) >= 'a' && (c) <= 'f') ? ((c) - 'a' + 10) : 0)) \
+    )
+
 #define fl fflush(stdout)
 
 #ifdef CONTROL_
@@ -159,8 +171,7 @@
 
 extern group_header *current_group, *group_sequence, *rc_sequence;
 
-
-int             l_g_index, s_g_first;
+extern int	l_g_index, s_g_first;
 
 #define	Loop_Groups_Number(num) \
     for (num = 0; num < master.number_of_groups; num++)
@@ -258,7 +269,7 @@
 char           *strsave(char *);
 char           *str3save(char *, char *, char *);
 char           *fgetstr(FILE *);
-int             getline(char *, int);
+int             local_getline(char *, int);
 extern char    *tmp_directory;
 extern char    *nntp_cache_dir;
 #endif				/* _NN_GLOBAL_H */