Переглянути джерело

declare __getopt_msg in stdio_impl.h

it's not ideal, but the function is essentially an extended stdio
function specialized to getopt's needs. the only reason it exists is
avoiding pulling printf code into every program using getopt.
Rich Felker 6 роки тому
батько
коміт
8c1ac426e1
2 змінених файлів з 3 додано та 2 видалено
  1. 2 0
      src/internal/stdio_impl.h
  2. 1 2
      src/misc/getopt_long.c

+ 2 - 0
src/internal/stdio_impl.h

@@ -87,6 +87,8 @@ void __register_locked_file(FILE *, struct __pthread *);
 void __unlist_locked_file(FILE *);
 void __unlist_locked_file(FILE *);
 void __do_orphaned_stdio_locks(void);
 void __do_orphaned_stdio_locks(void);
 
 
+void __getopt_msg(const char *, const char *, const char *, size_t);
+
 #define feof(f) ((f)->flags & F_EOF)
 #define feof(f) ((f)->flags & F_EOF)
 #define ferror(f) ((f)->flags & F_ERR)
 #define ferror(f) ((f)->flags & F_ERR)
 
 

+ 1 - 2
src/misc/getopt_long.c

@@ -5,6 +5,7 @@
 #include <getopt.h>
 #include <getopt.h>
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
+#include "stdio_impl.h"
 
 
 extern int __optpos, __optreset;
 extern int __optpos, __optreset;
 
 
@@ -18,8 +19,6 @@ static void permute(char *const *argv, int dest, int src)
 	av[dest] = tmp;
 	av[dest] = tmp;
 }
 }
 
 
-void __getopt_msg(const char *, const char *, const char *, size_t);
-
 static int __getopt_long_core(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly);
 static int __getopt_long_core(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly);
 
 
 static int __getopt_long(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly)
 static int __getopt_long(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly)