Subj : file_id.diz extraction function
To   : Ignatius
From : mark lewis
Date : Tue Dec 19 2017 02:11 am


On 2017 Dec 18 20:05:50, you wrote to All:

Ig>    if (pos('.zip',fn)<>0) then fpsystem('unzip -L -o '+fn+' file_id.diz -d
Ig> '+general.temppath+cstr(node)+'/ARC/ >/dev/null')
Ig>    else if (pos('.lzh',fn)<>0) then fpsystem('lha e f '+fn+' file_id.diz
Ig> '+general.temppath+cstr(node)+'/ARC/ >/dev/null')
Ig>    else if (pos('.arj',fn)<>0) then fpsystem('arj e f '+fn+' file_id.diz
Ig> '+general.temppath+cstr(node)+'/ARC/ >/dev/null')
Ig>    else if (pos('.rar',fn)<>0) then fpsystem('unrar x -cl '+fn+'
Ig> file_id.diz '+general.temppath+cstr(node)+'/ARC/ >/dev/null');

these extrtact the file_id.diz file... the whole file... there's no way to
extract only part of it...

Ig>      if (exist('/home/rg/TEMP' + cstr(node) + '/ARC/file_id.diz'))
Ig> then
Ig>      assign(T,'/home/rg/TEMP' +cstr(node) + '/ARC/file_id.diz');
Ig>      reset(T);
Ig>         if (IOResult <> 0) then exit;
Ig>         star('Importing description.');
Ig>         Index := 1;
Ig>         erase(T);
Ig> end;

nothing here does anything with the file except where you assign it, reset it,
and then erase it... you don't ever read it... you don't even have a begin and
end inside the "if" statement...

Ig> The problem is that it only extracts the first line of the file_id.diz.
Ig> Anyone have any ideas?

nope, sorry...

but i do have a question... why are you using general.temppath+cstr(node) in
the extraction lines but you have hardcoded /home/rg/TEMP+cstr(node) in the
importing part? if i had to guess, general.temppath contains /home/rg/TEMP...

but that brings up something else... why keep calling cstr over and over and
over... build your string one time and use it over and over... the code will be
much more efficient...

 eg: mytempARCpath:=general.temppath+cstr(node)+'/ARC/';

    if (pos('.zip',fn)<>0) then fpsystem('unzip -L -o '+fn+' file_id.diz -d
 '+mytempARCpath+' >/dev/null')
    else if (pos('.lzh',fn)<>0) then fpsystem('lha e f '+fn+' file_id.diz
 '+mytempARCpath+' >/dev/null')
    else if (pos('.arj',fn)<>0) then fpsystem('arj e f '+fn+' file_id.diz
 '+mytempARCpath+' >/dev/null')
    else if (pos('.rar',fn)<>0) then fpsystem('unrar x -cl '+fn+' file_id.diz
'+mytempARCpath+' >/dev/null');

      if (exist(mytempARCpath + 'file_id.diz')) then
      BEGIN <-- missing in original code
      assign(T,mytempARCpath + 'file_id.diz');
      reset(T);
         if (IOResult <> 0) then exit;
         star('Importing description.');
         Index := 1;
         erase(T);
      END; <-- missing in original code
 end;


)\/(ark

Always Mount a Scratch Monkey
Do you manage your own servers? If you are not running an IDS/IPS yer doin' it
wrong...
... It's good to be children sometimes and never better than at Christmas.
---
* Origin:  (1:3634/12.73)