Patch from Alejandro Sedeno, somewhat modified by me, which
[u/mdw/putty] / unix / unix.h
index ff665b9..9de4e4a 100644 (file)
@@ -6,12 +6,16 @@
 #endif
 
 #include <stdio.h>                    /* for FILENAME_MAX */
+#include <stdint.h>                   /* C99 int types */
+#ifndef NO_LIBDL
+#include <dlfcn.h>                    /* Dynamic library loading */
+#endif /*  NO_LIBDL */
 #include "charset.h"
 
 struct Filename {
     char path[FILENAME_MAX];
 };
-#define f_open(filename, mode) ( fopen((filename).path, (mode)) )
+FILE *f_open(struct Filename, char const *, int);
 
 struct FontSpec {
     char name[256];
@@ -24,6 +28,9 @@ typedef int OSSocket;
 
 extern Backend pty_backend;
 
+typedef uint32_t uint32; /* C99: uint32_t defined in stdint.h */
+#define PUTTY_UINT32_DEFINED
+
 /*
  * Under GTK, we send MA_CLICK _and_ MA_2CLK, or MA_CLICK _and_
  * MA_3CLK, when a button is pressed for the second or third time.
@@ -60,6 +67,18 @@ extern long tickcount_offset;
 #define WCHAR wchar_t
 #define BYTE unsigned char
 
+/*
+ * Unix-specific global flag
+ *
+ * FLAG_STDERR_TTY indicates that standard error might be a terminal and
+ * might get its configuration munged, so anything trying to output plain
+ * text (i.e. with newlines in it) will need to put it back into cooked
+ * mode first.  Applications setting this flag should also call
+ * stderr_tty_init() before messing with any terminal modes, and can call
+ * premsg() before outputting text to stderr and postmsg() afterwards.
+ */
+#define FLAG_STDERR_TTY 0x1000
+
 /* Things pty.c needs from pterm.c */
 char *get_x_display(void *frontend);
 int font_dimension(void *frontend, int which);/* 0 for width, 1 for height */
@@ -80,7 +99,7 @@ int reallyclose(void *frontend);
 
 /* Things pterm.c needs from {ptermm,uxputty}.c */
 char *make_default_wintitle(char *hostname);
-int process_nonoption_arg(char *arg, Config *cfg);
+int process_nonoption_arg(char *arg, Config *cfg, int *allow_launch);
 
 /* pterm.c needs this special function in xkeysym.c */
 int keysym_to_unicode(int keysym);
@@ -91,6 +110,12 @@ char *x_get_default(const char *key);
 /* Things uxstore.c provides to pterm.c */
 void provide_xrm_string(char *string);
 
+/* Things provided by uxcons.c */
+struct termios;
+void stderr_tty_init(void);
+void premsg(struct termios *);
+void postmsg(struct termios *);
+
 /* The interface used by uxsel.c */
 void uxsel_init(void);
 typedef int (*uxsel_callback_fn)(int fd, int event);
@@ -105,7 +130,7 @@ void uxsel_input_remove(int id);
 
 /* uxcfg.c */
 struct controlbox;
-void unix_setup_config_box(struct controlbox *b, int midsession);
+void unix_setup_config_box(struct controlbox *b, int midsession, int protocol);
 
 /* gtkcfg.c */
 void gtk_setup_config_box(struct controlbox *b, int midsession, void *window);
@@ -128,6 +153,9 @@ void gtk_setup_config_box(struct controlbox *b, int midsession, void *window);
 void (*putty_signal(int sig, void (*func)(int)))(int);
 void block_signal(int sig, int block_it);
 
+/* uxmisc.c */
+int cloexec(int);
+
 /*
  * Exports from unicode.c.
  */