4567df2001-07-20Martin Nilsson string copy_to = "manual/images";
5515f02001-07-27Martin Nilsson #define DEBUG
4567df2001-07-20Martin Nilsson 
5515f02001-07-27Martin Nilsson void parse_file(string file) { if(file=="sub_manual.xml") return; string dir = getcwd()+"/"+dirname(file)+"/"; string x,y; y = Stdio.read_file(file);
4567df2001-07-20Martin Nilsson #ifdef DEBUG
5515f02001-07-27Martin Nilsson  array err = catch {
4567df2001-07-20Martin Nilsson  x = Tools.AutoDoc.ProcessXML.moveImages
5515f02001-07-27Martin Nilsson  (y, dir, copy_to); }; if(!err) {
20a38f2001-07-26Martin Nilsson  if(x!=y)
5515f02001-07-27Martin Nilsson  Stdio.write_file(file, x); } else { if(objectp(err) && _typeof(err) <= Tools.AutoDoc.AutoDocError) werror("%O\n", err); else if(arrayp(err)) werror(describe_backtrace(err)); else werror("%O\n", err);
8ed7eb2001-07-18Martin Nilsson  }
5515f02001-07-27Martin Nilsson #else x = Tools.AutoDoc.ProcessXML.moveImages (Stdio.read_file(file), dir, copy_to); if(x!=y) Stdio.write_file(directory+file, x); #endif
8ed7eb2001-07-18Martin Nilsson } int main(int num, array(string) args) {
4567df2001-07-20Martin Nilsson  if(num<3) throw( "Not enough arguments to autodoc_images.pike\n" );
5515f02001-07-27Martin Nilsson  copy_to = args[1]; foreach(args[2..], string file) parse_file( file );
8ed7eb2001-07-18Martin Nilsson  }