chiark / gitweb /
core/swap.c: Do not add Before=swap.target to swap units.
[elogind.git] / src / journal / journalctl.c
index 54ee6d8cc85d773fd074425dc6316e14674b1690..0498f294ae9df9db867883209a314a37314343ce 100644 (file)
@@ -193,10 +193,17 @@ static int parse_argv(int argc, char *argv[]) {
                 case 'o':
                         arg_output = output_mode_from_string(optarg);
                         if (arg_output < 0) {
-                                log_error("Unknown output '%s'.", optarg);
+                                log_error("Unknown output format '%s'.", optarg);
                                 return -EINVAL;
                         }
 
+                        if (arg_output == OUTPUT_EXPORT ||
+                            arg_output == OUTPUT_JSON ||
+                            arg_output == OUTPUT_JSON_PRETTY ||
+                            arg_output == OUTPUT_JSON_SSE ||
+                            arg_output == OUTPUT_CAT)
+                                arg_quiet = true;
+
                         break;
 
                 case 'a':
@@ -908,23 +915,19 @@ int main(int argc, char *argv[]) {
 
                 if (r > 0) {
                         if (arg_follow)
-                                printf("---- Logs begin at %s.\n", format_timestamp(start_buf, sizeof(start_buf), start));
+                                printf("-- Logs begin at %s. --\n",
+                                       format_timestamp(start_buf, sizeof(start_buf), start));
                         else
-                                printf("---- Logs begin at %s, end at %s.\n",
+                                printf("-- Logs begin at %s, end at %s. --\n",
                                        format_timestamp(start_buf, sizeof(start_buf), start),
                                        format_timestamp(end_buf, sizeof(end_buf), end));
                 }
         }
 
         for (;;) {
-                for (;;) {
+                while (arg_lines == 0 || arg_follow || n_shown < arg_lines) {
                         int flags;
 
-                        if (arg_lines > 0 && n_shown >= arg_lines) {
-                                r = 0;
-                                goto finish;
-                        }
-
                         if (need_seek) {
                                 r = sd_journal_next(j);
                                 if (r < 0) {
@@ -953,7 +956,7 @@ int main(int argc, char *argv[]) {
                                 if (r >= 0) {
                                         if (previous_boot_id_valid &&
                                             !sd_id128_equal(boot_id, previous_boot_id))
-                                                printf(ANSI_HIGHLIGHT_ON "---- Reboot ----" ANSI_HIGHLIGHT_OFF "\n");
+                                                printf(ANSI_HIGHLIGHT_ON "-- Reboot --" ANSI_HIGHLIGHT_OFF "\n");
 
                                         previous_boot_id = boot_id;
                                         previous_boot_id_valid = true;