Switch to unified view

a/src/utils/smallut.cpp b/src/utils/smallut.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: smallut.cpp,v 1.25 2006-12-19 12:11:21 dockes Exp $ (C) 2004 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: smallut.cpp,v 1.26 2007-02-08 17:05:12 dockes Exp $ (C) 2004 J.F.Dockes";
3
#endif
3
#endif
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
...
...
254
    case INQUOTE: 
254
    case INQUOTE: 
255
    case ESCAPE:
255
    case ESCAPE:
256
    return false;
256
    return false;
257
    }
257
    }
258
    return true;
258
    return true;
259
}
260
261
void stringsToString(const list<string> &tokens, string &s) 
262
{
263
    for (list<string>::const_iterator it = tokens.begin();
264
   it != tokens.end(); it++) {
265
  bool hasblanks = false;
266
  if (it->find_first_of(" \t\n") != string::npos)
267
      hasblanks = true;
268
  if (it != tokens.begin())
269
      s.append(1, ' ');
270
  if (hasblanks)
271
      s.append(1, '"');
272
  for (unsigned int i = 0; i < it->length(); i++) {
273
      char car = it->at(i);
274
      if (car == '"') {
275
      s.append(1, '\\');
276
      s.append(1, car);
277
      } else {
278
      s.append(1, car);
279
      }
280
  }
281
  if (hasblanks)
282
      s.append(1, '"');
283
    }
259
}
284
}
260
285
261
void stringToTokens(const string& str, list<string>& tokens,
286
void stringToTokens(const string& str, list<string>& tokens,
262
            const string& delims, bool skipinit)
287
            const string& delims, bool skipinit)
263
{
288
{