totaldone / 1024);
snprintf(totalsize_str, sizeof(totalsize_str), INT64_FORMAT, totalsize);
+#define VERBOSE_FILENAME_LENGTH 35
if (verbose)
{
if (!filename)
* call)
*/
fprintf(stderr,
- ngettext("%s/%s kB (100%%), %d/%d tablespace %35s",
- "%s/%s kB (100%%), %d/%d tablespaces %35s",
+ ngettext("%s/%s kB (100%%), %d/%d tablespace %*s",
+ "%s/%s kB (100%%), %d/%d tablespaces %*s",
tablespacecount),
totaldone_str, totalsize_str,
- tablespacenum, tablespacecount, "");
+ tablespacenum, tablespacecount,
+ VERBOSE_FILENAME_LENGTH + 5, "");
else
+ {
+ bool truncate = (strlen(filename) > VERBOSE_FILENAME_LENGTH);
+
fprintf(stderr,
- ngettext("%s/%s kB (%d%%), %d/%d tablespace (%-30.30s)",
- "%s/%s kB (%d%%), %d/%d tablespaces (%-30.30s)",
+ ngettext("%s/%s kB (%d%%), %d/%d tablespace (%s%-*.*s)",
+ "%s/%s kB (%d%%), %d/%d tablespaces (%s%-*.*s)",
tablespacecount),
totaldone_str, totalsize_str, percent,
- tablespacenum, tablespacecount, filename);
+ tablespacenum, tablespacecount,
+ /* Prefix with "..." if we do leading truncation */
+ truncate ? "..." : "",
+ truncate ? VERBOSE_FILENAME_LENGTH - 3 : VERBOSE_FILENAME_LENGTH,
+ truncate ? VERBOSE_FILENAME_LENGTH - 3 : VERBOSE_FILENAME_LENGTH,
+ /* Truncate filename at beginning if it's too long */
+ truncate ? filename + strlen(filename) - VERBOSE_FILENAME_LENGTH + 3 : filename);
+ }
}
else
fprintf(stderr,