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
00037 int bld__work(struct estat *root, int argc, char *argv[])
00038 {
00039 int status;
00040
00041 STOPIF( waa__find_base(root, &argc, &argv), NULL);
00042 STOPIF( url__load_list(NULL, 0), NULL);
00043
00044
00045 current_url=urllist[urllist_count-1];
00046
00047 root->do_userselected = 1;
00048 opt_recursive=1;
00049
00050 STOPIF( waa__build_tree(root), NULL);
00051 DEBUGP("build tree, now saving");
00052 STOPIF( waa__output_tree(root), NULL);
00053
00054 ex:
00055 return status;
00056 }
00057
00058
00090 int delay__work(struct estat *root, int argc, char *argv[])
00091 {
00092 int status;
00093 int i;
00094 time_t last;
00095 struct sstat_t st;
00096 char *filename, *eos;
00097 char *list[]= { WAA__DIR_EXT, WAA__URLLIST_EXT };
00098
00099
00100 STOPIF( waa__find_base(root, &argc, &argv), NULL);
00101 if (opt__is_verbose() > 0)
00102 printf("Waiting on WC root \"%s\"\n", wc_path);
00103
00104 last=0;
00105 for(i=0; i<sizeof(list)/sizeof(list[0]); i++)
00106 {
00107 STOPIF( waa__get_waa_directory(wc_path, &filename, &eos, NULL,
00108 waa__get_gwd_flag(list[i])), NULL);
00109 strcpy(eos, list[i]);
00110
00111 status=hlp__lstat(filename, &st);
00112 DEBUGP("stat(%s) returns status %d; %llu.%03u=%24.24s",
00113 filename, status,
00114 (t_ull)st.mtim.tv_sec, (unsigned int)(st.mtim.tv_nsec/1000000),
00115 ctime(&st.mtim.tv_sec));
00116
00117 if (status == ENOENT)
00118 {
00119
00120 }
00121 else
00122 {
00123 STOPIF( status, NULL);
00124 if (st.mtim.tv_sec > last) last=st.mtim.tv_sec;
00125 }
00126 }
00127
00128 DEBUGP("waiting until %llu", (t_ull)last);
00129 opt__set_int(OPT__DELAY, PRIO_MUSTHAVE, -1);
00130 STOPIF( hlp__delay(last, 1), NULL);
00131
00132 ex:
00133 return status;
00134 }
00135