*** empty log message ***
[h316.git] / pc-tools / ldc2 / src / tool.cpp
1 #include <vector>
2 #include <string>
3
4 #include <stdio.h>
5
6 #include "config.hh"
7
8 using namespace std;
9
10 /*!
11 *\brief Output a vector of strings to out_fd.
12 *\arg strings A vector containing text.
13 *\retval 0 The vector was empty.
14 *\retval 1 The vector contained text.
15 */
16 int dump_vector(vector<string> strings){
17 int res=0;
18 for (vector<string>::iterator iter=strings.begin();iter<strings.end();iter++){
19 char buffer[50000];
20 snprintf(buffer,50000,"%s\n",(*iter).c_str());
21 write (out_fd,buffer,strlen(buffer));
22 res=1;
23 }
24 return res;
25 }
26
27 /*!
28 *\brief Output a vector of strings to stderr.
29 *\arg strings A vector containing text.
30 *\retval 0 The vector was empty.
31 *\retval 1 The vector contained text.
32 */
33 int dump_vector_err(vector<string> strings){
34 int res=0;
35 for (vector<string>::iterator iter=strings.begin();iter<strings.end();iter++){
36 char buffer[50000];
37 snprintf(buffer,50000,"%s\n",(*iter).c_str());
38 write (2,buffer,strlen(buffer));
39 res=1;
40 }
41 return res;
42 }