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/str.hh"
49#include "base/types.hh"
50
51using namespace std;
52
53string
54__get_hostname()
55{
56 char host[256];

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

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

--- 30 unchanged lines hidden ---