--- cde/lib/DtSvc/DtUtil2/UserMsg.h | 4 +-- cde/programs/dtsession/SmCommun.c | 1 + cde/programs/dtsession/SmConMgmt.c | 2 +- cde/programs/dtsession/SmGlobals.c | 50 +++++++++++++++++------------------ cde/programs/dtsession/SmLock.c | 1 + cde/programs/dtsession/SmMain.c | 1 + cde/programs/dtsession/SmProp.c | 1 + cde/programs/dtsession/SmRestore.c | 36 ++++++++++++++----------- cde/programs/dtsession/SmRestore.h | 1 + cde/programs/dtsession/SmSave.c | 12 +++++---- cde/programs/dtsession/SmScreen.c | 1 + cde/programs/dtsession/SmUI.c | 11 +++++--- cde/programs/dtsession/SmWindow.c | 1 + cde/programs/dtsession/SrvFile_io.h | 5 +++- cde/programs/dtsession/SrvPalette.c | 19 ++++++++----- 15 files changed, 86 insertions(+), 60 deletions(-)
diff --git a/cde/lib/DtSvc/DtUtil2/UserMsg.h b/cde/lib/DtSvc/DtUtil2/UserMsg.h index 097dd59..54c2f78 100644 --- a/cde/lib/DtSvc/DtUtil2/UserMsg.h +++ b/cde/lib/DtSvc/DtUtil2/UserMsg.h @@ -79,14 +79,14 @@ extern void _DtSimpleErrnoError( #define DtProgName XeProgName -extern _DtPrintDefaultError( +extern int _DtPrintDefaultError( Display *dpy, XErrorEvent *event, char *msg ); #define _DTPRINTDEFAULTERROR_BUFSIZE 1024 -extern _DtPrintDefaultErrorSafe( +extern int _DtPrintDefaultErrorSafe( Display *dpy, XErrorEvent *event, char *msg, diff --git a/cde/programs/dtsession/SmCommun.c b/cde/programs/dtsession/SmCommun.c index 9446d47..c86c0c1 100644 --- a/cde/programs/dtsession/SmCommun.c +++ b/cde/programs/dtsession/SmCommun.c @@ -58,6 +58,7 @@ #include <X11/extensions/scrnsaver.h> #endif /* USE_X11SSEXT */ #include <Xm/Xm.h> +#include <Dt/Dt.h> #include <Dt/DtP.h> #include <Dt/Action.h> #include <Dt/SessionM.h> diff --git a/cde/programs/dtsession/SmConMgmt.c b/cde/programs/dtsession/SmConMgmt.c index 23ed57c..cda6055 100644 --- a/cde/programs/dtsession/SmConMgmt.c +++ b/cde/programs/dtsession/SmConMgmt.c @@ -162,7 +162,7 @@ GetMemoryUtilization(void) { #if !defined(linux) static int init = 0; - static kmem; + static int kmem; #if !defined(SVR4) && !defined(sco) && !defined(hpV4) && !defined(_POWER) && !defined (__osf__) && !defined(CSRG_BASED) extern void nlist(); #endif diff --git a/cde/programs/dtsession/SmGlobals.c b/cde/programs/dtsession/SmGlobals.c index 4bda658..e721d19 100644 --- a/cde/programs/dtsession/SmGlobals.c +++ b/cde/programs/dtsession/SmGlobals.c @@ -714,9 +714,9 @@ SetRestorePath( */ if(smGD.compatMode == True) { - smGD.clientPath[0] = NULL; - smGD.resourcePath[0] = NULL; - smGD.settingPath[0] = NULL; + smGD.clientPath[0] = 0; + smGD.resourcePath[0] = 0; + smGD.settingPath[0] = 0; smGD.sessionType = DEFAULT_SESSION; smGD.restoreSession = NULL; return(0); @@ -836,7 +836,7 @@ SetSysDefaults( void ) */ strcpy(smGD.resourcePath, ""); strcpy(smGD.clientPath, ""); - smGD.settingPath[0] = NULL; + smGD.settingPath[0] = 0; smGD.sessionType = DEFAULT_SESSION; smGD.restoreSession = (char *) SM_SYSTEM_DIRECTORY; @@ -845,7 +845,7 @@ SetSysDefaults( void ) { strcat(smGD.clientPath, "/"); strncat(smGD.clientPath, langSpec, MAXPATHLEN-2); - smGD.clientPath[MAXPATHLEN-1]; + smGD.clientPath[MAXPATHLEN-1] = 0; } strcat(smGD.clientPath, "/"); @@ -865,8 +865,8 @@ SetSysDefaults( void ) PrintErrnoError(DtError, GETMESSAGE(4, 2, "No defaults files exist. " "No applications will be restarted.")); - smGD.clientPath[0] = NULL; - smGD.resourcePath[0] = NULL; + smGD.clientPath[0] = 0; + smGD.resourcePath[0] = 0; } else { @@ -881,8 +881,8 @@ SetSysDefaults( void ) PrintErrnoError(DtError, GETMESSAGE(4, 3, "No defaults files exist. " "No applications will be restarted.")); - smGD.clientPath[0] = NULL; - smGD.resourcePath[0] = NULL; + smGD.clientPath[0] = 0; + smGD.resourcePath[0] = 0; } } } @@ -934,13 +934,13 @@ SetResSet( void ) status = stat(smGD.resourcePath, &buf); if(status == -1) { - smGD.resourcePath[0] = NULL; + smGD.resourcePath[0] = 0; } status = stat(smGD.settingPath, &buf); if(status == -1) { - smGD.settingPath[0] = NULL; + smGD.settingPath[0] = 0; } return(0); } @@ -1039,9 +1039,9 @@ SetSavePath( if(smGD.savePath == NULL) { PrintErrnoError(DtError, smNLS.cantCreateDirsString); - smGD.clientPath[0] = NULL; - smGD.settingPath[0] = NULL; - smGD.resourcePath[0] = NULL; + smGD.clientPath[0] = 0; + smGD.settingPath[0] = 0; + smGD.resourcePath[0] = 0; return(-1); } @@ -1123,9 +1123,9 @@ SetSavePath( MoveDirectory(smGD.clientPath, smGD.etcPath, False); } - smGD.clientPath[0] = NULL; - smGD.settingPath[0] = NULL; - smGD.resourcePath[0] = NULL; + smGD.clientPath[0] = 0; + smGD.settingPath[0] = 0; + smGD.resourcePath[0] = 0; } else { @@ -1141,9 +1141,9 @@ SetSavePath( if(status == -1) { PrintErrnoError(DtError, smNLS.cantCreateDirsString); - smGD.clientPath[0] = NULL; - smGD.settingPath[0] = NULL; - smGD.resourcePath[0] = NULL; + smGD.clientPath[0] = 0; + smGD.settingPath[0] = 0; + smGD.resourcePath[0] = 0; return(-1); } chmod(smGD.clientPath, 0755); @@ -1189,9 +1189,9 @@ SetSavePath( if(status == -1) { PrintErrnoError(DtError, smNLS.cantCreateDirsString); - smGD.clientPath[0] = NULL; - smGD.settingPath[0] = NULL; - smGD.resourcePath[0] = NULL; + smGD.clientPath[0] = 0; + smGD.settingPath[0] = 0; + smGD.resourcePath[0] = 0; return(-1); } chmod(smGD.clientPath, 0755); @@ -1257,7 +1257,7 @@ SetFontSavePath(char *langPtr) if(status == -1) { PrintErrnoError(DtError, smNLS.cantCreateDirsString); - smGD.fontPath[0] = NULL; + smGD.fontPath[0] = 0; return(-1); } chmod(smGD.fontPath, 0755); @@ -1275,7 +1275,7 @@ SetFontSavePath(char *langPtr) if(status == -1) { PrintErrnoError(DtError, smNLS.cantCreateDirsString); - smGD.fontPath[0] = NULL; + smGD.fontPath[0] = 0; return(-1); } chmod(smGD.fontPath, 0755); diff --git a/cde/programs/dtsession/SmLock.c b/cde/programs/dtsession/SmLock.c index 41b4abd..0e7307c 100644 --- a/cde/programs/dtsession/SmLock.c +++ b/cde/programs/dtsession/SmLock.c @@ -92,6 +92,7 @@ #endif #include "Sm.h" +#include "SmGlobals.h" #include "SmUI.h" #include "SmError.h" #include "SmLock.h" diff --git a/cde/programs/dtsession/SmMain.c b/cde/programs/dtsession/SmMain.c index 9a864d6..23ce151 100644 --- a/cde/programs/dtsession/SmMain.c +++ b/cde/programs/dtsession/SmMain.c @@ -69,6 +69,7 @@ #include <Dt/UserMsg.h> #include <Dt/EnvControlP.h> #include <Dt/DtP.h> +#include <Dt/Lock.h> #include "Sm.h" #include "SmError.h" #include "SmGlobals.h" diff --git a/cde/programs/dtsession/SmProp.c b/cde/programs/dtsession/SmProp.c index e87a701..26f1e02 100644 --- a/cde/programs/dtsession/SmProp.c +++ b/cde/programs/dtsession/SmProp.c @@ -33,6 +33,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <X11/Intrinsic.h> #include <X11/SM/SMlib.h> #include "SmXSMP.h" diff --git a/cde/programs/dtsession/SmRestore.c b/cde/programs/dtsession/SmRestore.c index 7fb200c..28748ab 100644 --- a/cde/programs/dtsession/SmRestore.c +++ b/cde/programs/dtsession/SmRestore.c @@ -67,6 +67,7 @@ #include <X11/apollosys.h> /* for pid_t struct in hp-ux sys/types.h */ #endif #include <sys/socket.h> +#include <sys/wait.h> #include <netinet/in.h> #include <netdb.h> #include <errno.h> @@ -96,6 +97,7 @@ #include <Dt/MsgLog.h> #include <bms/spc.h> #include <Dt/CmdInv.h> +#include <Dt/ActionUtilP.h> #include "Sm.h" #include "SmResource.h" @@ -334,6 +336,8 @@ static void RemoteRequestSucceeded(char *, void *); static void SetTemporaryDisplay ( int screenNum); +int RestorePreferences(char *filename); + static void RestoreDisplay ( int screenNum); @@ -650,7 +654,7 @@ StartWM( void ) Boolean goodWmStartup = True; int status; - if((smGD.wmStartup == NULL) || (*smGD.wmStartup == NULL)) + if((smGD.wmStartup == NULL) || (*smGD.wmStartup == 0)) { ForkWM(); } @@ -1105,7 +1109,7 @@ RestoreSettings( void ) /* * Load the resources from the SM database file */ - if (smGD.settingPath[0] != NULL) + if (smGD.settingPath[0] != 0) { smBase = XrmGetFileDatabase(smGD.settingPath); @@ -1565,7 +1569,7 @@ RestoreIndependentResources( void ) Boolean resIndep = False, resRet; char *resdata; - if(((smGD.sessionLang == NULL) || (*smGD.sessionLang == NULL)) && + if(((smGD.sessionLang == NULL) || (*smGD.sessionLang == 0)) && (smRes.displayResolution == 0)) { /* @@ -2441,12 +2445,12 @@ GetNextLine( void ) { string = (unsigned char *) fgets((char *)line, fileSize, cfileP); } - else if ((parseP != NULL) && (*parseP != NULL)) + else if ((parseP != NULL) && (*parseP != 0)) /* read parse string */ { string = line; #ifdef MULTIBYTE - while ((*parseP != NULL) && + while ((*parseP != 0) && ((chlen = mblen ((char *) parseP, MB_CUR_MAX)) > 0) && (*parseP != '\n')) /* copy all but NULL and newlines to line buffer */ @@ -2463,7 +2467,7 @@ GetNextLine( void ) *(string++) = *(parseP++); } #endif - *string = NULL; + *string = 0; if (*parseP == '\n') { parseP++; @@ -2803,7 +2807,7 @@ GetSmartString( lnwsP++; if (lnwsP < endP) { - *lnwsP = NULL; + *lnwsP = 0; } } @@ -2867,9 +2871,9 @@ GetSmartString( * NULL -> point to NULL */ - if (*endP != NULL) + if (*endP != 0) { - *endP = NULL; /* write NULL over terminator */ + *endP = 0; /* write NULL over terminator */ *linePP = ++curP; /* point beyond terminator */ } else @@ -3589,7 +3593,7 @@ StartLocalClient ( else tmpEnv = envp; - for (ppchar = tmpEnv; ppchar && *ppchar; *ppchar++) + for (ppchar = tmpEnv; ppchar && *ppchar; ppchar++) putenv (strdup (*ppchar)); } @@ -4089,14 +4093,14 @@ FixEnvironmentData( void ) int i; extern char **environ; /* MODIFIED - DISPLAY is remove if found. */ - for (i=0, ppchar = environ; *ppchar; *ppchar++, i++) + for (i=0, ppchar = environ; *ppchar; ppchar++, i++) { if ((strncmp (*ppchar, DISPLAY_NAME_EQUAL, strlen(DISPLAY_NAME_EQUAL))) == 0) { /* * Change the DISPLAY environment variable. */ - for (; *ppchar; *ppchar++, i++) + for (; *ppchar; ppchar++, i++) { environ[i]=environ[i+1]; } @@ -4754,7 +4758,7 @@ char ** RemoveEnvironmentVars ( if (!envp) return (NULL); - for (count = 0, ppchar = envp; ppchar && *ppchar; count++, *ppchar++) ; + for (count = 0, ppchar = envp; ppchar && *ppchar; count++, ppchar++) ; retEnv = (char **) XtMalloc ((count + 1) * sizeof (char *)); if (!retEnv) @@ -4762,7 +4766,7 @@ char ** RemoveEnvironmentVars ( if (!ignoreEnvPtr) { for (count = 0, ppchar = envp; ppchar && *ppchar; - count++, *ppchar++) { + count++, ppchar++) { retEnv[count] = *ppchar; } retEnv[count] = NULL; @@ -4770,11 +4774,11 @@ char ** RemoveEnvironmentVars ( return (retEnv); } - for (count = 0, ppchar = envp; ppchar && *ppchar; *ppchar++) { + for (count = 0, ppchar = envp; ppchar && *ppchar; ppchar++) { found = False; - for (ppchar2 = ignoreEnvPtr; ppchar2 && *ppchar2; *ppchar2++) { + for (ppchar2 = ignoreEnvPtr; ppchar2 && *ppchar2; ppchar2++) { if ((!strncmp (*ppchar, *ppchar2, strlen (*ppchar2))) && (((*ppchar)[strlen(*ppchar2)]) == '=')) { diff --git a/cde/programs/dtsession/SmRestore.h b/cde/programs/dtsession/SmRestore.h index 4ab71c2..d63c1bb 100644 --- a/cde/programs/dtsession/SmRestore.h +++ b/cde/programs/dtsession/SmRestore.h @@ -76,6 +76,7 @@ extern int RestoreState( void ) ; extern int SetCompatState( void ) ; extern int StartWM( void ) ; extern int RestoreResources(Boolean, ...) ; +extern int RestorePreferences(char *) ; extern void RestoreIndependentResources(void) ; extern void StartEtc( Boolean ) ; extern void CreateExecString(char *) ; diff --git a/cde/programs/dtsession/SmSave.c b/cde/programs/dtsession/SmSave.c index b7e7ae3..3df9e15 100644 --- a/cde/programs/dtsession/SmSave.c +++ b/cde/programs/dtsession/SmSave.c @@ -88,6 +88,8 @@ #include "SmDB.h" #include "SmProperty.h" #include "SmProp.h" +#include "Srv.h" +#include "SrvFile_io.h" #ifdef MULTIBYTE #include <stdlib.h> @@ -359,7 +361,7 @@ CompleteSave ( ) * CALLED - SETTINGS MUST BE SAVED BEFORE RESOURCES BECAUSE SETTINGS * GETS INFORMATION SAVED IN RESOURCES (smToSet.dClickBuf) */ - smToSet.dClickBuf[0] = NULL; + smToSet.dClickBuf[0] = 0; /* * Do the actual output of the X settings information. Output will @@ -1607,9 +1609,9 @@ OutputResource( void ) /* * Write out the LANG variable and the screen's Y resolution */ - *resSpec = NULL; + *resSpec = 0; langPtr = getenv("LANG"); - if((langPtr != NULL) && (*langPtr != NULL)) + if((langPtr != NULL) && (*langPtr != 0)) { sprintf(resSpec, "%s*%s: %s\n", SM_RESOURCE_NAME, SmNsessionLang, langPtr); @@ -1623,7 +1625,7 @@ OutputResource( void ) (float) DisplayHeightMM(smGD.display, 0)) * 1000; intYRes = fltYRes; - if(*resSpec == NULL) + if(*resSpec == 0) { strcpy(resSpec, SM_RESOURCE_NAME); } @@ -1697,7 +1699,7 @@ OutputResource( void ) if (preeditBuf) XFree(preeditBuf); } - if((smCust.dClickChange == True) && (smToSet.dClickBuf[0] != NULL)) + if((smCust.dClickChange == True) && (smToSet.dClickBuf[0] != 0)) { _DtAddToResource(smGD.display, (char *)smToSet.dClickBuf); } diff --git a/cde/programs/dtsession/SmScreen.c b/cde/programs/dtsession/SmScreen.c index bd41fe4..7c02a71 100644 --- a/cde/programs/dtsession/SmScreen.c +++ b/cde/programs/dtsession/SmScreen.c @@ -51,6 +51,7 @@ #include <Dt/UserMsg.h> #include <Dt/SaverP.h> #include "Sm.h" +#include "SmCommun.h" #include "SmUI.h" /* smDD.* */ #include "SmError.h" #include "SmWindow.h" diff --git a/cde/programs/dtsession/SmUI.c b/cde/programs/dtsession/SmUI.c index 87df356..5ce5ad2 100644 --- a/cde/programs/dtsession/SmUI.c +++ b/cde/programs/dtsession/SmUI.c @@ -76,10 +76,13 @@ #include <Dt/SessionM.h> #include <Dt/Icon.h> #include <Dt/MsgLog.h> +#include <Dt/Lock.h> +#include <Tt/tttk.h> #include "Sm.h" #include "SmUI.h" #include "SmSave.h" +#include "SmRestore.h" #include "SmHelp.h" #include "SmGlobals.h" @@ -1167,8 +1170,8 @@ ImmediateExit( */ if(smGD.bmsDead == False) { - notice = (Tt_message) tttk_message_create( 0, TT_NOTICE, TT_SESSION, 0, - "XSession_Ending", 0); + notice = (Tt_message) tttk_message_create( NULL, TT_NOTICE, TT_SESSION, NULL, + "XSession_Ending", NULL); tt_message_send( notice ); tt_message_destroy( notice ); } @@ -1184,8 +1187,8 @@ ImmediateExit( int sessionType = smGD.sessionType; XtIntervalId timerId; - msg = (Tt_message) tttk_message_create( 0, TT_NOTICE, TT_SESSION, 0, - "DtActivity_Beginning", 0 ); + msg = (Tt_message) tttk_message_create( NULL, TT_NOTICE, TT_SESSION, NULL, + "DtActivity_Beginning", NULL ); tt_message_send( msg ); tt_message_destroy( msg ); diff --git a/cde/programs/dtsession/SmWindow.c b/cde/programs/dtsession/SmWindow.c index 36f0cb9..80ecdf1 100644 --- a/cde/programs/dtsession/SmWindow.c +++ b/cde/programs/dtsession/SmWindow.c @@ -57,6 +57,7 @@ #include <X11/Xutil.h> #include <X11/Xatom.h> #include <Dt/UserMsg.h> +#include <Dt/WsmP.h> #include "Sm.h" #include "SmError.h" #include "SmWindow.h" diff --git a/cde/programs/dtsession/SrvFile_io.h b/cde/programs/dtsession/SrvFile_io.h index 4a445eb..79f6600 100644 --- a/cde/programs/dtsession/SrvFile_io.h +++ b/cde/programs/dtsession/SrvFile_io.h @@ -78,7 +78,10 @@ extern struct _palette * GetPaletteDefinition( Display *dpy, int screen_number, char *palette) ; - +extern void SaveDefaultPalette( + Display *dpy, + char *dtPath, + int mode ); #endif /*_srvfile_h*/ /* DON'T ADD ANYTHING AFTER THIS #endif */ diff --git a/cde/programs/dtsession/SrvPalette.c b/cde/programs/dtsession/SrvPalette.c index 5ecce49..aef5157 100644 --- a/cde/programs/dtsession/SrvPalette.c +++ b/cde/programs/dtsession/SrvPalette.c @@ -71,6 +71,8 @@ static char rcsid[] = #ifdef sun #include "OWsync.h" +#else +#include <Dt/DtP.h> #endif #define DEFAULT 4 @@ -345,7 +347,7 @@ _DtCacheProperties( *(palette->converted + palette->converted_len) = XmPIXEL_SET_PROP_VERSION ; palette->converted_len++ ; - palette->converted[palette->converted_len] = NULL ; + palette->converted[palette->converted_len] = 0 ; XChangeProperty(dpy, win, pixel_set_atom, XA_STRING, 8, PropModeAppend, (unsigned char *) XtNewString(palette->converted), palette->converted_len) ; @@ -796,7 +798,7 @@ lose_selection( Widget w, Atom *selection ) { - char *tmpStr, *tmpStr2; + char *tmpStr, *tmpStr2, *tmpStr3; Atom pixel_set_atom ; pixel_set_atom = XInternAtom(XtDisplay(w), XmSPIXEL_SET_PROP, FALSE) ; @@ -804,8 +806,13 @@ lose_selection( tmpStr = (char *)SRV_MALLOC(strlen(MSG2) + strlen(MSG2a) + 6); tmpStr2 = (char *)SRV_MALLOC(strlen(MSG2) + 1); - sprintf(tmpStr2,"%s", MSG2); - sprintf(tmpStr,"%s%s%s", tmpStr2, selection, MSG2a); + if (selection != NULL) { + tmpStr3 = XGetAtomName(XtDisplay(w), *selection); + } else { + tmpStr3 = NULL; + } + printf(tmpStr2,"%s", MSG2); + sprintf(tmpStr,"%s%s%s", tmpStr2, (tmpStr3 == NULL) ? "(null)" : tmpStr3, MSG2a); _DtSimpleError(XmSCOLOR_SRV_NAME, DtWarning, NULL, tmpStr, NULL); SRV_FREE(tmpStr); SRV_FREE(tmpStr2); @@ -932,9 +939,9 @@ FindMaximumDefault( colorSrv.FgColor[screen_number] = WHITE; return(4); } - /* should never get here */ - return(0); } + /* should never get here */ + return(0); } /**************************************************************************** -- 1.7.9.2 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ cdesktopenv-devel mailing list cdesktopenv-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel