int main(){ ps = new PagingSystem(32, 1024, 4); test_dir(); test_store(); test_dir(); test_delete(); test_dir(); test_read(); }
void ft_cd(t_data *uni) { char *str; int m; char *pwd; pwd = (char *)malloc(sizeof(char) * 2000); m = 0; uni->i = 2; pwd = getcwd(pwd, 2000); str = ft_strdup(uni->buf); while (uni->i >= 0) { str[uni->i] = ' '; uni->i--; } str = ft_strtrim(str); if ((uni->i = chdir(str)) == -1) { ft_send(uni->cs, 0, "ERROR wrong path\n", 17); free(str); free(pwd); return ; } test_dir(uni, pwd); free(str); free(pwd); }
void test_file(device_t * devp) { printfk("\n\rFile test begin:\n\r"); test_rfs(devp); test_dir(devp); chk_rfsbitmap(devp); test_allocblk(devp); test_fsys(devp); printfk("File test end.\n\r"); //hal_sysdie("test rfs run"); return; }
int main(void){ rng = gsl_rng_alloc (gsl_rng_taus); gsl_rng_set(rng, seed); printf("%d\n", seed); test_multinomial(); test_dirichlet(); test_bivariate_gaussian(); test_dir(); test_shuffle(); return 0; }
/* * Open the log file. Takes care of detecting an already-existing * file and asking the user whether they want to append, overwrite * or cancel logging. */ void logfopen(void *handle) { struct LogContext *ctx = (struct LogContext *)handle; struct tm tm; FILE *fp; int mode; /* Prevent repeat calls */ if (ctx->state != L_CLOSED) return; if (!ctx->logtype) return; tm = ltime(); /* substitute special codes in file name */ if (ctx->currlogfilename) filename_free(ctx->currlogfilename); ctx->currlogfilename = xlatlognam(conf_get_filename(ctx->conf, CONF_logfilename), conf_get_str(ctx->conf, CONF_host), conf_get_int(ctx->conf, CONF_port), &tm); #ifdef PERSOPORT test_dir( /*&*/ctx->currlogfilename ) ; #endif fp = f_open(ctx->currlogfilename, "r", FALSE); /* file already present? */ if (fp) { int logxfovr = conf_get_int(ctx->conf, CONF_logxfovr); fclose(fp); if (logxfovr != LGXF_ASK) { mode = ((logxfovr == LGXF_OVR) ? 2 : 1); } else mode = askappend(ctx->frontend, ctx->currlogfilename, logfopen_callback, ctx); } else mode = 2; /* create == overwrite */ if (mode < 0) ctx->state = L_OPENING; else logfopen_callback(ctx, mode); /* open the file */ }
/* * Open the log file. Takes care of detecting an already-existing * file and asking the user whether they want to append, overwrite * or cancel logging. */ void logfopen(void *handle) { struct LogContext *ctx = (struct LogContext *)handle; struct tm tm; int mode; /* Prevent repeat calls */ if (ctx->state != L_CLOSED) return; if (!ctx->cfg.logtype) return; tm = ltime(); /* substitute special codes in file name */ xlatlognam(&ctx->currlogfilename, ctx->cfg.logfilename,ctx->cfg.host, &tm); #ifdef PERSOPORT test_dir( &ctx->currlogfilename ) ; #endif ctx->lgfp = f_open(ctx->currlogfilename, "r", FALSE); /* file already present? */ if (ctx->lgfp) { fclose(ctx->lgfp); if (ctx->cfg.logxfovr != LGXF_ASK) { mode = ((ctx->cfg.logxfovr == LGXF_OVR) ? 2 : 1); } else mode = askappend(ctx->frontend, ctx->currlogfilename, logfopen_callback, ctx); } else mode = 2; /* create == overwrite */ if (mode < 0) ctx->state = L_OPENING; else logfopen_callback(ctx, mode); /* open the file */ }