diff --git a/ssheven-constants.r b/ssheven-constants.r new file mode 100644 index 0000000..4436939 --- /dev/null +++ b/ssheven-constants.r @@ -0,0 +1,29 @@ +/* used as both a C and resource file include, so keep it simple */ + +#ifndef __SSHEVEN_CONSTANTS_R__ +#define __SSHEVEN_CONSTANTS_R__ + +/* so many versions */ +#define SSHEVEN_VERSION "0.1.0" +#define SSHEVEN_LONG_VERSION "0.1.0 prerelease, by cy384" +#define SSHEVEN_DESCRIPTION "ssheven 0.1.0 by cy384" +#define SSHEVEN_VERSION_MAJOR 0x00 +#define SSHEVEN_VERSION_MINOR 0x10 +#define SSHEVEN_VERSION_PRERELEASE 0x01 + +/* options: development, alpha, beta, release */ +#define SSHEVEN_RELEASE_TYPE development +#define SSHEVEN_RELEASE_REGION verUS + +/* requested number of bytes for RAM, used in SIZE resource */ +#define SSHEVEN_MINIMUM_PARTITION 1024*1024 +#define SSHEVEN_REQUIRED_PARTITION SSHEVEN_MINIMUM_PARTITION + +/* size for recv and send thread buffers */ +#define SSHEVEN_BUFFER_SIZE 4096 + +/* terminal type to send over ssh, determines features etc. + * "vanilla" supports basically nothing, which is good for us here */ +#define SSHEVEN_TERMINAL_TYPE "vanilla" + +#endif diff --git a/ssheven.c b/ssheven.c index 661234d..0b84b79 100644 --- a/ssheven.c +++ b/ssheven.c @@ -57,7 +57,7 @@ static pascal void yield_notifier(void* contextPtr, OTEventCode code, OTResult r // read from the channel and print to console void ssh_read(void) { - int rc = libssh2_channel_read(ssh_con.channel, ssh_con.recv_buffer, BUFFER_SIZE); + int rc = libssh2_channel_read(ssh_con.channel, ssh_con.recv_buffer, SSHEVEN_BUFFER_SIZE); if (rc == 0) return; @@ -352,7 +352,7 @@ void ssh_setup_terminal(void) { int rc = 0; - SSH_CHECK(libssh2_channel_request_pty(ssh_con.channel, TERMINAL_TYPE)); + SSH_CHECK(libssh2_channel_request_pty(ssh_con.channel, SSHEVEN_TERMINAL_TYPE)); SSH_CHECK(libssh2_channel_shell(ssh_con.channel)); } @@ -492,8 +492,8 @@ int main(int argc, char** argv) if (ok) { - ssh_con.recv_buffer = OTAllocMem(BUFFER_SIZE); - ssh_con.send_buffer = OTAllocMem(BUFFER_SIZE); + ssh_con.recv_buffer = OTAllocMem(SSHEVEN_BUFFER_SIZE); + ssh_con.send_buffer = OTAllocMem(SSHEVEN_BUFFER_SIZE); if (ssh_con.recv_buffer == NULL || ssh_con.send_buffer == NULL) { diff --git a/ssheven.h b/ssheven.h index 2c61704..9e7cf64 100644 --- a/ssheven.h +++ b/ssheven.h @@ -22,15 +22,8 @@ // libssh2 #include -// version string -#define SSHEVEN_VERSION "0.1.0" - -// size for recv and send thread buffers -#define BUFFER_SIZE 4096 - -// terminal type to send over ssh, determines features etc. -// "vanilla" supports basically nothing, which is good for us here -#define TERMINAL_TYPE "vanilla" +// ssheven constants +#include "ssheven-constants.r" // sinful globals struct ssheven_console diff --git a/ssheven.r b/ssheven.r index e8f799c..e393e7b 100644 --- a/ssheven.r +++ b/ssheven.r @@ -1,3 +1,5 @@ +#include "ssheven-constants.r" + #include "Dialogs.r" resource 'DLOG' (128) { @@ -61,29 +63,36 @@ resource 'SIZE' (-1) { reserved, reserved, reserved, - 1024 * 1024, - 1024 * 1024 + SSHEVEN_MINIMUM_PARTITION, + SSHEVEN_REQUIRED_PARTITION }; #include "MacTypes.r" /* see macintosh tb essentials page 7-31 */ +/* yes, we need two */ +/* first one displayed in version field of info window */ resource 'vers' (1, purgeable) { - 0x01, 0x00, development, 0x01, verUS, - "0.1.0", - "0.1.0 prerelease, by cy384" + SSHEVEN_VERSION_MAJOR, SSHEVEN_VERSION_MINOR, + SSHEVEN_RELEASE_TYPE, SSHEVEN_VERSION_PRERELEASE, + SSHEVEN_RELEASE_REGION, + SSHEVEN_VERSION, + SSHEVEN_LONG_VERSION }; +/* second one displayed beneath icon at top of info window */ resource 'vers' (2, purgeable) { - 0x01, 0x00, development, 0x01, verUS, - "0.1.0", - "0.1.0 prerelease, by cy384" + SSHEVEN_VERSION_MAJOR, SSHEVEN_VERSION_MINOR, + SSHEVEN_RELEASE_TYPE, SSHEVEN_VERSION_PRERELEASE, + SSHEVEN_RELEASE_REGION, + SSHEVEN_VERSION, + SSHEVEN_LONG_VERSION }; /* signature resource */ type 'SSH7' as 'STR '; resource 'SSH7' (0, purgeable) { - "ssheven 0.1.0 by cy384" + SSHEVEN_DESCRIPTION }; #include "Finder.r"