#!/usr/local/bin/perl
$rcs
=
"/usr/local/bin"
;
$ci
=
"$rcs/ci"
;
$perm
= 0755;
(
$ACCOUNT
,
$PASSWORD
,
$path
) =
@ARGV
;
chomp
(
$path
= `pwd`)
if
(!
$path
);
$c
= ars_Login(
"localhost"
,
$ACCOUNT
,
$PASSWORD
);
die
"login error: $ars_errstr\n"
unless
defined
(
$c
);
@schema
= ars_GetListSchema(
$c
, 0, 1024);
@active
= ars_GetListActiveLink(
$c
);
@filter
= ars_GetListFilter(
$c
);
@escal
= ars_GetListEscalation(
$c
);
@menu
= ars_GetListCharMenu(
$c
);
@admin_ext
= ars_GetListAdminExtension(
$c
);
sub
name_to_path {
my
$name
=
shift
;
$name
=~ s/ /_/g;
$name
=~ s/\//:/g;
return
$name
;
}
sub
dump_type {
my
(
$path
,
$type
,
$names
) =
@_
;
if
(! -d
"$path"
) {
mkdir
"$path"
,
$perm
||
die
"can't create directory $path"
;
mkdir
"$path/RCS"
,
$perm
||
die
"can't create directory $path/RCS"
;
}
foreach
$name
(
@$names
) {
$val
= ars_Export(
$c
,
""
,
$type
,
$name
);
$val
=~ s/^
$name
= name_to_path(
$name
);
open
DUMP,
"> $path/$name"
||
die
"can't write file $path/$name"
;
print
DUMP
$val
;
close
DUMP;
$name
=~ s/
'/'
\\
''
/;
system
(
"$ci -l -q '$path/$name'"
);
}
}
dump_type(
"$path/schema"
,
"Schema"
, \
@schema
);
dump_type(
"$path/active"
,
"Active_Link"
, \
@active
);
dump_type(
"$path/filter"
,
"Filter"
, \
@filter
);
dump_type(
"$path/escalation"
,
"Escalation"
, \
@escal
);
dump_type(
"$path/menu"
,
"Char_Menu"
, \
@menu
);
dump_type(
"$path/admin_ext"
,
"Admin_Ext"
, \
@admin_ext
);