-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtoolbox.c
More file actions
executable file
·4307 lines (3748 loc) · 103 KB
/
toolbox.c
File metadata and controls
executable file
·4307 lines (3748 loc) · 103 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ~~~~~~~~~~~~~~~ C Toolbox ~~~~~~~~~~~~~~~~
// portable data manipulation functions
// portable socket server functions
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// toolbox.c
//
// Copyright (c) 2006 Francois Oligny-Lemieux
//
// Author : Francois Oligny-Lemieux
// Created : 15.May.2006
// Modified : 26.Jun.2016
//
// Description:
// Common functions
//
// License: Yipp Dual Personal Open Source License and Business Monetary License
// http://yipp.ca/licenses/dual-personal-open-source-business-monetary-license/
//
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include "toolbox.h"
#include "toolbox-basic-types.h"
#if C_TOOLBOX_TIMING == 1
# if ( defined(_MSC_VER) )
# if ! defined(_WINDOWS_)
# include <windows.h>
# endif
# include <mmsystem.h>
# else
# include "sys/time.h"
# include <dirent.h>
# endif
#endif
#include <sys/types.h>
#include <sys/stat.h>
#if defined(_MSC_VER) && !defined(__TOOLBOX_NETWORK_H__)
# include <windows.h>
#endif
#if C_TOOLBOX_LOG_COMMAND == 1
FILE * g_toolbox_toolbox_log_file = NULL;
#endif
/* global variable configs */
/* your app can modify those */
int g_verbose = 0;
int char_extract_path(const char * source, char * destination, int destination_size)
{
const char * strRet;
unsigned int length = 0;
if ( source == NULL )
{
return -1;
}
if ( destination == NULL )
{
return -2;
}
strRet = strrchr(source, '\\');
if ( strRet == NULL )
{ strRet = strrchr(source, '/');
}
if ( strRet )
{
length = strRet - source;
}
if ( destination_size <= length )
{
return TOOLBOX_ERROR_BUFFER_TOO_SMALL;
}
strncpy(destination, source, length);
destination[length] = '\0';
return 1;
}
int char_extract_filename(const char * source, char * destination, int destination_size)
{
const char * strRet;
unsigned int length = 0;
if ( source == NULL )
{
return -1;
}
if ( destination == NULL )
{
return -2;
}
destination[0] = '\0';
strRet = strrchr(source, '\\');
if ( strRet == NULL )
{ strRet = strrchr(source, '/');
}
if ( strRet )
{
length = strlen(strRet+1);
if ( length > 0 )
{
if ( destination_size <= length )
{
return TOOLBOX_ERROR_BUFFER_TOO_SMALL;
}
strncpy(destination, strRet+1, length);
destination[length] = '\0';
return 1;
}
}
return 0;
}
// utf8 string MUST be terminated.
char * C_utf8EndOfString(const char * utf8, int utf8_buffer_size)
{
const char * zero = "\0";
if ( utf8 == NULL )
{
return NULL;
}
if ( utf8_buffer_size == -1 )
{
utf8_buffer_size = 0x7FFFFFFF;
}
return C_memfind((unsigned char *)utf8, utf8_buffer_size, (unsigned char *)zero, 1);
}
// written 25.Jan.2008
// will realloc the string if too small, or malloc it if NULL
// separator is optional and can be NULL
// other parameters are mandatory
// max_length is either -1 or to the maximum length that can be copied from append.
int C_Append(char ** string, unsigned int * buffersize, const char * append, int max_length, const char * separator)
{
//unsigned int strLen;
unsigned int newSize = 0;
int mallocop = 0;
char * new_string = NULL;
if ( max_length == 0 )
{
return 0;
}
if ( *string )
{ newSize = strlen(*string);
}
if ( max_length < 0 )
{ newSize += strlen(append); // append without restriction
}
else
{ newSize += max_length; // append up to max_length
}
if ( separator )
{ newSize += strlen(separator);
}
newSize += 2;
if ( *string == NULL )
{
new_string = (char*)malloc(newSize);
mallocop = 1;
*buffersize = 0;
}
else if ( newSize > *buffersize )
{
new_string = (char*)realloc(*string, newSize);
mallocop = 1;
}
if ( mallocop )
{
if ( new_string == NULL )
{
return TOOLBOX_ERROR_MALLOC;
}
*string = new_string;
memset(new_string+*buffersize, 0, newSize - *buffersize); // frank fixme optimize by erasing only end char and first chars
*buffersize = newSize;
}
if ( separator )
{ strcat(*string, separator);
}
if ( max_length < 0 )
{
strcat(*string, append);
}
else
{
strncat(*string, append, max_length);
}
return 1;
}
// written 01.May.2008
int buffer_to_file(const char * buffer, const char * filename)
{
FILE * file;
int iret;
if ( buffer == NULL )
{
return -1;
}
if ( filename == NULL )
{
return -2;
}
file = fopen(filename, "wb");
if ( file == NULL )
{
return TOOLBOX_ERROR_CANNOT_OPEN_FILE;
}
iret = fwrite((char*)buffer, 1, strlen(buffer), file);
fclose(file);
if ( iret <= 0 )
{
return -10;
}
return 1;
}
int C_FileExists(const char * filename)
{
FILE * test;
int ret = 0;
if ( filename == NULL || filename[0] == '\0' )
{
return -1;
}
test = fopen(filename, "r");
if (test == NULL)
{
ret = 0;
}
else
{
ret = 1;
fclose(test);
}
return ret;
}
const char * C_GetFileExtension(const char * filename){ int count = 5; const char * strLook; int strLength = strlen(filename); if (strLength == 0) return NULL; strLook = &filename[strLength-1]; while (count > 0 && strLook > &filename[0]) { if (*strLook == '.') return strLook+1; strLook--; count--; } return NULL;}
int C_DirectoryExists(const char * directory)
{
//FILE * test;
//int ret = 0;
#if ( defined(_MSC_VER) )
DWORD attributes = GetFileAttributes(directory);
if ( attributes != INVALID_FILE_ATTRIBUTES
&& attributes & FILE_ATTRIBUTE_DIRECTORY )
{
return 1;
}
# if _DEBUG
attributes = GetLastError();
attributes = attributes;
# endif
return 0;
#else
DIR * dirPtr;
dirPtr = opendir(directory);
if ( dirPtr == NULL )
{
return 0;
}
closedir(dirPtr);
return 1;
#endif
}
int C_CreateDirectory(const char * directory)
{
//FILE * test;
//int ret = 0;
#if ( defined(_MSC_VER) )
BOOL bret = CreateDirectory(directory, NULL);
if ( bret == FALSE )
{
// failure
return -10;
}
return 1;
#else
int iret;
iret = mkdir(directory, 0755);
if ( iret < 0 )
{
// failure
return -10;
}
return 1;
#endif
}
// by default will overwrite file
int C_CopyFile(const char * source, const char * destination)
{
#if ( defined(_MSC_VER) )
BOOL bret;
#else
char command[256];
#endif
if ( source == NULL )
{
return -1;
}
if ( destination == NULL )
{
return -1;
}
#if ( defined(_MSC_VER) )
bret = CopyFile(source,destination,FALSE/*bFailIfExists*/);
if ( bret == FALSE )
{
// error
#if _DEBUG
printf("WIN32 CopyFile failed with error(%d)\r\n", (int)GetLastError());
#endif
return -10;
}
#else
snprintf(command,255,"cp -f \"%s\" \"%s\"", source,destination);
system(command);
#endif
return 1;
}
// written 08.Jan.2008
int C_CopyFileEx(const char * source, const char * destination, int flags)
{
#if ( defined(_MSC_VER) )
BOOL bret;
DWORD win32_flags = 0x00000008/*COPY_FILE_ALLOW_DECRYPTED_DESTINATION*/;
#else
char command[256];
#endif
if ( source == NULL )
{
return -1;
}
if ( destination == NULL )
{
return -1;
}
#if ( defined(_MSC_VER) )
# if(_WIN32_WINNT >= 0x0400)
if ( (flags&TOOLBOX_OVERWRITE_DESTINATION)==0 )
{ win32_flags |= 0x00000001/*COPY_FILE_FAIL_IF_EXISTS*/;
}
bret = CopyFileEx(source, destination, NULL/*progress*/, NULL/*progress data*/, FALSE, win32_flags);
if ( bret == FALSE )
{
// error
# if _DEBUG
printf("WIN32 CopyFileEx failed with error(%d)\r\n", (int)GetLastError());
# endif
return -10;
}
# else
bret = FALSE;
if ( (flags&TOOLBOX_OVERWRITE_DESTINATION)==0 )
{ bret = TRUE;
}
bret = CopyFile(source,destination,bret/*bFailIfExists*/);
if ( bret == FALSE )
{
// error
#if _DEBUG
printf("WIN32 CopyFile failed with error(%d)\r\n", (int)GetLastError());
#endif
return -10;
}
# endif
#else
if ( flags & TOOLBOX_OVERWRITE_DESTINATION )
{
snprintf(command,255,"cp -f \"%s\" \"%s\"", source,destination);
}
else
{
snprintf(command,255,"cp \"%s\" \"%s\"", source,destination);
}
system(command);
#endif
return 1;
}
// by default will overwrite file
int C_MoveFile(const char * source, const char * destination)
{
#if ( defined(_MSC_VER) )
BOOL bret;
#else
char command[256];
#endif
if ( source == NULL )
{
return -1;
}
if ( destination == NULL )
{
return -1;
}
#if ( defined(_MSC_VER) )
bret = MoveFileEx(source,destination, MOVEFILE_REPLACE_EXISTING|MOVEFILE_WRITE_THROUGH|MOVEFILE_COPY_ALLOWED);
if ( bret == FALSE )
{
// error
#if _DEBUG
int win32_error = GetLastError();
printf("WIN32 MoveFileEx failed with error(%d)\r\n", win32_error);
#endif
return -10;
}
#else
snprintf(command,255,"mv -f \"%s\" \"%s\"", source,destination);
system(command);
#endif
return 1;
}
// flags are agregates of gnucFlags_E
// written 08.Jan.2008
int C_MoveFileEx(const char * source, const char * destination, int flags)
{
#if ( defined(_MSC_VER) )
BOOL bret;
DWORD win32_flags = MOVEFILE_WRITE_THROUGH;
#else
char command[256];
#endif
if ( source == NULL )
{
return -1;
}
if ( destination == NULL )
{
return -2;
}
#if ( defined(_MSC_VER) )
if ( flags & TOOLBOX_OVERWRITE_DESTINATION )
{ win32_flags |= MOVEFILE_REPLACE_EXISTING;
}
win32_flags |= MOVEFILE_COPY_ALLOWED;
bret = MoveFileEx(source, destination, win32_flags);
if ( bret == FALSE )
{
// error
#if _DEBUG
int win32_error = GetLastError();
printf("WIN32 MoveFile failed with error(%d)\r\n", win32_error);
#endif
return -10;
}
#else
if ( flags & TOOLBOX_OVERWRITE_DESTINATION )
{
snprintf(command,255,"mv -f \"%s\" \"%s\"", source,destination);
}
else
{
snprintf(command,255,"mv \"%s\" \"%s\"", source,destination);
}
system(command);
#endif
return 1;
}
// written 19.Feb.2011
int C_endSlashDirectory(char * directory_inout)
{
int backslashes = 0;
char * strRet;
char * strRet2;
strRet = strstr(directory_inout, "\\");
if ( strRet )
{
backslashes = 1;
}
strRet = C_strendstr(directory_inout, "\\");
strRet2 = C_strendstr(directory_inout, "/");
if ( strRet == NULL && strRet2 == NULL )
{
if ( backslashes )
{ strcat(directory_inout, "\\");
}
else
{ strcat(directory_inout, "/");
}
}
return 1;
}
int C_GetTempFilename(const char * path, char * out_filename)
{
#if defined(_MSC_VER)
char temp[256]="";
#endif
if ( out_filename == NULL )
{
return -1;
}
#if defined(_MSC_VER)
// windows
if ( tmpnam(temp)==NULL )
{
return -12;
}
if ( temp[0] == '\\' )
{
int length = strlen(temp);
memmove(temp, temp+1, length); // copy the last byte '\0'
temp[length-1] = '\0'; // redundant
}
out_filename[0] = '\0';
if ( path )
{
strcpy(out_filename, path);
if ( path[strlen(path)-1] != '/'
&& path[strlen(path)-1] != '\\'
)
{
// append slash
strcat(out_filename, "/");
}
}
strcat(out_filename, temp);
#else
// linux
int outfd;
if ( path )
{
strcpy(out_filename, path);
if ( path[strlen(path)-1] != '/'
&& path[strlen(path)-1] != '\\'
)
{
// append slash
strcat(out_filename, "/");
}
}
strcat(out_filename, "XXXXXX");
outfd = mkstemp(out_filename);
if (outfd == -1)
{
printf("<!-- mkstemp on filename(%s) failed -->\n", out_filename);
return -10;
}
close(outfd);
/* Fix the permissions */
if (chmod(out_filename, 0600) != 0)
{
unlink(out_filename);
return -11;
}
#endif
return 1;
}
int C_itoa( unsigned int i, char * toLoad, unsigned int toLoad_size )
{
char temp[22];
char *p = &temp[21];
*p-- = '\0';
do {
*p-- = '0' + i % 10;
i /= 10;
} while (i > 0);
strncpy(toLoad, p+1, toLoad_size-1);
toLoad[toLoad_size-1] = '\n';
return 1;
}
// this function has been obtained somewhere on the web.
int C_axtoi(const char * hex)
{
int n = 0; // position in string
int m = 0; // position in digit[] to shift
int count; // loop index
int intValue = 0; // integer value of hex string
int digit[32]; // hold values to convert
if ( strstr(hex, "0x")==hex )
{ hex+=2;
}
while (n < 32)
{
if (hex[n] == '\0')
{ break; }
if (hex[n] >= 0x30 && hex[n] <= 0x39 ) //if 0 to 9
{ digit[n] = hex[n] & 0x0f; } //convert to int
else if (hex[n] >= 'a' && hex[n] <= 'f') //if a to f
{ digit[n] = (hex[n] & 0x0f) + 9; } //convert to int
else if (hex[n] >= 'A' && hex[n] <= 'F') //if A to F
{ digit[n] = (hex[n] & 0x0f) + 9; } //convert to int
else
{ break; }
n++;
}
count = n;
m = n - 1;
n = 0;
while (n < count)
{
// digit[n] is value of hex digit at position n
// (m << 2) is the number of positions to shift
// OR the bits into return value
intValue = intValue | (digit[n] << (m << 2));
m--; // adjust the position to set
n++; // next digit to process
}
return (intValue);
}
// will replace in place
char* C_strreplace(char * source, const char token, const char replacement)
{
char * strRet;
if (source == NULL) return NULL;
if (token == replacement) return source;
strRet = strchr(source, token);
while (strRet)
{ *strRet = replacement;
strRet = strchr(source, token);
}
return source;
}
// written 04.Feb.2009
// will write at most dst_max_length and always NULL-terminate the string.
int C_strncpy(char * destination, const char * source, int dst_max_length)
{
if ( destination == NULL )
{ return -1;
}
if ( source == NULL )
{ return -2;
}
if ( dst_max_length <= 0 )
{ return -3;
}
while ( *source != '\0' )
{
*destination = *source++;
dst_max_length--;
if ( dst_max_length == 0 )
{
*destination = '\0';
break;
}
destination++;
}
return 1;
}
// returns NULL on error or not found
// returns pointer from inside string when found, at beginning of needle in string.
char * C_strcasestr(const char * string, const char * needle)
{
int i;
int j;
int stringLen;
int needleLen;
int searchLen;
if ( string == NULL )
{
return NULL;
}
if ( needle == NULL )
{
return NULL;
}
stringLen = strlen(string);
needleLen = strlen(needle);
searchLen = stringLen - needleLen + 1;
for (i=0; i<searchLen; i++)
{
for (j=0; ; j++)
{
if ( j == needleLen )
{
return (char*) string+i;
}
if ( tolower(string[i+j]) != tolower(needle[j]) )
{
// we are not interested in this i
break;
}
}
}
return NULL; // not found
}
char * C_strncasestr(const char * string, int string_length, const char * needle)
{
int i;
int j;
int stringLen;
int needleLen;
int searchLen;
if ( string == NULL )
{
return NULL;
}
if ( needle == NULL )
{
return NULL;
}
stringLen = string_length;
needleLen = strlen(needle);
searchLen = stringLen - needleLen + 1;
for (i=0; i<searchLen; i++)
{
for (j=0; ; j++)
{
if ( j == needleLen )
{
return (char*) string+i;
}
if ( string[i+j] == '\0'
|| ( tolower(string[i+j]) != tolower(needle[j]) )
)
{
// string is over.
// we are not interested in this i
break;
}
}
}
return NULL; // not found
}
// Author: Francois Oligny-Lemieux
// Created: 22.Mar.2007
// if string ends with needle, return pointer to first char of needle in string
// else return NULL
char * C_strendstr(const char * string, const char * needle)
{
unsigned int stringLength;
unsigned int needleLength;
char * strRet;
if ( string == NULL )
{
return NULL;
}
if ( needle == NULL )
{
return NULL;
}
stringLength = strlen(string);
needleLength = strlen(needle);
if ( needleLength > stringLength )
{
return NULL;
}
// string[stringLength] represents '\0'
// string[stringLength-needleLength] represents theorical start of needle in string
strRet = strstr(&string[stringLength-needleLength], needle);
if ( strRet )
{
return strRet;
}
return NULL;
}
// Author: Francois Oligny-Lemieux
// Created: 22.Mar.2007
// if string ends with needle (case insensitive), return pointer to first char of needle in string
// else return NULL
char * C_striendstr(const char * string, const char * needle)
{
unsigned int stringLength;
unsigned int needleLength;
char * strRet;
if ( string == NULL )
{
return NULL;
}
if ( needle == NULL )
{
return NULL;
}
stringLength = strlen(string);
needleLength = strlen(needle);
if ( needleLength > stringLength )
{
return NULL;
}
// string[stringLength] represents '\0'
// string[stringLength-needleLength] represents theorical start of needle in string
strRet = C_strcasestr(&string[stringLength-needleLength], needle);
if ( strRet )
{
return strRet;
}
return NULL;
}
// Author: Francois Oligny-Lemieux
// Created: 18.May.2007
// Binary-safe strlen
int C_strlen(const char * string, int string_buffer_size)
{
uint8_t success = 0;
int i = 0;
if ( string == NULL )
{
return -1;
}
while ( i<string_buffer_size )
{
if ( string[i] == '\0' )
{
success = 1;
break;
}
i++;
}
if ( success == 0 )
{
return -1;
}
return i;
}
// written 04.Feb.2009, returns end of string
const char * C_eos(const char * string)
{
if ( string == NULL )
{
return NULL;
}
while ( *string != '\0' )
{
string++;
}
return string;
}
// written 20.Aug.2007
void * C_memfind(const unsigned char * buffer, int buffer_length, const unsigned char * needle, int needle_length)
{
unsigned int i;
unsigned int j;
//unsigned int found;
void * out_value = NULL;
if ( buffer == NULL )
{
return NULL;
}
if ( buffer_length <= 0 )
{
return NULL;
}
if ( needle == NULL )
{
return NULL;
}
if ( needle_length <= 0 )
{
return NULL;
}
for (i=0; i<(unsigned int)buffer_length; i++)
{
for (j=0; j<(unsigned int)needle_length; j++)
{
if ( buffer[i+j] != needle[j] )
{
break;
}
}
if ( j == needle_length )
{
out_value = (void*)&buffer[i];
return out_value;
}
}
return NULL;
}
#if defined(__C_TOOLBOX_TEXT_BUFFER_READER_H__)
int putTextBufferReader_into_charArray(textBufferReader * reader, charArray * array)
{
int iret;
char buffer[TEXT_BUFFER_READER_MAX_LINE_SIZE+1];
if ( reader == 0 )
{
return -1;
}
if ( array == 0 )
{
return -1;
}