~ubuntu-branches/ubuntu/saucy/octave-miscellaneous/saucy-proposed

« back to all changes in this revision

Viewing changes to debian/patches/waitbar-rename.patch

  • Committer: Package Import Robot
  • Author(s): Thomas Weber, Rafael Laboissiere, Sébastien Villemot
  • Date: 2012-03-11 23:14:58 UTC
  • Revision ID: package-import@ubuntu.com-20120311231458-s8nkjp69yz5c9t4u
Tags: 1.0.11-2
[ Rafael Laboissiere ]
* Bump the debhelper compatibility level to 9
* debian/control: Bump standards version to 3.9.3, no changes needed

[ Sébastien Villemot ]
* Add Sébastien Villemot to Uploaders
* Build-Depend on octave-pkg-dev >= 1.0.0
* debian/copyright: update using machine-readable format 1.0
* debian/patches/match-cell-array.patch: new patch
* debian/rules: fix wrong +x perms in upstream tarball
* debian/patches/waitbar-rename.patch: new patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: renamed waitbar to text_waitbar to not shadow core function
 
2
Author: Carnë Draug <carandraug+dev@gmail.com>
 
3
Origin: commit: 9647
 
4
Last-Update: 2012-03-09
 
5
---
 
6
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 
7
--- a/src/waitbar.cc
 
8
+++ /dev/null
 
9
@@ -1,265 +0,0 @@
 
10
-/**************************************************************************
 
11
- *  Waitbar function -- displays progress of lengthy calculations
 
12
- *  -------------------------------------------------------------
 
13
- *  Copyright (c) 2002  Quentin Spencer <qspencer@ieee.org>
 
14
- *
 
15
- *  This library is free software; you can redistribute it and/or
 
16
- *  modify it under the terms of the GNU Library General Public
 
17
- *  License as published by the Free Software Foundation; either
 
18
- *  version 2 of the License, or (at your option) any later version.
 
19
- *
 
20
- *  This library is distributed in the hope that it will be useful,
 
21
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
22
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
23
- *  Library General Public License for more details.
 
24
- *
 
25
- *  You should have received a copy of the GNU Library General Public
 
26
- *  License along with this library; if not, see <http://www.gnu.org/licenses/>.
 
27
- *
 
28
- *************************************************************************/
 
29
-
 
30
-#include <octave/oct.h>
 
31
-
 
32
-// Note the extern "C" is need for mingw with a version of termcap.h 
 
33
-// without the extern "C" explicitly included. Doing it twice should be
 
34
-// harmless.
 
35
-extern "C" {
 
36
-#if defined (HAVE_TERM_H)
 
37
-#  include <term.h>
 
38
-#elif defined (HAVE_TERMCAP_H)
 
39
-#  include <termcap.h>
 
40
-#endif
 
41
-};
 
42
-
 
43
-#define BUF_SIZE       256
 
44
-#define MAX_LEN                240
 
45
-#define DEFAULT_LEN    50
 
46
-#define        BAR_CHAR        '#'
 
47
-#define SPACING                3
 
48
-
 
49
-static bool no_terminal=false;
 
50
-
 
