summaryrefslogtreecommitdiff
path: root/Userland/dmesg.cpp
blob: f8b3b48db1ad8f81a0adf136392ab2d51d68a834 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <assert.h>
#include <LibCore/CFile.h>

int main(int argc, char** argv)
{
    (void) argc;
    (void) argv;
    CFile f("/proc/dmesg");
    if (!f.open(CIODevice::ReadOnly)) {
        fprintf(stderr, "open: failed to open /proc/dmesg: %s", f.error_string());
        return 1;
    }
    const auto& b = f.read_all();
    for (auto i = 0; i < b.size(); ++i)
        putchar(b[i]);
    return 0;
}