X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/e717686ac14c00c5836e5f8742ff7a6cd7f62b69..81e41406f4027dfef50dcd5ef33403661bea5995:/bandb/bandb.c?ds=sidebyside diff --git a/bandb/bandb.c b/bandb/bandb.c index 2d272a1f..769f6fe4 100644 --- a/bandb/bandb.c +++ b/bandb/bandb.c @@ -26,14 +26,12 @@ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * - * $Id: bandb.c 26094 2008-09-19 15:33:46Z androsyn $ */ #include "setup.h" -#include +#include #include #include "rsdb.h" -#include "common.h" +#include "ircd_defs.h" #define MAXPARA 10 @@ -161,11 +159,11 @@ list_bans(void) for(j = 0; j < table.row_count; j++) { if(i == BANDB_KLINE) - rb_snprintf(buf, sizeof(buf), "%c %s %s %s :%s", + snprintf(buf, sizeof(buf), "%c %s %s %s :%s", bandb_letter[i], table.row[j][0], table.row[j][1], table.row[j][2], table.row[j][3]); else - rb_snprintf(buf, sizeof(buf), "%c %s %s :%s", + snprintf(buf, sizeof(buf), "%c %s %s :%s", bandb_letter[i], table.row[j][0], table.row[j][2], table.row[j][3]); @@ -238,6 +236,9 @@ parse_request(rb_helper *helper) } +static void +error_cb(rb_helper *helper) __attribute__((noreturn)); + static void error_cb(rb_helper *helper) { @@ -255,9 +256,9 @@ dummy_handler(int sig) #endif static void -setup_signals() +setup_signals(void) { -#ifndef WINDOWS +#ifndef _WIN32 struct sigaction act; act.sa_flags = 0; @@ -284,13 +285,16 @@ setup_signals() } +static void +db_error_cb(const char *errstr) __attribute__((noreturn)); + static void db_error_cb(const char *errstr) { char buf[256]; - rb_snprintf(buf, sizeof(buf), "! :%s", errstr); + snprintf(buf, sizeof(buf), "! :%s", errstr); rb_helper_write(bandb_helper, "%s", buf); - rb_sleep(2 << 30, 0); + rb_sleep(1 << 30, 0); exit(1); } @@ -298,14 +302,13 @@ int main(int argc, char *argv[]) { setup_signals(); - bandb_helper = rb_helper_child(parse_request, error_cb, NULL, NULL, NULL, 256, 256, 256, 256); /* XXX fix me */ + bandb_helper = rb_helper_child(parse_request, error_cb, NULL, NULL, NULL, 256, 256, 256); /* XXX fix me */ if(bandb_helper == NULL) { fprintf(stderr, - "This is ircd-ratbox bandb. You aren't supposed to run me directly. Maybe you want bantool?\n"); + "This is the charybdis bandb for internal ircd use.\n"); fprintf(stderr, - "However I will print my Id tag $Id: bandb.c 26094 2008-09-19 15:33:46Z androsyn $\n"); - fprintf(stderr, "Have a nice day\n"); + "You aren't supposed to run me directly (did you want bantool?). Exiting.\n"); exit(1); } rsdb_init(db_error_cb);