⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 init.c

📁 Linux系统备份源代码 可基于用户自定义策略实现系统、应用数据备份
💻 C
📖 第 1 页 / 共 5 页
字号:
      /*save the retry count*/      conf__retry=p[6]-'0';      conf__retry++;      debug("Retry is %d\n",conf__retry-1);      /*end of command*/      end=p;      while(*end!='\0' && *end!='\n' && *end!=' ' && *end!='\r')        end++;      /*next command*/      p=end;    }    /*Keyword 'VOLUMENAME'*/    if(!strncasecmp(p,"VOLUMENAME=",11))    {      debug("found keyword 'VOLUMENAME' at position %d\n",p-buffer);      /*end of command*/      end=p;      while(*end!='\0' && *end!='\n' && *end!='\r')        end++;      /*make sure the string dont exceed 256 characters*/      if((end-p-11)>256)      {        free(buffer);        errcode=6;        sprintf(strn,"VOLUMENAME in script is too long. Maximum 256 characters\n");        UI__Warning(strn);        return -1;      }      /*save the archivename*/      memcpy(conf__archive_name,p+11,end-p-11);      conf__archive_name[end-p-11]='\0';      debug("archive name set to \"%s\"\n",conf__archive_name);      /*next command*/      p=end;    }    /*Keyword 'INCLUDE SPECIAL FILES'*/    if(!strncasecmp(p,"INCLUDE SPECIAL FILES",21))    {      conf__special_files=1;      /*end of command*/      while(*p!='\0' && *p!='\n' && *p!='\r')        p++;    }    /* Keyword 'BEFORE=' */    if(!strncasecmp(p,"BEFORE=",7))    {      /* where does the line end ?? */      p+=7;      end=p;      while(*end!='\n' && *end!='\r' && *end!='\0')        end++;      if(end-p>1000)      {        free(buffer);        errcode=6;        sprintf(strn,"BEFORE in script is too long. Maximum 1000 characters\n");        UI__Warning(strn);        return -1;      }      memcpy(conf__before,p,end-p);      conf__before[end-p]='\0';      /*end of command*/      while(*p!='\0' && *p!='\n' && *p!='\r')        p++;    }    /*Keyword 'AFTER=' */    if(!strncasecmp(p,"AFTER=",6))    {      /* where does the line end ?? */      p+=6;      end=p;      while(*end!='\n' && *end!='\r' && *end!='\0')        end++;      if(end-p>1000)      {        free(buffer);        errcode=6;        sprintf(strn,"AFTER in script is too long. Maximum 1000 characters\n");        UI__Warning(strn);        return -1;      }      memcpy(conf__after,p,end-p);      conf__after[end-p]='\0';      /*end of command*/      while(*p!='\0' && *p!='\n' && *p!='\r')        p++;    }    /* Keyword 'EXCLUDE=' */    if(!strncasecmp(p,"EXCLUDE=",8))    {      /* where does the line end ?? */      p+=8;      end=p;      while(*end!='\n' && *end!='\r' && *end!='\0')        end++;      /* reallocate exclude list. If list is NULL, the list is allocated */      if(conf__exclude_files==NULL)        prev_length=0;      else        prev_length=strlen(conf__exclude_files);      if((new_list=(char*) realloc(conf__exclude_files,prev_length+(end-p)+2))==NULL)      {        free(buffer);        UI__Warning("Unable to reallocate exclude list..\n");        errcode=11;        return -1;      }      conf__exclude_files=new_list;      /* copy file-/dirname into buffer */      if(prev_length!=0)      {        strcat(conf__exclude_files,"\n");        prev_length++;      }      conf__exclude_files[prev_length+(end-p)]='\0';      memcpy(&conf__exclude_files[prev_length],p,end-p);      /*end of command*/      while(*p!='\0' && *p!='\n' && *p!='\r')        p++;    }    /*Keyword 'RSH=' */    if(!strncasecmp(p,"RSH=",4))    {      /* where does the line end ?? */      p+=4;      end=p;      while(*end!='\n' && *end!='\r' && *end!='\0')        end++;      if(end-p>255)      {        free(buffer);        errcode=6;        sprintf(strn,"RSH in script is too long. Maximum 255 characters\n");        UI__Warning(strn);        return -1;      }      memcpy(conf__rsh,p,end-p);      conf__rsh[end-p]='\0';      /*end of command*/      while(*p!='\0' && *p!='\n' && *p!='\r')        p++;    }    /*Keyword 'NICE=' */    if(!strncasecmp(p,"NICE=",5))    {      /* where does the line end ?? */      p+=5;      end=p;      while(*end!='\n' && *end!='\r' && *end!='\0')        end++;      if(end-p==0)      {        free(buffer);        errcode=67;        sprintf(strn,"NICE in script is missing a number\n");        UI__Warning(strn);        return -1;      }      sscanf(p,"%d",&conf__nice);      /*end of command*/      while(*p!='\0' && *p!='\n' && *p!='\r')        p++;    }    /*Keyword 'REWIND=YES' */    if(!strncasecmp(p,"REWIND=YES",10))    {      conf__force_rewind=1;      conf__force_non_rewind=0;      /*end of command*/      while(*p!='\0' && *p!='\n' && *p!='\r')        p++;    }    /*Keyword 'REWIND=NO' */    if(!strncasecmp(p,"REWIND=NO",9))    {      conf__force_rewind=0;      conf__force_non_rewind=1;      /*end of command*/      while(*p!='\0' && *p!='\n' && *p!='\r')        p++;    }    /*Keyword 'MTDEVICE=YES' */    if(!strncasecmp(p,"MTDEVICE=YES",12))    {      conf__force_mt=1;      conf__force_not_mt=0;      /*end of command*/      while(*p!='\0' && *p!='\n' && *p!='\r')        p++;    }    /*Keyword 'FOLLOW SYMLINKS' */    if(!strncasecmp(p,"FOLLOW SYMLINKS",15))    {      conf__follow_symlinks=1;      /*end of command*/      while(*p!='\0' && *p!='\n' && *p!='\r')        p++;    }    /*Keyword 'MTDEVICE=NO' */    if(!strncasecmp(p,"MTDEVICE=NO",9))    {      conf__force_mt=0;      conf__force_not_mt=1;      /*end of command*/      while(*p!='\0' && *p!='\n' && *p!='\r')        p++;    }    /*Keyword 'REPORTMAIL'*/    if(!strncasecmp(p,"REPORTMAIL=",11))    {      debug("found keyword 'REPORTMAIL' at position %d\n",p-buffer);      /*end of command*/      end=p;      while(*end!='\0' && *end!='\n' && *end!='\r')        end++;      /*make sure the string dont exceed 256 characters*/      if((end-p-11)>256)      {        free(buffer);        errcode=6;        UI__Warning("REPORTMAIL in script is too long. Maximum 256 characters\n");        return -1;      }      /* save the mail address for reports */      memcpy(conf__report_mail,p+11,end-p-11);      conf__report_mail[end-p-11]='\0';      debug("Report mail address set to \"%s\"\n",conf__report_mail);      /*next command*/      p=end;    }    /* Keyword 'SMTPHOST' */    if(!strncasecmp(p,"SMTPHOST=",9))    {      debug("found keyword 'SMTPHOST' at position %d\n",p-buffer);      /*end of command*/      end=p;      while(*end!='\0' && *end!='\n' && *end!='\r')        end++;      /*make sure the string dont exceed 256 characters*/      if((end-p-9)>256)      {        free(buffer);        errcode=6;        UI__Warning("SMTPHOST in script is too long. Maximum 256 characters\n");        return -1;      }      /* save the mail address for reports */      memcpy(conf__smtp_host,p+9,end-p-9);      conf__smtp_host[end-p-9]='\0';      debug("Smtp host set to \"%s\"\n",conf__smtp_host);      /*next command*/      p=end;    }    /* Keyword 'SMTPUSER' */    if(!strncasecmp(p,"SMTPUSER=",9))    {      debug("found keyword 'SMTPUSER' at position %d\n",p-buffer);      /*end of command*/      end=p;      while(*end!='\0' && *end!='\n' && *end!='\r')        end++;      /*make sure the string dont exceed 256 characters*/      if((end-p-9)>256)      {        free(buffer);        errcode=6;        UI__Warning("SMTPUSER in script is too long. Maximum 256 characters\n");        return -1;      }      /* save the mail address for reports */      memcpy(conf__smtp_user,p+9,end-p-9);      conf__smtp_user[end-p-9]='\0';      p = base64_encode(conf__smtp_user);      strcpy(conf__smtp_user,p);      free(p);      debug("Smtp user set to \"%s\"\n",conf__smtp_user);      /*next command*/      p=end;    }    /* Keyword 'SMTPPASS' */    if(!strncasecmp(p,"SMTPPASS=",9))    {      debug("found keyword 'SMTPPASS' at position %d\n",p-buffer);      /*end of command*/      end=p;      while(*end!='\0' && *end!='\n' && *end!='\r')        end++;      /*make sure the string dont exceed 256 characters*/      if((end-p-9)>256)      {        free(buffer);        errcode=6;        UI__Warning("SMTPPASS in script is too long. Maximum 256 characters\n");        return -1;      }      /* save the mail address for reports */      memcpy(conf__smtp_pass,p+9,end-p-9);      conf__smtp_pass[end-p-9]='\0';      p = base64_encode(conf__smtp_pass);      strcpy(conf__smtp_pass,p);      free(p);      debug("Smtp pass set to \"%s\"\n",conf__smtp_pass);      /*next command*/      p=end;    }    /* Keyword 'TYPE=TARCDRW' */    if(!strncasecmp(p,"TYPE=TARCDRW",12))    {      debug("found keyword 'TYPE=TARCDRW' at position %d\n",p-buffer);      conf__type=TARCDRW;      /*end of command*/      end=p;      while(*end!='\0' && *end!='\n' && *end!='\r')        end++;      /*next command*/      p=end;    }    /* Keyword 'TYPE=TARISO' */    if(!strncasecmp(p,"TYPE=TARISO",11))    {      debug("found keyword 'TYPE=TARISO' at position %d\n",p-buffer);      conf__type=TARISO;      /*end of command*/      end=p;      while(*end!='\0' && *end!='\n' && *end!='\r')        end++;      /*next command*/      p=end;    }    /* Keyword 'TYPE=TARCD' */    if(!strncasecmp(p,"TYPE=TARCDR",11))    {      debug("found keyword 'TYPE=TARCDR' at position %d\n",p-buffer);      conf__type=TARCDR;      /*end of command*/      end=p;      while(*end!='\0' && *end!='\n' && *end!='\r')        end++;      /*next command*/      p=end;    }    /* Keyword 'TYPE=TAR' */    if(!strncasecmp(p,"TYPE=TAR",8))    {      debug("found keyword 'TYPE=TAR' at position %d\n",p-buffer);      conf__type=TAR;      /*end of command*/      end=p;      while(*end!='\0' && *end!='\n' && *end!='\r')        end++;      /*next command*/      p=end;    }    /* Keyword 'TYPE=FILECOPY' */    if(!strncasecmp(p,"TYPE=FILECOPY",13))    {      debug("found keyword 'TYPE=FILECOPY' at position %d\n",p-buffer);      conf__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -