diff options
| author | Rich Megginson <rmeggins@redhat.com> | 2007-06-15 22:11:15 +0000 |
|---|---|---|
| committer | Rich Megginson <rmeggins@redhat.com> | 2007-06-15 22:11:15 +0000 |
| commit | 0046d389d23bd217e3109949064c33de07dbc017 (patch) | |
| tree | fe3269e4ba221280d607cf4c54f17c596fa8adab /ldap/admin/src/scripts/Resource.pm | |
| parent | 1698cb64cfd185dfee586169a3daef252e97f07a (diff) | |
| download | ds-0046d389d23bd217e3109949064c33de07dbc017.tar.gz ds-0046d389d23bd217e3109949064c33de07dbc017.tar.xz ds-0046d389d23bd217e3109949064c33de07dbc017.zip | |
Resolves: bug 237356
Description: Move DS Admin Code into Admin Server
Reviewed by: nhosoi (Thanks!)
Fix Description: 1) Since we moved the o=NetscapeRoot code out of cfg_sspt.c, we no longer need to create the suffix and backend in create_instance.c
2) Added code to enable/disable dialogs e.g. for dialogs that can change the flow conditionally
3) Added code to allow the user to backup to the first prompt on a dialog, for dialogs with many prompts
4) Allow continuation lines in Resource files, instead of having to have embedded \n chars. This allows easier editing and layout.
5) Added an addSuffix function
6) Moved the register_servers.pl code from admin server into DS Util.pm and made it a little more general purpose.
Platforms tested: RHEL4
Diffstat (limited to 'ldap/admin/src/scripts/Resource.pm')
| -rw-r--r-- | ldap/admin/src/scripts/Resource.pm | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/ldap/admin/src/scripts/Resource.pm b/ldap/admin/src/scripts/Resource.pm index a8cb62a5..4bc52a74 100644 --- a/ldap/admin/src/scripts/Resource.pm +++ b/ldap/admin/src/scripts/Resource.pm @@ -74,19 +74,45 @@ sub read { } for my $filename (@{$self->{filenames}}) { + my $incontinuation = 0; + my $curkey; open RES, $filename or die "Error: could not open resource file $filename: $!"; while (<RES>) { - next if (/^\s*$/); # skip blank lines - next if (/^\s*\#/); # skip comment lines + my $iscontinuation; + chop; # trim trailing newline + if (/^\s*$/) { # skip blank/empty lines + $incontinuation = 0; + next; + } + if (/^\s*\#/) { # skip comment lines + $incontinuation = 0; + next; + } # read name = value pairs like this # bol whitespace* name whitespace* '=' whitespace* value eol # the value will include any trailing whitespace - if (/^\s*(.*?)\s*=\s*(.*?)$/) { - $self->{res}->{$1} = $2; + if (/\\$/) { + chop; + $iscontinuation = 1; + } + if ($incontinuation) { + $self->{res}->{$curkey} .= "\n" . $_; + } elsif (/^\s*(.*?)\s*=\s*(.*?)$/) { # replace \n with real newline - $self->{res}->{$1} =~ s/\\n/\n/g; + if ($curkey) { + $self->{res}->{$curkey} =~ s/\\n/\n/g; + } + $curkey = $1; + $self->{res}->{$curkey} = $2; + } + if ($iscontinuation) { # if line ends with a backslash, continue the data on the next line + $incontinuation = 1; + } else { + $incontinuation = 0; } } + # replace \n with real newline + $self->{res}->{$curkey} =~ s/\\n/\n/g; close RES; } } |
