summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/common/outbound.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/common/outbound.c b/src/common/outbound.c
index 1e90016e..120bb241 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -423,7 +423,7 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop)
 	int type;
 	struct User *user;
 	char *at, *dot, *lastdot;
-	char username[64], fullhost[128], domain[128], tbuf[512], *p2;
+	char username[64], fullhost[128], domain[128], buf[512], *p2;
 
 	user = userlist_find (sess, mask);
 	if (user && user->hostname)  /* it's a nickname, let's find a proper ban mask */
@@ -473,7 +473,7 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop)
 		else
 			type = prefs.hex_irc_ban_type;
 
-		tbuf[0] = 0;
+		buf[0] = 0;
 		if (inet_addr (fullhost) != -1)	/* "fullhost" is really a IP number */
 		{
 			lastdot = strrchr (fullhost, '.');
@@ -487,19 +487,19 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop)
 			switch (type)
 			{
 			case 0:
-				snprintf (tbuf, TBUFSIZE, "%s%s *!*@%s.*", mode, p2, domain);
+				snprintf (buf, sizeof (buf), "%s%s *!*@%s.*", mode, p2, domain);
 				break;
 
 			case 1:
-				snprintf (tbuf, TBUFSIZE, "%s%s *!*@%s", mode, p2, fullhost);
+				snprintf (buf, sizeof (buf), "%s%s *!*@%s", mode, p2, fullhost);
 				break;
 
 			case 2:
-				snprintf (tbuf, TBUFSIZE, "%s%s *!%s@%s.*", mode, p2, username, domain);
+				snprintf (buf, sizeof (buf), "%s%s *!%s@%s.*", mode, p2, username, domain);
 				break;
 
 			case 3:
-				snprintf (tbuf, TBUFSIZE, "%s%s *!%s@%s", mode, p2, username, fullhost);
+				snprintf (buf, sizeof (buf), "%s%s *!%s@%s", mode, p2, username, fullhost);
 				break;
 			}
 		} else
@@ -507,29 +507,29 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop)
 			switch (type)
 			{
 			case 0:
-				snprintf (tbuf, TBUFSIZE, "%s%s *!*@*%s", mode, p2, domain);
+				snprintf (buf, sizeof (buf), "%s%s *!*@*%s", mode, p2, domain);
 				break;
 
 			case 1:
-				snprintf (tbuf, TBUFSIZE, "%s%s *!*@%s", mode, p2, fullhost);
+				snprintf (buf, sizeof (buf), "%s%s *!*@%s", mode, p2, fullhost);
 				break;
 
 			case 2:
-				snprintf (tbuf, TBUFSIZE, "%s%s *!%s@*%s", mode, p2, username, domain);
+				snprintf (buf, sizeof (buf), "%s%s *!%s@*%s", mode, p2, username, domain);
 				break;
 
 			case 3:
-				snprintf (tbuf, TBUFSIZE, "%s%s *!%s@%s", mode, p2, username, fullhost);
+				snprintf (buf, sizeof (buf), "%s%s *!%s@%s", mode, p2, username, fullhost);
 				break;
 			}
 		}
 
 	} else
 	{
-		snprintf (tbuf, TBUFSIZE, "%s %s", mode, mask);
+		snprintf (buf, sizeof (buf), "%s %s", mode, mask);
 	}
 	
-	return g_strdup (tbuf);
+	return g_strdup (buf);
 }
 
 static void
mbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#!/usr/bin/perl

use strict;
use warnings;

sub header {
  my $file = shift;
  open my $input, "<", $file or die "Couldn't open '$file':$!";
  my @file = <$input>;
  close $file;
  return toc(@file);
}

sub toc {
  my @lines = @_;
  for( @lines ) {
    if( /^\s*$/s ) { $_ = qq{"\\n"\n}; next; }
    if( /^\s*#/ ) { $_ = qq{"\\n"\n}; next; }
    s/\\/\\\\/g; # double the number of \'s
    s/"/\\"/g;
    s/^\s*/"/;
    s/\n/\\n"\n/;
  }
  return @lines;
}

for my $files (
	[ "xchat.pm.h",         # output file
		"lib/Xchat.pm",      # input files
		"lib/Xchat/Embed.pm",
		"lib/Xchat/List/Network.pm",
		"lib/Xchat/List/Network/Entry.pm",
		"lib/Xchat/List/Network/AutoJoin.pm",
	],
	[ "irc.pm.h",   # output file
		"lib/IRC.pm" # input file
	]
) {
	my ($output,@inputs) = @$files;

	open my $header, ">", $output or die "Couldn't open '$output': $!";

	print $header qq["BEGIN {\\n"\n];
	for my $input ( @inputs ) {
		(my $trimmed = $input) =~ s{^lib/}{};
		print $header qq["\$INC{'$trimmed'} = 'Compiled into the plugin.';\\n"\n];
	}
	print $header qq["}\\n"\n];

	for my $input ( @inputs ) {
		print $header qq["{\\n"\n];
		print $header qq{"#line 1 \\"$input\\"\\n"\n};
		print $header header( $input );
		print $header qq["}\\n"\n];
	}
	close $header;
}