mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
Move all extern declarations into header files.
This is another cleanup I felt a need for while I was doing boolification. If you define a function or variable in one .c file and declare it extern in another, then nothing will check you haven't got the types of the two declarations mismatched - so when you're _changing_ the type, it's a pain to make sure you've caught all the copies of it. It's better to put all those extern declarations in header files, so that the declaration in the header is also in scope for the definition. Then the compiler will complain if they don't match, which is what I want.
This commit is contained in:
@ -107,8 +107,6 @@ void session_window_closed(void) {}
|
||||
void window_setup_error(const char *errmsg) {}
|
||||
#else /* GTK_CHECK_VERSION(3,0,0) */
|
||||
|
||||
extern const bool use_event_log;
|
||||
|
||||
static void startup(GApplication *app, gpointer user_data)
|
||||
{
|
||||
GMenu *menubar, *menu, *section;
|
||||
@ -216,7 +214,6 @@ GtkWidget *make_gtk_toplevel_window(GtkFrontend *frontend)
|
||||
|
||||
void launch_duplicate_session(Conf *conf)
|
||||
{
|
||||
extern const bool dup_check_launchable;
|
||||
assert(!dup_check_launchable || conf_launchable(conf));
|
||||
g_application_hold(G_APPLICATION(app));
|
||||
new_session_window(conf_copy(conf), NULL);
|
||||
@ -315,15 +312,11 @@ int main(int argc, char **argv)
|
||||
{
|
||||
int status;
|
||||
|
||||
{
|
||||
/* Call the function in ux{putty,pterm}.c to do app-type
|
||||
* specific setup */
|
||||
extern void setup(bool);
|
||||
setup(false); /* false means we are not a one-session process */
|
||||
}
|
||||
/* Call the function in ux{putty,pterm}.c to do app-type
|
||||
* specific setup */
|
||||
setup(false); /* false means we are not a one-session process */
|
||||
|
||||
if (argc > 1) {
|
||||
extern char *pty_osx_envrestore_prefix;
|
||||
pty_osx_envrestore_prefix = argv[--argc];
|
||||
}
|
||||
|
||||
|
@ -3189,15 +3189,7 @@ GtkWidget *create_config_box(const char *title, Conf *conf,
|
||||
dp->retval = -1;
|
||||
dp->window = window;
|
||||
|
||||
{
|
||||
/* in gtkwin.c */
|
||||
extern void set_window_icon(GtkWidget *window,
|
||||
const char *const *const *icon,
|
||||
int n_icon);
|
||||
extern const char *const *const cfg_icon[];
|
||||
extern const int n_cfg_icon;
|
||||
set_window_icon(window, cfg_icon, n_cfg_icon);
|
||||
}
|
||||
set_window_icon(window, cfg_icon, n_cfg_icon);
|
||||
|
||||
#if !GTK_CHECK_VERSION(2,0,0)
|
||||
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(treescroll),
|
||||
@ -3860,8 +3852,6 @@ static void eventlog_list_handler(union control *ctrl, dlgparam *dp,
|
||||
|
||||
if (gtk_selection_owner_set(es->window, GDK_SELECTION_PRIMARY,
|
||||
GDK_CURRENT_TIME)) {
|
||||
extern GdkAtom compound_text_atom;
|
||||
|
||||
gtk_selection_add_target(es->window, GDK_SELECTION_PRIMARY,
|
||||
GDK_SELECTION_TYPE_STRING, 1);
|
||||
gtk_selection_add_target(es->window, GDK_SELECTION_PRIMARY,
|
||||
|
@ -47,9 +47,6 @@
|
||||
static char *progname, **gtkargvstart;
|
||||
static int ngtkargs;
|
||||
|
||||
extern char **pty_argv; /* declared in pty.c */
|
||||
extern bool use_pty_argv;
|
||||
|
||||
static const char *app_name = "pterm";
|
||||
|
||||
char *x_get_default(const char *key)
|
||||
@ -590,12 +587,9 @@ int main(int argc, char **argv)
|
||||
|
||||
setlocale(LC_CTYPE, "");
|
||||
|
||||
{
|
||||
/* Call the function in ux{putty,pterm}.c to do app-type
|
||||
* specific setup */
|
||||
extern void setup(bool);
|
||||
setup(true); /* true means we are a one-session process */
|
||||
}
|
||||
/* Call the function in ux{putty,pterm}.c to do app-type
|
||||
* specific setup */
|
||||
setup(true); /* true means we are a one-session process */
|
||||
|
||||
progname = argv[0];
|
||||
|
||||
@ -626,8 +620,6 @@ int main(int argc, char **argv)
|
||||
block_signal(SIGPIPE, true);
|
||||
|
||||
if (argc > 1 && !strncmp(argv[1], "---", 3)) {
|
||||
extern const bool dup_check_launchable;
|
||||
|
||||
read_dupsession_data(conf, argv[1]);
|
||||
/* Splatter this argument so it doesn't clutter a ps listing */
|
||||
smemclr(argv[1], strlen(argv[1]));
|
||||
|
@ -5468,11 +5468,7 @@ void new_session_window(Conf *conf, const char *geometry_string)
|
||||
#endif
|
||||
);
|
||||
|
||||
{
|
||||
extern const char *const *const main_icon[];
|
||||
extern const int n_main_icon;
|
||||
set_window_icon(inst->window, main_icon, n_main_icon);
|
||||
}
|
||||
set_window_icon(inst->window, main_icon, n_main_icon);
|
||||
|
||||
gtk_widget_show(inst->window);
|
||||
|
||||
@ -5484,7 +5480,6 @@ void new_session_window(Conf *conf, const char *geometry_string)
|
||||
{
|
||||
GtkWidget *menuitem;
|
||||
char *s;
|
||||
extern const bool use_event_log, new_session, saved_sessions;
|
||||
|
||||
inst->menu = gtk_menu_new();
|
||||
|
||||
|
79
unix/unix.h
79
unix/unix.h
@ -189,7 +189,14 @@ enum MenuAction {
|
||||
};
|
||||
void app_menu_action(GtkFrontend *frontend, enum MenuAction);
|
||||
|
||||
/* Things gtkdlg.c needs from pterm.c */
|
||||
/* Arrays of pixmap data used for GTK window icons. (main_icon is for
|
||||
* the process's main window; cfg_icon is the modified icon used for
|
||||
* its config box.) */
|
||||
extern const char *const *const main_icon[];
|
||||
extern const char *const *const cfg_icon[];
|
||||
extern const int n_main_icon, n_cfg_icon;
|
||||
|
||||
/* Things gtkdlg.c needs from gtkwin.c */
|
||||
#ifdef MAY_REFER_TO_GTK_IN_HEADERS
|
||||
enum DialogSlot {
|
||||
DIALOG_SLOT_RECONFIGURE,
|
||||
@ -202,9 +209,12 @@ enum DialogSlot {
|
||||
GtkWidget *gtk_seat_get_window(Seat *seat);
|
||||
void register_dialog(Seat *seat, enum DialogSlot slot, GtkWidget *dialog);
|
||||
void unregister_dialog(Seat *seat, enum DialogSlot slot);
|
||||
void set_window_icon(GtkWidget *window, const char *const *const *icon,
|
||||
int n_icon);
|
||||
extern GdkAtom compound_text_atom;
|
||||
#endif
|
||||
|
||||
/* Things pterm.c needs from gtkdlg.c */
|
||||
/* Things gtkwin.c needs from gtkdlg.c */
|
||||
#ifdef MAY_REFER_TO_GTK_IN_HEADERS
|
||||
GtkWidget *create_config_box(const char *title, Conf *conf,
|
||||
bool midsession, int protcfginfo,
|
||||
@ -247,18 +257,52 @@ GtkWidget *create_message_box(
|
||||
post_dialog_fn_t after, void *afterctx);
|
||||
#endif
|
||||
|
||||
/* Things pterm.c needs from {ptermm,uxputty}.c */
|
||||
/* Things gtkwin.c needs from {ptermm,uxputty}.c */
|
||||
char *make_default_wintitle(char *hostname);
|
||||
|
||||
/* pterm.c needs this special function in xkeysym.c */
|
||||
/* gtkwin.c needs this special function in xkeysym.c */
|
||||
int keysym_to_unicode(int keysym);
|
||||
|
||||
/* Things uxstore.c needs from pterm.c */
|
||||
/* Things uxstore.c needs from gtkwin.c */
|
||||
char *x_get_default(const char *key);
|
||||
|
||||
/* Things uxstore.c provides to pterm.c */
|
||||
/* Things uxstore.c provides to gtkwin.c */
|
||||
void provide_xrm_string(char *string);
|
||||
|
||||
/* Function that {gtkapp,gtkmain}.c needs from ux{pterm,putty}.c. Does
|
||||
* early process setup that varies between applications (e.g.
|
||||
* pty_pre_init or sk_init), and is passed a boolean by the caller
|
||||
* indicating whether this is an OS X style multi-session monolithic
|
||||
* process or an ordinary Unix one-shot. */
|
||||
void setup(bool single_session_in_this_process);
|
||||
|
||||
/*
|
||||
* Per-application constants that affect behaviour of shared modules.
|
||||
*/
|
||||
/* Do we need an Event Log menu item? (yes for PuTTY, no for pterm) */
|
||||
extern const bool use_event_log;
|
||||
/* Do we need a New Session menu item? (yes for PuTTY, no for pterm) */
|
||||
extern const bool new_session;
|
||||
/* Do we need a Saved Sessions menu item? (yes for PuTTY, no for pterm) */
|
||||
extern const bool saved_sessions;
|
||||
/* When we Duplicate Session, do we need to double-check that the Conf
|
||||
* is in a launchable state? (no for pterm, because conf_launchable
|
||||
* returns an irrelevant answer, since we'll force use of the pty
|
||||
* backend which ignores all the relevant settings) */
|
||||
extern const bool dup_check_launchable;
|
||||
/* In the Duplicate Session serialised data, do we send/receive an
|
||||
* argv array after the main Conf? (yes for pterm, no for PuTTY) */
|
||||
extern const bool use_pty_argv;
|
||||
|
||||
/*
|
||||
* OS X environment munging: this is the prefix we expect to find on
|
||||
* environment variable names that were changed by osxlaunch.
|
||||
* Extracted from the command line of the OS X pterm main binary, and
|
||||
* used in uxpty.c to restore the original environment before
|
||||
* launching its subprocess.
|
||||
*/
|
||||
extern char *pty_osx_envrestore_prefix;
|
||||
|
||||
/* Things provided by uxcons.c */
|
||||
struct termios;
|
||||
void stderr_tty_init(void);
|
||||
@ -360,4 +404,25 @@ Socket *make_fd_socket(int infd, int outfd, int inerrfd, Plug *plug);
|
||||
#define DEFAULT_GTK_FONT "server:fixed"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/*
|
||||
* uxpty.c.
|
||||
*/
|
||||
void pty_pre_init(void); /* pty+utmp setup before dropping privilege */
|
||||
/* Pass in the argv[] for an instance of the pty backend created by
|
||||
* the standard vtable constructor. Only called from (non-OSX) pterm,
|
||||
* which will construct exactly one such instance, and initialises
|
||||
* this from the command line. */
|
||||
extern char **pty_argv;
|
||||
|
||||
/*
|
||||
* gtkask.c.
|
||||
*/
|
||||
char *gtk_askpass_main(const char *display, const char *wintitle,
|
||||
const char *prompt, bool *success);
|
||||
|
||||
/*
|
||||
* uxsftpserver.c.
|
||||
*/
|
||||
extern const SftpServerVtable unix_live_sftpserver_vt;
|
||||
|
||||
#endif /* PUTTY_UNIX_H */
|
||||
|
@ -349,10 +349,6 @@ static char *askpass_gui(const char *prompt)
|
||||
char *passphrase;
|
||||
bool success;
|
||||
|
||||
/* in gtkask.c */
|
||||
char *gtk_askpass_main(const char *display, const char *wintitle,
|
||||
const char *prompt, bool *success);
|
||||
|
||||
passphrase = gtk_askpass_main(
|
||||
display, "Pageant passphrase prompt", prompt, &success);
|
||||
if (!success) {
|
||||
|
@ -43,8 +43,6 @@ char *make_default_wintitle(char *hostname)
|
||||
|
||||
void setup(bool single)
|
||||
{
|
||||
extern void pty_pre_init(void); /* declared in pty.c */
|
||||
|
||||
cmdline_tooltype = TOOLTYPE_NONNETWORK;
|
||||
default_protocol = -1;
|
||||
|
||||
|
@ -355,8 +355,6 @@ static bool longoptarg(const char *arg, const char *expected,
|
||||
return false;
|
||||
}
|
||||
|
||||
extern const SftpServerVtable unix_live_sftpserver_vt;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int *fdlist;
|
||||
|
@ -23,12 +23,6 @@
|
||||
#define SALT_FILENAME "salt"
|
||||
#define SALT_SIZE 64
|
||||
|
||||
/*
|
||||
* Functions provided by uxnet.c to help connection sharing.
|
||||
*/
|
||||
SockAddr *unix_sock_addr(const char *path);
|
||||
Socket *new_unix_listener(SockAddr *listenaddr, Plug *plug);
|
||||
|
||||
static char *make_parentdir_name(void)
|
||||
{
|
||||
char *username, *parent;
|
||||
|
Reference in New Issue
Block a user