summaryrefslogtreecommitdiffstats
path: root/text-utils/pg.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--text-utils/pg.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/text-utils/pg.c b/text-utils/pg.c
index adb3840..30ed046 100644
--- a/text-utils/pg.c
+++ b/text-utils/pg.c
@@ -247,9 +247,9 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" +/pattern/ start at the line containing pattern\n"), out);
fputs(USAGE_SEPARATOR, out);
- printf(USAGE_HELP_OPTIONS(16));
+ fprintf(out, USAGE_HELP_OPTIONS(16));
- printf(USAGE_MAN_TAIL("pg(1)"));
+ fprintf(out, USAGE_MAN_TAIL("pg(1)"));
exit(0);
}
@@ -618,9 +618,9 @@ static void prompt(long long pageno)
if ((p = strstr(pstring, "%d")) == NULL) {
mesg(pstring);
} else {
- strcpy(b, pstring);
- sprintf(b + (p - pstring), "%lld", pageno);
- strcat(b, p + 2);
+ snprintf(b, sizeof(b),
+ "%.*s%lld%s", (int) (p - pstring), pstring,
+ pageno, p + 2);
mesg(b);
}
}