~ubuntu-branches/ubuntu/trusty/lshw/trusty

« back to all changes in this revision

Viewing changes to src/core/osutils.cc

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2008-06-19 17:35:08 UTC
  • mfrom: (1.1.7 upstream) (2.1.3 lenny)
  • Revision ID: james.westby@ubuntu.com-20080619173508-661hjngqxww5z0oq
Tags: 02.13-2ubuntu1
* Merge from debian unstable, remaining changes:
  - 10-cap-detection.dpatch: fixes hang when reading capabilities of some
    PCI devies (LP: 202460; needs-to-goto-debian)
  - Set maintainer to Ubuntu

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
#include <dirent.h>
10
10
#include <limits.h>
11
11
#include <stdlib.h>
 
12
#include <string.h>
12
13
#include <regex.h>
13
14
#include <ctype.h>
14
15
#include <stdio.h>
18
19
#include <linux/kdev_t.h>
19
20
#endif
20
21
 
21
 
__ID("@(#) $Id: osutils.cc 1907 2007-10-13 22:23:16Z lyonel $");
 
22
__ID("@(#) $Id: osutils.cc 1959 2008-05-09 20:32:50Z lyonel $");
22
23
 
23
24
using namespace std;
24
25
 
183
184
  return S_ISLNK(buf.st_mode);
184
185
}
185
186
 
 
187
int selectfile(const struct dirent *d)
 
188
{
 
189
  struct stat buf;
 
190
 
 
191
  if (d->d_name[0] == '.')
 
192
    return 0;
 
193
 
 
194
  if (lstat(d->d_name, &buf) != 0)
 
195
    return 0;
 
196
 
 
197
  return S_ISREG(buf.st_mode);
 
198
}
186
199
 
187
200
static int selectdevice(const struct dirent *d)
188
201
{
333
346
}
334
347
 
335
348
 
 
349
string tohex(unsigned long long n)
 
350
{
 
351
  char buffer[80];
 
352
 
 
353
  snprintf(buffer, sizeof(buffer), "%llX", n);
 
354
 
 
355
  return string(buffer);
 
356
}
 
357
 
336
358
string join(const string & j, const string & s1, const string & s2)
337
359
{
338
360
  if(s1 == "") return s2;