From 067a15ea093c726b3ce3bf96c3f3e27744da3271 Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 9 Feb 1999 15:18:34 +0000 Subject: [PATCH] Added automatic version distinguishing code, to differentiate releases from nightly builds from random development builds git-svn-id: svn://svn.tartarus.org/sgt/putty@28 cda61777-01e9-0310-a592-d414129be87e --- Makefile | 25 ++++++++++++++++++------- putty.h | 5 +++++ version.c | 20 ++++++++++++++++++++ win_res.h | 6 ++++-- win_res.rc | 17 ++++++++--------- windlg.c | 1 + 6 files changed, 56 insertions(+), 18 deletions(-) create mode 100644 version.c diff --git a/Makefile b/Makefile index 3de1ee01..4ffc3b48 100644 --- a/Makefile +++ b/Makefile @@ -1,26 +1,32 @@ # Makefile for PuTTY. Use `FWHACK=/DFWHACK' to cause the firewall hack # to be built in. (requires rebuild of ssh.obj only) +# Can also build with `VER=/DSNAPSHOT=1999-01-25' or +# `VER=/DRELEASE=0.43' to get version numbering; otherwise you'll +# get `Unidentified build'. + CFLAGS = /nologo /W3 /YX /O2 /Yd /D_WINDOWS /DDEBUG /ML /Fd .c.obj: cl $(FWHACK) $(CFLAGS) /c $*.c -OBJS1 = window.obj windlg.obj terminal.obj telnet.obj misc.obj noise.obj +PUTTYOBJS = window.obj windlg.obj terminal.obj telnet.obj +OBJS1 = misc.obj noise.obj OBJS2 = ssh.obj sshcrc.obj sshdes.obj sshmd5.obj sshrsa.obj sshrand.obj -OBJS3 = sshsha.obj +OBJS3 = sshsha.obj version.obj RESRC = win_res.res LIBS1 = advapi32.lib user32.lib gdi32.lib -LIBS2 = wsock32.lib comctl32.lib comdlg32.lib +LIBS2 = ws2_32.lib comctl32.lib comdlg32.lib -putty.exe: $(OBJS1) $(OBJS2) $(OBJS3) $(RESRC) link.rsp +putty.exe: $(PUTTYOBJS) $(OBJS1) $(OBJS2) $(OBJS3) $(RESRC) link.rsp link /debug -out:putty.exe @link.rsp -puttyd.exe: $(OBJS1) $(OBJS2) $(OBJS3) $(RESRC) link.rsp +puttyd.exe: $(PUTTYOBJS) $(OBJS1) $(OBJS2) $(OBJS3) $(RESRC) link.rsp link /debug -out:puttyd.exe @link.rsp link.rsp: makefile echo /nologo /subsystem:windows > link.rsp + echo $(PUTTYOBJS) >> link.rsp echo $(OBJS1) >> link.rsp echo $(OBJS2) >> link.rsp echo $(OBJS3) >> link.rsp @@ -41,9 +47,14 @@ sshmd5.obj: sshmd5.c ssh.h sshrsa.obj: sshrsa.c ssh.h sshsha.obj: sshsha.c ssh.h sshrand.obj: sshrand.c ssh.h +version.obj: versionpseudotarget + +# Hack to force version.obj to be rebuilt always +versionpseudotarget: + cl $(FWHACK) $(VER) $(CFLAGS) /c version.c win_res.res: win_res.rc win_res.h putty.ico - rc $(FWHACK) -r win_res.rc + rc $(FWHACK) -r -DWIN32 -D_WIN32 -DWINVER=0x0400 win_res.rc clean: del *.obj @@ -53,4 +64,4 @@ clean: del *.aps del *.ilk del *.pdb - del link.rsp + del *.rsp diff --git a/putty.h b/putty.h index 52a50616..4fed74d8 100644 --- a/putty.h +++ b/putty.h @@ -227,6 +227,11 @@ void *saferealloc(void *, size_t); void safefree(void *); /* + * Exports from version.c. + */ +extern char ver[]; + +/* * A debug system. */ #ifdef DEBUG diff --git a/version.c b/version.c new file mode 100644 index 00000000..834beec8 --- /dev/null +++ b/version.c @@ -0,0 +1,20 @@ +/* + * PuTTY version numbering + */ + +#define STR1(x) #x +#define STR(x) STR1(x) + +#if defined SNAPSHOT + +char ver[] = "Development snapshot " STR(SNAPSHOT); + +#elif defined RELEASE + +char ver[] = "Release " STR(RELEASE); + +#else + +char ver[] = "Unidentified build, " __DATE__ " " __TIME__; + +#endif diff --git a/win_res.h b/win_res.h index d4925abc..b50da6ca 100644 --- a/win_res.h +++ b/win_res.h @@ -19,8 +19,10 @@ #define IDN_LIST 1001 #define IDA_ICON 1001 -#define IDA_TEXT 1002 -#define IDA_LICENCE 1003 +#define IDA_TEXT1 1002 +#define IDA_VERSION 1003 +#define IDA_TEXT2 1004 +#define IDA_LICENCE 1005 #define IDC_TAB 1001 #define IDC_ABOUT 1002 diff --git a/win_res.rc b/win_res.rc index 43b4c5b8..36bdd7d9 100644 --- a/win_res.rc +++ b/win_res.rc @@ -4,18 +4,17 @@ #include "win_res.h" -IDI_MAINICON ICON "putty.ico" - -IDD_ABOUTBOX DIALOG DISCARDABLE 140, 40, 136, 58 +IDD_ABOUTBOX DIALOG DISCARDABLE 140, 40, 136, 70 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "About PuTTY" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "&Close", IDOK, 82, 40, 48, 14 - PUSHBUTTON "View &Licence", IDA_LICENCE, 6, 40, 70, 14 - ICON IDI_MAINICON, IDA_ICON, 10, 10, 0, 0 - LTEXT "PuTTY Beta 0.45\n\251 1997-8 Simon Tatham\nAll rights reserved.", - IDA_TEXT, 40, 6, 96, 24 + DEFPUSHBUTTON "&Close", IDOK, 82, 52, 48, 14 + PUSHBUTTON "View &Licence", IDA_LICENCE, 6, 52, 70, 14 + CTEXT "PuTTY", IDA_TEXT1, 10, 6, 120, 8 + CTEXT "", IDA_VERSION, 10, 16, 120, 16 + CTEXT "\251 1997-9 Simon Tatham. All rights reserved.", + IDA_TEXT2, 10, 34, 120, 16 END IDD_MAINBOX DIALOG DISCARDABLE 0, 0, 180, 216 @@ -210,7 +209,7 @@ FONT 8, "MS Sans Serif" BEGIN DEFPUSHBUTTON "OK", IDOK, 98, 211, 44, 14 - LTEXT "Copyright \251 1998 Simon Tatham", 1000, 10, 10, 206, 8 + LTEXT "Copyright \251 1997-9 Simon Tatham", 1000, 10, 10, 206, 8 LTEXT "Portions copyright Gary S. Brown and Eric Young", 1100, 10, 18, 206, 8 LTEXT "Permission is hereby granted, free of charge, to any person", 1002, 10, 34, 206, 8 diff --git a/windlg.c b/windlg.c index 58b570fd..6fe11bb5 100644 --- a/windlg.c +++ b/windlg.c @@ -367,6 +367,7 @@ static int CALLBACK AboutProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: + SetDlgItemText (hwnd, IDA_VERSION, ver); return 1; /* case WM_CTLCOLORDLG: */ /* return (int) GetStockObject (LTGRAY_BRUSH); */ -- 2.11.0