static char buf[BUFSIZE + 1];
static size_t offset = 0;
-uint64_t get_timestamp(sd_journal *j) {
+static uint64_t get_timestamp(sd_journal *j) {
uint64_t timestamp;
int r = sd_journal_get_realtime_usec(j, ×tamp);
if (r < 0) {
return timestamp;
}
-void print_to_buf(const char * string, uint32_t length) {
+static void print_to_buf(const char * string, uint32_t length) {
if (!length) {
return;
}
offset += remaining;
}
-void print_cursor(sd_journal *j) {
+static void print_cursor(sd_journal *j) {
int r;
char *cursor = NULL;
r = sd_journal_get_cursor(j, &cursor);
free(cursor);
}
-void print_first_cursor(sd_journal *j) {
+static void print_first_cursor(sd_journal *j) {
static bool printed_first_cursor = false;
if (!printed_first_cursor) {
print_cursor(j);
}
}
-void print_reboot(sd_journal *j) {
+static void print_reboot(sd_journal *j) {
const char *d;
size_t l;
int r = sd_journal_get_data(j, "_BOOT_ID", (const void **)&d, &l);
}
}
-void print_timestamp(sd_journal *j) {
+static void print_timestamp(sd_journal *j) {
uint64_t timestamp;
int r = sd_journal_get_realtime_usec(j, ×tamp);
if (r < 0) {
print_to_buf(timestring, 15);
}
-void print_pid(sd_journal *j) {
+static void print_pid(sd_journal *j) {
const char *d;
size_t l;
int r = sd_journal_get_data(j, "_PID", (const void **)&d, &l);
print_to_buf("]", 1);
}
-bool print_field(sd_journal *j, const char *field) {
+static bool print_field(sd_journal *j, const char *field) {
const char *d;
size_t l;
int r = sd_journal_get_data(j, field, (const void **)&d, &l);
}
-void print_line(sd_journal *j) {
+static void print_line(sd_journal *j) {
print_reboot(j);
print_timestamp(j);
print_to_buf(" ", 1);
print_to_buf("\n", 1);
}
-char *progname;
+static char *progname;
-void usage(char *error) {
+_Noreturn static void usage(char *error) {
if (error) {
fprintf(stderr, "ERROR: %s\n", error);
}
break;
case 'h':
usage(NULL);
- break;
case '?':
default:
usage("invalid option or missing argument");