aboutsummaryrefslogtreecommitdiffstats
path: root/src/rotate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rotate.c')
-rw-r--r--src/rotate.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/rotate.c b/src/rotate.c
index b40ae1a..ad1752e 100644
--- a/src/rotate.c
+++ b/src/rotate.c
@@ -1,4 +1,4 @@
-/*
+/*
* rotate.c:
*
* Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
@@ -8,8 +8,11 @@
static char rcsid[] = "$Id$";
-/*
+/*
* $Log$
+ * Revision 1.9 2008/03/07 12:37:04 james
+ * *** empty log message ***
+ *
* Revision 1.8 2008/03/06 01:41:48 james
* *** empty log message ***
*
@@ -46,14 +49,13 @@ static char rcsid[] = "$Id$";
void
rotate_gzip (char *file)
{
- switch (fork ())
- {
- case 0:
- break;
- case -1:
- default:
- return;
- }
+ switch (fork ()) {
+ case 0:
+ break;
+ case -1:
+ default:
+ return;
+ }
daemon (1, 0);
execlp ("gzip", "gzip", file, (char *) 0);
@@ -72,16 +74,15 @@ rotate (char *file)
buf1 = malloc (i);
buf2 = malloc (i);
- for (i = NUM_FILES_TO_KEEP; i > 0; --i)
- {
- sprintf (buf1, "%s.%d", file, i - 1);
- sprintf (buf2, "%s.%d", file, i);
- rename (buf1, buf2);
+ for (i = NUM_FILES_TO_KEEP; i > 0; --i) {
+ sprintf (buf1, "%s.%d", file, i - 1);
+ sprintf (buf2, "%s.%d", file, i);
+ rename (buf1, buf2);
- sprintf (buf1, "%s.%d.gz", file, i - 1);
- sprintf (buf2, "%s.%d.gz", file, i);
- rename (buf1, buf2);
- }
+ sprintf (buf1, "%s.%d.gz", file, i - 1);
+ sprintf (buf2, "%s.%d.gz", file, i);
+ rename (buf1, buf2);
+ }
sprintf (buf1, "%s.%d", file, 0);
rename (file, buf1);