#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,
#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>
{
#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
*/
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);
*/
strcpy(smGD.resourcePath, "");
strcpy(smGD.clientPath, "");
- smGD.settingPath[0] = NULL;
+ smGD.settingPath[0] = 0;
smGD.sessionType = DEFAULT_SESSION;
smGD.restoreSession = (char *) SM_SYSTEM_DIRECTORY;
{
strcat(smGD.clientPath, "/");
strncat(smGD.clientPath, langSpec, MAXPATHLEN-2);
- smGD.clientPath[MAXPATHLEN-1];
+ smGD.clientPath[MAXPATHLEN-1] = 0;
}
strcat(smGD.clientPath, "/");
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
{
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;
}
}
}
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);
}
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);
}
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
{
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);
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);
if(status == -1)
{
PrintErrnoError(DtError, smNLS.cantCreateDirsString);
- smGD.fontPath[0] = NULL;
+ smGD.fontPath[0] = 0;
return(-1);
}
chmod(smGD.fontPath, 0755);
if(status == -1)
{
PrintErrnoError(DtError, smNLS.cantCreateDirsString);
- smGD.fontPath[0] = NULL;
+ smGD.fontPath[0] = 0;
return(-1);
}
chmod(smGD.fontPath, 0755);
#endif
#include "Sm.h"
+#include "SmGlobals.h"
#include "SmUI.h"
#include "SmError.h"
#include "SmLock.h"
#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"
*/
#include <stdio.h>
+#include <stdlib.h>
#include <X11/Intrinsic.h>
#include <X11/SM/SMlib.h>
#include "SmXSMP.h"
#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>
#include <Dt/MsgLog.h>
#include <bms/spc.h>
#include <Dt/CmdInv.h>
+#include <Dt/ActionUtilP.h>
#include "Sm.h"
#include "SmResource.h"
static void SetTemporaryDisplay (
int screenNum);
+int RestorePreferences(char *filename);
+
static void RestoreDisplay (
int screenNum);
Boolean goodWmStartup = True;
int status;
- if((smGD.wmStartup == NULL) || (*smGD.wmStartup == NULL))
+ if((smGD.wmStartup == NULL) || (*smGD.wmStartup == 0))
{
ForkWM();
}
/*
* Load the resources from the SM database file
*/
- if (smGD.settingPath[0] != NULL)
+ if (smGD.settingPath[0] != 0)
{
smBase = XrmGetFileDatabase(smGD.settingPath);
Boolean resIndep = False, resRet;
char *resdata;
- if(((smGD.sessionLang == NULL) || (*smGD.sessionLang == NULL)) &&
+ if(((smGD.sessionLang == NULL) || (*smGD.sessionLang == 0)) &&
(smRes.displayResolution == 0))
{
/*
{
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 */
*(string++) = *(parseP++);
}
#endif
- *string = NULL;
+ *string = 0;
if (*parseP == '\n')
{
parseP++;
lnwsP++;
if (lnwsP < endP)
{
- *lnwsP = NULL;
+ *lnwsP = 0;
}
}
* 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
else
tmpEnv = envp;
- for (ppchar = tmpEnv; ppchar && *ppchar; *ppchar++)
+ for (ppchar = tmpEnv; ppchar && *ppchar; ppchar++)
putenv (strdup (*ppchar));
}
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];
}
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)
if (!ignoreEnvPtr) {
for (count = 0, ppchar = envp; ppchar && *ppchar;
- count++, *ppchar++) {
+ count++, ppchar++) {
retEnv[count] = *ppchar;
}
retEnv[count] = NULL;
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)]) == '=')) {
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 *) ;
#include "SmDB.h"
#include "SmProperty.h"
#include "SmProp.h"
+#include "Srv.h"
+#include "SrvFile_io.h"
#ifdef MULTIBYTE
#include <stdlib.h>
* 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
/*
* 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);
(float) DisplayHeightMM(smGD.display, 0)) * 1000;
intYRes = fltYRes;
- if(*resSpec == NULL)
+ if(*resSpec == 0)
{
strcpy(resSpec, SM_RESOURCE_NAME);
}
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);
}
#include <Dt/UserMsg.h>
#include <Dt/SaverP.h>
#include "Sm.h"
+#include "SmCommun.h"
#include "SmUI.h" /* smDD.* */
#include "SmError.h"
#include "SmWindow.h"
#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"
*/
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 );
}
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 );
#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"
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 */
#ifdef sun
#include "OWsync.h"
+#else
+#include <Dt/DtP.h>
#endif
#define DEFAULT 4
*(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) ;
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) ;
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);
colorSrv.FgColor[screen_number] = WHITE;
return(4);
}
- /* should never get here */
- return(0);
}
+ /* should never get here */
+ return(0);
}
/****************************************************************************