Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit25445d9

Browse files
committed
Replace warnx by elog
1 parent62860f9 commit25445d9

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

‎pgut/getopt.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ struct option {
5757
intval;
5858
};
5959

60-
__BEGIN_DECLS
6160
intgetopt_long(int,char*const*,constchar*,
6261
conststructoption*,int*);
6362
intgetopt_long_only(int,char*const*,constchar*,
@@ -73,6 +72,5 @@ extern int optind, opterr, optopt;
7372
#define_OPTRESET_DECLARED
7473
externintoptreset;/* getopt(3) external variable */
7574
#endif
76-
__END_DECLS
7775

7876
#endif/* !_GETOPT_H_ */

‎pgut/getopt_long.c

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,23 @@
5151

5252
#include<sys/cdefs.h>
5353

54-
#include<err.h>
5554
#include<errno.h>
5655
#include"getopt.h"
5756
#include<stdlib.h>
5857
#include<string.h>
5958

59+
#defineLOG(-4)
60+
#defineINFO(-3)
61+
#defineNOTICE(-2)
62+
#defineWARNING(-1)
63+
#defineERROR1
64+
#defineFATAL2
65+
#definePANIC3
66+
67+
externvoid
68+
elog(intelevel,constchar*fmt, ...)
69+
__attribute__((format(printf,2,3)));
70+
6071
#defineGNU_COMPATIBLE/* Be more compatible, configure's use us! */
6172

6273

@@ -245,7 +256,7 @@ parse_long_options(char * const *nargv, const char *options,
245256
if (!exact_match&&second_partial_match) {
246257
/* ambiguous abbreviation */
247258
if (PRINT_ERROR)
248-
warnx(ambig,
259+
elog(WARNING,ambig,
249260
#ifdefGNU_COMPATIBLE
250261
current_dash,
251262
#endif
@@ -258,7 +269,7 @@ parse_long_options(char * const *nargv, const char *options,
258269
if (long_options[match].has_arg==no_argument
259270
&&has_equal) {
260271
if (PRINT_ERROR)
261-
warnx(noarg,
272+
elog(WARNING,noarg,
262273
#ifdefGNU_COMPATIBLE
263274
current_dash,
264275
#endif
@@ -296,7 +307,7 @@ parse_long_options(char * const *nargv, const char *options,
296307
* should be generated.
297308
*/
298309
if (PRINT_ERROR)
299-
warnx(recargstring,
310+
elog(WARNING,recargstring,
300311
#ifdefGNU_COMPATIBLE
301312
current_dash,
302313
#endif
@@ -317,7 +328,7 @@ parse_long_options(char * const *nargv, const char *options,
317328
return (-1);
318329
}
319330
if (PRINT_ERROR)
320-
warnx(illoptstring,
331+
elog(WARNING,illoptstring,
321332
#ifdefGNU_COMPATIBLE
322333
current_dash,
323334
#endif
@@ -494,11 +505,11 @@ getopt_internal(int nargc, char * const *nargv, const char *options,
494505
++optind;
495506
#ifdefGNU_COMPATIBLE
496507
if (PRINT_ERROR)
497-
warnx(posixly_correct ?illoptchar :gnuoptchar,
508+
elog(WARNING,posixly_correct ?illoptchar :gnuoptchar,
498509
optchar);
499510
#else
500511
if (PRINT_ERROR)
501-
warnx(illoptchar,optchar);
512+
elog(WARNING,illoptchar,optchar);
502513
#endif
503514
optopt=optchar;
504515
return (BADCH);
@@ -510,7 +521,7 @@ getopt_internal(int nargc, char * const *nargv, const char *options,
510521
elseif (++optind >=nargc) {/* no arg */
511522
place=EMSG;
512523
if (PRINT_ERROR)
513-
warnx(recargchar,optchar);
524+
elog(WARNING,recargchar,optchar);
514525
optopt=optchar;
515526
return (BADARG);
516527
}else/* white space */
@@ -534,7 +545,7 @@ getopt_internal(int nargc, char * const *nargv, const char *options,
534545
if (++optind >=nargc) {/* no arg */
535546
place=EMSG;
536547
if (PRINT_ERROR)
537-
warnx(recargchar,optchar);
548+
elog(WARNING,recargchar,optchar);
538549
optopt=optchar;
539550
return (BADARG);
540551
}else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp