From 5695dac694806d1c1a9c0a6ad00f1ba4ac59ec5e Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Mon, 23 Nov 2009 23:23:47 +0100 Subject: [PATCH] remove currentDesktop from server request but allow -do macros on new Untitled --- motifless-nc.patch | 532 ++++++++++++--------------------------------- release-client.patch | 76 +++---- remote-nc.patch | 158 ++++++-------- versionedServerAtoms.patch | 66 ++++-- 4 files changed, 295 insertions(+), 537 deletions(-) rewrite motifless-nc.patch (79%) diff --git a/motifless-nc.patch b/motifless-nc.patch dissimilarity index 79% index f32a17a..30e0a0f 100644 --- a/motifless-nc.patch +++ b/motifless-nc.patch @@ -1,394 +1,138 @@ ---- - - makefiles/Makefile.bertw | 7 +- - source/Makefile.common | 12 +++- - source/nc.c | 2 - source/server_common.c | 4 + - util/Makefile.common | 3 - - util/Makefile.dependencies | 1 - util/misc.c | 64 ------------------------- - util/misc.h | 4 - - util/prefFile.c | 7 +- - util/wmdesktop.c | 113 +++++++++++++++++++++++++++++++++++++++++++++ - util/wmdesktop.h | 36 ++++++++++++++ - 11 files changed, 174 insertions(+), 79 deletions(-) - -diff --quilt old/source/Makefile.common new/source/Makefile.common ---- old/source/Makefile.common -+++ new/source/Makefile.common -@@ -26,11 +26,15 @@ all: nedit nc - nedit: $(OBJS) ../util/libNUtil.a $(XMLLIB) $(XLTLIB) - $(CC) $(CFLAGS) -c linkdate.c - $(CC) $(CFLAGS) $(OBJS) linkdate.o $(XMLLIB) \ -- $(XLTLIB) ../util/libNUtil.a $(LIBS) -o $@ -+ $(XLTLIB) ../util/libNUtil.a $(XMLIBS) $(LIBS) -o $@ - --# Note LIBS isn't quite right here; it links unnecessarily against Motif --nc: nc.o server_common.o ../util/libNUtil.a -- $(CC) $(CFLAGS) nc.o server_common.o ../util/libNUtil.a $(LIBS) -o $@ -+nc: nc.o server_common.o \ -+ ../util/fileUtils.o \ -+ ../util/utils.o \ -+ ../util/prefFile.o \ -+ ../util/wmdesktop.o \ -+ ../util/clearcase.o -+ $(CC) $(CFLAGS) $^ $(LIBS) -o $@ - - help.o: help.c - $(CC) $(CFLAGS) $(BIGGER_STRINGS) -c help.c -o $@ -diff --quilt old/util/Makefile.common new/util/Makefile.common ---- old/util/Makefile.common -+++ new/util/Makefile.common -@@ -5,7 +5,8 @@ - # - - OBJS = DialogF.o getfiles.o printUtils.o misc.o fileUtils.o \ -- prefFile.o fontsel.o managedList.o utils.o clearcase.o motif.o -+ prefFile.o fontsel.o managedList.o utils.o clearcase.o motif.o \ -+ wmdesktop.o - - all: libNUtil.a - -diff --quilt old/util/Makefile.dependencies new/util/Makefile.dependencies ---- old/util/Makefile.dependencies -+++ new/util/Makefile.dependencies -@@ -10,3 +10,4 @@ prefFile.o: prefFile.c prefFile.h fileUt - printUtils.o: printUtils.c printUtils.h DialogF.h misc.h prefFile.h - utils.o: utils.c utils.h - vmsUtils.o: vmsUtils.c -+wmdesktop.o: wmdesktop.c wmdesktop.h -diff --quilt old/util/misc.c new/util/misc.c ---- old/util/misc.c -+++ new/util/misc.c -@@ -2172,70 +2172,6 @@ void CloseAllPopupsFor(Widget shell) - #endif - } - --static long queryDesktop(Display *display, Window window, Atom deskTopAtom) --{ -- long deskTopNumber = 0; -- Atom actualType; -- int actualFormat; -- unsigned long nItems, bytesAfter; -- unsigned char *prop; -- -- if (XGetWindowProperty(display, window, deskTopAtom, 0, 1, -- False, AnyPropertyType, &actualType, &actualFormat, &nItems, -- &bytesAfter, &prop) != Success) { -- return -1; /* Property not found */ -- } -- -- if (actualType == None) { -- return -1; /* Property does not exist */ -- } -- -- if (actualFormat != 32 || nItems != 1) { -- XFree((char*)prop); -- return -1; /* Wrong format */ -- } -- -- deskTopNumber = *(long*)prop; -- XFree((char*)prop); -- return deskTopNumber; --} -- --/* --** Returns the current desktop number, or -1 if no desktop information --** is available. --*/ --long QueryCurrentDesktop(Display *display, Window rootWindow) --{ -- static Atom currentDesktopAtom = (Atom)-1; -- -- if (currentDesktopAtom == (Atom)-1) -- currentDesktopAtom = XInternAtom(display, "_NET_CURRENT_DESKTOP", True); -- -- if (currentDesktopAtom != None) -- return queryDesktop(display, rootWindow, currentDesktopAtom); -- -- return -1; /* No desktop information */ --} -- --/* --** Returns the number of the desktop the given shell window is currently on, --** or -1 if no desktop information is available. Note that windows shown --** on all desktops (sometimes called sticky windows) should return 0xFFFFFFFF. --*/ --long QueryDesktop(Display *display, Widget shell) --{ -- static Atom wmDesktopAtom = (Atom)-1; -- -- if (wmDesktopAtom == (Atom)-1) -- wmDesktopAtom = XInternAtom(display, "_NET_WM_DESKTOP", True); -- -- if (wmDesktopAtom != None) -- return queryDesktop(display, XtWindow(shell), wmDesktopAtom); -- -- return -1; /* No desktop information */ --} -- -- - /* - ** Clipboard wrapper functions that call the Motif clipboard functions - ** a number of times before giving up. The interfaces are similar to the -diff --quilt old/util/misc.h new/util/misc.h ---- old/util/misc.h -+++ new/util/misc.h -@@ -28,6 +28,8 @@ - #ifndef NEDIT_MISC_H_INCLUDED - #define NEDIT_MISC_H_INCLUDED - -+#include "wmdesktop.h" -+ - #include - #include - #include -@@ -122,8 +124,6 @@ void InstallMouseWheelActions(XtAppConte - void AddMouseWheelSupport(Widget w); - void RadioButtonChangeState(Widget widget, Boolean state, Boolean notify); - void CloseAllPopupsFor(Widget shell); --long QueryCurrentDesktop(Display *display, Window rootWindow); --long QueryDesktop(Display *display, Widget shell); - int SpinClipboardStartCopy(Display *display, Window window, - XmString clip_label, Time timestamp, Widget widget, - XmCutPasteProc callback, long *item_id); -diff --quilt old/makefiles/Makefile.bertw new/makefiles/Makefile.bertw ---- old/makefiles/Makefile.bertw -+++ new/makefiles/Makefile.bertw -@@ -47,7 +47,8 @@ endif - - ARFLAGS=-urs - --LIBS += -lXm -lXmu -lXp -lXext -lXt -lSM -lICE -lX11 -lm -+LIBS += -lXmu -lXp -lXext -lXt -lSM -lICE -lX11 -lm -+XMLIBS += -lXm - - ifdef OM231 - OM23=1 -@@ -59,8 +60,8 @@ endif - - ifdef OM23 - CFLAGS += -I/home/$(USER)/opt/openmotif-2.3.$(OM23)/include -- LIBS += -Wl,-R,/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib -- LIBS += -L/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib -+ XMLIBS += -Wl,-R,/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib -+ XMLIBS += -L/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib - endif - - include Makefile.common -diff --quilt /dev/null new/util/wmdesktop.c ---- /dev/null -+++ new/util/wmdesktop.c -@@ -0,0 +1,113 @@ -+static const char CVSID[] = "$Id"; -+/******************************************************************************* -+* * -+* wmdesktop.c -- Query WM Desktop * -+* * -+* Copyright (C) 1999 Mark Edel * -+* * -+* This is free software; you can redistribute it and/or modify it under the * -+* terms of the GNU General Public License as published by the Free Software * -+* Foundation; either version 2 of the License, or (at your option) any later * -+* version. In addition, you may distribute version of this program linked to * -+* Motif or Open Motif. See README for details. * -+* * -+* This software is distributed in the hope that it will be useful, but WITHOUT * -+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * -+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * -+* for more details. * -+* * -+* You should have received a copy of the GNU General Public License along with * -+* software; if not, write to the Free Software Foundation, Inc., 59 Temple * -+* Place, Suite 330, Boston, MA 02111-1307 USA * -+* * -+* Nirvana Text Editor * -+* July 28, 1992 * -+* * -+* Written by Mark Edel * -+* * -+*******************************************************************************/ -+ -+#ifdef HAVE_CONFIG_H -+#include "../config.h" -+#endif -+ -+#include "wmdesktop.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#ifdef HAVE_DEBUG_H -+#include "../debug.h" -+#endif -+ -+static long queryDesktop(Display *display, Window window, Atom deskTopAtom) -+{ -+ long deskTopNumber = 0; -+ Atom actualType; -+ int actualFormat; -+ unsigned long nItems, bytesAfter; -+ unsigned char *prop; -+ -+ if (XGetWindowProperty(display, window, deskTopAtom, 0, 1, -+ False, AnyPropertyType, &actualType, &actualFormat, &nItems, -+ &bytesAfter, &prop) != Success) { -+ return -1; /* Property not found */ -+ } -+ -+ if (actualType == None) { -+ return -1; /* Property does not exist */ -+ } -+ -+ if (actualFormat != 32 || nItems != 1) { -+ XFree((char*)prop); -+ return -1; /* Wrong format */ -+ } -+ -+ deskTopNumber = *(long*)prop; -+ XFree((char*)prop); -+ return deskTopNumber; -+} -+ -+/* -+** Returns the current desktop number, or -1 if no desktop information -+** is available. -+*/ -+long QueryCurrentDesktop(Display *display, Window rootWindow) -+{ -+ static Atom currentDesktopAtom = (Atom)-1; -+ -+ if (currentDesktopAtom == (Atom)-1) -+ currentDesktopAtom = XInternAtom(display, "_NET_CURRENT_DESKTOP", True); -+ -+ if (currentDesktopAtom != None) -+ return queryDesktop(display, rootWindow, currentDesktopAtom); -+ -+ return -1; /* No desktop information */ -+} -+ -+/* -+** Returns the number of the desktop the given shell window is currently on, -+** or -1 if no desktop information is available. Note that windows shown -+** on all desktops (sometimes called sticky windows) should return 0xFFFFFFFF. -+*/ -+long QueryDesktop(Display *display, Widget shell) -+{ -+ static Atom wmDesktopAtom = (Atom)-1; -+ -+ if (wmDesktopAtom == (Atom)-1) -+ wmDesktopAtom = XInternAtom(display, "_NET_WM_DESKTOP", True); -+ -+ if (wmDesktopAtom != None) -+ return queryDesktop(display, XtWindow(shell), wmDesktopAtom); -+ -+ return -1; /* No desktop information */ -+} -diff --quilt /dev/null new/util/wmdesktop.h ---- /dev/null -+++ new/util/wmdesktop.h -@@ -0,0 +1,36 @@ -+/* $Id$ */ -+/******************************************************************************* -+* * -+* wmdesktop.h -- Nirvana Editor Query WM Desktop * -+* * -+* Copyright 2004 The NEdit Developers * -+* * -+* This is free software; you can redistribute it and/or modify it under the * -+* terms of the GNU General Public License as published by the Free Software * -+* Foundation; either version 2 of the License, or (at your option) any later * -+* version. In addition, you may distribute versions of this program linked to * -+* Motif or Open Motif. See README for details. * -+* * -+* This software is distributed in the hope that it will be useful, but WITHOUT * -+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * -+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -+* more details. * -+* * -+* You should have received a copy of the GNU General Public License along with * -+* software; if not, write to the Free Software Foundation, Inc., 59 Temple * -+* Place, Suite 330, Boston, MA 02111-1307 USA * -+* * -+* Nirvana Text Editor * -+* July 31, 2001 * -+* * -+*******************************************************************************/ -+ -+#ifndef NEDIT_WMDESKTOP_H_INCLUDED -+#define NEDIT_WMDESKTOP_H_INCLUDED -+ -+#include -+ -+long QueryCurrentDesktop(Display *display, Window rootWindow); -+long QueryDesktop(Display *display, Widget shell); -+ -+#endif /* NEDIT_WMDESKTOP_H_INCLUDED */ -diff --quilt old/source/nc.c new/source/nc.c ---- old/source/nc.c -+++ new/source/nc.c -@@ -36,7 +36,7 @@ static const char CVSID[] = "$Id: nc.c,v - #include "../util/utils.h" - #include "../util/prefFile.h" - #include "../util/system.h" --#include "../util/misc.h" -+#include "../util/wmdesktop.h" - - #include - #include -diff --quilt old/source/server_common.c new/source/server_common.c ---- old/source/server_common.c -+++ new/source/server_common.c -@@ -35,10 +35,12 @@ - #include - #endif - #endif /*VMS*/ --#include "nedit.h" - #include "server_common.h" - #include "../util/utils.h" - -+/* comes from nc.c or nedit.c */ -+extern Display *TheDisplay; -+ - /* - * Create the server property atoms for the server with serverName. - * Atom names are generated as follows: -diff --quilt old/util/prefFile.c new/util/prefFile.c ---- old/util/prefFile.c -+++ new/util/prefFile.c -@@ -45,7 +45,8 @@ static const char CVSID[] = "$Id: prefFi - #include - #endif - #endif --#include -+#include -+#include - - #ifdef HAVE_DEBUG_H - #include "../debug.h" -@@ -217,14 +218,14 @@ static void readPrefs(XrmDatabase prefDB - sprintf(rsrcClass, "%s.%s", appClass, rsrcDescrip[i].class); - if (prefDB!=NULL && - XrmGetResource(prefDB, rsrcName, rsrcClass, &type, &rsrcValue)) { -- if (strcmp(type, XmRString)) { -+ if (strcmp(type, XtRString)) { - fprintf(stderr,"nedit: Internal Error: Unexpected resource type, %s\n", - type); - return; - } - valueString = rsrcValue.addr; - } else if (XrmGetResource(appDB,rsrcName,rsrcClass,&type,&rsrcValue)) { -- if (strcmp(type, XmRString)) { -+ if (strcmp(type, XtRString)) { - fprintf(stderr,"nedit: Internal Error: Unexpected resource type, %s\n", - type); - return; +--- + + Makefile | 11 +++++++++++ + makefiles/Makefile.bertw | 7 ++++--- + source/Makefile.common | 11 +++++++---- + source/server_common.c | 5 +++-- + util/prefFile.c | 7 ++++--- + 5 files changed, 29 insertions(+), 12 deletions(-) + +diff --quilt old/source/Makefile.common new/source/Makefile.common +--- old/source/Makefile.common ++++ new/source/Makefile.common +@@ -26,11 +26,14 @@ all: nedit nc + nedit: $(OBJS) ../util/libNUtil.a $(XMLLIB) $(XLTLIB) + $(CC) $(CFLAGS) -c linkdate.c + $(CC) $(CFLAGS) $(OBJS) linkdate.o $(XMLLIB) \ +- $(XLTLIB) ../util/libNUtil.a $(LIBS) -o $@ ++ $(XLTLIB) ../util/libNUtil.a $(XMLIBS) $(LIBS) -o $@ + +-# Note LIBS isn't quite right here; it links unnecessarily against Motif +-nc: nc.o server_common.o ../util/libNUtil.a +- $(CC) $(CFLAGS) nc.o server_common.o ../util/libNUtil.a $(LIBS) -o $@ ++nc: nc.o server_common.o \ ++ ../util/fileUtils.o \ ++ ../util/utils.o \ ++ ../util/prefFile.o \ ++ ../util/clearcase.o ++ $(CC) $(CFLAGS) $^ $(LIBS) -o $@ + + help.o: help.c + $(CC) $(CFLAGS) $(BIGGER_STRINGS) -c help.c -o $@ +diff --quilt old/makefiles/Makefile.bertw new/makefiles/Makefile.bertw +--- old/makefiles/Makefile.bertw ++++ new/makefiles/Makefile.bertw +@@ -47,7 +47,8 @@ endif + + ARFLAGS=-urs + +-LIBS += -lXm -lXmu -lXp -lXext -lXt -lSM -lICE -lX11 -lm ++LIBS += -lXmu -lXp -lXext -lXt -lSM -lICE -lX11 -lm ++XMLIBS += -lXm + + ifdef OM231 + OM23=1 +@@ -59,8 +60,8 @@ endif + + ifdef OM23 + CFLAGS += -I/home/$(USER)/opt/openmotif-2.3.$(OM23)/include +- LIBS += -Wl,-R,/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib +- LIBS += -L/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib ++ XMLIBS += -Wl,-R,/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib ++ XMLIBS += -L/home/$(USER)/opt/openmotif-2.3.$(OM23)/lib + endif + + include Makefile.common +diff --quilt old/source/server_common.c new/source/server_common.c +--- old/source/server_common.c ++++ new/source/server_common.c +@@ -26,7 +26,6 @@ + * * + *******************************************************************************/ + #include +-#include + #include + #ifdef VMS + #include "../util/VMSparam.h" +@@ -35,10 +34,12 @@ + #include + #endif + #endif /*VMS*/ +-#include "nedit.h" + #include "server_common.h" + #include "../util/utils.h" + ++/* comes from nc.c or nedit.c */ ++extern Display *TheDisplay; ++ + #define NEDIT_VERSION_STRING "5.7" + #define NEDIT_VERSION_STRING_LEN 3 + +diff --quilt old/util/prefFile.c new/util/prefFile.c +--- old/util/prefFile.c ++++ new/util/prefFile.c +@@ -45,7 +45,8 @@ static const char CVSID[] = "$Id: prefFi + #include + #endif + #endif +-#include ++#include ++#include + + #ifdef HAVE_DEBUG_H + #include "../debug.h" +@@ -217,14 +218,14 @@ static void readPrefs(XrmDatabase prefDB + sprintf(rsrcClass, "%s.%s", appClass, rsrcDescrip[i].class); + if (prefDB!=NULL && + XrmGetResource(prefDB, rsrcName, rsrcClass, &type, &rsrcValue)) { +- if (strcmp(type, XmRString)) { ++ if (strcmp(type, XtRString)) { + fprintf(stderr,"nedit: Internal Error: Unexpected resource type, %s\n", + type); + return; + } + valueString = rsrcValue.addr; + } else if (XrmGetResource(appDB,rsrcName,rsrcClass,&type,&rsrcValue)) { +- if (strcmp(type, XmRString)) { ++ if (strcmp(type, XtRString)) { + fprintf(stderr,"nedit: Internal Error: Unexpected resource type, %s\n", + type); + return; +diff --quilt old/Makefile new/Makefile +--- old/Makefile ++++ new/Makefile +@@ -18,6 +18,16 @@ all: + @echo "(For example, type \"make linux\" for a Linux system.)" + @ls makefiles/Makefile* | sed -e 's|makefiles/Makefile\.||g' | column | column -t | sed -e 's/^/\t/' + ++ifdef CLIENT_ONLY ++.DEFAULT: ++ @- (cd util; if [ -f ../makefiles/Makefile.$@ -a ! -f ./Makefile.$@ ];\ ++ then ln -s ../makefiles/Makefile.$@ .; fi) ++ @- (cd source; if [ -f ../makefiles/Makefile.$@ -a ! -f ./Makefile.$@ ];\ ++ then ln -s ../makefiles/Makefile.$@ .; fi) ++ ++ (cd util; $(MAKE) -f Makefile.$@ fileUtils.o utils.o prefFile.o clearcase.o) ++ (cd source; $(MAKE) -f Makefile.$@ nc) ++else + .DEFAULT: + @- (cd Microline/XmL; if [ -f ../../makefiles/Makefile.$@ -a ! -f ./Makefile.$@ ];\ + then ln -s ../../makefiles/Makefile.$@ .; fi) +@@ -35,6 +45,7 @@ all: + (cd Xlt; $(MAKE) -f Makefile.$@ libXlt.a) + (cd Microline/XmL; $(MAKE) -f Makefile.$@ libXmL.a) + (cd source; $(MAKE) -f Makefile.$@ nedit nc) ++endif + + .PHONY: docs help clean realclean + diff --git a/release-client.patch b/release-client.patch index 17841c6..1d2a533 100644 --- a/release-client.patch +++ b/release-client.patch @@ -4,15 +4,15 @@ source/highlightData.c | 4 ++-- source/macro.c | 15 +++++++++++++++ source/menu.c | 31 ++++++++++++++++++++++++++++++- - source/nc.c | 14 ++++++++------ + source/nc.c | 13 +++++++------ source/nedit.h | 1 + - source/server.c | 25 ++++++++++--------------- + source/server.c | 19 +++++++++++-------- source/server_common.c | 5 ++--- source/server_common.h | 3 +-- source/window.c | 22 +++++++++++++++------- source/windowTitle.c | 11 +++++++++++ source/windowTitle.h | 1 + - 12 files changed, 97 insertions(+), 36 deletions(-) + 12 files changed, 97 insertions(+), 29 deletions(-) diff --quilt old/source/menu.c new/source/menu.c --- old/source/menu.c @@ -126,29 +126,22 @@ diff --quilt old/source/server.c new/source/server.c WindowInfo *window, *lastFile = NULL; long currentDesktop = QueryCurrentDesktop(TheDisplay, RootWindow(TheDisplay, DefaultScreen(TheDisplay))); -@@ -375,18 +377,10 @@ static void processServerCommandString(c +@@ -375,10 +377,10 @@ static void processServerCommandString(c command both followed by newlines. This bit of code reads the header, and converts the newlines following the filename and do command to nulls to terminate the filename and doCommand strings */ -- itemsRead = sscanf(inPtr, "%d %d %d %d %d %ld %d %d %d %d%n", &lineNum, -+ itemsRead = sscanf(inPtr, "%d %d %d %d %d %ld %d %d %d %d %d%n", &lineNum, - &readFlag, &createFlag, &iconicFlag, &tabbed, ¤tDesktop, -- &fileLen, &doLen, &lmLen, &geomLen, &charsRead); -- if (itemsRead == 9) { -- /* backward compatibility, without currentDesktop */ -- geomLen = lmLen; -- lmLen = doLen; -- doLen = fileLen; -- fileLen = currentDesktop; -- currentDesktop = QueryCurrentDesktop(TheDisplay, -- RootWindow(TheDisplay, DefaultScreen(TheDisplay))); -- } else if (itemsRead != 10) -+ &clientWaits, &fileLen, &doLen, &lmLen, &geomLen, &charsRead); -+ if (itemsRead != 11) +- itemsRead = sscanf(inPtr, "%d %d %d %d %d %d %d %d %d%n", &lineNum, +- &readFlag, &createFlag, &iconicFlag, &tabbed, &fileLen, +- &doLen, &lmLen, &geomLen, &charsRead); +- if (itemsRead != 9) ++ itemsRead = sscanf(inPtr, "%d %d %d %d %d %d %d %d %d %d%n", &lineNum, ++ &readFlag, &createFlag, &iconicFlag, &tabbed, &clientWaits, ++ &fileLen, &doLen, &lmLen, &geomLen, &charsRead); ++ if (itemsRead != 10) goto readError; inPtr += charsRead + 1; if (fileLen >= 0 && inPtr - string + fileLen > stringLen) -@@ -509,7 +503,8 @@ static void processServerCommandString(c +@@ -505,7 +507,8 @@ static void processServerCommandString(c command can do anything, including closing the window!) */ if (window != NULL) { deleteFileOpenProperty(window, requestname); @@ -273,7 +266,7 @@ diff --quilt old/source/macro.c new/source/macro.c diff --quilt old/source/nc.c new/source/nc.c --- old/source/nc.c +++ new/source/nc.c -@@ -228,8 +228,7 @@ static void createWaitProperties(void) +@@ -227,8 +227,7 @@ static void createWaitProperties(void) fileListHead.waitForCloseCount++; item->waitForFileClosedAtom = CreateServerFileClosedAtom(Preferences.serverName, @@ -283,40 +276,39 @@ diff --quilt old/source/nc.c new/source/nc.c setPropertyValue(item->waitForFileClosedAtom); } } -@@ -779,9 +778,10 @@ static void parseCommandLine(int argc, c +@@ -781,9 +780,10 @@ static void parseCommandLine(int argc, c } /* See below for casts */ -- sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld %ld\n" -+ sprintf(outPtr, "%d %d %d %d %d %ld %d %ld %ld %ld %ld\n" +- sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld\n" ++ sprintf(outPtr, "%d %d %d %d %d %d %ld %ld %ld %ld\n" "%s%s\n%s\n%s\n%s\n%n", - lineNum, read, create, iconic, tabbed, currentDesktop, + lineNum, read, create, iconic, tabbed, + !!Preferences.waitForClose, filePrefixLen + (long) strlen(path), (long) strlen(toDoCommand), (long) strlen(langMode), (long) strlen(geometry), -@@ -824,8 +824,9 @@ static void parseCommandLine(int argc, c +@@ -826,8 +826,8 @@ static void parseCommandLine(int argc, c The "long" cast on strlen() is necessary because size_t is 64 bit on Alphas, and 32-bit on most others. There is no printf format specifier for "size_t", thanx, ANSI. */ -- sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld %ld\n%n", lineNum, -- read, create, iconic, isTabbed, currentDesktop, -+ sprintf(outPtr, "%d %d %d %d %d %ld %d %ld %ld %ld %ld\n%n", -+ lineNum, read, create, iconic, isTabbed, -+ currentDesktop, !!Preferences.waitForClose, +- sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld\n%n", lineNum, +- read, create, iconic, isTabbed, ++ sprintf(outPtr, "%d %d %d %d %d %d %ld %ld %ld %ld\n%n", lineNum, ++ read, create, iconic, isTabbed, !!Preferences.waitForClose, filePrefixLen + (long) strlen(path), (long) strlen(toDoCommand), (long) strlen(langMode), (long) strlen(geometry), &charsWritten); -@@ -888,7 +889,7 @@ static void parseCommandLine(int argc, c +@@ -891,7 +891,7 @@ static void parseCommandLine(int argc, c /* TODO: what about other platforms? */ #endif /* VMS */ -- sprintf(outPtr, "0 0 0 %d %d %ld %ld %ld %ld %ld\n%n", iconic, tabbed, -+ sprintf(outPtr, "0 0 0 %d %d %ld 0 %ld %ld %ld %ld\n%n", iconic, tabbed, - currentDesktop, -(filePrefixLen + length), +- sprintf(outPtr, "0 0 %d %d %d %ld %ld %ld %ld\n%n", ++ sprintf(outPtr, "0 0 %d %d %d 0 %ld %ld %ld %ld\n%n", + doInNew, iconic, tabbed, -(filePrefixLen + length), (long) strlen(toDoCommand), (long) strlen(langMode), (long) strlen(geometry), &charsWritten); -@@ -1090,3 +1091,4 @@ static void printNcVersion(void ) { +@@ -1093,3 +1093,4 @@ static void printNcVersion(void ) { COMPILE_OS, COMPILE_MACHINE, COMPILE_COMPILER, __DATE__, __TIME__); } @@ -398,7 +390,7 @@ diff --quilt old/source/windowTitle.h new/source/windowTitle.h diff --quilt old/source/server_common.c new/source/server_common.c --- old/source/server_common.c +++ new/source/server_common.c -@@ -99,8 +99,7 @@ Atom CreateServerFileOpenAtom(const char +@@ -114,8 +114,7 @@ Atom CreateServerFileOpenAtom(const char } Atom CreateServerFileClosedAtom(const char *serverName, @@ -406,12 +398,12 @@ diff --quilt old/source/server_common.c new/source/server_common.c - Bool only_if_exist) + const char *path) { - char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+9+1]; - const char *userName = GetUserName(NEDIT_NAME); -@@ -108,7 +107,7 @@ Atom CreateServerFileClosedAtom(const ch - Atom atom; + char propName[10+1+ + NEDIT_VERSION_STRING_LEN+1+ +@@ -130,7 +129,7 @@ Atom CreateServerFileClosedAtom(const ch - sprintf(propName, "NEDIT_5.7_FILE_%s_%s_%s_%s_WF_CLOSED", hostName, userName, serverName, path); + sprintf(propName, "NEDIT_%s_FILE_%s_%s_%s_%s_WF_CLOSED", + NEDIT_VERSION_STRING, hostName, userName, serverName, path); - atom = XInternAtom(TheDisplay, propName, only_if_exist); + atom = XInternAtom(TheDisplay, propName, False); return(atom); diff --git a/remote-nc.patch b/remote-nc.patch index 1a9b4b1..c0d2a34 100644 --- a/remote-nc.patch +++ b/remote-nc.patch @@ -1,25 +1,17 @@ --- - source/nc.c | 111 +++++++++++++++++++++++++++++++++++++++---------- - source/server.c | 50 ++++++++++++++-------- - source/server_common.c | 22 ++++----- + source/nc.c | 112 +++++++++++++++++++++++++++++++++++++++---------- + source/server.c | 42 +++++++++++------- + source/server_common.c | 16 +++---- source/windowTitle.c | 8 ++- - util/utils.c | 101 ++++++++++++++++++++++++++++++-------------- + util/utils.c | 101 +++++++++++++++++++++++++++++--------------- util/utils.h | 6 +- - 6 files changed, 209 insertions(+), 89 deletions(-) + 6 files changed, 202 insertions(+), 83 deletions(-) diff --quilt old/source/nc.c new/source/nc.c --- old/source/nc.c +++ new/source/nc.c -@@ -36,6 +36,7 @@ static const char CVSID[] = "$Id: nc.c,v - #include "../util/utils.h" - #include "../util/prefFile.h" - #include "../util/system.h" -+#include "../util/misc.h" - - #include - #include -@@ -181,7 +182,7 @@ static void setPropertyValue(Atom atom) +@@ -181,7 +181,7 @@ static void setPropertyValue(Atom atom) } /* Add another entry to the file entry list, if it doesn't exist yet. */ @@ -28,7 +20,7 @@ diff --quilt old/source/nc.c new/source/nc.c { FileListEntry *item; -@@ -196,8 +197,9 @@ static void addToFileList(const char *pa +@@ -196,8 +196,9 @@ static void addToFileList(const char *pa item = malloc(sizeof(item[0])); item->waitForFileOpenAtom = None; item->waitForFileClosedAtom = None; @@ -40,7 +32,7 @@ diff --quilt old/source/nc.c new/source/nc.c item->next = fileListHead.fileList; fileListHead.fileList = item; } -@@ -233,6 +235,8 @@ int main(int argc, char **argv) +@@ -233,6 +234,8 @@ int main(int argc, char **argv) Atom serverExistsAtom, serverRequestAtom; XrmDatabase prefDB; Boolean serverExists; @@ -49,7 +41,7 @@ diff --quilt old/source/nc.c new/source/nc.c /* Initialize toolkit and get an application context */ XtToolkitInitialize(); -@@ -251,21 +255,26 @@ int main(int argc, char **argv) +@@ -251,21 +254,26 @@ int main(int argc, char **argv) don't support the .nc file anymore) */ prefDB = CreatePreferencesDatabase(NULL, APP_CLASS, OpTable, XtNumber(OpTable), (unsigned *)&argc, argv); @@ -82,7 +74,7 @@ diff --quilt old/source/nc.c new/source/nc.c /* Read the application resources into the Preferences data structure */ RestorePreferences(prefDB, XtDatabase(TheDisplay), APP_NAME, APP_CLASS, PrefDescrip, XtNumber(PrefDescrip)); -@@ -503,7 +512,8 @@ static int startServer(const char *messa +@@ -503,7 +511,8 @@ static int startServer(const char *messa /* prompt user whether to start server */ if (!Preferences.autoStart) { @@ -92,7 +84,7 @@ diff --quilt old/source/nc.c new/source/nc.c do { c = getc(stdin); } while (c == ' ' || c == '\t'); -@@ -605,19 +615,35 @@ static CommandLine processCommandLine(in +@@ -605,19 +614,34 @@ static CommandLine processCommandLine(in */ static void parseCommandLine(int argc, char **argv, CommandLine *commandLine) { @@ -104,8 +96,7 @@ diff --quilt old/source/nc.c new/source/nc.c int lineNum = 0, read = 0, create = 0, iconic = 0, tabbed = -1, length = 0; int i, lineArg, nRead, charsWritten, opts = True; int fileCount = 0, group = 0, isTabbed; -+ long currentDesktop = QueryCurrentDesktop(TheDisplay, -+ RootWindow(TheDisplay, DefaultScreen(TheDisplay))); ++ int doInNew = False; + + char *filePrefix = ""; + long filePrefixLen = 0; @@ -130,15 +121,26 @@ diff --quilt old/source/nc.c new/source/nc.c } /* In case of no arguments, must still allocate space for one record header */ if (length < MAX_RECORD_HEADER_LENGTH) -@@ -735,16 +761,19 @@ static void parseCommandLine(int argc, c +@@ -635,6 +659,10 @@ static void parseCommandLine(int argc, c + } else if (opts && !strcmp(argv[i], "-do")) { + nextArg(argc, argv, &i); + toDoCommand = argv[i]; ++ } else if (opts && !strcmp(argv[i], "-do-in-new")) { ++ nextArg(argc, argv, &i); ++ toDoCommand = argv[i]; ++ doInNew = True; + } else if (opts && !strcmp(argv[i], "-lm")) { + copyCommandLineArg(commandLine, argv[i]); + nextArg(argc, argv, &i); +@@ -735,16 +763,19 @@ static void parseCommandLine(int argc, c } /* See below for casts */ - sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld\n%s\n%s\n%s\n%s\n%n", - lineNum, read, create, iconic, tabbed, (long) strlen(path), -+ sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld %ld\n" ++ sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld\n" + "%s%s\n%s\n%s\n%s\n%n", -+ lineNum, read, create, iconic, tabbed, currentDesktop, ++ lineNum, read, create, iconic, tabbed, + filePrefixLen + (long) strlen(path), (long) strlen(toDoCommand), (long) strlen(langMode), (long) strlen(geometry), @@ -154,14 +156,12 @@ diff --quilt old/source/nc.c new/source/nc.c fileCount++; } if (nameList != NULL) -@@ -777,11 +806,14 @@ static void parseCommandLine(int argc, c - The "long" cast on strlen() is necessary because size_t +@@ -778,10 +809,13 @@ static void parseCommandLine(int argc, c is 64 bit on Alphas, and 32-bit on most others. There is no printf format specifier for "size_t", thanx, ANSI. */ -- sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld\n%n", lineNum, + sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld\n%n", lineNum, - read, create, iconic, isTabbed, (long) strlen(path), -+ sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld %ld\n%n", lineNum, -+ read, create, iconic, isTabbed, currentDesktop, ++ read, create, iconic, isTabbed, + filePrefixLen + (long) strlen(path), (long) strlen(toDoCommand), (long) strlen(langMode), (long) strlen(geometry), &charsWritten); @@ -171,7 +171,7 @@ diff --quilt old/source/nc.c new/source/nc.c strcpy(outPtr, path); outPtr += strlen(path); *outPtr++ = '\n'; -@@ -797,7 +829,7 @@ static void parseCommandLine(int argc, c +@@ -797,9 +831,10 @@ static void parseCommandLine(int argc, c toDoCommand = ""; /* Create the file open atoms for the paths supplied */ @@ -179,8 +179,11 @@ diff --quilt old/source/nc.c new/source/nc.c + addToFileList(filePrefixLen, filePrefix, path); fileCount++; #endif /* VMS */ ++ doInNew = False; } -@@ -812,10 +844,42 @@ static void parseCommandLine(int argc, c + } + #ifdef VMS +@@ -812,10 +847,42 @@ static void parseCommandLine(int argc, c * iconic state (and optional language mode and geometry). */ if (toDoCommand[0] != '\0' || fileCount == 0) { @@ -213,8 +216,8 @@ diff --quilt old/source/nc.c new/source/nc.c + /* TODO: what about other platforms? */ +#endif /* VMS */ + -+ sprintf(outPtr, "0 0 0 %d %d %ld %ld %ld %ld %ld\n%n", iconic, tabbed, -+ currentDesktop, -(filePrefixLen + length), ++ sprintf(outPtr, "0 0 %d %d %d %ld %ld %ld %ld\n%n", ++ doInNew, iconic, tabbed, -(filePrefixLen + length), + (long) strlen(toDoCommand), (long) strlen(langMode), + (long) strlen(geometry), &charsWritten); outPtr += charsWritten; @@ -226,7 +229,7 @@ diff --quilt old/source/nc.c new/source/nc.c strcpy(outPtr, toDoCommand); outPtr += strlen(toDoCommand); *outPtr++ = '\n'; -@@ -826,6 +890,9 @@ static void parseCommandLine(int argc, c +@@ -826,6 +893,9 @@ static void parseCommandLine(int argc, c outPtr += strlen(geometry); *outPtr++ = '\n'; } @@ -239,26 +242,8 @@ diff --quilt old/source/nc.c new/source/nc.c diff --quilt old/source/server.c new/source/server.c --- old/source/server.c +++ new/source/server.c -@@ -375,16 +375,26 @@ static void processServerCommandString(c - command both followed by newlines. This bit of code reads the - header, and converts the newlines following the filename and do - command to nulls to terminate the filename and doCommand strings */ -- itemsRead = sscanf(inPtr, "%d %d %d %d %d %d %d %d %d%n", &lineNum, -- &readFlag, &createFlag, &iconicFlag, &tabbed, &fileLen, -- &doLen, &lmLen, &geomLen, &charsRead); -- if (itemsRead != 9) -+ itemsRead = sscanf(inPtr, "%d %d %d %d %d %ld %d %d %d %d%n", &lineNum, -+ &readFlag, &createFlag, &iconicFlag, &tabbed, ¤tDesktop, -+ &fileLen, &doLen, &lmLen, &geomLen, &charsRead); -+ if (itemsRead == 9) { -+ /* backward compatibility, without currentDesktop */ -+ geomLen = lmLen; -+ lmLen = doLen; -+ doLen = fileLen; -+ fileLen = currentDesktop; -+ currentDesktop = QueryCurrentDesktop(TheDisplay, -+ RootWindow(TheDisplay, DefaultScreen(TheDisplay))); -+ } else if (itemsRead != 10) +@@ -381,10 +381,12 @@ static void processServerCommandString(c + if (itemsRead != 9) goto readError; inPtr += charsRead + 1; - if (inPtr - string + fileLen > stringLen) @@ -272,7 +257,7 @@ diff --quilt old/source/server.c new/source/server.c *inPtr++ = '\0'; if (inPtr - string + doLen > stringLen) goto readError; -@@ -411,13 +421,15 @@ static void processServerCommandString(c +@@ -411,13 +413,16 @@ static void processServerCommandString(c if (fileLen <= 0) { for (window=WindowList; window!=NULL; window=window->next) if (!window->filenameSet && !window->fileChanged && @@ -281,18 +266,25 @@ diff --quilt old/source/server.c new/source/server.c + (fileLen < 0 ? !strcmp(window->path, fullname) : True)) break; - if (*doCommand == '\0') { +- if (*doCommand == '\0') { ++ if (*doCommand == '\0' || createFlag) { if (window == NULL) { - EditNewFile(findWindowOnDesktop(tabbed, currentDesktop), +- EditNewFile(findWindowOnDesktop(tabbed, currentDesktop), - NULL, iconicFlag, lmLen==0?NULL:langMode, NULL, ++ window = EditNewFile(findWindowOnDesktop(tabbed, ++ currentDesktop), + NULL, iconicFlag, lmLen==0?NULL:langMode, + fileLen < 0 ? fullname : NULL, False); } else { if (iconicFlag) -@@ -426,22 +438,24 @@ static void processServerCommandString(c +@@ -425,23 +430,28 @@ static void processServerCommandString(c + else RaiseDocumentWindow(window); } ++ ++ if (window && *doCommand != '\0') ++ DoMacro(window, doCommand, "-do-in-new macro"); } else { - WindowInfo *win = WindowList; - /* Starting a new command while another one is still running @@ -476,56 +468,50 @@ diff --quilt old/util/utils.c new/util/utils.c diff --quilt old/source/server_common.c new/source/server_common.c --- old/source/server_common.c +++ new/source/server_common.c -@@ -57,8 +57,8 @@ void CreateServerPropertyAtoms(const cha - Atom *serverRequestAtomReturn) - { - char propName[24+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN]; +@@ -64,8 +64,8 @@ void CreateServerPropertyAtoms(const cha + MAXNODENAMELEN+1+ + MAXUSERNAMELEN+1+ + MAXSERVERNAMELEN+1]; - const char *userName = GetUserName(); - const char *hostName = GetNameOfHost(); + const char *userName = GetUserName(NEDIT_NAME); + const char *hostName = GetNameOfHost(NEDIT_NAME); - sprintf(propName, "NEDIT_5.7_SERVER_EXISTS_%s_%s_%s", hostName, userName, serverName); - *serverExistsAtomReturn = XInternAtom(TheDisplay, propName, False); -@@ -86,9 +86,9 @@ void CreateServerPropertyAtoms(const cha - Atom CreateServerFileOpenAtom(const char *serverName, - const char *path) - { -- char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+7]; + sprintf(propName, "NEDIT_%s_SERVER_EXISTS_%s_%s_%s", + NEDIT_VERSION_STRING, hostName, userName, serverName); +@@ -102,8 +102,8 @@ Atom CreateServerFileOpenAtom(const char + MAXSERVERNAMELEN+1+ + MAXPATHLEN+1+ + 7+1]; - const char *userName = GetUserName(); - const char *hostName = GetNameOfHost(); -+ char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+7+1]; + const char *userName = GetUserName(NEDIT_NAME); + const char *hostName = GetNameOfHost(NEDIT_NAME); Atom atom; - sprintf(propName, "NEDIT_5.7_FILE_%s_%s_%s_%s_WF_OPEN", hostName, userName, serverName, path); -@@ -100,9 +100,9 @@ Atom CreateServerFileClosedAtom(const ch - const char *path, - Bool only_if_exist) - { -- char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+9]; + sprintf(propName, "NEDIT_%s_FILE_%s_%s_%s_%s_WF_OPEN", +@@ -123,8 +123,8 @@ Atom CreateServerFileClosedAtom(const ch + MAXSERVERNAMELEN+1+ + MAXPATHLEN+1+ + 9+1]; - const char *userName = GetUserName(); - const char *hostName = GetNameOfHost(); -+ char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+9+1]; + const char *userName = GetUserName(NEDIT_NAME); + const char *hostName = GetNameOfHost(NEDIT_NAME); Atom atom; - sprintf(propName, "NEDIT_5.7_FILE_%s_%s_%s_%s_WF_CLOSED", hostName, userName, serverName, path); -@@ -116,9 +116,9 @@ Atom CreateServerFileClosedAtom(const ch - */ - void DeleteServerFileAtoms(const char* serverName, Window rootWindow) - { -- char propNamePrefix[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1]; + sprintf(propName, "NEDIT_%s_FILE_%s_%s_%s_%s_WF_CLOSED", +@@ -145,8 +145,8 @@ void DeleteServerFileAtoms(const char* s + MAXUSERNAMELEN+1+ + MAXSERVERNAMELEN+1+ + 1]; - const char *userName = GetUserName(); - const char *hostName = GetNameOfHost(); -+ char propNamePrefix[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+1]; + const char *userName = GetUserName(NEDIT_NAME); + const char *hostName = GetNameOfHost(NEDIT_NAME); - int length = sprintf(propNamePrefix, "NEDIT_5.7_FILE_%s_%s_%s_", hostName, userName, serverName); + int length = sprintf(propNamePrefix, "NEDIT_%s_FILE_%s_%s_%s_", + NEDIT_VERSION_STRING, hostName, userName, serverName); - int nProperties; diff --quilt old/util/utils.h new/util/utils.h --- old/util/utils.h +++ new/util/utils.h diff --git a/versionedServerAtoms.patch b/versionedServerAtoms.patch index da79bf2..4ce47b1 100644 --- a/versionedServerAtoms.patch +++ b/versionedServerAtoms.patch @@ -1,68 +1,104 @@ --- - source/server_common.c | 18 +++++++++--------- - 1 file changed, 9 insertions(+), 9 deletions(-) + source/server_common.c | 47 ++++++++++++++++++++++++++++++++++++++--------- + 1 file changed, 38 insertions(+), 9 deletions(-) diff --quilt old/source/server_common.c new/source/server_common.c --- old/source/server_common.c +++ new/source/server_common.c -@@ -56,13 +56,13 @@ void CreateServerPropertyAtoms(const cha +@@ -39,6 +39,9 @@ + #include "server_common.h" + #include "../util/utils.h" + ++#define NEDIT_VERSION_STRING "5.7" ++#define NEDIT_VERSION_STRING_LEN 3 ++ + /* + * Create the server property atoms for the server with serverName. + * Atom names are generated as follows: +@@ -56,13 +59,19 @@ void CreateServerPropertyAtoms(const cha Atom *serverExistsAtomReturn, Atom *serverRequestAtomReturn) { - char propName[20+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN]; -+ char propName[24+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN]; ++ char propName[20+1+ ++ NEDIT_VERSION_STRING_LEN+1+ ++ MAXNODENAMELEN+1+ ++ MAXUSERNAMELEN+1+ ++ MAXSERVERNAMELEN+1]; const char *userName = GetUserName(); const char *hostName = GetNameOfHost(); - sprintf(propName, "NEDIT_SERVER_EXISTS_%s_%s_%s", hostName, userName, serverName); -+ sprintf(propName, "NEDIT_5.7_SERVER_EXISTS_%s_%s_%s", hostName, userName, serverName); ++ sprintf(propName, "NEDIT_%s_SERVER_EXISTS_%s_%s_%s", ++ NEDIT_VERSION_STRING, hostName, userName, serverName); *serverExistsAtomReturn = XInternAtom(TheDisplay, propName, False); - sprintf(propName, "NEDIT_SERVER_REQUEST_%s_%s_%s", hostName, userName, serverName); -+ sprintf(propName, "NEDIT_5.7_SERVER_REQUEST_%s_%s_%s", hostName, userName, serverName); ++ sprintf(propName, "NEDIT_%s_SERVER_REQUEST_%s_%s_%s", ++ NEDIT_VERSION_STRING, hostName, userName, serverName); *serverRequestAtomReturn = XInternAtom(TheDisplay, propName, False); } -@@ -86,12 +86,12 @@ void CreateServerPropertyAtoms(const cha +@@ -86,12 +95,19 @@ void CreateServerPropertyAtoms(const cha Atom CreateServerFileOpenAtom(const char *serverName, const char *path) { - char propName[10+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+7]; -+ char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+7]; ++ char propName[10+1+ ++ NEDIT_VERSION_STRING_LEN+1+ ++ MAXNODENAMELEN+1+ ++ MAXUSERNAMELEN+1+ ++ MAXSERVERNAMELEN+1+ ++ MAXPATHLEN+1+ ++ 7+1]; const char *userName = GetUserName(); const char *hostName = GetNameOfHost(); Atom atom; - sprintf(propName, "NEDIT_FILE_%s_%s_%s_%s_WF_OPEN", hostName, userName, serverName, path); -+ sprintf(propName, "NEDIT_5.7_FILE_%s_%s_%s_%s_WF_OPEN", hostName, userName, serverName, path); ++ sprintf(propName, "NEDIT_%s_FILE_%s_%s_%s_%s_WF_OPEN", ++ NEDIT_VERSION_STRING, hostName, userName, serverName, path); atom = XInternAtom(TheDisplay, propName, False); return(atom); } -@@ -100,12 +100,12 @@ Atom CreateServerFileClosedAtom(const ch +@@ -100,12 +116,19 @@ Atom CreateServerFileClosedAtom(const ch const char *path, Bool only_if_exist) { - char propName[10+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+9]; -+ char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+9]; ++ char propName[10+1+ ++ NEDIT_VERSION_STRING_LEN+1+ ++ MAXNODENAMELEN+1+ ++ MAXUSERNAMELEN+1+ ++ MAXSERVERNAMELEN+1+ ++ MAXPATHLEN+1+ ++ 9+1]; const char *userName = GetUserName(); const char *hostName = GetNameOfHost(); Atom atom; - sprintf(propName, "NEDIT_FILE_%s_%s_%s_%s_WF_CLOSED", hostName, userName, serverName, path); -+ sprintf(propName, "NEDIT_5.7_FILE_%s_%s_%s_%s_WF_CLOSED", hostName, userName, serverName, path); ++ sprintf(propName, "NEDIT_%s_FILE_%s_%s_%s_%s_WF_CLOSED", ++ NEDIT_VERSION_STRING, hostName, userName, serverName, path); atom = XInternAtom(TheDisplay, propName, only_if_exist); return(atom); } -@@ -116,10 +116,10 @@ Atom CreateServerFileClosedAtom(const ch +@@ -116,10 +139,16 @@ Atom CreateServerFileClosedAtom(const ch */ void DeleteServerFileAtoms(const char* serverName, Window rootWindow) { - char propNamePrefix[10+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1]; -+ char propNamePrefix[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1]; ++ char propNamePrefix[10+1+ ++ NEDIT_VERSION_STRING_LEN+1+ ++ MAXNODENAMELEN+1+ ++ MAXUSERNAMELEN+1+ ++ MAXSERVERNAMELEN+1+ ++ 1]; const char *userName = GetUserName(); const char *hostName = GetNameOfHost(); - int length = sprintf(propNamePrefix, "NEDIT_FILE_%s_%s_%s_", hostName, userName, serverName); -+ int length = sprintf(propNamePrefix, "NEDIT_5.7_FILE_%s_%s_%s_", hostName, userName, serverName); ++ int length = sprintf(propNamePrefix, "NEDIT_%s_FILE_%s_%s_%s_", ++ NEDIT_VERSION_STRING, hostName, userName, serverName); int nProperties; Atom* atoms = XListProperties(TheDisplay, rootWindow, &nProperties); -- 2.11.4.GIT