コード例 #1
0
ファイル: parse_line.c プロジェクト: jaybi42/21sh
int			parse_line(t_line *l, t_ftl_root *hist)
{
	if (l->str == NULL)
		return (0);
	if (parse_history(l, hist) == 1)
		return (1);
	if (parse_quote(l) == 1)
		return (1);
	parse_newline(l->str, hist);
	return (0);
}
コード例 #2
0
ファイル: history.c プロジェクト: Xiaobin0860/foobillardplus
void init_history(void) {

	  char *filenames[] = {"body-bg.png","content-bg.png","feature.jpg","footer-bg.png","gradient-shadow.png","header-bg.jpg","logo.jpg","sidebar-h3-bg.jpg"};
#define ARRAYLEN 8
   char directorycheck[1024];
   char directorycheck1[1024];
   char copy_file[1024];
   int i, checktournament, checkhistory;

#ifdef USE_WIN
   strcpy(file_name,getenv("USERPROFILE"));
   strcat(file_name,"/Desktop/foobillardplus-data");
   mkdir(file_name); //build directory every time is not a problem
#elif defined(__APPLE__)
   strcpy(file_name,getenv("HOME"));
   strcat(file_name,"/Library/Application Support/Foobillard++");
   mkdir(file_name,0777); //build directory every time is not a problem
#else
   strcpy(file_name,getenv("HOME"));
   strcat(file_name,"/foobillardplus-data");
   mkdir(file_name,0777); //build directory every time is not a problem
#endif
   checktournament = check_xml("tournament.xml");
   checkhistory = check_xml("history.xml");
   if(!checkhistory || !checktournament) {
   	  //only build, if no xml-file is there
   	  //fprintf(stderr,"Call only one time\n");
#ifdef USE_WIN
      sprintf(directorycheck,"%s/html",file_name);
      mkdir(directorycheck);
      sprintf(directorycheck1,"%s/html/images",file_name);
      mkdir(directorycheck1);
#else
      sprintf(directorycheck,"%s/html",file_name);
      mkdir(directorycheck,0777);
      sprintf(directorycheck1,"%s/html/images",file_name);
      mkdir(directorycheck1,0777);
#endif
      if(!chdir("html") ) {
      	if(!checkhistory) {
         sprintf(copy_file,"%s/%s",directorycheck,"history.xsl");
         filecopy("history.xsl",copy_file);
         sprintf(copy_file,"%s/%s",directorycheck,"history.xml");
         parse_history("history.xml",copy_file);
      	}
      	if(!checktournament) {
         sprintf(copy_file,"%s/%s",directorycheck,"tournament.xsl");
         filecopy("tournament.xsl",copy_file);
         sprintf(copy_file,"%s/%s",directorycheck,"tournament.xml");
         parse_history("tournament.xml",copy_file);
      	}
         sprintf(copy_file,"%s/%s",directorycheck,"styles.css");
         filecopy("styles.css",copy_file);
         if(!chdir("images")) {
         	for(i=0;i< ARRAYLEN ;i++) {
            sprintf(copy_file,"%s/%s",directorycheck1,filenames[i]);
            filecopy(filenames[i],copy_file);
         	}
            chdir("../..");
         } else {
         	chdir("..");
         }
      }
    }
#undef ARRAYLEN
}