]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - misc-utils/cal.c
Merge branch 'PR/libmount-utab-event' of github.com:karelzak/util-linux-work
[thirdparty/util-linux.git] / misc-utils / cal.c
index c5be03d205e087599c95e3df749727314eed7ce0..e6f4a6e4f3a6a4061c9b4fb007e6106923a6faff 100644 (file)
@@ -320,7 +320,7 @@ int main(int argc, char **argv)
                {"twelve", no_argument, NULL, 'Y'},
                {"help", no_argument, NULL, 'h'},
                {"vertical", no_argument, NULL,'v'},
-               {"column", required_argument, NULL,'c'},
+               {"columns", required_argument, NULL,'c'},
                {NULL, 0, NULL, 0}
        };
 
@@ -433,7 +433,8 @@ int main(int argc, char **argv)
                        if (strcmp(optarg, "auto") == 0)
                                cols = COLUMNS_AUTO;
                        else
-                               cols = strtosize_or_err(optarg, "foo");
+                               cols = strtosize_or_err(optarg,
+                                               _("failed to parse columns"));
                        break;
                case 'V':
                        print_version(EXIT_SUCCESS);
@@ -691,9 +692,9 @@ static void headers_init(struct cal_control *ctl)
        for (i = 0; i < DAYS_IN_WEEK; i++) {
                size_t space_left;
 
-               if (i)
-                       strcat(cur_dh++, " ");
                space_left = sizeof(day_headings) - (cur_dh - day_headings);
+               if (i && space_left)
+                       strncat(cur_dh++, " ", space_left--);
 
                if (space_left <= (ctl->day_width - 1))
                        break;
@@ -1295,8 +1296,8 @@ static void __attribute__((__noreturn__)) usage(void)
                "                         %s\n", USAGE_COLORS_DEFAULT);
 
        fputs(USAGE_SEPARATOR, out);
-       printf(USAGE_HELP_OPTIONS(23));
-       printf(USAGE_MAN_TAIL("cal(1)"));
+       fprintf(out, USAGE_HELP_OPTIONS(23));
+       fprintf(out, USAGE_MAN_TAIL("cal(1)"));
 
        exit(EXIT_SUCCESS);
 }