📄 usage.c
字号:
/* metaflac - Command-line FLAC metadata editor
* Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "usage.h"
#include "FLAC/format.h"
#include <stdarg.h>
#include <stdio.h>
static void usage_header(FILE *out)
{
fprintf(out, "==============================================================================\n");
fprintf(out, "metaflac - Command-line FLAC metadata editor version %s\n", FLAC__VERSION_STRING);
fprintf(out, "Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson\n");
fprintf(out, "\n");
fprintf(out, "This program is free software; you can redistribute it and/or\n");
fprintf(out, "modify it under the terms of the GNU General Public License\n");
fprintf(out, "as published by the Free Software Foundation; either version 2\n");
fprintf(out, "of the License, or (at your option) any later version.\n");
fprintf(out, "\n");
fprintf(out, "This program is distributed in the hope that it will be useful,\n");
fprintf(out, "but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
fprintf(out, "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n");
fprintf(out, "GNU General Public License for more details.\n");
fprintf(out, "\n");
fprintf(out, "You should have received a copy of the GNU General Public License\n");
fprintf(out, "along with this program; if not, write to the Free Software\n");
fprintf(out, "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n");
fprintf(out, "==============================================================================\n");
}
static void usage_summary(FILE *out)
{
fprintf(out, "Usage:\n");
fprintf(out, " metaflac [options] [operations] FLACfile [FLACfile ...]\n");
fprintf(out, "\n");
fprintf(out, "Use metaflac to list, add, remove, or edit metadata in one or more FLAC files.\n");
fprintf(out, "You may perform one major operation, or many shorthand operations at a time.\n");
fprintf(out, "\n");
fprintf(out, "Options:\n");
fprintf(out, "--preserve-modtime Preserve the original modification time in spite of edits\n");
fprintf(out, "--with-filename Prefix each output line with the FLAC file name\n");
fprintf(out, " (the default if more than one FLAC file is specified)\n");
fprintf(out, "--no-filename Do not prefix each output line with the FLAC file name\n");
fprintf(out, " (the default if only one FLAC file is specified)\n");
fprintf(out, "--no-utf8-convert Do not convert tags from UTF-8 to local charset,\n");
fprintf(out, " or vice versa. This is useful for scripts.\n");
fprintf(out, "--dont-use-padding By default metaflac tries to use padding where possible\n");
fprintf(out, " to avoid rewriting the entire file if the metadata size\n");
fprintf(out, " changes. Use this option to tell metaflac to not take\n");
fprintf(out, " advantage of padding this way.\n");
}
int short_usage(const char *message, ...)
{
va_list args;
if(message) {
va_start(args, message);
(void) vfprintf(stderr, message, args);
va_end(args);
}
usage_header(stderr);
fprintf(stderr, "\n");
fprintf(stderr, "This is the short help; for full help use 'metaflac --help'\n");
fprintf(stderr, "\n");
usage_summary(stderr);
return message? 1 : 0;
}
int long_usage(const char *message, ...)
{
FILE *out = (message? stderr : stdout);
va_list args;
if(message) {
va_start(args, message);
(void) vfprintf(stderr, message, args);
va_end(args);
}
usage_header(out);
fprintf(out, "\n");
usage_summary(out);
fprintf(out, "\n");
fprintf(out, "Shorthand operations:\n");
fprintf(out, "--show-md5sum Show the MD5 signature from the STREAMINFO block.\n");
fprintf(out, "--show-min-blocksize Show the minimum block size from the STREAMINFO block.\n");
fprintf(out, "--show-max-blocksize Show the maximum block size from the STREAMINFO block.\n");
fprintf(out, "--show-min-framesize Show the minimum frame size from the STREAMINFO block.\n");
fprintf(out, "--show-max-framesize Show the maximum frame size from the STREAMINFO block.\n");
fprintf(out, "--show-sample-rate Show the sample rate from the STREAMINFO block.\n");
fprintf(out, "--show-channels Show the number of channels from the STREAMINFO block.\n");
fprintf(out, "--show-bps Show the # of bits per sample from the STREAMINFO block.\n");
fprintf(out, "--show-total-samples Show the total # of samples from the STREAMINFO block.\n");
fprintf(out, "\n");
fprintf(out, "--show-vendor-tag Show the vendor string from the VORBIS_COMMENT block.\n");
fprintf(out, "--show-tag=NAME Show all tags where the the field name matches 'NAME'.\n");
fprintf(out, "--remove-tag=NAME Remove all tags whose field name is 'NAME'.\n");
fprintf(out, "--remove-first-tag=NAME Remove first tag whose field name is 'NAME'.\n");
fprintf(out, "--remove-all-tags Remove all tags, leaving only the vendor string.\n");
fprintf(out, "--set-tag=FIELD Add a tag. The FIELD must comply with the Vorbis comment\n");
fprintf(out, " spec, of the form \"NAME=VALUE\". If there is currently\n");
fprintf(out, " no tag block, one will be created.\n");
fprintf(out, "--import-tags-from=FILE Import tags from a file. Use '-' for stdin. Each line\n");
fprintf(out, " should be of the form NAME=VALUE. Multi-line comments\n");
fprintf(out, " are currently not supported. Specify --remove-all-tags\n");
fprintf(out, " and/or --no-utf8-convert before --import-tags-from if\n");
fprintf(out, " necessary.\n");
fprintf(out, "--export-tags-to=FILE Export tags to a file. Use '-' for stdin. Each line\n");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -