/*
利用wget  指令和队列 模拟实现网络爬虫
利用自己的站点wzsts.host3v.com测试了一下
有一点错误
文件运行后拿到index.html
对于连接仅仅可以拿到 html 和htm 结尾的 而.com的没有考虑(设计文件可能多)
一次测试后了解到如下问题:
1.文件应该有树形话还原网站目录
2.文本记录的连接应该分类化
项目运行需要 su 根权限进行 
因为mv命令
本项目仅仅适合在linux下运行
本项目给真真的linux 爬虫做铺垫
*/
#include<bits/stdc++.h>
using namespace std;
#include <stdlib.h>
#include <iostream>
#include <fstream>
string s("index.html");
queue<string>q;
 //略去一段
int main()
{
 //index.html
system("wget wzsts.host3v.com");

ofstream out("out.txt"); 
string mv("mv ");
string html(" html");
q.push(s);
  while(!q.empty())
   {
out<<q.front().c_str();   out<<"\n";  
if(strstr(q.front().c_str(),".html")||strstr(q.front().c_str(),".htm"))
  {
    fun(q.front().c_str()); 
    q.pop();
    string t("wget ");   t=t+s;  cout<<t.c_str()<<endl;
   system(t.c_str());
  }

string ss(q.front().c_str());
 ss=mv+ss.c_str()+html;     cout<<ss<<endl;
 system(ss.c_str());
   }

 out.close(); 
return 0;
}