Fixed dependencies in Makefile
[h316.git] / pc-tools / ldc2 / src / tool.cpp
1 /******************************************************************************
2 *
3 * LDC2 source code
4 *
5 * $Date: 2007/03/26 01:00:40 $
6 * $Author: hachti $
7 *
8 * $Log: tool.cpp,v $
9 * Revision 2.0 2007/03/26 01:00:40 hachti
10 * *** empty log message ***
11 *
12 *
13 ******************************************************************************/
14
15 #include <vector>
16 #include <string>
17
18 #include <stdio.h>
19
20 #include "config.hh"
21
22 using namespace std;
23
24
25 /*!
26 *\brief Output a vector of strings.
27 *\arg strings A vector containing text.
28 *\arg fp A FILE pointer where to write to.
29 *\retval 0 The vector was empty.
30 *\retval 1 The vector contained text.
31 */
32 int dump_vector_fp(vector<string> strings, FILE * fp){
33 int res=0;
34 for (vector<string>::iterator iter=strings.begin();iter<strings.end();iter++){
35 fprintf(fp,"%s\n",
36 iter->substr(0,iter->find_last_not_of(" ")+1).c_str());
37 res=1;
38 }
39 return res;
40 }
41
42 /*!
43 *\brief Output a vector of strings to out_fd.
44 *\arg strings A vector containing text.
45 *\retval 0 The vector was empty.
46 *\retval 1 The vector contained text.
47 */
48 int dump_vector(vector<string> strings){
49 FILE * fp=fdopen(out_fd,"w");
50 return dump_vector_fp(strings,fp);
51 }