/* Checkpoint management for tar.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright 2007, 2013 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3, or (at your option) any later
- version.
+ This file is part of GNU tar.
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- Public License for more details.
+ GNU tar is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
- You should have received a copy of the GNU General Public License along
- with this program. If not, see <http://www.gnu.org/licenses/>. */
+ GNU tar is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <system.h>
#include "common.h"
checkpoint_compile_action (const char *str)
{
struct checkpoint_action *act;
-
+
if (strcmp (str, ".") == 0 || strcmp (str, "dot") == 0)
alloc_action (cop_dot);
else if (strcmp (str, "bell") == 0)
}
void
-checkpoint_finish_compile ()
+checkpoint_finish_compile (void)
{
if (checkpoint_option)
{
if (!checkpoint_action)
/* Provide a historical default */
- checkpoint_compile_action ("echo");
+ checkpoint_compile_action ("echo");
}
else if (checkpoint_action)
/* Otherwise, set default checkpoint rate */
checkpoint_option = DEFAULT_CHECKPOINT;
}
-char *
+static char *
expand_checkpoint_string (const char *input, bool do_write, unsigned cpn)
{
const char *opstr = do_write ? gettext ("write") : gettext ("read");
case 'u':
outlen += cpslen - 2;
break;
-
+
case 's':
outlen += opstrlen - 2;
}
case 'u':
op = stpcpy (op, cps);
break;
-
+
case 's':
op = stpcpy (op, opstr);
break;
-
+
default:
*op++ = '%';
*op++ = *ip;
{
struct checkpoint_action *p;
FILE *tty = NULL;
-
+
for (p = checkpoint_action; p; p = p->next)
{
switch (p->opcode)
fflush (tty);
}
break;
-
+
case cop_echo:
{
char *tmp;
if (!str)
{
if (do_write)
- /* TRANSLATORS: This is a ``checkpoint of write operation'',
- *not* ``Writing a checkpoint''.
- E.g. in Spanish ``Punto de comprobaci@'on de escritura'',
- *not* ``Escribiendo un punto de comprobaci@'on'' */
+ /* TRANSLATORS: This is a "checkpoint of write operation",
+ *not* "Writing a checkpoint".
+ E.g. in Spanish "Punto de comprobaci@'on de escritura",
+ *not* "Escribiendo un punto de comprobaci@'on" */
str = gettext ("Write checkpoint %u");
else
- /* TRANSLATORS: This is a ``checkpoint of read operation'',
- *not* ``Reading a checkpoint''.
- E.g. in Spanish ``Punto de comprobaci@'on de lectura'',
- *not* ``Leyendo un punto de comprobaci@'on'' */
+ /* TRANSLATORS: This is a "checkpoint of read operation",
+ *not* "Reading a checkpoint".
+ E.g. in Spanish "Punto de comprobaci@'on de lectura",
+ *not* "Leyendo un punto de comprobaci@'on" */
str = gettext ("Read checkpoint %u");
}
tmp = expand_checkpoint_string (str, do_write, checkpoint);
free (tmp);
}
break;
-
+
case cop_ttyout:
if (!tty)
tty = fopen ("/dev/tty", "w");
free (tmp);
}
break;
-
+
case cop_sleep:
sleep (p->v.time);
break;
-
+
case cop_exec:
sys_exec_checkpoint_script (p->v.command,
archive_name_cursor[0],
{
if (checkpoint_option && !(++checkpoint % checkpoint_option))
run_checkpoint_actions (do_write);
-}
-
+}