mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 12:02:47 -05:00
Move some more files into subdirectories.
While I'm in the mood for cleaning up the top-level directory here: all the 'nostuff.c' files have moved into a new 'stubs' directory, and I broke up be_misc.c into smaller modules that can live in 'utils'.
This commit is contained in:
37
stubs/nocmdline.c
Normal file
37
stubs/nocmdline.c
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* nocmdline.c - stubs in applications which don't do the
|
||||
* standard(ish) PuTTY tools' command-line parsing
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include "putty.h"
|
||||
|
||||
/*
|
||||
* Stub version of the function in cmdline.c which provides the
|
||||
* password to SSH authentication by remembering it having been passed
|
||||
* as a command-line option. If we're not doing normal command-line
|
||||
* handling, then there is no such option, so that function always
|
||||
* returns failure.
|
||||
*/
|
||||
int cmdline_get_passwd_input(prompts_t *p)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* The main cmdline_process_param function is normally called from
|
||||
* applications' main(). An application linking against this stub
|
||||
* module shouldn't have a main() that calls it in the first place :-)
|
||||
* but it is just occasionally called by other supporting functions,
|
||||
* such as one in uxputty.c which sometimes handles a non-option
|
||||
* argument by making up equivalent options and passing them back to
|
||||
* this function. So we have to provide a link-time stub of this
|
||||
* function, but it had better not end up being called at run time.
|
||||
*/
|
||||
int cmdline_process_param(const char *p, char *value,
|
||||
int need_save, Conf *conf)
|
||||
{
|
||||
unreachable("cmdline_process_param should never be called");
|
||||
}
|
11
stubs/nogss.c
Normal file
11
stubs/nogss.c
Normal file
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Stub definitions of the GSSAPI library list, for Unix pterm and
|
||||
* any other application that needs the symbols defined but has no
|
||||
* use for them.
|
||||
*/
|
||||
|
||||
#include "putty.h"
|
||||
|
||||
const int ngsslibs = 0;
|
||||
const char *const gsslibnames[1] = { "dummy" };
|
||||
const struct keyvalwhere gsslibkeywords[1] = { { "dummy", 0, -1, -1 } };
|
38
stubs/noprint.c
Normal file
38
stubs/noprint.c
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Stub implementation of the printing interface for PuTTY, for the
|
||||
* benefit of non-printing terminal applications.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include "putty.h"
|
||||
|
||||
struct printer_job_tag {
|
||||
int dummy;
|
||||
};
|
||||
|
||||
printer_job *printer_start_job(char *printer)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void printer_job_data(printer_job *pj, const void *data, size_t len)
|
||||
{
|
||||
}
|
||||
|
||||
void printer_finish_job(printer_job *pj)
|
||||
{
|
||||
}
|
||||
|
||||
printer_enum *printer_start_enum(int *nprinters_ptr)
|
||||
{
|
||||
*nprinters_ptr = 0;
|
||||
return NULL;
|
||||
}
|
||||
char *printer_get_name(printer_enum *pe, int i)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
void printer_finish_enum(printer_enum *pe)
|
||||
{
|
||||
}
|
22
stubs/norand.c
Normal file
22
stubs/norand.c
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Stub implementations of RNG functions for applications without an RNG.
|
||||
*/
|
||||
|
||||
#include "putty.h"
|
||||
|
||||
void random_read(void *out, size_t size)
|
||||
{
|
||||
unreachable("Random numbers are not available in this application");
|
||||
}
|
||||
|
||||
void random_save_seed(void)
|
||||
{
|
||||
}
|
||||
|
||||
void random_destroy_seed(void)
|
||||
{
|
||||
}
|
||||
|
||||
void noise_ultralight(NoiseSourceId id, unsigned long data)
|
||||
{
|
||||
}
|
16
stubs/noterm.c
Normal file
16
stubs/noterm.c
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Stubs of functions in terminal.c, for use in programs that don't
|
||||
* have a terminal.
|
||||
*/
|
||||
|
||||
#include "putty.h"
|
||||
#include "terminal.h"
|
||||
|
||||
void term_nopaste(Terminal *term)
|
||||
{
|
||||
}
|
||||
|
||||
int term_get_userpass_input(Terminal *term, prompts_t *p)
|
||||
{
|
||||
return 0;
|
||||
}
|
21
stubs/notiming.c
Normal file
21
stubs/notiming.c
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* notiming.c: stub version of timing API.
|
||||
*
|
||||
* Used in any tool which needs a subsystem linked against the
|
||||
* timing API but doesn't want to actually provide timing. For
|
||||
* example, key generation tools need the random number generator,
|
||||
* but they don't want the hassle of calling noise_regular() at
|
||||
* regular intervals - and they don't _need_ it either, since they
|
||||
* have their own rigorous and different means of noise collection.
|
||||
*/
|
||||
|
||||
#include "putty.h"
|
||||
|
||||
unsigned long schedule_timer(int ticks, timer_fn_t fn, void *ctx)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void expire_timer_context(void *ctx)
|
||||
{
|
||||
}
|
40
stubs/nullplug.c
Normal file
40
stubs/nullplug.c
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* nullplug.c: provide a null implementation of the Plug vtable which
|
||||
* ignores all calls. Occasionally useful in cases where we want to
|
||||
* make a network connection just to see if it works, but not do
|
||||
* anything with it afterwards except close it again.
|
||||
*/
|
||||
|
||||
#include "putty.h"
|
||||
|
||||
void nullplug_log(Plug *plug, PlugLogType type, SockAddr *addr,
|
||||
int port, const char *err_msg, int err_code)
|
||||
{
|
||||
}
|
||||
|
||||
void nullplug_closing(Plug *plug, PlugCloseType type, const char *error_msg)
|
||||
{
|
||||
}
|
||||
|
||||
void nullplug_receive(Plug *plug, int urgent, const char *data, size_t len)
|
||||
{
|
||||
}
|
||||
|
||||
void nullplug_sent(Plug *plug, size_t bufsize)
|
||||
{
|
||||
}
|
||||
|
||||
static const PlugVtable nullplug_plugvt = {
|
||||
.log = nullplug_log,
|
||||
.closing = nullplug_closing,
|
||||
.receive = nullplug_receive,
|
||||
.sent = nullplug_sent,
|
||||
};
|
||||
|
||||
static Plug nullplug_plug = { &nullplug_plugvt };
|
||||
|
||||
/*
|
||||
* There's a singleton instance of nullplug, because it's not
|
||||
* interesting enough to worry about making more than one of them.
|
||||
*/
|
||||
Plug *const nullplug = &nullplug_plug;
|
Reference in New Issue
Block a user