static int lame_version_print(FILE * const fp) { const char *b = get_lame_os_bitness(); const char *v = get_lame_version(); const char *u = get_lame_url(); const size_t lenb = strlen(b); const size_t lenv = strlen(v); const size_t lenu = strlen(u); const size_t lw = 80; /* line width of terminal in characters */ const size_t sw = 16; /* static width of text */ if (lw >= lenb + lenv + lenu + sw || lw < lenu + 2) /* text fits in 80 chars per line, or line even too small for url */ if (lenb > 0) fprintf(fp, "LAME %s version %s (%s)\n\n", b, v, u); else fprintf(fp, "LAME version %s (%s)\n\n", v, u); else /* text too long, wrap url into next line, right aligned */ if (lenb > 0) fprintf(fp, "LAME %s version %s\n%*s(%s)\n\n", b, v, lw - 2 - lenu, "", u); else fprintf(fp, "LAME version %s\n%*s(%s)\n\n", v, lw - 2 - lenu, "", u); if (LAME_ALPHA_VERSION) fprintf(fp, "warning: alpha versions should be used for testing only\n\n"); return 0; }
static void id3v2AddLameVersion(lame_internal_flags * gfc) { char buffer[1024]; const char *b = get_lame_os_bitness(); const char *v = get_lame_version(); const char *u = get_lame_url(); const size_t lenb = strlen(b); if (lenb > 0) { sprintf(buffer, "LAME %s version %s (%s)", b, v, u); } else { sprintf(buffer, "LAME version %s (%s)", v, u); } copyV1ToV2(gfc, ID_ENCODER, buffer); }