#endif
};
+extern int line;
+
/* Your shared library should call one of these. */
extern void register_match(struct iptables_match *me);
extern void register_target(struct iptables_target *me);
*
* This code is distributed under the terms of GNU GPL v2
*
- * $Id: iptables-restore.c,v 1.22 2002/08/07 09:07:41 laforge Exp $
+ * $Id: iptables-restore.c,v 1.23 2003/03/03 08:05:07 laforge Exp $
*/
#include <getopt.h>
{
iptc_handle_t handle;
char buffer[10240];
- unsigned int line = 0;
int c;
char curtable[IPT_TABLE_MAXNAMELEN + 1];
FILE *in;
program_name = "iptables-restore";
program_version = IPTABLES_VERSION;
+ line = 0;
#ifdef NO_SHARED_LIBS
init_extensions();
{ 0 }
};
+/* we need this for iptables-restore. iptables-restore.c sets line to the
+ * current line of the input file, in order to give a more precise error
+ * message. iptables itself doesn't need this, so it is initialized to the
+ * magic number of -1 */
+int line = -1;
+
#ifndef __OPTIMIZE__
struct ipt_entry_target *
ipt_get_target(struct ipt_entry *e)
void
exit_tryhelp(int status)
{
+ if (line =! -1)
+ fprintf(stderr, "Error occured at line: %d\n", line);
fprintf(stderr, "Try `%s -h' or '%s --help' for more information.\n",
program_name, program_name );
exit(status);