00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 #include <time.h>
00010 
00011 #include "global.h"
00012 #include "waa.h"
00013 #include "helper.h"
00014 #include "options.h"
00015 #include "url.h"
00016 #include "build.h"
00017 
00018 
00034 int bld__work(struct estat *root, int argc, char *argv[])
00035 {
00036     int status;
00037 
00038     STOPIF( waa__find_base(root, &argc, &argv), NULL);
00039     STOPIF( url__load_list(NULL, 0), NULL);
00040     
00041 
00042     current_url=urllist[urllist_count-1];
00043     STOPIF( waa__build_tree(root), NULL);
00044     DEBUGP("build tree, now saving");
00045     STOPIF( waa__output_tree(root), NULL);
00046 
00047 ex:
00048     return status;
00049 }
00050 
00051 
00077 int delay__work(struct estat *root, int argc, char *argv[])
00078 {
00079     int status;
00080     int i;
00081     time_t last;
00082     struct sstat_t st;
00083     char *filename, *eos;
00084     char *list[]= { WAA__DIR_EXT, WAA__URLLIST_EXT };
00085 
00086 
00087     STOPIF( waa__find_base(root, &argc, &argv), NULL);
00088     if (opt__is_verbose() > 0)
00089         printf("Waiting on WC root \"%s\"\n", wc_path);
00090 
00091     last=0;
00092     for(i=0; i<sizeof(list)/sizeof(list[0]); i++)
00093     {
00094         STOPIF( waa__get_waa_directory(wc_path, &filename, &eos, NULL,
00095                     waa__get_gwd_flag(list[i])), NULL);
00096         strcpy(eos, list[i]);
00097 
00098         status=hlp__lstat(filename, &st);
00099         DEBUGP("stat(%s) returns status %d; %llu.%03u=%24.24s",
00100                 filename, status,
00101                 (t_ull)st.mtim.tv_sec, (unsigned int)(st.mtim.tv_nsec/1000000),
00102                 ctime(&st.mtim.tv_sec));
00103 
00104         if (status == ENOENT)
00105         {
00106             
00107         }
00108         else
00109         {
00110             STOPIF( status, NULL);
00111             if (st.mtim.tv_sec > last) last=st.mtim.tv_sec;
00112         }
00113     }
00114 
00115     DEBUGP("waiting until %llu", (t_ull)last);
00116     opt__set_int(OPT__DELAY, PRIO_MUSTHAVE, -1);
00117     STOPIF( hlp__delay(last, 1), NULL);
00118 
00119 ex:
00120     return status;
00121 }
00122