unsigned int impossible;
struct directory **dir_slot;
struct directory **dir_end;
+#ifdef WINDOWS32
+ char buf[INTSTR_LENGTH + 1];
+#endif
puts (_("\n# Directories\n"));
if (dir->contents == 0)
printf (_("# %s: could not be stat'd.\n"), dir->name);
else if (dir->contents->dirfiles.ht_vec == 0)
- {
#ifdef WINDOWS32
- printf (_("# %s (key %s, mtime %I64u): could not be opened.\n"),
- dir->name, dir->contents->path_key,
- (unsigned long long)dir->contents->mtime);
-#else /* WINDOWS32 */
-#ifdef VMS_INO_T
- printf (_("# %s (device %d, inode [%d,%d,%d]): could not be opened.\n"),
- dir->name, dir->contents->dev,
- dir->contents->ino[0], dir->contents->ino[1],
- dir->contents->ino[2]);
+ printf (_("# %s (key %s, mtime %s): could not be opened.\n"),
+ dir->name, dir->contents->path_key,
+ make_ulltoa ((unsigned long long)dir->contents->mtime, buf));
+#elif defined(VMS_INO_T)
+ printf (_("# %s (device %d, inode [%d,%d,%d]): could not be opened.\n"),
+ dir->name, dir->contents->dev,
+ dir->contents->ino[0], dir->contents->ino[1],
+ dir->contents->ino[2]);
#else
- printf (_("# %s (device %ld, inode %ld): could not be opened.\n"),
- dir->name, (long int) dir->contents->dev,
- (long int) dir->contents->ino);
+ printf (_("# %s (device %ld, inode %ld): could not be opened.\n"),
+ dir->name, (long) dir->contents->dev, (long) dir->contents->ino);
#endif
-#endif /* WINDOWS32 */
- }
else
{
unsigned int f = 0;
}
}
#ifdef WINDOWS32
- printf (_("# %s (key %s, mtime %I64u): "),
+ printf (_("# %s (key %s, mtime %s): "),
dir->name, dir->contents->path_key,
- (unsigned long long)dir->contents->mtime);
-#else /* WINDOWS32 */
-#ifdef VMS_INO_T
+ make_ulltoa ((unsigned long long)dir->contents->mtime, buf));
+#elif defined(VMS_INO_T)
printf (_("# %s (device %d, inode [%d,%d,%d]): "),
dir->name, dir->contents->dev,
dir->contents->ino[0], dir->contents->ino[1],
dir->contents->ino[2]);
#else
- printf (_("# %s (device %ld, inode %ld): "),
- dir->name,
+ printf (_("# %s (device %ld, inode %ld): "), dir->name,
(long)dir->contents->dev, (long)dir->contents->ino);
#endif
-#endif /* WINDOWS32 */
if (f == 0)
fputs (_("No"), stdout);
else
static char *
func_wordlist (char *o, char **argv, const char *funcname UNUSED)
{
+ char buf[INTSTR_LENGTH + 1];
long long start, stop, count;
+ const char* badfirst = _("invalid first argument to 'wordlist' function");
+ const char* badsecond = _("invalid second argument to 'wordlist' function");
- start = parse_numeric (argv[0],
- _("invalid first argument to 'wordlist' function"));
- stop = parse_numeric (argv[1],
- _("invalid second argument to 'wordlist' function"));
-
+ start = parse_numeric (argv[0], badfirst);
if (start < 1)
- ON (fatal, *expanding_var,
- "invalid first argument to 'wordlist' function: '%" PRId64 "'", start);
+ OSS (fatal, *expanding_var, "%s: '%s'", badfirst, make_lltoa (start, buf));
+ stop = parse_numeric (argv[1], badsecond);
if (stop < 0)
- ON (fatal, *expanding_var,
- "invalid second argument to 'wordlist' function: '%" PRId64 "'", stop);
+ OSS (fatal, *expanding_var, "%s: '%s'", badsecond, make_lltoa (stop, buf));
count = stop - start + 1;
return val;
}
+#if WINDOWS32
+ /* MSVCRT does not support the 'll' format specifier. */
+# define LLFMT "I64"
+#else
+# define LLFMT "ll"
+#endif
+
+/* Convert val into a string, written to buf. buf must be large enough
+ to hold the largest possible value, plus a nul byte. Returns buf. */
+
+char *
+make_lltoa (long long val, char *buf)
+{
+ sprintf (buf, "%" LLFMT "d", val);
+ return buf;
+}
+
+char *
+make_ulltoa (unsigned long long val, char *buf)
+{
+ sprintf (buf, "%" LLFMT "u", val);
+ return buf;
+}
+
/* Compare strings *S1 and *S2.
Return negative if the first is less, positive if it is greater,
zero if they are equal. */