summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c200
1 files changed, 100 insertions, 100 deletions
diff --git a/file.c b/file.c
index 8761d47..a237174 100644
--- a/file.c
+++ b/file.c
@@ -54,11 +54,11 @@ static int
file_hash_cmp (const void *x, const void *y)
{
return_ISTRING_COMPARE (((struct file const *) x)->hname,
- ((struct file const *) y)->hname);
+ ((struct file const *) y)->hname);
}
-#ifndef FILE_BUCKETS
-#define FILE_BUCKETS 1007
+#ifndef FILE_BUCKETS
+#define FILE_BUCKETS 1007
#endif
static struct hash_table files;
@@ -103,20 +103,20 @@ lookup_file (const char *name)
#endif
while (name[0] == '.'
#ifdef HAVE_DOS_PATHS
- && (name[1] == '/' || name[1] == '\\')
+ && (name[1] == '/' || name[1] == '\\')
#else
- && name[1] == '/'
+ && name[1] == '/'
#endif
- && name[2] != '\0')
+ && name[2] != '\0')
{
name += 2;
while (*name == '/'
#ifdef HAVE_DOS_PATHS
- || *name == '\\'
+ || *name == '\\'
#endif
- )
- /* Skip following slashes: ".//foo" is "foo", not "/foo". */
- ++name;
+ )
+ /* Skip following slashes: ".//foo" is "foo", not "/foo". */
+ ++name;
}
if (*name == '\0')
@@ -369,52 +369,52 @@ remove_intermediates (int sig)
for ( ; file_slot < file_end; file_slot++)
if (! HASH_VACANT (*file_slot))
{
- struct file *f = *file_slot;
+ struct file *f = *file_slot;
/* Is this file eligible for automatic deletion?
Yes, IFF: it's marked intermediate, it's not secondary, it wasn't
given on the command line, and it's either a -include makefile or
it's not precious. */
- if (f->intermediate && (f->dontcare || !f->precious)
- && !f->secondary && !f->cmd_target)
- {
- int status;
- if (f->update_status == -1)
- /* If nothing would have created this file yet,
- don't print an "rm" command for it. */
- continue;
- if (just_print_flag)
- status = 0;
- else
- {
- status = unlink (f->name);
- if (status < 0 && errno == ENOENT)
- continue;
- }
- if (!f->dontcare)
- {
- if (sig)
- error (NILF, _("*** Deleting intermediate file '%s'"), f->name);
- else
- {
- if (! doneany)
- DB (DB_BASIC, (_("Removing intermediate files...\n")));
- if (!silent_flag)
- {
- if (! doneany)
- {
- fputs ("rm ", stdout);
- doneany = 1;
- }
- else
- putchar (' ');
- fputs (f->name, stdout);
- fflush (stdout);
- }
- }
- if (status < 0)
- perror_with_name ("unlink: ", f->name);
- }
- }
+ if (f->intermediate && (f->dontcare || !f->precious)
+ && !f->secondary && !f->cmd_target)
+ {
+ int status;
+ if (f->update_status == -1)
+ /* If nothing would have created this file yet,
+ don't print an "rm" command for it. */
+ continue;
+ if (just_print_flag)
+ status = 0;
+ else
+ {
+ status = unlink (f->name);
+ if (status < 0 && errno == ENOENT)
+ continue;
+ }
+ if (!f->dontcare)
+ {
+ if (sig)
+ error (NILF, _("*** Deleting intermediate file '%s'"), f->name);
+ else
+ {
+ if (! doneany)
+ DB (DB_BASIC, (_("Removing intermediate files...\n")));
+ if (!silent_flag)
+ {
+ if (! doneany)
+ {
+ fputs ("rm ", stdout);
+ doneany = 1;
+ }
+ else
+ putchar (' ');
+ fputs (f->name, stdout);
+ fflush (stdout);
+ }
+ }
+ if (status < 0)
+ perror_with_name ("unlink: ", f->name);
+ }
+ }
}
if (doneany && !sig)
@@ -696,23 +696,23 @@ snap_deps (void)
for (f = lookup_file (".PRECIOUS"); f != 0; f = f->prev)
for (d = f->deps; d != 0; d = d->next)
for (f2 = d->file; f2 != 0; f2 = f2->prev)
- f2->precious = 1;
+ f2->precious = 1;
for (f = lookup_file (".LOW_RESOLUTION_TIME"); f != 0; f = f->prev)
for (d = f->deps; d != 0; d = d->next)
for (f2 = d->file; f2 != 0; f2 = f2->prev)
- f2->low_resolution_time = 1;
+ f2->low_resolution_time = 1;
for (f = lookup_file (".PHONY"); f != 0; f = f->prev)
for (d = f->deps; d != 0; d = d->next)
for (f2 = d->file; f2 != 0; f2 = f2->prev)
- {
- /* Mark this file as phony nonexistent target. */
- f2->phony = 1;
+ {
+ /* Mark this file as phony nonexistent target. */
+ f2->phony = 1;
f2->is_target = 1;
- f2->last_mtime = NONEXISTENT_MTIME;
- f2->mtime_before_update = NONEXISTENT_MTIME;
- }
+ f2->last_mtime = NONEXISTENT_MTIME;
+ f2->mtime_before_update = NONEXISTENT_MTIME;
+ }
for (f = lookup_file (".INTERMEDIATE"); f != 0; f = f->prev)
/* Mark .INTERMEDIATE deps as intermediate files. */
@@ -744,22 +744,22 @@ snap_deps (void)
if (f != 0 && f->is_target)
{
if (f->deps == 0)
- ignore_errors_flag = 1;
+ ignore_errors_flag = 1;
else
- for (d = f->deps; d != 0; d = d->next)
- for (f2 = d->file; f2 != 0; f2 = f2->prev)
- f2->command_flags |= COMMANDS_NOERROR;
+ for (d = f->deps; d != 0; d = d->next)
+ for (f2 = d->file; f2 != 0; f2 = f2->prev)
+ f2->command_flags |= COMMANDS_NOERROR;
}
f = lookup_file (".SILENT");
if (f != 0 && f->is_target)
{
if (f->deps == 0)
- silent_flag = 1;
+ silent_flag = 1;
else
- for (d = f->deps; d != 0; d = d->next)
- for (f2 = d->file; f2 != 0; f2 = f2->prev)
- f2->command_flags |= COMMANDS_SILENT;
+ for (d = f->deps; d != 0; d = d->next)
+ for (f2 = d->file; f2 != 0; f2 = f2->prev)
+ f2->command_flags |= COMMANDS_SILENT;
}
f = lookup_file (".NOTPARALLEL");
@@ -799,13 +799,13 @@ file_timestamp_cons (const char *fname, time_t stamp, long int ns)
FILE_TIMESTAMP ts = product + offset;
if (! (s <= FILE_TIMESTAMP_S (ORDINARY_MTIME_MAX)
- && product <= ts && ts <= ORDINARY_MTIME_MAX))
+ && product <= ts && ts <= ORDINARY_MTIME_MAX))
{
char buf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1];
ts = s <= OLD_MTIME ? ORDINARY_MTIME_MIN : ORDINARY_MTIME_MAX;
file_timestamp_sprintf (buf, ts);
error (NILF, _("%s: Timestamp out of range; substituting %s"),
- fname ? fname : _("Current time"), buf);
+ fname ? fname : _("Current time"), buf);
}
return ts;
@@ -829,10 +829,10 @@ file_timestamp_now (int *resolution)
struct timespec timespec;
if (clock_gettime (CLOCK_REALTIME, &timespec) == 0)
{
- r = 1;
- s = timespec.tv_sec;
- ns = timespec.tv_nsec;
- goto got_time;
+ r = 1;
+ s = timespec.tv_sec;
+ ns = timespec.tv_nsec;
+ goto got_time;
}
}
# endif
@@ -841,10 +841,10 @@ file_timestamp_now (int *resolution)
struct timeval timeval;
if (gettimeofday (&timeval, 0) == 0)
{
- r = 1000;
- s = timeval.tv_sec;
- ns = timeval.tv_usec * 1000;
- goto got_time;
+ r = 1000;
+ s = timeval.tv_sec;
+ ns = timeval.tv_usec * 1000;
+ goto got_time;
}
}
# endif
@@ -871,8 +871,8 @@ file_timestamp_sprintf (char *p, FILE_TIMESTAMP ts)
if (tm)
sprintf (p, "%04d-%02d-%02d %02d:%02d:%02d",
- tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
+ tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+ tm->tm_hour, tm->tm_min, tm->tm_sec);
else if (t < 0)
sprintf (p, "%ld", (long) t);
else
@@ -971,7 +971,7 @@ print_file (const void *item)
const struct dep *d;
fputs (_("# Also makes:"), stdout);
for (d = f->also_make; d != 0; d = d->next)
- printf (" %s", dep_name (d));
+ printf (" %s", dep_name (d));
putchar ('\n');
}
if (f->last_mtime == UNKNOWN_MTIME)
@@ -999,25 +999,25 @@ print_file (const void *item)
case cs_not_started:
case cs_finished:
switch (f->update_status)
- {
- case -1:
- break;
- case 0:
- puts (_("# Successfully updated."));
- break;
- case 1:
- assert (question_flag);
- puts (_("# Needs to be updated (-q is set)."));
- break;
- case 2:
- puts (_("# Failed to be updated."));
- break;
- default:
- puts (_("# Invalid value in 'update_status' member!"));
- fflush (stdout);
- fflush (stderr);
- abort ();
- }
+ {
+ case -1:
+ break;
+ case 0:
+ puts (_("# Successfully updated."));
+ break;
+ case 1:
+ assert (question_flag);
+ puts (_("# Needs to be updated (-q is set)."));
+ break;
+ case 2:
+ puts (_("# Failed to be updated."));
+ break;
+ default:
+ puts (_("# Invalid value in 'update_status' member!"));
+ fflush (stdout);
+ fflush (stderr);
+ abort ();
+ }
break;
default:
puts (_("# Invalid value in 'command_state' member!"));