JM プロジェクトは、主に Linux 関連のマニュアルページの日本語ページを翻訳・公開しています。
... , char * const argv[] , const char * optstring ); extern char * optarg ; extern int optind , opterr , optopt ; #include < getopt.h > int getopt_long(int argc , char * const argv[] , const char * optstring , const struct option * longopts , int * longi ... ndex ); int getopt_long_only(int argc , char * const argv[] , const char * optstring , const struct option * longopts , int * longindex ); gl ... ibc 向けの機能検査マクロの要件 ( feature_test_macros (7) 参照): getopt (): _POSIX_C_SOURCE >= 2 || _XOPEN_SOURCE getopt_long (), getopt_long_only (): _GNU_SOURCE 説明 getopt () 関数はコマンドラ ... ... , char * const argv[] , const char * optstring ); extern char * optarg ; extern int optind , opterr , optopt ; #include < getopt.h > int getopt_long(int argc , char * const argv[] , const char * optstring , const struct option * longopts , int * longi ... ndex ); int getopt_long_only(int argc , char * const argv[] , const char * optstring , const struct option * longopts , int * longindex ); gl ... ibc 向けの機能検査マクロの要件 ( feature_test_macros (7) 参照): getopt (): _POSIX_C_SOURCE >= 2 || _XOPEN_SOURCE getopt_long (), getopt_long_only (): _GNU_SOURCE 説明 getopt () 関数はコマンドラ ... ... , char * const argv[] , const char * optstring ); extern char * optarg ; extern int optind , opterr , optopt ; #include < getopt.h > int getopt_long(int argc , char * const argv[] , const char * optstring , const struct option * longopts , int * longi ... ndex ); int getopt_long_only(int argc , char * const argv[] , const char * optstring , const struct option * longopts , int * longindex ); gl ... ibc 向けの機能検査マクロの要件 ( feature_test_macros (7) 参照): getopt (): _POSIX_C_SOURCE >= 2 || _XOPEN_SOURCE getopt_long (), getopt_long_only (): _GNU_SOURCE 説明 getopt () 関数はコマンドラ ... ... , char * const argv[] , const char * optstring ); extern char * optarg ; extern int optind , opterr , optopt ; #include < getopt.h > int getopt_long(int argc , char * const argv[] , const char * optstring , const struct option * longopts , int * longi ... ndex ); int getopt_long_only(int argc , char * const argv[] , const char * optstring , const struct option * longopts , int * longindex ); gl ... ibc 向けの機能検査マクロの要件 ( feature_test_macros (7) 参照): getopt (): _POSIX_C_SOURCE >= 2 || _XOPEN_SOURCE getopt_long (), getopt_long_only (): _GNU_SOURCE 説明 getopt () 関数はコマンドラ ... ... , char * const argv[] , const char * optstring ); extern char * optarg ; extern int optind , opterr , optopt ; #include < getopt.h > int getopt_long(int argc , char * const argv[] , const char * optstring , const struct option * longopts , int * longi ... ndex ); int getopt_long_only(int argc , char * const argv[] , const char * optstring , const struct option * longopts , int * longindex ); gl ... ibc 向けの機能検査マクロの要件 ( feature_test_macros (7) 参照): getopt (): _POSIX_C_SOURCE >= 2 || _XOPEN_SOURCE getopt_long (), getopt_long_only (): _GNU_SOURCE 説明 getopt () 関数はコマンドラ ... ... , char * const argv[] , const char * optstring ); extern char * optarg ; extern int optind , opterr , optopt ; #include < getopt.h > int getopt_long(int argc , char * const argv[] , const char * optstring , const struct option * longopts , int * longi ... ndex ); int getopt_long_only(int argc , char * const argv[] , const char * optstring , const struct option * longopts , int * longindex ); gl ... ibc 向けの機能検査マクロの要件 ( feature_test_macros (7) 参照): getopt (): _POSIX_C_SOURCE >= 2 || _XOPEN_SOURCE getopt_long (), getopt_long_only (): _GNU_SOURCE 説明 getopt () 関数はコマンドラ ... ... , char * const argv[] , const char * optstring ); extern char * optarg ; extern int optind , opterr , optopt ; #include < getopt.h > int getopt_long(int argc , char * const argv[] , const char * optstring , const struct option * longopts , int * longi ... ndex ); int getopt_long_only(int argc , char * const argv[] , const char * optstring , const struct option * longopts , int * longindex ); gl ... ibc 向けの機能検査マクロの要件 ( feature_test_macros (7) 参照): getopt (): _POSIX_C_SOURCE >= 2 || _XOPEN_SOURCE getopt_long (), getopt_long_only (): _GNU_SOURCE 説明 getopt () 関数はコマンドラ ... ... optstring [options] [ -- ] parameters 説明 getopt は、コマンドラインのオプションを分解 ( 構文解析 ) して、シェル上の手続きによる解析作業を容易にしたり、 オプションが有効かど ... うかをチェックしたりするために使用する。 getopt は、そうしたことを行うのに GNU getopt (3) のルーティンを使っている。 getopt を呼び出すときに使用するパラメータは、2 つの部 ... 分に分けることができる。 すなわち、 getopt が解析を行うときの動作を変更するオプション部分 (上記「 書式 」の options と opstring ) と、解析の対象になるパラメータ部分 ... ... である。 igawk で使う AWK プログラムは gawk と同じであるが、 カレントディレクトリまたは検索パスのディレクトリにあるファイル getopt.awk をインクルードするために、 @include getopt.awk のような行をプログラムに書くことができる。 オプション AWK 言語と gawk が ... サポートするオプションについての完全な説明は、 gawk (1) を参照すること。 例 cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk 関連項目 gawk (1) Effective AWK Programmi ... ... 説明 getsubopt () は、 optionp で与えられたカンマ区切りのサブオプションリストを解析する。 (このようなサブオプションリストは getopt (3) を使ってコマンドラインを解釈した場合に現れることが多い。 例えば、 mount (8) の -o オプションを見るとよい。) それぞれの ... char *subopts; char *value; int opt; int readonly = 0; int readwrite = 0; char *name = NULL; int errfnd = 0; while ((opt = getopt(argc, argv, "o:")) != -1) { switch (opt) { case 'o': subopts = optarg; while (*subopts != '\0' && !errfnd) { switch (getsu ... 'ro', 'rw', " "and 'name=<value>'\n"); exit(EXIT_FAILURE); } /* Remainder of program... */ exit(EXIT_SUCCESS); } 関連項目 getopt (3) この文書について この man ページは Linux man-pages プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報 ... 日本語の文書やマニュアルを配布している個人/プロジェクトへのリンクです。