~ubuntu-branches/debian/squeeze/ntp/squeeze

« back to all changes in this revision

Viewing changes to .pc/libedit.patch/libntp/ntp_lineedit.c

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2010-05-24 11:09:51 UTC
  • mfrom: (1.2.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20100524110951-1o7gh469ygochf4n
Tags: 1:4.2.6.p1+dfsg-1
* New upstream version
  - They no longer ship arlib, adjust dfsg.patch.
  - Drop kfreebsd.patch, applied upstream
  - Update patches for upstream changes.
* Remove the obsolete config files:

  for ntp:
  - /etc/logcheck/ignore.d.server/ntp, removed in 1:4.2.6+dfsg-1
  - /etc/dhcp3/dhclient-enter-hooks.d/ntp, replaced by exit hooks in
    1:4.2.4p4+dfsg-3
  - /etc/network/if-up.d/ntp, removed in 1:4.2.4p0+dfsg-1

  for ntpdate:
  - /etc/dhcp3/dhclient-enter-hooks.d/ntpdate, replaced by exit hooks in
    1:4.2.4p4+dfsg-3

  Use dpkg 1.15.7.2's dpkg-maintscript-helper.  This needs
  a Pre-Depends to work, else it's never going to be removed.
  (Closes: #569530)
* Add "Depends: ${misc:Depends}" to ntp-doc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
#include <stdlib.h>
11
11
#include <stdio.h>
12
12
 
 
13
#if defined(HAVE_READLINE_HISTORY) &&           \
 
14
    (!defined(HAVE_READLINE_HISTORY_H) ||       \
 
15
     !defined(HAVE_READLINE_READLINE_H))
 
16
# undef HAVE_READLINE_HISTORY
 
17
#endif
13
18
#if defined(HAVE_READLINE_HISTORY)
14
19
# include <readline/readline.h>
15
20
# include <readline/history.h>
16
 
#else 
17
 
# if defined(HAVE_HISTEDIT_H)
18
 
#  include <histedit.h>
19
 
# endif
 
21
# define LE_READLINE
 
22
#elif defined(HAVE_HISTEDIT_H)
 
23
# include <histedit.h>
 
24
# define LE_EDITLINE
 
25
#else
 
26
# define LE_NONE
20
27
#endif
21
28
 
22
29
#include "ntp.h"
39
46
static char *   lineedit_prompt;
40
47
 
41
48
 
42
 
#if !defined(HAVE_READLINE_HISTORY) && defined(HAVE_HISTEDIT_H)
43
 
 
 
49
#ifdef LE_EDITLINE
44
50
        static EditLine *       ntp_el;
45
51
        static History *        ntp_hist;
46
52
        static HistEvent        hev;
47
53
 
48
54
        char *  ntp_prompt_callback(EditLine *);
49
 
 
50
 
#endif /* !HAVE_READLINE_HISTORY_H && HAVE_HISTEDIT_H */
 
55
#endif  /* LE_EDITLINE */
51
56
 
52
57
 
53
58
/*
68
73
                lineedit_prompt = estrdup(prompt);
69
74
        }
70
75
 
71
 
#if !defined(HAVE_READLINE_HISTORY) && defined(HAVE_HISTEDIT_H)
72
 
 
 
76
#ifdef LE_EDITLINE
73
77
        if (NULL == ntp_el) {
74
78
 
75
79
                ntp_el = el_init(progname, stdin, stdout, stderr);
104
108
                } else
105
109
                        success = 0;
106
110
        }
107
 
 
108
 
#endif  /* !HAVE_READLINE_HISTORY && HAVE_HISTEDIT_H */
 
111
#endif  /* LE_EDITLINE */
109
112
 
110
113
        ntp_readline_initted = success;
111
114
 
121
124
        void
122
125
        )
123
126
{
124
 
#if !defined(HAVE_READLINE_HISTORY) && defined(HAVE_HISTEDIT_H)
125
 
 
 
127
#ifdef LE_EDITLINE
126
128
        if (ntp_el) {
127
129
                el_end(ntp_el);
128
130
                ntp_el = NULL;
130
132
                history_end(ntp_hist);
131
133
                ntp_hist = NULL;
132
134
        }
133
 
 
134
 
#endif /* !HAVE_READLINE_HISTORY && HAVE_HISTEDIT_H */
 
135
#endif  /* LE_EDITLINE */
135
136
 
136
137
        if (lineedit_prompt) {
137
138
                free(lineedit_prompt);
153
154
        int *   pcount
154
155
        )
155
156
{
156
 
#if !defined(HAVE_READLINE_HISTORY) && !defined(HAVE_HISTEDIT_H)
157
 
        char line_buf[MAXEDITLINE];
 
157
        char *          line;
 
158
#ifdef LE_NONE
 
159
        char            line_buf[MAXEDITLINE];
158
160
#endif
159
 
#if !defined(HAVE_READLINE_HISTORY) && defined(HAVE_HISTEDIT_H)
 
161
#ifdef LE_EDITLINE
160
162
        const char *    cline;
161
163
#endif
162
 
        char *          line;
163
164
 
164
165
        if (!ntp_readline_initted)
165
166
                return NULL;
166
167
 
167
168
        *pcount = 0;
168
169
 
169
 
#if defined(HAVE_READLINE_HISTORY)
170
 
 
 
170
#ifdef LE_READLINE
171
171
        line = readline(lineedit_prompt ? lineedit_prompt : "");
172
172
        if (NULL != line) {
173
173
                if (*line) {
178
178
                        line = NULL;
179
179
                }
180
180
        }
181
 
 
182
 
#endif  /* HAVE_READLINE_HISTORY */
183
 
 
184
 
#if !defined(HAVE_READLINE_HISTORY) && defined(HAVE_HISTEDIT_H)
185
 
 
 
181
#endif  /* LE_READLINE */
 
182
 
 
183
#ifdef LE_EDITLINE
186
184
        cline = el_gets(ntp_el, pcount);
187
185
 
188
186
        if (NULL != cline && *cline) {
191
189
                line = estrdup(cline);
192
190
        } else
193
191
                line = NULL;
194
 
 
195
 
#endif  /* !HAVE_READLINE_HISTORY && HAVE_HISTEDIT_H */
196
 
 
197
 
#if !defined(HAVE_READLINE_HISTORY) && !defined(HAVE_HISTEDIT_H)
 
192
#endif  /* LE_EDITLINE */
 
193
 
 
194
#ifdef LE_NONE
198
195
                                        /* stone hammers */
199
196
        if (lineedit_prompt) {
200
197
# ifdef VMS
216
213
        } else
217
214
                line = NULL;
218
215
 
219
 
#endif  /* !HAVE_READLINE_HISTORY && !HAVE_HISTEDIT_H */
 
216
#endif  /* LE_NONE */
220
217
 
221
218
 
222
219
        if (!line)                      /* EOF */
226
223
}
227
224
 
228
225
 
229
 
#if !defined(HAVE_READLINE_HISTORY) && defined(HAVE_HISTEDIT_H)
 
226
#ifdef LE_EDITLINE
230
227
/*
231
228
 * ntp_prompt_callback - return prompt string to el_gets()
232
229
 */
239
236
 
240
237
        return lineedit_prompt;
241
238
}
242
 
#endif /* !HAVE_READLINE_HISTORY_H && HAVE_HISTEDIT_H */
 
239
#endif /* LE_EDITLINE */
243
240