summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--auth.c77
-rw-r--r--auth.h16
-rw-r--r--choose.c117
-rw-r--r--choose.h21
-rw-r--r--globals.c3
-rw-r--r--info.c112
-rw-r--r--info.h21
-rw-r--r--list.h26
-rw-r--r--lock.c46
-rw-r--r--lock.h18
-rw-r--r--log.c31
-rw-r--r--log.h15
-rw-r--r--mainwin.c13
-rw-r--r--mainwin.h8
-rw-r--r--misc.c45
-rw-r--r--popup.c15
-rw-r--r--popup.h12
-rw-r--r--prop.c56
-rw-r--r--prop.h26
-rw-r--r--remote.c25
-rw-r--r--restart.c42
-rw-r--r--restart.h20
-rw-r--r--save.c206
-rw-r--r--save.h35
-rw-r--r--saveutil.c62
-rw-r--r--saveutil.h16
-rw-r--r--signals.c41
-rw-r--r--xsm.c213
-rw-r--r--xsm.h38
-rw-r--r--xsm.man5
-rw-r--r--xtwatch.c35
-rw-r--r--xtwatch.h10
32 files changed, 597 insertions, 829 deletions
diff --git a/auth.c b/auth.c
index beb9b77..4eb594a 100644
--- a/auth.c
+++ b/auth.c
@@ -23,10 +23,18 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/auth.c,v 1.7 2001/12/14 20:02:23 dawes Exp $ */
#include "xsm.h"
#include <X11/ICE/ICEutil.h>
+#include "auth.h"
+
+#ifdef HAS_MKSTEMP
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#include <sys/stat.h>
static char *addAuthFile = NULL;
static char *remAuthFile = NULL;
@@ -40,10 +48,7 @@ static char *remAuthFile = NULL;
*/
Bool
-HostBasedAuthProc (hostname)
-
-char *hostname;
-
+HostBasedAuthProc(char *hostname)
{
return (0); /* For now, we don't support host based authentication */
}
@@ -56,12 +61,7 @@ char *hostname;
*/
static void
-write_iceauth (addfp, removefp, entry)
-
-FILE *addfp;
-FILE *removefp;
-IceAuthDataEntry *entry;
-
+write_iceauth(FILE *addfp, FILE *removefp, IceAuthDataEntry *entry)
{
fprintf (addfp,
"add %s \"\" %s %s ",
@@ -80,13 +80,15 @@ IceAuthDataEntry *entry;
+#ifndef HAS_MKSTEMP
static char *
-unique_filename (path, prefix)
-
-char *path;
-char *prefix;
-
+unique_filename(char *path, char *prefix)
+#else
+static char *
+unique_filename(char *path, char *prefix, int *pFd)
+#endif
{
+#ifndef HAS_MKSTEMP
#ifndef X_NOT_POSIX
return ((char *) tempnam (path, prefix));
#else
@@ -104,6 +106,19 @@ char *prefix;
else
return (NULL);
#endif
+#else
+ char tempFile[PATH_MAX];
+ char *ptr;
+
+ sprintf (tempFile, "%s/%sXXXXXX", path, prefix);
+ ptr = (char *)malloc(strlen(tempFile) + 1);
+ if (ptr != NULL)
+ {
+ strcpy(ptr, tempFile);
+ *pFd = mkstemp(ptr);
+ }
+ return ptr;
+#endif
}
@@ -116,12 +131,8 @@ char *prefix;
#define MAGIC_COOKIE_LEN 16
Status
-SetAuthentication (count, listenObjs, authDataEntries)
-
-int count;
-IceListenObj *listenObjs;
-IceAuthDataEntry **authDataEntries;
-
+SetAuthentication(int count, IceListenObj *listenObjs,
+ IceAuthDataEntry **authDataEntries)
{
FILE *addfp = NULL;
FILE *removefp = NULL;
@@ -129,6 +140,9 @@ IceAuthDataEntry **authDataEntries;
int original_umask;
char command[256];
int i;
+#ifdef HAS_MKSTEMP
+ int fd;
+#endif
original_umask = umask (0077); /* disallow non-owner access */
@@ -139,7 +153,7 @@ IceAuthDataEntry **authDataEntries;
if (!path)
path = ".";
}
-
+#ifndef HAS_MKSTEMP
if ((addAuthFile = unique_filename (path, ".xsm")) == NULL)
goto bad;
@@ -151,6 +165,19 @@ IceAuthDataEntry **authDataEntries;
if (!(removefp = fopen (remAuthFile, "w")))
goto bad;
+#else
+ if ((addAuthFile = unique_filename (path, ".xsm", &fd)) == NULL)
+ goto bad;
+
+ if (!(addfp = fdopen(fd, "wb")))
+ goto bad;
+
+ if ((remAuthFile = unique_filename (path, ".xsm", &fd)) == NULL)
+ goto bad;
+
+ if (!(removefp = fdopen(fd, "wb")))
+ goto bad;
+#endif
if ((*authDataEntries = (IceAuthDataEntry *) XtMalloc (
count * 2 * sizeof (IceAuthDataEntry))) == NULL)
@@ -225,11 +252,7 @@ IceAuthDataEntry **authDataEntries;
*/
void
-FreeAuthenticationData (count, authDataEntries)
-
-int count;
-IceAuthDataEntry *authDataEntries;
-
+FreeAuthenticationData(int count, IceAuthDataEntry *authDataEntries)
{
/* Each transport has entries for ICE and XSMP */
diff --git a/auth.h b/auth.h
index 65149b9..2302dbb 100644
--- a/auth.h
+++ b/auth.h
@@ -23,7 +23,17 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/auth.h,v 1.6 2001/12/14 20:02:23 dawes Exp $ */
-extern Status SetAuthentication ();
-extern void FreeAuthenticationData ();
-extern Bool HostBasedAuthProc ();
+#ifndef _AUTH_H_
+#define _AUTH_H_
+
+#include <X11/ICE/ICEutil.h>
+
+extern Bool HostBasedAuthProc(char *hostname);
+extern Status SetAuthentication(int count, IceListenObj *listenObjs,
+ IceAuthDataEntry **authDataEntries);
+extern void FreeAuthenticationData(int count,
+ IceAuthDataEntry *authDataEntries);
+
+#endif
diff --git a/choose.c b/choose.c
index 4f1255c..c5806f0 100644
--- a/choose.c
+++ b/choose.c
@@ -23,10 +23,12 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/choose.c,v 1.5 2001/12/14 20:02:24 dawes Exp $ */
#include "xsm.h"
#include "saveutil.h"
#include "lock.h"
+#include "choose.h"
#include <sys/types.h>
#include <X11/Shell.h>
@@ -71,13 +73,8 @@ Widget chooseSessionCancelButton;
int
-GetSessionNames (count_ret, short_names_ret, long_names_ret, locked_ret)
-
-int *count_ret;
-String **short_names_ret;
-String **long_names_ret;
-Bool **locked_ret;
-
+GetSessionNames(int *count_ret, String **short_names_ret,
+ String **long_names_ret, Bool **locked_ret)
{
DIR *dir;
struct dirent *entry;
@@ -132,7 +129,7 @@ Bool **locked_ret;
{
char *name = (char *) entry->d_name + 5;
char *id = NULL;
- Bool locked = CheckSessionLocked (name, long_names_ret, &id);
+ Bool locked = CheckSessionLocked (name, long_names_ret!=NULL, &id);
(*short_names_ret)[*count_ret] = XtNewString (name);
(*locked_ret)[*count_ret] = locked;
@@ -174,13 +171,8 @@ Bool **locked_ret;
void
-FreeSessionNames (count, namesShort, namesLong, lockFlags)
-
-int count;
-String *namesShort;
-String *namesLong;
-Bool *lockFlags;
-
+FreeSessionNames(int count, String *namesShort, String *namesLong,
+ Bool *lockFlags)
{
int i;
@@ -202,11 +194,7 @@ Bool *lockFlags;
static void
-SessionSelected (number, highlight)
-
-int number;
-Bool highlight;
-
+SessionSelected(int number, Bool highlight)
{
if (number >= 0)
{
@@ -230,11 +218,7 @@ Bool highlight;
static void
-AddSessionNames (count, names)
-
-int count;
-String *names;
-
+AddSessionNames(int count, String *names)
{
int i;
@@ -254,13 +238,9 @@ String *names;
void
-ChooseWindowStructureNotifyXtHandler (w, closure, event, continue_to_dispatch)
-
-Widget w;
-XtPointer closure;
-XEvent *event;
-Boolean *continue_to_dispatch;
-
+ChooseWindowStructureNotifyXtHandler(Widget w, XtPointer closure,
+ XEvent *event,
+ Boolean *continue_to_dispatch)
{
if (event->type == MapNotify)
{
@@ -284,8 +264,7 @@ Boolean *continue_to_dispatch;
void
-ChooseSession ()
-
+ChooseSession(void)
{
Dimension width, height;
Position x, y;
@@ -348,8 +327,7 @@ ChooseSession ()
static void
-CheckDeleteCancel ()
-
+CheckDeleteCancel (void)
{
if (delete_session_phase > 0)
{
@@ -363,8 +341,7 @@ CheckDeleteCancel ()
static void
-CheckBreakLockCancel ()
-
+CheckBreakLockCancel(void)
{
if (break_lock_phase > 0)
{
@@ -379,13 +356,7 @@ CheckBreakLockCancel ()
static void
-ChooseSessionUp (w, event, params, numParams)
-
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *numParams;
-
+ChooseSessionUp(Widget w, XEvent *event, String *params, Cardinal *numParams)
{
XawListReturnStruct *current;
@@ -400,13 +371,7 @@ Cardinal *numParams;
static void
-ChooseSessionDown (w, event, params, numParams)
-
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *numParams;
-
+ChooseSessionDown(Widget w, XEvent *event, String *params, Cardinal *numParams)
{
XawListReturnStruct *current;
@@ -422,13 +387,8 @@ Cardinal *numParams;
static void
-ChooseSessionBtn1Down (w, event, params, numParams)
-
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *numParams;
-
+ChooseSessionBtn1Down(Widget w, XEvent *event, String *params,
+ Cardinal *numParams)
{
XawListReturnStruct *current;
@@ -443,12 +403,7 @@ Cardinal *numParams;
static void
-ChooseSessionLoadXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+ChooseSessionLoadXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
XawListReturnStruct *current;
@@ -497,12 +452,7 @@ XtPointer callData;
static void
-ChooseSessionDeleteXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+ChooseSessionDeleteXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
XawListReturnStruct *current;
int longest;
@@ -596,12 +546,8 @@ XtPointer callData;
static void
-ChooseSessionBreakLockXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+ChooseSessionBreakLockXtProc(Widget w, XtPointer client_data,
+ XtPointer callData)
{
XawListReturnStruct *current;
char *name;
@@ -674,12 +620,8 @@ XtPointer callData;
static void
-ChooseSessionFailSafeXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+ChooseSessionFailSafeXtProc(Widget w, XtPointer client_data,
+ XtPointer callData)
{
/*
* Pop down choice of sessions, and start the fail safe session.
@@ -713,12 +655,7 @@ XtPointer callData;
static void
-ChooseSessionCancelXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+ChooseSessionCancelXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
if (delete_session_phase > 0 || break_lock_phase > 0)
{
@@ -736,7 +673,7 @@ XtPointer callData;
void
-create_choose_session_popup ()
+create_choose_session_popup(void)
{
static XtActionsRec choose_actions[] = {
diff --git a/choose.h b/choose.h
index 6816839..31dc9ca 100644
--- a/choose.h
+++ b/choose.h
@@ -23,8 +23,21 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/choose.h,v 1.6 2001/12/14 20:02:24 dawes Exp $ */
-extern void create_choose_session_popup ();
-extern int GetSessionNames ();
-extern void FreeSessionNames ();
-extern void ChooseSession ();
+#ifndef _CHOOSE_H_
+#define _CHOOSE_H_
+
+#include <X11/Intrinsic.h>
+
+extern int GetSessionNames(int *count_ret, String **short_names_ret,
+ String **long_names_ret, Bool **locked_ret);
+extern void FreeSessionNames(int count, String *namesShort, String *namesLong,
+ Bool *lockFlags);
+extern void ChooseWindowStructureNotifyXtHandler(Widget w, XtPointer closure,
+ XEvent *event,
+ Boolean *continue_to_dispatch);
+extern void ChooseSession(void);
+extern void create_choose_session_popup(void);
+
+#endif
diff --git a/globals.c b/globals.c
index 4c6d1cd..5bbbc44 100644
--- a/globals.c
+++ b/globals.c
@@ -23,6 +23,7 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/globals.c,v 1.6 2001/12/14 20:02:25 dawes Exp $ */
#include <X11/ICE/ICEutil.h>
@@ -35,6 +36,7 @@ List *RestartAnywayList;
List *RestartImmedList;
List *WaitForSaveDoneList;
+List *InitialSaveList;
List *FailedSaveList;
List *WaitForInteractList;
List *WaitForPhase2List;
@@ -86,3 +88,4 @@ Bool remote_allowed;
XtAppContext appContext;
Widget topLevel;
+XtSignalId sig_term_id, sig_usr1_id;
diff --git a/info.c b/info.c
index ba79f0d..005a2c4 100644
--- a/info.c
+++ b/info.c
@@ -23,10 +23,13 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/info.c,v 1.6 2001/12/14 20:02:25 dawes Exp $ */
#include "xsm.h"
#include "restart.h"
#include "popup.h"
+#include "info.h"
+#include "prop.h"
#include <X11/Shell.h>
#include <X11/Xaw/Form.h>
@@ -64,10 +67,7 @@ Widget clientPropTextWidget;
void
-ShowHint (client)
-
-ClientRec *client;
-
+ShowHint(ClientRec *client)
{
static Widget active = NULL;
int hint = client->restartHint;
@@ -101,11 +101,7 @@ typedef struct {
static void
-AppendStr (buffer, str)
-
-Buffer *buffer;
-char *str;
-
+AppendStr(Buffer *buffer, char *str)
{
int len = strlen (str);
@@ -130,10 +126,7 @@ char *str;
void
-DisplayProps (client)
-
-ClientRec *client;
-
+DisplayProps(ClientRec *client)
{
int index;
List *pl, *pj, *vl;
@@ -265,12 +258,7 @@ ClientRec *client;
static void
-ClientListXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+ClientListXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
XawListReturnStruct *current = (XawListReturnStruct *) callData;
ClientRec *client;
@@ -289,12 +277,7 @@ XtPointer callData;
static void
-ViewPropXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+ViewPropXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
ClientRec *client;
XawListReturnStruct *current;
@@ -316,12 +299,7 @@ XtPointer callData;
static void
-CloneXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+CloneXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
ClientRec *client;
XawListReturnStruct *current;
@@ -346,12 +324,7 @@ XtPointer callData;
static void
-KillClientXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+KillClientXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
ClientRec *client;
XawListReturnStruct *current;
@@ -375,12 +348,7 @@ XtPointer callData;
static void
-listDoneXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+listDoneXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
XtPopdown (clientInfoPopup);
client_info_visible = 0;
@@ -389,10 +357,7 @@ XtPointer callData;
char *
-GetProgramName (fullname)
-
-char *fullname;
-
+GetProgramName(char *fullname)
{
char *lastSlash = NULL;
int i;
@@ -410,8 +375,7 @@ char *fullname;
void
-UpdateClientList ()
-
+UpdateClientList(void)
{
ClientRec *client;
char *progName, *hostname, *tmp1, *tmp2;
@@ -617,12 +581,7 @@ UpdateClientList ()
static void
-RestartHintXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+RestartHintXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
XawListReturnStruct *current;
ClientRec *client;
@@ -667,6 +626,7 @@ XtPointer callData;
if (strcmp (SmRestartStyleHint, pprop->name) == 0)
{
List *vl = ListFirst (pprop->values);
+
PropValue *pval = (PropValue *) vl->thing;
*((char *) (pval->value)) = hint;
@@ -706,12 +666,7 @@ XtPointer callData;
static void
-clientPropDoneXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+clientPropDoneXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
XtPopdown (clientPropPopup);
client_prop_visible = 0;
@@ -720,13 +675,9 @@ XtPointer callData;
void
-ClientInfoStructureNotifyXtHandler (w, closure, event, continue_to_dispatch)
-
-Widget w;
-XtPointer closure;
-XEvent *event;
-Boolean *continue_to_dispatch;
-
+ClientInfoStructureNotifyXtHandler(Widget w, XtPointer closure,
+ XEvent *event,
+ Boolean *continue_to_dispatch)
{
if (event->type == MapNotify)
{
@@ -743,11 +694,7 @@ Boolean *continue_to_dispatch;
void
-ClientInfoXtProc (w, client_data, callData)
- Widget w;
- XtPointer client_data;
- XtPointer callData;
-
+ClientInfoXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
static int first_time = 1;
@@ -801,13 +748,8 @@ static unsigned char check_bits[] = {
static void
-DelClientInfoWinAction (w, event, params, num_params)
-
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *num_params;
-
+DelClientInfoWinAction(Widget w, XEvent *event, String *params,
+ Cardinal *num_params)
{
XtCallCallbacks (clientInfoDoneButton, XtNcallback, NULL);
}
@@ -815,13 +757,7 @@ Cardinal *num_params;
static void
-DelPropWinAction (w, event, params, num_params)
-
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *num_params;
-
+DelPropWinAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
XtCallCallbacks (clientPropDoneButton, XtNcallback, NULL);
}
@@ -829,7 +765,7 @@ Cardinal *num_params;
void
-create_client_info_popup ()
+create_client_info_popup(void)
{
/*
diff --git a/info.h b/info.h
index 9d98b26..0d3e786 100644
--- a/info.h
+++ b/info.h
@@ -23,7 +23,22 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/info.h,v 3.5 2001/12/14 20:02:25 dawes Exp $ */
-extern void create_client_info_popup ();
-extern void UpdateClientList ();
-extern void ClientInfoXtProc ();
+#ifndef _INFO_H_
+#define _INFO_H_
+
+#include "xsm.h"
+
+extern void ShowHint(ClientRec *client);
+extern void DisplayProps(ClientRec *client);
+extern char * GetProgramName(char *fullname);
+extern void UpdateClientList(void);
+extern void ClientInfoStructureNotifyXtHandler(Widget w, XtPointer closure,
+ XEvent *event,
+ Boolean *continue_to_dispatch);
+extern void ClientInfoXtProc(Widget w, XtPointer client_data,
+ XtPointer callData);
+extern void create_client_info_popup(void);
+
+#endif
diff --git a/list.h b/list.h
index 97b0593..e0a1198 100644
--- a/list.h
+++ b/list.h
@@ -23,6 +23,10 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/list.h,v 1.6 2001/12/14 20:02:25 dawes Exp $ */
+
+#ifndef _LIST_H_
+#define _LIST_H_
typedef struct _List {
struct _List *prev;
@@ -30,13 +34,15 @@ typedef struct _List {
char *thing;
} List;
-extern List *ListInit();
-extern List *ListFirst();
-extern List *ListNext();
-extern void ListFreeAll();
-extern void ListFreeAllButHead();
-extern void ListFreeOne();
-extern Status ListSearchAndFreeOne();
-extern List *ListAddFirst();
-extern List *ListAddLast();
-extern int ListCount();
+extern List *ListInit(void);
+extern List *ListFirst(List *l);
+extern List *ListNext(List *l);
+extern void ListFreeAll(List *l);
+extern void ListFreeAllButHead(List *l);
+extern List *ListAddFirst(List *l, char *v);
+extern List *ListAddLast(List *l, char *v);
+extern void ListFreeOne(List *e);
+extern Status ListSearchAndFreeOne(List *l, char *thing);
+extern int ListCount(List *l);
+
+#endif
diff --git a/lock.c b/lock.c
index 46b5083..611acdd 100644
--- a/lock.c
+++ b/lock.c
@@ -23,14 +23,16 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/lock.c,v 3.5 2002/05/31 18:46:14 dawes Exp $ */
#include "xsm.h"
+#include "lock.h"
+#include "choose.h"
#include <sys/types.h>
static char *
-GetPath ()
-
+GetPath(void)
{
char *path = (char *) getenv ("SM_SAVE_DIR");
@@ -46,11 +48,7 @@ GetPath ()
Status
-LockSession (session_name, write_id)
-
-char *session_name;
-Bool write_id;
-
+LockSession(char *session_name, Bool write_id)
{
char *path;
char lock_file[PATH_MAX];
@@ -60,14 +58,18 @@ Bool write_id;
path = GetPath ();
+#ifndef __UNIXOS2__
sprintf (lock_file, "%s/.XSMlock-%s", path, session_name);
sprintf (temp_lock_file, "%s/.XSMtlock-%s", path, session_name);
+#else
+ sprintf (temp_lock_file, "%s/%s.slk", path, session_name);
+#endif
if ((fd = creat (temp_lock_file, 0444)) < 0)
return (0);
- if (write_id &&
- (write (fd, networkIds, strlen (networkIds)) != strlen (networkIds)) ||
+ if ((write_id &&
+ (write (fd, networkIds, strlen (networkIds)) != strlen (networkIds))) ||
(write (fd, "\n", 1) != 1))
{
close (fd);
@@ -76,6 +78,7 @@ Bool write_id;
close (fd);
+#ifndef __UNIXOS2__
status = 1;
if (link (temp_lock_file, lock_file) < 0)
@@ -83,16 +86,16 @@ Bool write_id;
if (unlink (temp_lock_file) < 0)
status = 0;
+#else
+ status = 0;
+#endif
return (status);
}
void
-UnlockSession (session_name)
-
-char *session_name;
-
+UnlockSession(char *session_name)
{
char *path;
char lock_file[PATH_MAX];
@@ -106,10 +109,7 @@ char *session_name;
char *
-GetLockId (session_name)
-
-char *session_name;
-
+GetLockId(char *session_name)
{
char *path;
FILE *fp;
@@ -137,12 +137,7 @@ char *session_name;
Bool
-CheckSessionLocked (session_name, get_id, id_ret)
-
-char *session_name;
-Bool get_id;
-char **id_ret;
-
+CheckSessionLocked(char *session_name, Bool get_id, char **id_ret)
{
if (get_id)
*id_ret = GetLockId (session_name);
@@ -156,10 +151,7 @@ char **id_ret;
void
-UnableToLockSession (session_name)
-
-char *session_name;
-
+UnableToLockSession(char *session_name)
{
/*
* We should popup a dialog here giving error.
diff --git a/lock.h b/lock.h
index 2153c00..9e3af89 100644
--- a/lock.h
+++ b/lock.h
@@ -23,9 +23,17 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/lock.h,v 1.6 2001/12/14 20:02:25 dawes Exp $ */
-extern Status LockSession ();
-extern void UnlockSession ();
-extern char *GetLockId ();
-extern Bool CheckSessionLocked ();
-extern void UnableToLockSession ();
+#ifndef _LOCK_H_
+#define _LOCK_H_
+
+#include <X11/Xdefs.h>
+
+extern Status LockSession(char *session_name, Bool write_id);
+extern void UnlockSession(char* session_name);
+extern char * GetLockId(char *session_name);
+extern Bool CheckSessionLocked(char *session_name, Bool get_id, char **id_ret);
+extern void UnableToLockSession(char *session_name);
+
+#endif
diff --git a/log.c b/log.c
index f8f642a..7889bc2 100644
--- a/log.c
+++ b/log.c
@@ -23,10 +23,12 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/log.c,v 1.5 2001/12/14 20:02:26 dawes Exp $ */
#include "xsm.h"
#include "save.h"
#include "popup.h"
+#include "log.h"
#include <X11/Shell.h>
#include <X11/Xaw/Form.h>
@@ -41,12 +43,7 @@ Widget logOkButton;
void
-DisplayLogXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+DisplayLogXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
static int first_time = 1;
@@ -71,12 +68,7 @@ XtPointer callData;
static void
-logOkXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+logOkXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
XtPopdown (logPopup);
client_log_visible = 0;
@@ -85,10 +77,7 @@ XtPointer callData;
void
-add_log_text (str)
-
-char *str;
-
+add_log_text(char *str)
{
XawTextPosition pos = XawTextGetInsertionPoint (logText);
XawTextBlock text;
@@ -104,13 +93,7 @@ char *str;
static void
-DelLogWinAction (w, event, params, num_params)
-
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *num_params;
-
+DelLogWinAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
XtCallCallbacks (logOkButton, XtNcallback, NULL);
}
@@ -118,7 +101,7 @@ Cardinal *num_params;
void
-create_log_popup ()
+create_log_popup(void)
{
/*
diff --git a/log.h b/log.h
index 414ea5a..070a422 100644
--- a/log.h
+++ b/log.h
@@ -23,7 +23,16 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/log.h,v 1.6 2001/12/14 20:02:26 dawes Exp $ */
-extern void DisplayLogXtProc ();
-extern void create_log_popup ();
-extern void add_log_text ();
+#ifndef _LOG_H_
+#define _LOG_H_
+
+#include <X11/Intrinsic.h>
+
+extern void DisplayLogXtProc(Widget w, XtPointer client_data,
+ XtPointer callData);
+extern void add_log_text(char *str);
+extern void create_log_popup(void);
+
+#endif
diff --git a/mainwin.c b/mainwin.c
index ac317d6..b60de6e 100644
--- a/mainwin.c
+++ b/mainwin.c
@@ -23,11 +23,13 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/mainwin.c,v 1.5 2001/12/14 20:02:26 dawes Exp $ */
#include "xsm.h"
#include "info.h"
#include "save.h"
#include "log.h"
+#include "mainwin.h"
#include <X11/Shell.h>
#include <X11/Xaw/Form.h>
@@ -48,13 +50,7 @@ Widget shutdownDontSave;
static void
-DelMainWinAction (w, event, params, num_params)
-
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *num_params;
-
+DelMainWinAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
XtCallCallbacks (shutdownSave, XtNcallback, NULL);
}
@@ -62,8 +58,7 @@ Cardinal *num_params;
void
-create_main_window ()
-
+create_main_window (void)
{
/*
* Main window
diff --git a/mainwin.h b/mainwin.h
index 54063b9..98df23e 100644
--- a/mainwin.h
+++ b/mainwin.h
@@ -23,5 +23,11 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/mainwin.h,v 1.6 2001/12/14 20:02:26 dawes Exp $ */
-extern void create_main_window ();
+#ifndef _MAINWIN_H_
+#define _MAINWIN_H_
+
+extern void create_main_window(void);
+
+#endif
diff --git a/misc.c b/misc.c
index 0a33e1f..475ee87 100644
--- a/misc.c
+++ b/misc.c
@@ -23,6 +23,7 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/misc.c,v 1.6 2001/12/14 20:02:26 dawes Exp $ */
#include "xsm.h"
@@ -37,8 +38,7 @@ in this Software without prior written authorization from The Open Group.
* called NAME.
*/
int
-putenv(s)
- char *s;
+putenv(char *s)
{
char *v;
int varlen, idx;
@@ -95,46 +95,17 @@ putenv(s)
-strbw (a, b)
-
-char *a;
-char *b;
-
+int
+strbw(char *a, char *b)
{
return !strncmp (a, b, strlen (b));
}
-#ifdef X_NOT_STDC_ENV
-
-char *Strstr (s1, s2)
-
-char *s1;
-char *s2;
-
-{
- int n1, n2;
-
- n1 = strlen (s1);
- n2 = strlen (s2);
-
- for (; n1 >= n2; s1++, n1--)
- {
- if (!strncmp (s1, s2, n2))
- return s1;
- }
-
- return NULL;
-}
-
-#endif
-
-
-
#if defined(sun) && defined(SVR4)
-int System (s)
- char *s;
+int
+System(char *s)
{
int pid, status;
if ((pid = fork ()) == 0) {
@@ -148,8 +119,8 @@ int System (s)
-nomem ()
-
+void
+nomem(void)
{
fprintf (stderr, "Insufficient memory.\n");
exit (255);
diff --git a/popup.c b/popup.c
index b6ecfab..90c21b5 100644
--- a/popup.c
+++ b/popup.c
@@ -27,23 +27,16 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/xsm/popup.c,v 1.5 2001/12/14 20:02:26 dawes Exp $ */
#include "xsm.h"
#include <X11/Shell.h>
+#include "popup.h"
void
-PopupPopup (parent, popup, transient, first_time,
- offset_x, offset_y, delAction)
-
-Widget parent;
-Widget popup;
-Bool transient;
-Bool first_time;
-int offset_x;
-int offset_y;
-String delAction;
-
+PopupPopup(Widget parent, Widget popup, Bool transient, Bool first_time,
+ int offset_x, int offset_y, String delAction)
{
if (!transient && !first_time)
{
diff --git a/popup.h b/popup.h
index 68f04b1..7d5568d 100644
--- a/popup.h
+++ b/popup.h
@@ -27,5 +27,15 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/xsm/popup.h,v 1.6 2001/12/14 20:02:26 dawes Exp $ */
-extern void PopupPopup ();
+#ifndef _POPUP_H_
+#define _POPUP_H_
+
+#include <X11/Intrinsic.h>
+
+extern void PopupPopup(Widget parent, Widget popup, Bool transient,
+ Bool first_time, int offset_x, int offset_y,
+ String delAction);
+
+#endif
diff --git a/prop.c b/prop.c
index b8a4d25..5255a0b 100644
--- a/prop.c
+++ b/prop.c
@@ -23,17 +23,18 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/prop.c,v 1.5 2001/12/14 20:02:26 dawes Exp $ */
#include "xsm.h"
+#include "info.h"
+#include "prop.h"
+#include <X11/Xaw/List.h>
extern Widget clientListWidget;
void
-FreePropValues (propValues)
-
-List *propValues;
-
+FreePropValues(List *propValues)
{
List *pv;
PropValue *pval;
@@ -51,10 +52,7 @@ List *propValues;
void
-FreeProp (prop)
-
-Prop *prop;
-
+FreeProp(Prop *prop)
{
FreePropValues (prop->values);
XtFree (prop->name);
@@ -65,11 +63,7 @@ Prop *prop;
void
-SetInitialProperties (client, props)
-
-ClientRec *client;
-List *props;
-
+SetInitialProperties(ClientRec *client, List *props)
{
List *pl;
@@ -129,12 +123,7 @@ List *props;
void
-SetProperty (client, theProp, freeIt)
-
-ClientRec *client;
-SmProp *theProp;
-Bool freeIt;
-
+SetProperty(ClientRec *client, SmProp *theProp, Bool freeIt)
{
List *pl;
Prop *pprop = NULL;
@@ -232,11 +221,7 @@ Bool freeIt;
void
-DeleteProperty (client, propname)
-
-ClientRec *client;
-char *propname;
-
+DeleteProperty(ClientRec *client, char *propname)
{
List *pl;
@@ -271,13 +256,8 @@ char *propname;
void
-SetPropertiesProc (smsConn, managerData, numProps, props)
-
-SmsConn smsConn;
-SmPointer managerData;
-int numProps;
-SmProp **props;
-
+SetPropertiesProc(SmsConn smsConn, SmPointer managerData, int numProps,
+ SmProp **props)
{
ClientRec *client = (ClientRec *) managerData;
int updateList, i;
@@ -317,12 +297,8 @@ SmProp **props;
void
-DeletePropertiesProc (smsConn, managerData, numProps, propNames)
-
-SmsConn smsConn;
-SmPointer managerData;
-int numProps;
-char **propNames;
+DeletePropertiesProc(SmsConn smsConn, SmPointer managerData,
+ int numProps, char **propNames)
{
ClientRec *client = (ClientRec *) managerData;
@@ -350,11 +326,7 @@ char **propNames;
void
-GetPropertiesProc (smsConn, managerData)
-
-SmsConn smsConn;
-SmPointer managerData;
-
+GetPropertiesProc(SmsConn smsConn, SmPointer managerData)
{
ClientRec *client = (ClientRec *) managerData;
SmProp **propsRet, *propRet;
diff --git a/prop.h b/prop.h
index 0b45ffe..a124879 100644
--- a/prop.h
+++ b/prop.h
@@ -23,12 +23,22 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/prop.h,v 1.6 2001/12/14 20:02:26 dawes Exp $ */
-extern void FreePropValues ();
-extern void FreeProp ();
-extern void SetInitialProperties ();
-extern void SetProperty ();
-extern void DeleteProperty ();
-extern void SetPropertiesProc ();
-extern void DeletePropertiesProc ();
-extern void GetPropertiesProc ();
+#ifndef _PROP_H_
+#define _PROP_H_
+
+#include "xsm.h"
+
+extern void FreePropValues(List *propValues);
+extern void FreeProp(Prop *prop);
+extern void SetInitialProperties(ClientRec *client, List *props);
+extern void SetProperty(ClientRec *client, SmProp *theProp, Bool freeIt);
+extern void DeleteProperty(ClientRec *client, char *propname);
+extern void SetPropertiesProc(SmsConn smsConn, SmPointer managerData,
+ int numProps, SmProp **props);
+extern void DeletePropertiesProc(SmsConn smsConn, SmPointer managerData,
+ int numProps, char **propNames);
+extern void GetPropertiesProc(SmsConn smsConn, SmPointer managerData);
+
+#endif
diff --git a/remote.c b/remote.c
index 0b20bcc..5e942e7 100644
--- a/remote.c
+++ b/remote.c
@@ -23,35 +23,27 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/remote.c,v 1.5 2001/12/14 20:02:26 dawes Exp $ */
/*
* We use the rstart protocol to restart clients on remote machines.
*/
#include "xsm.h"
+#include "log.h"
#include <X11/ICE/ICEutil.h>
-static char *format_rstart_env();
+static char *format_rstart_env(char *str);
extern IceAuthDataEntry *authDataEntries;
extern int numTransports;
-extern void fprintfhex ();
void
-remote_start (restart_protocol, restart_machine, program, args, cwd, env,
- non_local_display_env, non_local_session_env)
-
-char *restart_protocol;
-char *restart_machine;
-char *program;
-char **args;
-char *cwd;
-char **env;
-char *non_local_display_env;
-char *non_local_session_env;
-
+remote_start(char *restart_protocol, char *restart_machine, char *program,
+ char **args, char *cwd, char **env,
+ char *non_local_display_env, char *non_local_session_env)
{
FILE *fp;
int pipefd[2];
@@ -211,10 +203,7 @@ char *non_local_session_env;
*/
static char *
-format_rstart_env (str)
-
-char *str;
-
+format_rstart_env(char *str)
{
int escape_count = 0, i;
char *temp = str;
diff --git a/restart.c b/restart.c
index daff7eb..581a0d4 100644
--- a/restart.c
+++ b/restart.c
@@ -23,11 +23,14 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/restart.c,v 1.6 2001/12/14 20:02:26 dawes Exp $ */
#include "xsm.h"
#include "log.h"
+#include "restart.h"
+#include "saveutil.h"
-extern void remote_start ();
+extern char **environ;
/*
@@ -36,10 +39,7 @@ extern void remote_start ();
*/
Bool
-CheckIsManager (program)
-
-char *program;
-
+CheckIsManager(char *program)
{
return (strcmp (program, "twm") == 0);
}
@@ -77,15 +77,8 @@ char *program;
*/
void
-GetRestartInfo (restart_service_prop, client_host_name,
- run_local, restart_protocol, restart_machine)
-
-char *restart_service_prop;
-char *client_host_name;
-Bool *run_local;
-char **restart_protocol;
-char **restart_machine;
-
+GetRestartInfo(char *restart_service_prop, char *client_host_name,
+ Bool *run_local, char **restart_protocol, char **restart_machine)
{
char hostnamebuf[80];
char *temp;
@@ -149,10 +142,7 @@ char **restart_machine;
*/
Status
-Restart (flag)
-
-int flag;
-
+Restart(int flag)
{
List *cl, *pl, *vl;
PendingClient *c;
@@ -163,7 +153,6 @@ int flag;
char **env;
char **pp;
int cnt;
- extern char **environ;
char *p;
char *restart_service_prop;
char *restart_protocol;
@@ -349,18 +338,13 @@ int flag;
*/
void
-Clone (client, useSavedState)
-
-ClientRec *client;
-Bool useSavedState;
-
+Clone(ClientRec *client, Bool useSavedState)
{
char *cwd;
char *program;
char **args;
char **env;
char **pp;
- extern char **environ;
char *p;
char *restart_service_prop;
char *restart_protocol;
@@ -531,8 +515,7 @@ Bool useSavedState;
void
-StartDefaultApps ()
-
+StartDefaultApps (void)
{
FILE *f;
char *buf, *p, *home, filename[128];
@@ -563,7 +546,7 @@ StartDefaultApps ()
buf = NULL;
buflen = 0;
- while (getline(&buf, &buflen, f))
+ while (getnextline(&buf, &buflen, f))
{
char logtext[256];
@@ -593,8 +576,7 @@ StartDefaultApps ()
void
-StartNonSessionAwareApps ()
-
+StartNonSessionAwareApps(void)
{
char logtext[256];
int i;
diff --git a/restart.h b/restart.h
index 6dcf553..a1abc89 100644
--- a/restart.h
+++ b/restart.h
@@ -23,8 +23,20 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/restart.h,v 1.6 2001/12/14 20:02:27 dawes Exp $ */
-extern void StartDefaultApps ();
-extern void StartNonSessionAwareApps ();
-extern Status Restart ();
-extern void Clone ();
+#ifndef _RESTART_H_
+#define _RESTART_H_
+
+#include "xsm.h"
+
+extern Bool CheckIsManager(char *program);
+extern void GetRestartInfo(char *restart_service_prop, char *client_host_name,
+ Bool *run_local, char **restart_protocol,
+ char **restart_machine);
+extern Status Restart(int flag);
+extern void Clone(ClientRec *client, Bool useSavedState);
+extern void StartDefaultApps(void);
+extern void StartNonSessionAwareApps(void);
+
+#endif
diff --git a/save.c b/save.c
index 36bb8dc..bc7bc0e 100644
--- a/save.c
+++ b/save.c
@@ -23,11 +23,15 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/save.c,v 3.4 2001/12/14 20:02:27 dawes Exp $ */
#include "xsm.h"
#include "save.h"
#include "saveutil.h"
#include "popup.h"
+#include "info.h"
+#include "lock.h"
+#include "choose.h"
#include <X11/Shell.h>
#include <X11/Xaw/Form.h>
@@ -94,15 +98,10 @@ static Bool help_visible = False;
static String name_in_use = NULL;
static Bool name_locked = False;
-void SetSaveSensitivity ();
static void
-MakeCurrentSession (new_name, name_changed)
-
-String new_name;
-Bool name_changed;
-
+MakeCurrentSession(String new_name, Bool name_changed)
{
char title[256];
List *cl;
@@ -190,10 +189,7 @@ Bool name_changed;
#define NAME_LOCKED 3
static int
-GetSaveName (nameRet)
-
-String *nameRet;
-
+GetSaveName(String *nameRet)
{
String new_name = NULL;
Bool name_changed;
@@ -253,12 +249,7 @@ String *nameRet;
static void
-GetSaveOptions (saveType, interactStyle, fast)
-
-int *saveType;
-int *interactStyle;
-Bool *fast;
-
+GetSaveOptions(int *saveType, int *interactStyle, Bool *fast)
{
XtPointer ptr;
@@ -279,12 +270,8 @@ Bool *fast;
-DoSave (saveType, interactStyle, fast)
-
-int saveType;
-int interactStyle;
-Bool fast;
-
+void
+DoSave(int saveType, int interactStyle, Bool fast)
{
ClientRec *client;
List *cl;
@@ -354,13 +341,7 @@ Bool fast;
static void
-SaveOkAction (w, event, params, num_params)
-
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *num_params;
-
+SaveOkAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
XtCallCallbacks (saveOkButton, XtNcallback, NULL);
}
@@ -368,13 +349,7 @@ Cardinal *num_params;
static void
-DelSaveWinAction (w, event, params, num_params)
-
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *num_params;
-
+DelSaveWinAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
XtCallCallbacks (saveCancelButton, XtNcallback, NULL);
}
@@ -382,13 +357,8 @@ Cardinal *num_params;
static void
-DelNameInUseWinAction (w, event, params, num_params)
-
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *num_params;
-
+DelNameInUseWinAction(Widget w, XEvent *event, String *params,
+ Cardinal *num_params)
{
XtCallCallbacks (nameInUseCancelButton, XtNcallback, NULL);
}
@@ -396,13 +366,8 @@ Cardinal *num_params;
static void
-DelBadSaveWinAction (w, event, params, num_params)
-
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *num_params;
-
+DelBadSaveWinAction(Widget w, XEvent *event, String *params,
+ Cardinal *num_params)
{
if (XtIsManaged (badSaveCancelButton))
XtCallCallbacks (badSaveCancelButton, XtNcallback, NULL);
@@ -413,13 +378,8 @@ Cardinal *num_params;
static void
-DelSaveHelpWinAction (w, event, params, num_params)
-
-Widget w;
-XEvent *event;
-String *params;
-Cardinal *num_params;
-
+DelSaveHelpWinAction(Widget w, XEvent *event, String *params,
+ Cardinal *num_params)
{
XtCallCallbacks (helpSaveOkButton, XtNcallback, NULL);
}
@@ -427,12 +387,7 @@ Cardinal *num_params;
static void
-SaveOkXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+SaveOkXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
String name = NULL;
char label[256];
@@ -504,10 +459,7 @@ XtPointer callData;
void
-LetClientInteract (cl)
-
-List *cl;
-
+LetClientInteract(List *cl)
{
ClientRec *client = (ClientRec *) cl->thing;
@@ -524,8 +476,7 @@ List *cl;
void
-StartPhase2 ()
-
+StartPhase2(void)
{
List *cl;
@@ -556,8 +507,7 @@ StartPhase2 ()
void
-FinishUpSave ()
-
+FinishUpSave(void)
{
ClientRec *client;
List *cl;
@@ -656,12 +606,7 @@ FinishUpSave ()
static void
-SaveCancelXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+SaveCancelXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
XtPopdown (savePopup);
@@ -681,17 +626,8 @@ XtPointer callData;
*/
static Widget
-AddToggle (widgetName, parent, state, radioGroup, radioData,
- fromHoriz, fromVert)
-
-char *widgetName;
-Widget parent;
-int state;
-Widget radioGroup;
-XtPointer radioData;
-Widget fromHoriz;
-Widget fromVert;
-
+AddToggle(char *widgetName, Widget parent, int state, Widget radioGroup,
+ XtPointer radioData, Widget fromHoriz, Widget fromVert)
{
Widget toggle;
@@ -710,10 +646,7 @@ Widget fromVert;
void
-SetSaveSensitivity (on)
-
-Bool on;
-
+SetSaveSensitivity(Bool on)
{
XtSetSensitive (savePopup, on);
@@ -741,13 +674,8 @@ Bool on;
void
-SavePopupStructureNotifyXtHandler (w, closure, event, continue_to_dispatch)
-
-Widget w;
-XtPointer closure;
-XEvent *event;
-Boolean *continue_to_dispatch;
-
+SavePopupStructureNotifyXtHandler(Widget w, XtPointer closure, XEvent *event,
+ Boolean *continue_to_dispatch)
{
if (event->type == MapNotify)
{
@@ -781,12 +709,7 @@ Boolean *continue_to_dispatch;
static void
-NameInUseOverwriteXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+NameInUseOverwriteXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
if (name_locked)
{
@@ -812,12 +735,7 @@ XtPointer callData;
static void
-NameInUseCancelXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+NameInUseCancelXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
XtPopdown (nameInUsePopup);
XtPopup (savePopup, XtGrabNone);
@@ -828,12 +746,7 @@ XtPointer callData;
static void
-BadSaveOkXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+BadSaveOkXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
ListFreeAllButHead (FailedSaveList);
XtPopdown (badSavePopup);
@@ -843,12 +756,7 @@ XtPointer callData;
static void
-BadSaveCancelXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+BadSaveCancelXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
ListFreeAllButHead (FailedSaveList);
XtPopdown (badSavePopup);
@@ -879,12 +787,7 @@ XtPointer callData;
static void
-BadSaveListXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+BadSaveListXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
}
@@ -892,12 +795,7 @@ XtPointer callData;
static void
-HelpSaveXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+HelpSaveXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
static int first_time = 1;
@@ -922,12 +820,7 @@ XtPointer callData;
static void
-HelpSaveOkXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+HelpSaveOkXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
XtPopdown (helpPopup);
help_visible = 0;
@@ -936,7 +829,7 @@ XtPointer callData;
void
-create_save_popup ()
+create_save_popup(void)
{
XtTranslations translations;
@@ -1247,7 +1140,7 @@ create_save_popup ()
void
-PopupSaveDialog ()
+PopupSaveDialog(void)
{
static int first_time = 1;
@@ -1284,12 +1177,7 @@ PopupSaveDialog ()
void
-CheckPointXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+CheckPointXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
wantShutdown = False;
PopupSaveDialog ();
@@ -1299,12 +1187,7 @@ XtPointer callData;
void
-ShutdownSaveXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+ShutdownSaveXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
wantShutdown = True;
PopupSaveDialog ();
@@ -1313,7 +1196,7 @@ XtPointer callData;
void
-PopupBadSave ()
+PopupBadSave(void)
{
ClientRec *client;
@@ -1359,7 +1242,7 @@ PopupBadSave ()
if (strcmp (pprop->name, SmProgram) == 0)
{
- progName = (char *) GetProgramName ((char *) pval->value);
+ progName = GetProgramName ((char *) pval->value);
if ((int) strlen (progName) > maxlen1)
maxlen1 = strlen (progName);
@@ -1411,7 +1294,7 @@ PopupBadSave ()
if (strcmp (pprop->name, SmProgram) == 0)
{
- progName = (char *) GetProgramName ((char *) pval->value);
+ progName = GetProgramName ((char *) pval->value);
}
else if (strcmp (pprop->name, "_XC_RestartService") == 0)
{
@@ -1479,12 +1362,7 @@ PopupBadSave ()
void
-ShutdownDontSaveXtProc (w, client_data, callData)
-
-Widget w;
-XtPointer client_data;
-XtPointer callData;
-
+ShutdownDontSaveXtProc(Widget w, XtPointer client_data, XtPointer callData)
{
List *cl;
ClientRec *client;
diff --git a/save.h b/save.h
index 5014137..5c76e56 100644
--- a/save.h
+++ b/save.h
@@ -23,13 +23,30 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/save.h,v 1.6 2001/12/14 20:02:27 dawes Exp $ */
-extern void create_save_popup ();
-extern void SetSaveSensitivity ();
-extern void PopupSaveDialog ();
-extern void CheckPointXtProc ();
-extern void ShutdownSaveXtProc ();
-extern void ShutdownDontSaveXtProc ();
-extern void LetClientInteract ();
-extern void StartPhase2 ();
-extern void FinishUpSave ();
+#ifndef _SAVE_H_
+#define _SAVE_H_
+
+#include <X11/Intrinsic.h>
+#include "list.h"
+
+extern void DoSave(int saveType, int interactStyle, Bool fast);
+extern void LetClientInteract(List *cl);
+extern void StartPhase2(void);
+extern void FinishUpSave(void);
+extern void SetSaveSensitivity(Bool on);
+extern void SavePopupStructureNotifyXtHandler(Widget w, XtPointer closure,
+ XEvent *event,
+ Boolean *continue_to_dispatch);
+extern void create_save_popup(void);
+extern void PopupSaveDialog(void);
+extern void CheckPointXtProc(Widget w, XtPointer client_data,
+ XtPointer callData);
+extern void ShutdownSaveXtProc(Widget w, XtPointer client_data,
+ XtPointer callData);
+extern void PopupBadSave(void);
+extern void ShutdownDontSaveXtProc(Widget w, XtPointer client_data,
+ XtPointer callData);
+
+#endif
diff --git a/saveutil.c b/saveutil.c
index 04ab6bf..2e604c8 100644
--- a/saveutil.c
+++ b/saveutil.c
@@ -23,20 +23,19 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/saveutil.c,v 1.6 2001/12/14 20:02:27 dawes Exp $ */
#include "xsm.h"
+#include "log.h"
+#include "saveutil.h"
char session_save_file[PATH_MAX];
-Bool getline();
extern Widget manualRestartCommands;
void
-set_session_save_file_name (session_name)
-
-char *session_name;
-
+set_session_save_file_name(char *session_name)
{
char *p;
@@ -56,17 +55,13 @@ char *session_name;
int
-ReadSave(session_name, sm_id)
-
-char *session_name;
-char **sm_id;
-
+ReadSave(char *session_name, char **sm_id)
{
char *buf;
int buflen;
char *p;
- PendingClient *c;
- Prop *prop;
+ PendingClient *c = NULL;
+ Prop *prop = NULL;
PropValue *val;
FILE *f;
int state, i;
@@ -86,7 +81,7 @@ char **sm_id;
buflen = 0;
/* Read version # */
- getline(&buf, &buflen, f);
+ getnextline(&buf, &buflen, f);
if((p = strchr(buf, '\n'))) *p = '\0';
version_number = atoi (buf);
if (version_number > SAVEFILE_VERSION)
@@ -100,20 +95,20 @@ char **sm_id;
}
/* Read SM's id */
- getline(&buf, &buflen, f);
+ getnextline(&buf, &buflen, f);
if((p = strchr(buf, '\n'))) *p = '\0';
*sm_id = XtNewString(buf);
/* Read number of clients running in the last session */
if (version_number >= 2)
{
- getline(&buf, &buflen, f);
+ getnextline(&buf, &buflen, f);
if((p = strchr(buf, '\n'))) *p = '\0';
num_clients_in_last_session = atoi (buf);
}
state = 0;
- while(getline(&buf, &buflen, f)) {
+ while(getnextline(&buf, &buflen, f)) {
if((p = strchr(buf, '\n'))) *p = '\0';
for(p = buf; *p && isspace(*p); p++) /* LOOP */;
if(*p == '#') continue;
@@ -213,7 +208,7 @@ char **sm_id;
String strbuf;
int bufsize = 0;
- getline(&buf, &buflen, f);
+ getnextline(&buf, &buflen, f);
if((p = strchr(buf, '\n'))) *p = '\0';
non_session_aware_count = atoi (buf);
@@ -224,7 +219,7 @@ char **sm_id;
for (i = 0; i < non_session_aware_count; i++)
{
- getline(&buf, &buflen, f);
+ getnextline(&buf, &buflen, f);
if((p = strchr(buf, '\n'))) *p = '\0';
non_session_aware_clients[i] = (char *) malloc (
strlen (buf) + 2);
@@ -260,11 +255,7 @@ char **sm_id;
static void
-SaveClient (f, client)
-
-FILE *f;
-ClientRec *client;
-
+SaveClient(FILE *f, ClientRec *client)
{
List *pl;
@@ -297,7 +288,7 @@ ClientRec *client;
for (pj = ListFirst (pprop->values); pj; pj = ListNext (pj))
{
pval = (PropValue *) pj->thing;
- fprintf (f, "\t%s\n", pval->value);
+ fprintf (f, "\t%s\n", (char *)pval->value);
}
}
}
@@ -308,10 +299,7 @@ ClientRec *client;
void
-WriteSave (sm_id)
-
-char *sm_id;
-
+WriteSave(char *sm_id)
{
ClientRec *client;
FILE *f;
@@ -419,10 +407,7 @@ char *sm_id;
Status
-DeleteSession (session_name)
-
-char *session_name;
-
+DeleteSession(char *session_name)
{
char *buf;
int buflen;
@@ -452,7 +437,7 @@ char *session_name;
buflen = 0;
/* Read version # */
- getline(&buf, &buflen, f);
+ getnextline(&buf, &buflen, f);
if((p = strchr(buf, '\n'))) *p = '\0';
version_number = atoi (buf);
if (version_number > SAVEFILE_VERSION)
@@ -465,15 +450,15 @@ char *session_name;
}
/* Skip SM's id */
- getline(&buf, &buflen, f);
+ getnextline(&buf, &buflen, f);
/* Skip number of clients running in the last session */
if (version_number >= 2)
- getline(&buf, &buflen, f);
+ getnextline(&buf, &buflen, f);
state = 0;
foundDiscard = 0;
- while(getline(&buf, &buflen, f)) {
+ while(getnextline(&buf, &buflen, f)) {
if((p = strchr(buf, '\n'))) *p = '\0';
for(p = buf; *p && isspace(*p); p++) /* LOOP */;
if(*p == '#') continue;
@@ -531,10 +516,7 @@ char *session_name;
Bool
-getline(pbuf, plen, f)
-char **pbuf;
-int *plen;
-FILE *f;
+getnextline(char **pbuf, int *plen, FILE *f)
{
int c;
int i;
diff --git a/saveutil.h b/saveutil.h
index 4d8cc64..86a040a 100644
--- a/saveutil.h
+++ b/saveutil.h
@@ -23,7 +23,17 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/saveutil.h,v 1.7 2001/12/14 20:02:27 dawes Exp $ */
-extern int ReadSave ();
-extern void WriteSave ();
-extern Status DeleteSession ();
+#ifndef _SAVEUTIL_H_
+#define _SAVEUTIL_H_
+
+#include <stdio.h>
+
+extern void set_session_save_file_name(char *session_name);
+extern int ReadSave(char *session_name, char **sm_id);
+extern void WriteSave(char *sm_id);
+extern Status DeleteSession(char *session_name);
+extern Bool getnextline(char **pbuf, int *plen, FILE *f);
+
+#endif
diff --git a/signals.c b/signals.c
index ec73792..7c2a2e7 100644
--- a/signals.c
+++ b/signals.c
@@ -23,12 +23,19 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/signals.c,v 3.6 2001/12/14 20:02:27 dawes Exp $ */
+
+#include <stdlib.h>
#include <X11/Xos.h>
#include <X11/Xfuncs.h>
+#include <X11/Intrinsic.h>
#include <X11/SM/SMlib.h>
+#include "save.h"
+
+#include <errno.h>
#ifdef USG
#ifndef __TYPES__
#include <sys/types.h> /* forgot to protect it... */
@@ -56,10 +63,16 @@ in this Software without prior written authorization from The Open Group.
#else
#define _POSIX_SOURCE
#include <signal.h>
+#ifdef SCO325
+#include <sys/procset.h>
+#include <sys/siginfo.h>
+#endif
#include <sys/wait.h>
#undef _POSIX_SOURCE
#endif
#endif
+#include "list.h"
+#include "save.h"
#if defined(X_NOT_POSIX) && defined(SIGNALRETURNSINT)
#define SIGVAL int
@@ -83,12 +96,11 @@ in this Software without prior written authorization from The Open Group.
#define SIGNALS_RESET_WHEN_CAUGHT
#endif
-#ifndef NULL
-#define NULL 0
-#endif
+#include <stddef.h>
int checkpoint_from_signal = 0;
+extern XtSignalId sig_term_id, sig_usr1_id;
extern Bool wantShutdown;
@@ -110,10 +122,10 @@ SIGVAL (*Signal (sig, handler))()
void
-sig_child_handler ()
+sig_child_handler (XtPointer closure, XtSignalId id)
{
- int pid;
+ int pid, olderrno = errno;
#if !defined(USE_POSIX_WAIT) && (defined(USE_SYSV_SIGNALS) && \
(defined(CRAY) || !defined(SIGTSTP)))
@@ -147,11 +159,18 @@ sig_child_handler ()
#endif /* USE_POSIX_WAIT else */
}
while (pid > 0);
+ errno = olderrno;
}
+void
+sig_term_handler(int sig)
+{
+ XtNoticeSignal(sig_term_id);
+}
+
void
-sig_term_handler ()
+xt_sig_term_handler (XtPointer closure, XtSignalId *id)
{
wantShutdown = 1;
@@ -159,9 +178,13 @@ sig_term_handler ()
DoSave (SmSaveLocal, SmInteractStyleNone, 1 /* fast */);
}
+void sig_usr1_handler(int sig)
+{
+ XtNoticeSignal(sig_usr1_id);
+}
void
-sig_usr1_handler ()
+xt_sig_usr1_handler (XtPointer closure, XtSignalId *id)
{
wantShutdown = 0;
@@ -172,7 +195,7 @@ sig_usr1_handler ()
void
-register_signals ()
+register_signals (XtAppContext appContext)
{
/*
@@ -194,6 +217,7 @@ register_signals ()
*/
Signal (SIGTERM, sig_term_handler);
+ sig_term_id = XtAppAddSignal(appContext, xt_sig_term_handler, NULL);
/*
@@ -201,6 +225,7 @@ register_signals ()
*/
Signal (SIGUSR1, sig_usr1_handler);
+ sig_usr1_id = XtAppAddSignal(appContext, xt_sig_usr1_handler, NULL);
}
diff --git a/xsm.c b/xsm.c
index ef4c7e2..618cdd2 100644
--- a/xsm.c
+++ b/xsm.c
@@ -23,6 +23,7 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/xsm.c,v 1.9 2001/12/14 20:02:27 dawes Exp $ */
/*
* X Session Manager.
@@ -48,6 +49,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Shell.h>
#include <X11/Xatom.h>
+#include <X11/Xaw/List.h>
Atom wmStateAtom;
Atom wmDeleteAtom;
@@ -56,11 +58,34 @@ static char *cmd_line_display = NULL;
/*
* Forward declarations
*/
-
-Status StartSession ();
-void NewConnectionXtProc ();
-Status NewClientProc ();
-void InstallIOErrorHandler ();
+static void PropertyChangeXtHandler(Widget w, XtPointer closure,
+ XEvent *event,
+ Boolean *continue_to_dispatch);
+static void GetEnvironment(void);
+static Status RegisterClientProc(SmsConn smsConn, SmPointer managerData,
+ char *previousId);
+static Bool OkToEnterInteractPhase(void);
+static void InteractRequestProc(SmsConn smsConn, SmPointer managerData,
+ int dialogType);
+static void InteractDoneProc(SmsConn smsConn, SmPointer managerData,
+ Bool cancelShutdown);
+static void SaveYourselfReqProc(SmsConn smsConn, SmPointer managerData,
+ int saveType, Bool shutdown,
+ int interactStyle, Bool fast, Bool global);
+static Bool OkToEnterPhase2(void);
+static void SaveYourselfPhase2ReqProc(SmsConn smsConn, SmPointer managerData);
+static void SaveYourselfDoneProc(SmsConn smsConn, SmPointer managerData,
+ Bool success);
+static void CloseConnectionProc(SmsConn smsConn, SmPointer managerData,
+ int count, char **reasonMsgs);
+static Status NewClientProc(SmsConn smsConn, SmPointer managerData,
+ unsigned long *maskRet,
+ SmsCallbacks *callbacksRet,
+ char **failureReasonRet);
+static void NewConnectionXtProc(XtPointer client_data, int *source,
+ XtInputId *id);
+static void MyIoErrorHandler(IceConn ice_conn);
+static void InstallIOErrorHandler(void);
static void CloseListeners(void);
/*
@@ -75,6 +100,7 @@ extern Widget checkPointButton;
extern Widget shutdownButton;
extern Widget clientListWidget;
extern Widget savePopup;
+extern XtSignalId sig_term_id, sig_usr1_id;
extern int checkpoint_from_signal;
@@ -84,12 +110,8 @@ static IceListenObj *listenObjs;
/*
* Main program
*/
-
-main (argc, argv)
-
-int argc;
-char **argv;
-
+int
+main(int argc, char *argv[])
{
char *p;
char errormsg[256];
@@ -138,7 +160,7 @@ char **argv;
wmDeleteAtom = XInternAtom (
XtDisplay (topLevel), "WM_DELETE_WINDOW", False);
- register_signals ();
+ register_signals (appContext);
/*
@@ -235,6 +257,9 @@ char **argv;
WaitForSaveDoneList = ListInit();
if (!WaitForSaveDoneList) nomem();
+ InitialSaveList = ListInit();
+ if (!InitialSaveList) nomem();
+
FailedSaveList = ListInit();
if (!FailedSaveList) nomem();
@@ -296,18 +321,14 @@ char **argv;
*/
XtAppMainLoop (appContext);
+ exit(0);
}
-void
-PropertyChangeXtHandler (w, closure, event, continue_to_dispatch)
-
-Widget w;
-XtPointer closure;
-XEvent *event;
-Boolean *continue_to_dispatch;
-
+static void
+PropertyChangeXtHandler(Widget w, XtPointer closure, XEvent *event,
+ Boolean *continue_to_dispatch)
{
if (w == topLevel && event->type == PropertyNotify &&
event->xproperty.atom == wmStateAtom)
@@ -334,11 +355,7 @@ Boolean *continue_to_dispatch;
void
-SetWM_DELETE_WINDOW (widget, delAction)
-
-Widget widget;
-String delAction;
-
+SetWM_DELETE_WINDOW(Widget widget, String delAction)
{
char translation[64];
@@ -351,9 +368,8 @@ String delAction;
-void
-GetEnvironment ()
-
+static void
+GetEnvironment(void)
{
static char envDISPLAY[]="DISPLAY";
static char envSESSION_MANAGER[]="SESSION_MANAGER";
@@ -452,11 +468,7 @@ GetEnvironment ()
Status
-StartSession (name, use_default)
-
-char *name;
-Bool use_default;
-
+StartSession(char *name, Bool use_default)
{
int database_read = 0;
Dimension width;
@@ -597,10 +609,8 @@ Bool use_default;
-EndSession (status)
-
-int status;
-
+void
+EndSession(int status)
{
if (verbose)
printf ("\nSESSION MANAGER GOING AWAY!\n");
@@ -634,11 +644,7 @@ int status;
void
-FreeClient (client, freeProps)
-
-ClientRec *client;
-Bool freeProps;
-
+FreeClient(ClientRec *client, Bool freeProps)
{
if (freeProps)
{
@@ -669,13 +675,8 @@ Bool freeProps;
* Session Manager callbacks
*/
-Status
-RegisterClientProc (smsConn, managerData, previousId)
-
-SmsConn smsConn;
-SmPointer managerData;
-char *previousId;
-
+static Status
+RegisterClientProc(SmsConn smsConn, SmPointer managerData, char *previousId)
{
ClientRec *client = (ClientRec *) managerData;
char *id;
@@ -788,6 +789,8 @@ char *previousId;
{
SmsSaveYourself (smsConn, SmSaveLocal,
False, SmInteractStyleNone, False);
+
+ ListAddLast (InitialSaveList, (char *) client);
}
else if (client_info_visible)
{
@@ -803,8 +806,7 @@ char *previousId;
static Bool
-OkToEnterInteractPhase ()
-
+OkToEnterInteractPhase(void)
{
return ((ListCount (WaitForInteractList) +
ListCount (WaitForPhase2List)) == ListCount (WaitForSaveDoneList));
@@ -812,13 +814,8 @@ OkToEnterInteractPhase ()
-void
-InteractRequestProc (smsConn, managerData, dialogType)
-
-SmsConn smsConn;
-SmPointer managerData;
-int dialogType;
-
+static void
+InteractRequestProc(SmsConn smsConn, SmPointer managerData, int dialogType)
{
ClientRec *client = (ClientRec *) managerData;
@@ -844,12 +841,8 @@ int dialogType;
-void
-InteractDoneProc (smsConn, managerData, cancelShutdown)
- SmsConn smsConn;
- SmPointer managerData;
- Bool cancelShutdown;
-
+static void
+InteractDoneProc(SmsConn smsConn, SmPointer managerData, Bool cancelShutdown)
{
ClientRec *client = (ClientRec *) managerData;
List *cl;
@@ -915,18 +908,9 @@ InteractDoneProc (smsConn, managerData, cancelShutdown)
-void
-SaveYourselfReqProc (smsConn, managerData, saveType,
- shutdown, interactStyle, fast, global)
-
-SmsConn smsConn;
-SmPointer managerData;
-int saveType;
-Bool shutdown;
-int interactStyle;
-Bool fast;
-Bool global;
-
+static void
+SaveYourselfReqProc(SmsConn smsConn, SmPointer managerData, int saveType,
+ Bool shutdown, int interactStyle, Bool fast, Bool global)
{
if (verbose)
printf("SAVE YOURSELF REQUEST not supported!\n");
@@ -935,7 +919,7 @@ Bool global;
static Bool
-OkToEnterPhase2 ()
+OkToEnterPhase2(void)
{
return (ListCount (WaitForPhase2List) == ListCount (WaitForSaveDoneList));
@@ -943,12 +927,8 @@ OkToEnterPhase2 ()
-void
-SaveYourselfPhase2ReqProc (smsConn, managerData)
-
-SmsConn smsConn;
-SmPointer managerData;
-
+static void
+SaveYourselfPhase2ReqProc(SmsConn smsConn, SmPointer managerData)
{
ClientRec *client = (ClientRec *) managerData;
@@ -985,12 +965,8 @@ SmPointer managerData;
-void
-SaveYourselfDoneProc (smsConn, managerData, success)
- SmsConn smsConn;
- SmPointer managerData;
- Bool success;
-
+static void
+SaveYourselfDoneProc(SmsConn smsConn, SmPointer managerData, Bool success)
{
ClientRec *client = (ClientRec *) managerData;
@@ -1001,7 +977,11 @@ SaveYourselfDoneProc (smsConn, managerData, success)
}
if (!ListSearchAndFreeOne (WaitForSaveDoneList, (char *) client))
+ {
+ if (ListSearchAndFreeOne (InitialSaveList, (char *) client))
+ SmsSaveComplete (client->smsConn);
return;
+ }
if (!success)
{
@@ -1028,12 +1008,9 @@ SaveYourselfDoneProc (smsConn, managerData, success)
void
-CloseDownClient (client)
-
-ClientRec *client;
-
+CloseDownClient(ClientRec *client)
{
- int index_deleted;
+ int index_deleted = 0;
if (verbose) {
printf ("ICE Connection closed, IceConn fd = %d\n",
@@ -1144,13 +1121,9 @@ ClientRec *client;
-void
-CloseConnectionProc (smsConn, managerData, count, reasonMsgs)
- SmsConn smsConn;
- SmPointer managerData;
- int count;
- char **reasonMsgs;
-
+static void
+CloseConnectionProc(SmsConn smsConn, SmPointer managerData,
+ int count, char **reasonMsgs)
{
ClientRec *client = (ClientRec *) managerData;
@@ -1173,15 +1146,9 @@ CloseConnectionProc (smsConn, managerData, count, reasonMsgs)
-Status
-NewClientProc (smsConn, managerData, maskRet, callbacksRet, failureReasonRet)
-
-SmsConn smsConn;
-SmPointer managerData;
-unsigned long *maskRet;
-SmsCallbacks *callbacksRet;
-char **failureReasonRet;
-
+static Status
+NewClientProc(SmsConn smsConn, SmPointer managerData, unsigned long *maskRet,
+ SmsCallbacks *callbacksRet, char **failureReasonRet)
{
ClientRec *newClient = (ClientRec *) XtMalloc (sizeof (ClientRec));
@@ -1272,13 +1239,8 @@ char **failureReasonRet;
* Xt callback invoked when a client attempts to connect.
*/
-void
-NewConnectionXtProc (client_data, source, id)
-
-XtPointer client_data;
-int *source;
-XtInputId *id;
-
+static void
+NewConnectionXtProc(XtPointer client_data, int *source, XtInputId *id)
{
IceConn ice_conn;
char *connstr;
@@ -1330,10 +1292,8 @@ XtInputId *id;
-SetAllSensitive (on)
-
-Bool on;
-
+void
+SetAllSensitive(Bool on)
{
XtSetSensitive (mainWindow, on);
SetSaveSensitivity (on);
@@ -1366,18 +1326,15 @@ Bool on;
static IceIOErrorHandler prev_handler;
-void
-MyIoErrorHandler (ice_conn)
-
-IceConn ice_conn;
-
+static void
+MyIoErrorHandler(IceConn ice_conn)
{
if (prev_handler)
(*prev_handler) (ice_conn);
}
-void
-InstallIOErrorHandler ()
+static void
+InstallIOErrorHandler(void)
{
IceIOErrorHandler default_handler;
diff --git a/xsm.h b/xsm.h
index 74bad45..5315373 100644
--- a/xsm.h
+++ b/xsm.h
@@ -23,6 +23,10 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/xsm.h,v 1.8 2001/12/14 20:02:27 dawes Exp $ */
+
+#ifndef _XSM_H_
+#define _XSM_H_
#include <X11/Xos.h>
#include <X11/Xfuncs.h>
@@ -56,9 +60,7 @@ in this Software without prior written authorization from The Open Group.
#endif
#include <ctype.h>
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
-#endif
#include <X11/StringDefs.h>
#include <X11/Intrinsic.h>
@@ -171,13 +173,20 @@ extern XtAppContext appContext;
extern Widget topLevel;
extern Widget mainWindow;
-extern void fprintfhex ();
+extern void fprintfhex(FILE *fp, unsigned int len, char *cp);
+extern Status StartSession(char *name, Bool use_default);
+extern void EndSession(int status);
+extern void SetWM_DELETE_WINDOW(Widget widget, String delAction);
+extern void SetAllSensitive(Bool on);
+extern void FreeClient(ClientRec *client, Bool freeProps);
+extern void CloseDownClient(ClientRec *client);
+
+/* misc.c */
+extern int strbw(char *a, char *b);
+extern void nomem(void);
+
-#ifndef X_NOT_STDC_ENV
#define Strstr strstr
-#else
-extern char *Strstr();
-#endif
/* Fix ISC brain damage. When using gcc fdopen isn't declared in <stdio.h>. */
#if defined(ISC) && __STDC__
@@ -189,6 +198,21 @@ extern int System();
#define system(s) System(s)
#endif
+/* remote.c */
+extern void remote_start(char *restart_protocol, char *restart_machine,
+ char *program, char **args, char *cwd, char **env,
+ char *non_local_display_env,
+ char *non_local_session_env );
+
+/* signals.c */
+extern void sig_child_handler(void);
+extern void sig_term_handler(void);
+extern void sig_usr1_handler(void);
+extern void register_signals(XtAppContext);
+extern int execute_system_command(char *s);
+
#ifdef XKB
#include <X11/extensions/XKBbells.h>
#endif
+
+#endif /* _XSM_H_ */
diff --git a/xsm.man b/xsm.man
index 280621c..8b0ebb2 100644
--- a/xsm.man
+++ b/xsm.man
@@ -22,7 +22,10 @@
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from The Open Group.
-.TH XSM 1 "Release 6.4" "X Version 11"
+.\"
+.\" $XFree86: xc/programs/xsm/xsm.man,v 1.7 2001/12/14 20:02:28 dawes Exp $
+.\"
+.TH XSM 1 __xorgversion__
.SH NAME
xsm \- X Session Manager
.SH SYNOPSIS
diff --git a/xtwatch.c b/xtwatch.c
index 4a42e27..4dd1050 100644
--- a/xtwatch.c
+++ b/xtwatch.c
@@ -23,40 +23,34 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/xtwatch.c,v 1.5 2001/12/14 20:02:28 dawes Exp $ */
#include <X11/ICE/ICElib.h>
#include <X11/Intrinsic.h>
#include "xsm.h"
+#include "xtwatch.h"
-extern void CloseDownClient ();
-
+static void _XtIceWatchProc(IceConn ice_conn, IcePointer client_data,
+ Bool opening, IcePointer *watch_data );
+static void _XtProcessIceMsgProc(XtPointer client_data, int *source,
+ XtInputId *id);
Status
-InitWatchProcs (appContext)
-
-XtAppContext appContext;
-
+InitWatchProcs(XtAppContext appContext)
{
- void _XtIceWatchProc ();
return (IceAddConnectionWatch (_XtIceWatchProc, (IcePointer) appContext));
}
-void
-_XtIceWatchProc (ice_conn, client_data, opening, watch_data)
-
-IceConn ice_conn;
-IcePointer client_data;
-Bool opening;
-IcePointer *watch_data;
-
+static void
+_XtIceWatchProc(IceConn ice_conn, IcePointer client_data, Bool opening,
+ IcePointer *watch_data)
{
if (opening)
{
XtAppContext appContext = (XtAppContext) client_data;
- void _XtProcessIceMsgProc ();
*watch_data = (IcePointer) XtAppAddInput (
appContext,
@@ -72,13 +66,8 @@ IcePointer *watch_data;
}
-void
-_XtProcessIceMsgProc (client_data, source, id)
-
-XtPointer client_data;
-int *source;
-XtInputId *id;
-
+static void
+_XtProcessIceMsgProc(XtPointer client_data, int *source, XtInputId *id)
{
IceConn ice_conn = (IceConn) client_data;
IceProcessMessagesStatus status;
diff --git a/xtwatch.h b/xtwatch.h
index 4ee3b00..8ad0b04 100644
--- a/xtwatch.h
+++ b/xtwatch.h
@@ -23,5 +23,13 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
******************************************************************************/
+/* $XFree86: xc/programs/xsm/xtwatch.h,v 1.6 2001/12/14 20:02:28 dawes Exp $ */
-extern Status InitWatchProcs ();
+#ifndef _XTWATCH_H_
+#define _XTWATCH_H_
+
+#include <X11/Intrinsic.h>
+
+extern Status InitWatchProcs(XtAppContext appContext);
+
+#endif