char *fmt_x(t_mods mods, char *out_str) { char *new_str; char *pad; int slen; slen = ft_strlen(out_str); if (mods.width != -1) { new_str = (char *)malloc(sizeof(char) * mods.width + 1); pad = (char *)malloc(sizeof(char) * (mods.width - slen)); if (mods.precision != -1 && mods.precision > slen) new_str = do_precision(new_str, pad, out_str, mods); else if (mods.precision == -1) new_str = do_width(new_str, pad, out_str, mods); } else if (mods.precision > slen) { new_str = (char *)malloc(sizeof(char) * mods.precision); pad = (char *)malloc(sizeof(char) * (mods.precision - slen)); new_str = do_precision(new_str, pad, out_str, mods); } else new_str = out_str; if (mods.flag == '#') new_str = do_flags(mods, new_str); return (new_str); }
PUBLIC int main(int ac, char **av) { int i, n_files; char **files; argc = ac; argv = av; while (--argc > 0 && (*++argv)[0] == '-') do_flags(*argv); files = argv; n_files = argc; if (debflag('v')) { fprintf(errout, "%s\n%s\n%s\n", fuzz_banner, fuzz_rcsid, fuzz_copyright); fflush(errout); } debugging = debflag('p'); init_sym(); init_type(); init_dict(); open_prelude(); read_a_file(); if (dflag) { check_file(); clear_temp((univ) NULL); } debugging = TRUE; if (n_files == 0) { /* Finished prelude, no args: read stdin */ file_name = "standard input"; yyrestart(stdin); read_a_file(); } else { for (i = 0; i < n_files; i++) { reopen_input(files[i]); yyrestart(yyin); read_a_file(); } } if (dflag) { check_file(); clear_temp((univ) NULL); } #ifdef DEBUG if (debflag('h')) dump_hash(); #endif return (n_errors > 0 ? 1 : 0); }