User:David/Imported Cvars

Introduction
In order to ease getting all the cvars here, I made a perl script to make a MediaWiki importable XML file. This page is here so if it ever needs to be done again, it can be done quickly and easily.

Steps

 * Get a list of cvars.
 * Run trem, and do /cvarlist. Copy said list to a file.
 * I hacked my copy of trem to show the default value instead of the current.
 * I also changed the default value to "See Text" for ones where the default contained my username or whatever.
 * Should have ~450 lines in the format 'SURIALC cvar_name "default value"'
 * Binning blank lines etc won't hurt.
 * Run script.
 * See below for the script.
 * You can change the number of items per page on line 9. Defaults to 95 per file.
 * It timed out at ~125 imported.
 * Makes files called cvars-#.xml
 * It wants that cvar list you made before on stdin.
 * Check it!.
 * This is very important, don't blame me if it goes bang.
 * Each file should start with
 * Each file should end with
 * Import!
 * I got paradox to do it. Any SysOp should be able to.  No idea how or where.

The script
use strict;
 * 1) !/usr/bin/perl -W

my $count = 0;

sub pageno {	my ($pageno) = @_; return (int(($pageno)/95+1)); }

while(my $line = ) {	if ($line =~ /^(.)(.)(.)(.)(.)(.)(.) ([^ ]+) "([^"]*)"$/)	{		# SURIALC		# S=serverinfo		# U=userinfo		# R=readonly		# I=initilisation only or something.		# A=archive		# L=latched		# C=cheat		$count++;		if (pageno($count) != pageno($count-1) or $count == 1)		{			open (FILE, ">", "cvars-" . pageno($count) . ".xml" );			print FILE "\n";		}		else		{			open (FILE, ">>", "cvars-" . pageno($count) . ".xml" );		}		print FILE " \n";		print FILE "    $8 \n";		print FILE "    \n";		print FILE "      " . `echo -n \$(date '+%Y-%m-%dT%H:%M:%SZ')` . " \n";		print FILE "       David  \n";		print FILE "      AUTO IMPORTED BY SCRIPT! User:David/Imported_Cvars for more info. \n";		print FILE "     \n";			print FILE "\n";		print FILE "\n";		print FILE "== Usage ==\n";		print FILE "\n";		print FILE " \n";		print FILE "    \n";		print FILE "  \n";		if (pageno($count) != pageno($count+1))		{			print FILE " \n";		}		close (FILE);	}	else	{		print STDERR "Unable to parse line: " . $line;	} }

open (FILE, ">>", "cvars-" . pageno($count) . ".xml" ); print FILE " \n"; close (FILE);