Deleted Added
sdiff udiff text old ( 8655:e4001326a5ba ) new ( 9142:e9b713df4e1d )
full compact
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 31 unchanged lines hidden (view full) ---

40#include <cerrno>
41#include <cmath>
42#include <cstdio>
43#include <cstdlib>
44#include <cstring>
45#include <string>
46
47#include "base/misc.hh"
48#include "base/types.hh"
49
50using namespace std;
51
52string
53__get_hostname()
54{
55 char host[256];

--- 16 unchanged lines hidden (view full) ---

72 char line[80];
73 char format[80];
74 long usage;
75
76 FILE *fp = fopen(filename, "r");
77
78 while (fp && !feof(fp) && !done) {
79 if (fgets(line, 80, fp)) {
80 if (strncmp(line, target, strlen(target)) == 0) {
81 snprintf(format, sizeof(format), "%s %%ld", target);
82 sscanf(line, format, &usage);
83
84 fclose(fp);
85 return usage ;
86 }
87 }
88 }

--- 30 unchanged lines hidden ---