Skip to content

Commit

Permalink
common: Rename tool.h to options.h
Browse files Browse the repository at this point in the history
As the interface provided by tool.h is sorely for command-line option
parsing, options.h would be a better name.  This also allows
consumers (the p11-kit and trust commands) to factor out shared
utilities under the name of p11-kit/tool.[ch] or trust/tool.[ch].

Signed-off-by: Daiki Ueno <[email protected]>
  • Loading branch information
ueno committed Jan 2, 2024
1 parent 81715a2 commit a50af66
Show file tree
Hide file tree
Showing 27 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion common/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ libp11_test_la_SOURCES = \
$(NULL)

libp11_tool_la_SOURCES = \
common/options.c common/options.h \
common/print.c common/print.h \
common/tool.c common/tool.h \
$(NULL)

if !OS_WIN32
Expand Down
2 changes: 1 addition & 1 deletion common/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ if get_option('test')
endif

libp11_tool_sources = [
'options.c'
'print.c',
'tool.c'
]

if host_system != 'windows'
Expand Down
2 changes: 1 addition & 1 deletion common/tool.c → common/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
#define _(x) (x)
#endif

#include "tool.h"
#include "options.h"

static char
short_option (int opt)
Expand Down
6 changes: 3 additions & 3 deletions common/tool.h → common/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
* Author: Stef Walter <[email protected]>
*/

#ifndef P11_TOOL_H_
#define P11_TOOL_H_
#ifndef P11_OPTIONS_H_
#define P11_OPTIONS_H_

#include <getopt.h>

Expand Down Expand Up @@ -62,4 +62,4 @@ int p11_tool_getopt (int argc,
void p11_tool_usage (const p11_tool_desc *usages,
const struct option *longopts);

#endif /* P11_TOOL_H_ */
#endif /* P11_OPTIONS_H_ */
2 changes: 1 addition & 1 deletion p11-kit/add-profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "debug.h"
#include "iter.h"
#include "message.h"
#include "tool.h"
#include "options.h"

#ifdef OS_UNIX
#include "tty.h"
Expand Down
2 changes: 1 addition & 1 deletion p11-kit/delete-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "debug.h"
#include "iter.h"
#include "message.h"
#include "tool.h"
#include "options.h"

#ifdef OS_UNIX
#include "tty.h"
Expand Down
2 changes: 1 addition & 1 deletion p11-kit/delete-profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "debug.h"
#include "iter.h"
#include "message.h"
#include "tool.h"
#include "options.h"

#ifdef OS_UNIX
#include "tty.h"
Expand Down
2 changes: 1 addition & 1 deletion p11-kit/export-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include "iter.h"
#include "message.h"
#include "pem.h"
#include "tool.h"
#include "options.h"

#ifdef OS_UNIX
#include "tty.h"
Expand Down
2 changes: 1 addition & 1 deletion p11-kit/generate-keypair.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "debug.h"
#include "iter.h"
#include "message.h"
#include "tool.h"
#include "options.h"

#ifdef OS_UNIX
#include "tty.h"
Expand Down
2 changes: 1 addition & 1 deletion p11-kit/import-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "iter.h"
#include "message.h"
#include "pem.h"
#include "tool.h"
#include "options.h"

#ifdef OS_UNIX
#include "tty.h"
Expand Down
2 changes: 1 addition & 1 deletion p11-kit/list-mechanisms.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "message.h"
#include "pkcs11.h"
#include "print.h"
#include "tool.h"
#include "options.h"
#include "uri.h"

#include <assert.h>
Expand Down
2 changes: 1 addition & 1 deletion p11-kit/list-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include "iter.h"
#include "message.h"
#include "print.h"
#include "tool.h"
#include "options.h"

#ifdef OS_UNIX
#include "tty.h"
Expand Down
2 changes: 1 addition & 1 deletion p11-kit/list-profiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include "debug.h"
#include "iter.h"
#include "message.h"
#include "tool.h"
#include "options.h"

#ifdef OS_UNIX
#include "tty.h"
Expand Down
2 changes: 1 addition & 1 deletion p11-kit/list-tokens.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "iter.h"
#include "message.h"
#include "print.h"
#include "tool.h"
#include "options.h"

#include <assert.h>
#include <limits.h>
Expand Down
2 changes: 1 addition & 1 deletion p11-kit/lists.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#include "message.h"
#include "p11-kit.h"
#include "print.h"
#include "tool.h"
#include "options.h"
#include "uri.h"

#ifdef ENABLE_NLS
Expand Down
2 changes: 1 addition & 1 deletion p11-kit/p11-kit.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#endif
#define N_(x) (x)

#include "tool.h"
#include "options.h"

int p11_kit_list_modules (int argc,
char *argv[]);
Expand Down
2 changes: 1 addition & 1 deletion p11-kit/print-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "conf.h"
#include "debug.h"
#include "message.h"
#include "tool.h"
#include "options.h"

#include <assert.h>
#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion p11-kit/remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include "message.h"
#include "p11-kit.h"
#include "remote.h"
#include "tool.h"
#include "options.h"

#include <assert.h>
#include <errno.h>
Expand Down
2 changes: 1 addition & 1 deletion p11-kit/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include "path.h"
#include "p11-kit.h"
#include "remote.h"
#include "tool.h"
#include "options.h"

#include <assert.h>
#include <errno.h>
Expand Down
2 changes: 1 addition & 1 deletion po/POTFILES.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# List of source files which contain translatable strings.
common/options.c
common/persist.c
common/tool.c
p11-kit/add-profile.c
p11-kit/conf.c
p11-kit/delete-object.c
Expand Down
2 changes: 1 addition & 1 deletion subprojects/pkcs11-json
Submodule pkcs11-json updated 1 files
+1 −1 Makefile.am
2 changes: 1 addition & 1 deletion trust/anchor.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "extract.h"
#include "message.h"
#include "parser.h"
#include "tool.h"
#include "options.h"
#include "pkcs11x.h"

#include "p11-kit/iter.h"
Expand Down
2 changes: 1 addition & 1 deletion trust/check-format.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "message.h"
#include "persist.h"
#include "print.h"
#include "tool.h"
#include "options.h"

#include <assert.h>
#include <errno.h>
Expand Down
2 changes: 1 addition & 1 deletion trust/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include "enumerate.h"
#include "message.h"
#include "persist.h"
#include "tool.h"
#include "options.h"
#include "url.h"

#include "p11-kit/iter.h"
Expand Down
2 changes: 1 addition & 1 deletion trust/extract.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "path.h"
#include "pkcs11x.h"
#include "save.h"
#include "tool.h"
#include "options.h"
#include "digest.h"

#include "p11-kit/iter.h"
Expand Down
2 changes: 1 addition & 1 deletion trust/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include "message.h"
#include "pkcs11x.h"
#include "print.h"
#include "tool.h"
#include "options.h"
#include "url.h"

#include "p11-kit/iter.h"
Expand Down
2 changes: 1 addition & 1 deletion trust/trust.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include "debug.h"
#include "message.h"
#include "path.h"
#include "tool.h"
#include "options.h"

#include <assert.h>
#include <ctype.h>
Expand Down

0 comments on commit a50af66

Please sign in to comment.