1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
if (word(2 $loadinfo()) != 'pf') {
load -pf $word(1 $loadinfo());
return;
};
# Copyright (c) 2006 EPIC Software Labs
# Written by BlackJac@EFNet
#
# Version: 1.1.2006.12.11.1
#
# This script simulates the save command of epic4 for epic5. The
# behavior should be nearly identical to the original.
package save;
alias save (args) {
@ :choice = shift(args);
@ :append = word(0 $args) == '-append' ? shift(args) : "";
if (findw($choice -alias -all -assign -bind -notify -on -server -set) > -1 && @args) {
if (!append) {
@ unlink("$args");
};
if ((save.fd = open("$args" W)) > -1) {
save.$after(- $choice);
xecho -b -c Settings saved to $args;
@ close($save.fd);
@ save.fd = [];
};
} else {
xecho -b -c Usage: save [-alias|-all|-assign|-bind|-notify|-on|-server|-set] [-append] [<path>];
};
};
alias save.alias (void) {
fe ($symbolctl(pmatch alias *)) ss {
@ write($save.fd ALIAS $ss \{$symbolctl(get $ss 1 alias value)\});
};
};
alias save.all (void) {
fe (alias assign bind notify on server set) ss {
save.$ss;
};
};
alias save.assign (void) {
fe ($remw(save.fd $symbolctl(pmatch assign *))) ss {
@ write($save.fd ASSIGN $ss $($ss));
};
};
alias save.bind (void) {
fe ($^"bindctl(map)) ss {
if ((:bind = bindctl(sequence $ss get)) != 'self_insert') {
@ write($save.fd BIND $ss $bind);
};
};
};
alias save.notify (void) {
fe ($notify()) ss {
@ write($save.fd NOTIFY $^{^}^|^[^]^\ss);
};
};
alias save.on (void) {
fe ($hookctl(list populated_lists)) ss {
fe ($hookctl(list hooks $ss)) tt {
@ write($save.fd $hookctl(get hook $tt string));
};
};
};
alias save.server (void) {
fe ($serverctl(omatch *)) ss {
@ write($save.fd SERVER -ADD $serverctl(get $ss itsname):$serverctl(get $ss port):$serverctl(get $ss password):$serverctl(get $ss nickname):$serverctl(get $ss group):$serverctl(get $ss protocol));
};
};
alias save.set (void) {
fe ($symbolctl(pmatch builtin_variable *)) ss {
@ write($save.fd SET $ss $getset($ss));
};
};
|