Imported Upstream version 1.8.7
[debian/sudo] / plugins / sudoers / regress / logging / check_wrap.c
index 2b904d929096d863186fd3964b0afcc29370e632..0791fa384e3e600a5b343bb327f5d7074bc96330 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 Todd C. Miller <Todd.Miller@courtesan.com>
+ * Copyright (c) 2011-2013 Todd C. Miller <Todd.Miller@courtesan.com>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
 # include <strings.h>
 #endif /* HAVE_STRINGS_H */
 
+#define SUDO_ERROR_WRAP 0
+
 #include "missing.h"
 #include "error.h"
+#include "sudo_plugin.h"
 
 extern void writeln_wrap(FILE *fp, char *line, size_t len, size_t maxlen);
 
+__dso_public int main(int argc, char *argv[]);
+
 static void
 usage(void)
 {
@@ -56,12 +61,16 @@ main(int argc, char *argv[])
     char *cp, *dash, *line, lines[2][2048];
     int which = 0;
 
+#if !defined(HAVE_GETPROGNAME) && !defined(HAVE___PROGNAME)
+    setprogname(argc > 0 ? argv[0] : "check_wrap");
+#endif
+
     if (argc != 2)
        usage();
 
     fp = fopen(argv[1], "r");
     if (fp == NULL)
-       errorx(1, "unable to open %s", argv[1]);
+       fatalx("unable to open %s", argv[1]);
 
     /*
      * Each test record consists of a log entry on one line and a list of
@@ -95,9 +104,3 @@ main(int argc, char *argv[])
 
     exit(0);
 }
-
-void
-cleanup(int gotsig)
-{
-    return;
-}