51
-DEFUN_DLD(waitbar, args, nargout,
 
52
-"waitbar(...);\n\
 
53
- WAITBAR displays a text-based wait bar. This function\n\
 
54
- is similar to the Matlab waitbar command, but it is\n\
 
55
- a text, rather than graphical function.\n\n\
 
56
- A typical usage of WAITBAR in a lengthy computation\n\
 
57
- (inside a FOR loop, for example) is as follows:\n\n\
 
58
- for i=1:1000\n\
 
59
-     ## computation\n\
 
60
-     waitbar(i/1000);\n\
 
61
- end\n\n\
 
62
- WAITBAR(X,TITLE), where 0 <= X <= 1, sets the position of\n\
 
63
- the waitbar to the fractional length X. Values of X exactly\n\
 
64
- equal to 0 or 1 clear the waitbar. The optional second\n\
 
65
- argument TITLE sets the waitbar caption to TITLE.\n\n\
 
66
- If Octave is running in a smart terminal, the width is\n\
 
67
- automatically detected, and the title is displayed in the\n\
 
68
- waitbar (and truncated if it is too long). Otherwise, the\n\
 
69
- title is not displayed and the width is initialized to a\n\
 
70
- default of 50 characters, or it can be set to N characters\n\
 
71
- with WAITBAR(0,N). If no terminal is detected (such as when\n\
 
72
- Octave is run in batch mode and output is redirected), no\n\
 
73
- output is generated.\n\n\
 
74
- For compatibility with the Matlab version of this function\n\
 
75
- (which is graphical rather than text-based), additional\n\
 
76
- arguments are ignored, but there are no guarantees of perfect\n\
 
77
- compatibility.")
 
78
-{
 
79
-  static char print_buf[BUF_SIZE];
 
80
-  static int n_chars_old;
 
81
-  static int pct_int_old;
 
82
-  static int length;
 
83
-#if defined(USE_TERM)
 
84
-  static char term_buffer[1024];
 
85
-  static char *begin_rv, *end_rv;
 
86
-  static int brvlen, ervlen, pct_pos;
 
87
-  static bool smart_term;
 
88
-  static bool newtitle = false;
 
89
-  static charMatrix title;
 
90
-  int j;
 
91
-#endif
 
92
-  static char *term;
 
93
-  static bool init;
 
94
-
 
95
-  double pct;
 
96
-  int i;
 
97
-
 
98
-  octave_value_list retval;
 
99
-  retval(0) = Matrix(0,0);
 
100
-  int nargin = args.length();
 
101
-  if (nargin < 1) {
 
102
-    print_usage ();
 
103
-    return retval;
 
104
-  }
 
105
-
 
106
-  if(no_terminal)
 
107
-    return retval;
 
108
-
 
109
-  pct  = args(0).double_value();
 
110
-  if(pct>1.0)  pct     = 1.0;          // to prevent overflow
 
111
-
 
112
-#if defined(USE_TERM)
 
113
-  if(nargin==2 && args(1).is_string())
 
114
-    {
 
115
-      newtitle = true;
 
116
-      title = args(1).string_value();
 
117
-    }
 
118
-  if(nargin==3)
 
119
-    {
 
120
-      newtitle = true;
 
121
-      title = args(2).string_value();
 
122
-    }
 
123
-#endif
 
124
-
 
125
-  if(pct==0.0 || pct==1.0)
 
126
-    {
 
127
-      init = true;
 
128
-      term = getenv("TERM");
 
129
-      if(!term)
 
130
-       {
 
131
-         no_terminal   = true;
 
132
-         return retval;
 
133
-       }
 
134
-#if defined (USE_TERM)
 
135
-      i = tgetnum("co");
 
136
-      smart_term = i ? true : false;
 
137
-      if(nargin==1 || args(1).is_string())
 
138
-       length = smart_term ? i-1 : DEFAULT_LEN;
 
139
-#else
 
140
-      if(nargin==1)
 
141
-        length = DEFAULT_LEN;
 
142
-#endif
 
143
-      else
 
144
-       if(nargin==2 && !(args(1).is_string()))
 
145
-       {
 
146
-         length        = args(1).int_value();
 
147
-         if(length>MAX_LEN)    length  = MAX_LEN;
 
148
-         if(length<=0)         length  = DEFAULT_LEN;
 
149
-       }
 
150
-#if defined (USE_TERM)
 
151
-      pct_pos = length/2-2;
 
152
-      if(smart_term)
 
153
-       {
 
154
-         // get terminal strings ("rv"="reverse video")
 
155
-         char* buf_ptr = term_buffer;
 
156
-         begin_rv      = tgetstr("so", &buf_ptr);
 
157
-         end_rv        = tgetstr("se", &buf_ptr);
 
158
-         
 
159
-         // Display a progress bar, but only if the current terminal has a
 
160
-         // standout mode
 
161
-         if (begin_rv && end_rv)
 
162
-           {
 
163
-             brvlen = 0;       
 
164
-             buf_ptr = begin_rv;
 
165
-             while(buf_ptr[++brvlen]);
 
166
-             ervlen = 0;       buf_ptr = end_rv;
 
167
-             while(buf_ptr[++ervlen]);
 
168
-           }
 
169
-                 
 
170
-         // initialize print buffer
 
171
-         for(i=0; i<BUF_SIZE; ++i)
 
172
-           print_buf[i]        = ' ';
 
173
-         print_buf[length+brvlen+ervlen+1] = '\r';
 
174
-         print_buf[length+brvlen+ervlen+2] = '\0';
 
175
-         for(i=0; i<brvlen; ++i)
 
176
-           print_buf[i]        = begin_rv[i];
 
177
-         for(i=0; i<ervlen; ++i)
 
178
-           print_buf[i+brvlen] = end_rv[i];
 
179
-         fputs(print_buf,stdout);
 
180
-         if(title.length())
 
181
-           newtitle    = true;
 
182
-       }
 
183
-      else
 
184
-       {
 
185
-#endif
 
186
-         for(i=0; i<BUF_SIZE; ++i)
 
187
-           print_buf[i]        = ' ';
 
188
-         print_buf[length+8]   = '\r';
 
189
-         print_buf[length+9]   = '\0';
 
190
-         fputs(print_buf,stdout);
 
191
-         print_buf[0]          = '[';
 
192
-         print_buf[length+1]   = ']';
 
193
-#if defined (USE_TERM)
 
194
-       }
 
195
-#endif
 
196
-      n_chars_old      = 0;
 
197
-      fflush(stdout);
 
198
-      return retval;
 
199
-    }
 
200
-  else
 
201
-    {
 
202
-      // calculate position
 
203
-      int n_chars=(int)(pct*length+0.5);
 
204
-      int pct_int=(int)(pct*100.0+0.5);
 
205
-
 
206
-      // check to see if we got this far without initialization
 
207
-      if(init==false)
 
208
-       {
 
209
-         Fwaitbar(octave_value(0.0),0);
 
210
-         fputs(print_buf,stdout);
 
211
-         fflush(stdout);
 
212
-       }
 
213
-
 
214
-      // check to see of output needs to be updated
 
215
-#if !defined (USE_TERM)
 
216
-      if(n_chars!=n_chars_old || pct_int!=pct_int_old)
 
217
-       {
 
218
-#else
 
219
-      if(n_chars!=n_chars_old || pct_int!=pct_int_old || newtitle)
 
220
-       {
 
221
-         if(smart_term)
 
222
-           {
 
223
-             static char pct_str[5];
 
224
-             sprintf(pct_str,"%3i%%",pct_int);
 
225
-
 
226
-             // Insert the title
 
227
-             if(newtitle)
 
228
-               {
 
229
-                 pct_pos       = length-SPACING*2;
 
230
-                 for(i=SPACING+brvlen; i<pct_pos+brvlen-SPACING;  ++i)
 
231
-                   print_buf[ i>=n_chars_old+brvlen ? i+ervlen : i ] = ' ';
 
232
-                 for(i=SPACING+brvlen, j=0; j<title.length(); ++i, ++j)
 
233
-                   if(i<pct_pos+brvlen-SPACING)
 
234
-                     print_buf[ i>=n_chars_old ? i+ervlen : i ] = title(0,j);
 
235
-                 newtitle      = false;
 
236
-               }
 
237
-
 
238
-             // Insert the percentage string
 
239
-             for(i=pct_pos+brvlen, j=0; j<4; ++i, ++j)
 
240
-               print_buf[ i>=n_chars_old+brvlen ? i+ervlen : i ] = pct_str[j];
 
241
-
 
242
-             // Move print_buf characters
 
243
-             if(n_chars_old<n_chars)
 
244
-               for(i=n_chars_old+brvlen; i<n_chars+brvlen; ++i)
 
245
-                 print_buf[i]  = print_buf[i+ervlen];
 
246
-             else
 
247
-               for(i=n_chars_old+brvlen-1; i>=n_chars+brvlen; --i)
 
248
-                 print_buf[i+ervlen]   = print_buf[i];
 
249
-
 
250
-             // Insert end of reverse video
 
251
-             for(i=n_chars+brvlen, j=0; j<ervlen; ++i, ++j)
 
252
-               print_buf[i]    = end_rv[j];
 
253
-           }
 
254
-         else
 
255
-           {
 
256
-#endif
 
257
-             if(n_chars>=n_chars_old)
 
258
-               for(int i=n_chars_old+1; i<=n_chars; ++i)
 
259
-                 print_buf[i]  = BAR_CHAR;
 
260
-             else
 
261
-               for(int i=n_chars+1; i<=n_chars_old; ++i)
 
262
-                 print_buf[i]  = ' ';
 
263
-             sprintf(&(print_buf[length+3])," %3i%%\r",pct_int);
 
264
-#if defined (USE_TERM)
 
265
-           }
 
266
-#endif
 
267
-         fputs(print_buf,stdout);
 
268
-         fflush(stdout);
 
269
-         n_chars_old   = n_chars;
 
270
-         pct_int_old   = pct_int;
 
271
-       }
 
272
-    }
 
273
-  return retval;
 
274
-}
 
275
--- /dev/null
 
276
+++ b/src/text_waitbar.cc
 
277
@@ -0,0 +1,265 @@
 
278
+/**************************************************************************
 
279
+ *  Waitbar function -- displays progress of lengthy calculations
 
280
+ *  -------------------------------------------------------------
 
281
+ *  Copyright (c) 2002  Quentin Spencer <qspencer@ieee.org>
 
282
+ *
 
283
+ *  This library is free software; you can redistribute it and/or
 
284
+ *  modify it under the terms of the GNU Library General Public
 
285
+ *  License as published by the Free Software Foundation; either
 
286
+ *  version 2 of the License, or (at your option) any later version.
 
287
+ *
 
288
+ *  This library is distributed in the hope that it will be useful,
 
289
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
290
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
291
+ *  Library General Public License for more details.
 
292
+ *
 
293
+ *  You should have received a copy of the GNU Library General Public
 
294
+ *  License along with this library; if not, see <http://www.gnu.org/licenses/>.
 
295
+ *
 
296
+ *************************************************************************/
 
297
+
 
298
+#include <octave/oct.h>
 
299
+
 
300
+// Note the extern "C" is need for mingw with a version of termcap.h 
 
301
+// without the extern "C" explicitly included. Doing it twice should be
 
302
+// harmless.
 
303
+extern "C" {
 
304
+#if defined (HAVE_TERM_H)
 
305
+#  include <term.h>
 
306
+#elif defined (HAVE_TERMCAP_H)
 
307
+#  include <termcap.h>
 
308
+#endif
 
309
+};
 
310
+
 
311
+#define BUF_SIZE       256
 
312
+#define MAX_LEN                240
 
313
+#define DEFAULT_LEN    50
 
314
+#define        BAR_CHAR        '#'
 
315
+#define SPACING                3
 
316
+
 
317
+static bool no_terminal=false;
 
318
+
 
319
+DEFUN_DLD(text_waitbar, args, nargout,
 
320
+"text_waitbar(...);\n\
 
321
+ TEXT_WAITBAR displays a text-based wait bar. This function\n\
 
322
+ is similar to the Matlab waitbar command, but it is\n\
 
323
+ a text, rather than graphical function.\n\n\
 
324
+ A typical usage of TEXT_WAITBAR in a lengthy computation\n\
 
325
+ (inside a FOR loop, for example) is as follows:\n\n\
 
326
+ for i=1:1000\n\
 
327
+     ## computation\n\
 
328
+     text_waitbar(i/1000);\n\
 
329
+ end\n\n\
 
330
+ TEXT_WAITBAR(X,TITLE), where 0 <= X <= 1, sets the position of\n\
 
331
+ the waitbar to the fractional length X. Values of X exactly\n\
 
332
+ equal to 0 or 1 clear the waitbar. The optional second\n\
 
333
+ argument TITLE sets the waitbar caption to TITLE.\n\n\
 
334
+ If Octave is running in a smart terminal, the width is\n\
 
335
+ automatically detected, and the title is displayed in the\n\
 
336
+ waitbar (and truncated if it is too long). Otherwise, the\n\
 
337
+ title is not displayed and the width is initialized to a\n\
 
338
+ default of 50 characters, or it can be set to N characters\n\
 
339
+ with TEXT_WAITBAR(0,N). If no terminal is detected (such as when\n\
 
340
+ Octave is run in batch mode and output is redirected), no\n\
 
341
+ output is generated.\n\n\
 
342
+ For compatibility with the Matlab version of this function\n\
 
343
+ (which is graphical rather than text-based), additional\n\
 
344
+ arguments are ignored, but there are no guarantees of perfect\n\
 
345
+ compatibility.")
 
346
+{
 
347
+  static char print_buf[BUF_SIZE];
 
348
+  static int n_chars_old;
 
349
+  static int pct_int_old;
 
350
+  static int length;
 
351
+#if defined(USE_TERM)
 
352
+  static char term_buffer[1024];
 
353
+  static char *begin_rv, *end_rv;
 
354
+  static int brvlen, ervlen, pct_pos;
 
355
+  static bool smart_term;
 
356
+  static bool newtitle = false;
 
357
+  static charMatrix title;
 
358
+  int j;
 
359
+#endif
 
360
+  static char *term;
 
361
+  static bool init;
 
362
+
 
363
+  double pct;
 
364
+  int i;
 
365
+
 
366
+  octave_value_list retval;
 
367
+  retval(0) = Matrix(0,0);
 
368
+  int nargin = args.length();
 
369
+  if (nargin < 1) {
 
370
+    print_usage ();
 
371
+    return retval;
 
372
+  }
 
373
+
 
374
+  if(no_terminal)
 
375
+    return retval;
 
376
+
 
377
+  pct  = args(0).double_value();
 
378
+  if(pct>1.0)  pct     = 1.0;          // to prevent overflow
 
379
+
 
380
+#if defined(USE_TERM)
 
381
+  if(nargin==2 && args(1).is_string())
 
382
+    {
 
383
+      newtitle = true;
 
384
+      title = args(1).string_value();
 
385
+    }
 
386
+  if(nargin==3)
 
387
+    {
 
388
+      newtitle = true;
 
389
+      title = args(2).string_value();
 
390
+    }
 
391
+#endif
 
392
+
 
393
+  if(pct==0.0 || pct==1.0)
 
394
+    {
 
395
+      init = true;
 
396
+      term = getenv("TERM");
 
397
+      if(!term)
 
398
+       {
 
399
+         no_terminal   = true;
 
400
+         return retval;
 
401
+       }
 
402
+#if defined (USE_TERM)
 
403
+      i = tgetnum("co");
 
404
+      smart_term = i ? true : false;
 
405
+      if(nargin==1 || args(1).is_string())
 
406
+       length = smart_term ? i-1 : DEFAULT_LEN;
 
407
+#else
 
408
+      if(nargin==1)
 
409
+        length = DEFAULT_LEN;
 
410
+#endif
 
411
+      else
 
412
+       if(nargin==2 && !(args(1).is_string()))
 
413
+       {
 
414
+         length        = args(1).int_value();
 
415
+         if(length>MAX_LEN)    length  = MAX_LEN;
 
416
+         if(length<=0)         length  = DEFAULT_LEN;
 
417
+       }
 
418
+#if defined (USE_TERM)
 
419
+      pct_pos = length/2-2;
 
420
+      if(smart_term)
 
421
+       {
 
422
+         // get terminal strings ("rv"="reverse video")
 
423
+         char* buf_ptr = term_buffer;
 
424
+         begin_rv      = tgetstr("so", &buf_ptr);
 
425
+         end_rv        = tgetstr("se", &buf_ptr);
 
426
+         
 
427
+         // Display a progress bar, but only if the current terminal has a
 
428
+         // standout mode
 
429
+         if (begin_rv && end_rv)
 
430
+           {
 
431
+             brvlen = 0;       
 
432
+             buf_ptr = begin_rv;
 
433
+             while(buf_ptr[++brvlen]);
 
434
+             ervlen = 0;       buf_ptr = end_rv;
 
435
+             while(buf_ptr[++ervlen]);
 
436
+           }
 
437
+                 
 
438
+         // initialize print buffer
 
439
+         for(i=0; i<BUF_SIZE; ++i)
 
440
+           print_buf[i]        = ' ';
 
441
+         print_buf[length+brvlen+ervlen+1] = '\r';
 
442
+         print_buf[length+brvlen+ervlen+2] = '\0';
 
443
+         for(i=0; i<brvlen; ++i)
 
444
+           print_buf[i]        = begin_rv[i];
 
445
+         for(i=0; i<ervlen; ++i)
 
446
+           print_buf[i+brvlen] = end_rv[i];
 
447
+         fputs(print_buf,stdout);
 
448
+         if(title.length())
 
449
+           newtitle    = true;
 
450
+       }
 
451
+      else
 
452
+       {
 
453
+#endif
 
454
+         for(i=0; i<BUF_SIZE; ++i)
 
455
+           print_buf[i]        = ' ';
 
456
+         print_buf[length+8]   = '\r';
 
457
+         print_buf[length+9]   = '\0';
 
458
+         fputs(print_buf,stdout);
 
459
+         print_buf[0]          = '[';
 
460
+         print_buf[length+1]   = ']';
 
461
+#if defined (USE_TERM)
 
462
+       }
 
463
+#endif
 
464
+      n_chars_old      = 0;
 
465
+      fflush(stdout);
 
466
+      return retval;
 
467
+    }
 
468
+  else
 
469
+    {
 
470
+      // calculate position
 
471
+      int n_chars=(int)(pct*length+0.5);
 
472
+      int pct_int=(int)(pct*100.0+0.5);
 
473
+
 
474
+      // check to see if we got this far without initialization
 
475
+      if(init==false)
 
476
+       {
 
477
+         Ftext_waitbar(octave_value(0.0),0);
 
478
+         fputs(print_buf,stdout);
 
479
+         fflush(stdout);
 
480
+       }
 
481
+
 
482
+      // check to see of output needs to be updated
 
483
+#if !defined (USE_TERM)
 
484
+      if(n_chars!=n_chars_old || pct_int!=pct_int_old)
 
485
+       {
 
486
+#else
 
487
+      if(n_chars!=n_chars_old || pct_int!=pct_int_old || newtitle)
 
488
+       {
 
489
+         if(smart_term)
 
490
+           {
 
491
+             static char pct_str[5];
 
492
+             sprintf(pct_str,"%3i%%",pct_int);
 
493
+
 
494
+             // Insert the title
 
495
+             if(newtitle)
 
496
+               {
 
497
+                 pct_pos       = length-SPACING*2;
 
498
+                 for(i=SPACING+brvlen; i<pct_pos+brvlen-SPACING;  ++i)
 
499
+                   print_buf[ i>=n_chars_old+brvlen ? i+ervlen : i ] = ' ';
 
500
+                 for(i=SPACING+brvlen, j=0; j<title.length(); ++i, ++j)
 
501
+                   if(i<pct_pos+brvlen-SPACING)
 
502
+                     print_buf[ i>=n_chars_old ? i+ervlen : i ] = title(0,j);
 
503
+                 newtitle      = false;
 
504
+               }
 
505
+
 
506
+             // Insert the percentage string
 
507
+             for(i=pct_pos+brvlen, j=0; j<4; ++i, ++j)
 
508
+               print_buf[ i>=n_chars_old+brvlen ? i+ervlen : i ] = pct_str[j];
 
509
+
 
510
+             // Move print_buf characters
 
511
+             if(n_chars_old<n_chars)
 
512
+               for(i=n_chars_old+brvlen; i<n_chars+brvlen; ++i)
 
513
+                 print_buf[i]  = print_buf[i+ervlen];
 
514
+             else
 
515
+               for(i=n_chars_old+brvlen-1; i>=n_chars+brvlen; --i)
 
516
+                 print_buf[i+ervlen]   = print_buf[i];
 
517
+
 
518
+             // Insert end of reverse video
 
519
+             for(i=n_chars+brvlen, j=0; j<ervlen; ++i, ++j)
 
520
+               print_buf[i]    = end_rv[j];
 
521
+           }
 
522
+         else
 
523
+           {
 
524
+#endif
 
525
+             if(n_chars>=n_chars_old)
 
526
+               for(int i=n_chars_old+1; i<=n_chars; ++i)
 
527
+                 print_buf[i]  = BAR_CHAR;
 
528
+             else
 
529
+               for(int i=n_chars+1; i<=n_chars_old; ++i)
 
530
+                 print_buf[i]  = ' ';
 
531
+             sprintf(&(print_buf[length+3])," %3i%%\r",pct_int);
 
532
+#if defined (USE_TERM)
 
533
+           }
 
534
+#endif
 
535
+         fputs(print_buf,stdout);
 
536
+         fflush(stdout);
 
537
+         n_chars_old   = n_chars;
 
538
+         pct_int_old   = pct_int;
 
539
+       }
 
540
+    }
 
541
+  return retval;
 
542
+}
 
543
--- a/src/Makefile
 
544
+++ b/src/Makefile
 
545
@@ -4,14 +4,14 @@
 
546
        TERM_LIB=-ltermcap
 
547
 endif
 
548
 
 
549
-TARGETS=waitbar.oct $(LISTEN) xmlread.oct  \
 
550
+TARGETS=text_waitbar.oct $(LISTEN) xmlread.oct  \
 
551
        csvexplode.oct csv2cell.oct csvconcat.oct cell2csv.oct \
 
552
        cell2cell.oct partarray.oct
 
553
 
 
554
 all:   $(TARGETS)
 
555
 
 
556
-waitbar.oct: waitbar.cc
 
557
-       $(MKOCTFILE) $(MISCDEFS) waitbar.cc $(TERM_LIB)
 
558
+text_waitbar.oct: text_waitbar.cc
 
559
+       $(MKOCTFILE) $(MISCDEFS) text_waitbar.cc $(TERM_LIB)
 
560
 
 
561
 server.oct: server.o listencanfork.o stringmatch.o
 
562
        $(MKOCTFILE) server.o listencanfork.o stringmatch.o