Extract ruby_api_version_name

This commit is contained in:
Nobuyoshi Nakada 2025-08-14 09:10:12 +09:00 committed by Nobuyoshi Nakada
parent c8233db221
commit 9b576cd625
4 changed files with 23 additions and 16 deletions

9
ruby.c
View file

@ -61,7 +61,6 @@
#include "ruby/util.h"
#include "ruby/version.h"
#include "ruby/internal/error.h"
#include "version.h"
#define singlebit_only_p(x) !((x) & ((x)-1))
STATIC_ASSERT(Qnil_1bit_from_Qfalse, singlebit_only_p(Qnil^Qfalse));
@ -302,6 +301,8 @@ ruby_show_usage_line(const char *name, const char *secondary, const char *descri
description, help, highlight, width, columns);
}
RUBY_EXTERN const char ruby_api_version_name[];
static void
usage(const char *name, int help, int highlight, int columns)
{
@ -404,9 +405,9 @@ usage(const char *name, int help, int highlight, int columns)
unsigned int w = (columns > 80 ? (columns - 79) / 2 : 0) + 16;
#define SHOW(m) show_usage_line(&(m), help, highlight, w, columns)
printf("%sUsage:%s %s [options] [--] [filepath] [arguments]\n\n", sb, se, name);
printf("Details and examples at https://docs.ruby-lang.org/en/%s/ruby/options_md.html\n",
RUBY_PATCHLEVEL == -1 ? "master" : STRINGIZE(RUBY_VERSION_MAJOR) "." STRINGIZE(RUBY_VERSION_MINOR));
printf("%sUsage:%s %s [options] [--] [filepath] [arguments]\n", sb, se, name);
printf("\n""Details and examples at https://docs.ruby-lang.org/en/%s/ruby/options_md.html\n",
ruby_api_version_name);
for (i = 0; i < num; ++i)
SHOW(usage_msg[i]);