1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Merge branch 'master' into autotools-conversion

This commit is contained in:
Jon Trulson 2020-01-26 12:17:44 -07:00
commit 313b4a8e0b
8 changed files with 115 additions and 54 deletions

View file

@ -0,0 +1,18 @@
This is another method to setup an xsession which allows you to execute
commads before the CDE Xsession gets executed.
This alternate method is useful when for example you need to
set a different language.
In this example we
1. have the login manager execute /usr/dt/bin/startxsession.sh script
2. The /usr/dt/bin/startxsession.sh first sets properly the LANG variable
(or you can add whatever you want to execute before CDE Xsession starts)
and then executes /usr/dt/bin/Xsession which will start CDE.
To install, after you edit the startxsession.sh to your liking, do as root:
cp /path/to/cdesktopenv-code/cde/contrib/desktopentry/cde-alt.desktop /usr/share/xsessions/
cp /path/to/cdesktopenv-code/cde/contrib/desktopentry/startxsession.sh /usr/dt/bin/
chmod ugo+rx /usr/dt/bin/startxsession.sh

View file

@ -0,0 +1,7 @@
[Desktop Entry]
Name=CDE
Comment=Use this session to boot into the Common Desktop Environment
Keywords=Common Desktop Environment
Exec=/usr/dt/bin/startxsession.sh
Icon=Dtlogo.pm
Type=Application

View file

@ -0,0 +1,6 @@
#!/bin/sh
export PATH=$PATH:/usr/dt/bin
export LANG=el_GR.UTF-8
/usr/dt/bin/Xsession

View file

@ -38,8 +38,14 @@ DEFINES = -DDTLIB $(LOCAL_DEFINES) \
-DOSMINORVERSION=OSMinorVersion \ -DOSMINORVERSION=OSMinorVersion \
$(ICONV_INBUF_DEFINE) $(BIT_ORDER_DEFINES) $(ICONV_INBUF_DEFINE) $(BIT_ORDER_DEFINES)
#if defined(FreeBSDArchitecture)
JPEGLIB = -ljpeg
#endif
#ifdef SharedDtHelpReqs #ifdef SharedDtHelpReqs
REQUIREDLIBS = SharedDtHelpReqs REQUIREDLIBS = SharedDtHelpReqs $(JPEGLIB)
#else
REQUIREDLIBS = $(JPEGLIB)
#endif #endif
HEADERS = \ HEADERS = \

View file

@ -176,10 +176,23 @@ getSessionPath(
/* /*
* NOTE: it is assumed that _DtCreateDtDirs() returns a buffer of * NOTE: it is assumed that _DtCreateDtDirs() returns a buffer of
* size MAXPATHLEN+1. This allows us to avoid a extra alloc * size MAXPATHLEN. This allows us to avoid a extra alloc
* and copy -- at the expense of code maintainability. * and copy -- at the expense of code maintainability.
*
* JET - 2020. This is stupid. At least account for the strings
* you are adding further on down... This "solution" isn't great
* either. Real fix would be to have all callers pass in bufptr
* and len all the way down the chain instead of tmpPath.
*/ */
if ((strlen(tmpPath) + 1 + strlen(property)) > MAXPATHLEN) goto abort; if ((strlen(tmpPath)
+ 1 /* "/" */
+ strlen(property)
+ 1 /* "/" */
+ ((*saveFile == NULL) ? strlen("dtXXXXXX") + 1 : strlen(*saveFile))
) >= MAXPATHLEN)
{
goto abort;
}
/* /*
* parse the property string and create directory if needed * parse the property string and create directory if needed

View file

@ -83,14 +83,14 @@ char *
_DtCreateDtDirs( _DtCreateDtDirs(
Display *display ) Display *display )
{ {
char *tmpPath; char *tmpPath = NULL;
Boolean needSessionsDir = False; Boolean needSessionsDir = False;
Boolean useOldSession = False; Boolean useOldSession = False;
struct stat buf; struct stat buf;
int status; int status;
char *home; char *home = NULL;
char *sessionDir; char *sessionDir = NULL;
char *displayName; char *displayName = NULL;
/* /*
* Sanity check - make sure there's an existing display * Sanity check - make sure there's an existing display
@ -101,15 +101,14 @@ _DtCreateDtDirs(
if ((home = getenv("HOME")) == NULL) if ((home = getenv("HOME")) == NULL)
home = ""; home = "";
tmpPath = XtCalloc(1, MAXPATHLEN + 1); tmpPath = XtCalloc(1, MAXPATHLEN);
if(tmpPath == NULL) if(tmpPath == NULL)
return(NULL); return(NULL);
/* /*
* If the $HOME/.dt directory does not exist, create it * If the $HOME/.dt directory does not exist, create it
*/ */
strncpy(tmpPath, home, MAXPATHLEN); snprintf(tmpPath, MAXPATHLEN, "%s/%s", home, DtPERSONAL_CONFIG_DIRECTORY);
strncat(tmpPath, "/" DtPERSONAL_CONFIG_DIRECTORY, MAXPATHLEN);
status = stat(tmpPath, &buf); status = stat(tmpPath, &buf);
if (status == -1) { if (status == -1) {
@ -124,8 +123,7 @@ _DtCreateDtDirs(
/* /*
* Create the personal DB directory if it does not exist. * Create the personal DB directory if it does not exist.
*/ */
strncpy(tmpPath, home, MAXPATHLEN); snprintf(tmpPath, MAXPATHLEN, "%s/%s", home, DtPERSONAL_DB_DIRECTORY);
strncat(tmpPath, "/" DtPERSONAL_DB_DIRECTORY, MAXPATHLEN);
if ((status = stat (tmpPath, &buf)) == -1) { if ((status = stat (tmpPath, &buf)) == -1) {
if ((status = mkdir (tmpPath, 0000)) != -1) if ((status = mkdir (tmpPath, 0000)) != -1)
@ -135,8 +133,7 @@ _DtCreateDtDirs(
/* /*
* Create the personal tmp dir if it does not exist. * Create the personal tmp dir if it does not exist.
*/ */
strncpy(tmpPath, home, MAXPATHLEN); snprintf(tmpPath, MAXPATHLEN, "%s/%s", home, DtPERSONAL_TMP_DIRECTORY);
strncat(tmpPath, "/" DtPERSONAL_TMP_DIRECTORY, MAXPATHLEN);
if ((status = stat (tmpPath, &buf)) == -1) { if ((status = stat (tmpPath, &buf)) == -1) {
if ((status = mkdir (tmpPath, 0000)) != -1) if ((status = mkdir (tmpPath, 0000)) != -1)
@ -173,12 +170,13 @@ _DtCreateDtDirs(
*/ */
if ((displayName = GetDisplayName (display)) != NULL) { if ((displayName = GetDisplayName (display)) != NULL) {
strncpy (tmpPath, home, MAXPATHLEN); snprintf(tmpPath, MAXPATHLEN, "%s/%s/%s",
strncat (tmpPath, "/" DtPERSONAL_CONFIG_DIRECTORY, MAXPATHLEN); home,
strncat (tmpPath, "/", MAXPATHLEN); DtPERSONAL_CONFIG_DIRECTORY,
strncat (tmpPath, displayName, MAXPATHLEN); displayName);
free(displayName); /* CDExc22771 */ free(displayName); /* CDExc22771 */
displayName = NULL;
if ((status = stat (tmpPath, &buf)) == -1) { if ((status = stat (tmpPath, &buf)) == -1) {
if ((status = mkdir (tmpPath, 0000)) != -1) if ((status = mkdir (tmpPath, 0000)) != -1)
@ -215,12 +213,13 @@ _DtCreateDtDirs(
*/ */
if ((displayName = GetDisplayName (display)) != NULL) { if ((displayName = GetDisplayName (display)) != NULL) {
strncpy (tmpPath, home, MAXPATHLEN); snprintf(tmpPath, MAXPATHLEN, "%s/%s/%s",
strncat (tmpPath, "/" DtPERSONAL_CONFIG_DIRECTORY, MAXPATHLEN); home,
strncat (tmpPath, "/", MAXPATHLEN); DtPERSONAL_CONFIG_DIRECTORY,
strncat (tmpPath, displayName, MAXPATHLEN); displayName);
free(displayName); /* CDExc22771 */ free(displayName); /* CDExc22771 */
displayName = NULL;
if ((status = stat(tmpPath, &buf)) != 0) if ((status = stat(tmpPath, &buf)) != 0)
/* /*
@ -238,9 +237,10 @@ _DtCreateDtDirs(
* If we don't have an old style directory - we check for a sessions * If we don't have an old style directory - we check for a sessions
* directory, and create it if it doesn't exist * directory, and create it if it doesn't exist
*/ */
strncpy (tmpPath, home, MAXPATHLEN); snprintf(tmpPath, MAXPATHLEN, "%s/%s/%s",
strncat (tmpPath, "/" DtPERSONAL_CONFIG_DIRECTORY, MAXPATHLEN); home,
strncat (tmpPath, "/" DtSM_SESSION_DIRECTORY, MAXPATHLEN); DtPERSONAL_CONFIG_DIRECTORY,
DtSM_SESSION_DIRECTORY);
if ((status = stat(tmpPath, &buf)) == -1) { if ((status = stat(tmpPath, &buf)) == -1) {
if ((status = mkdir(tmpPath, 0000)) == -1) { if ((status = mkdir(tmpPath, 0000)) == -1) {

View file

@ -210,11 +210,7 @@ _DtSimpleError(
if (NULL == message) return; if (NULL == message) return;
Va_start(args, format); Va_start(args, format);
#if defined(USE_SNPRINTF)
(void) vsnprintf(message, MESSAGE_BUFFER, format, args); (void) vsnprintf(message, MESSAGE_BUFFER, format, args);
#else
(void) vsprintf(message, format, args);
#endif
va_end(args); va_end(args);
log_message(progName, help, message, severity, FALSE); log_message(progName, help, message, severity, FALSE);
@ -235,11 +231,7 @@ _DtSimpleErrnoError(
if (NULL == message) return; if (NULL == message) return;
Va_start(args, format); Va_start(args, format);
#if defined(USE_SNPRINTF)
(void) vsnprintf(message, MESSAGE_BUFFER, format, args); (void) vsnprintf(message, MESSAGE_BUFFER, format, args);
#else
(void) vsprintf(message, format, args);
#endif
va_end(args); va_end(args);
log_message(progName, help, message, severity, TRUE); log_message(progName, help, message, severity, TRUE);

View file

@ -501,10 +501,10 @@ CheckMonitor(
int n, screen_number, result; int n, screen_number, result;
Arg args[4]; Arg args[4];
char screenStr[5], cust_msg[24]; char screenStr[5], cust_msg[24];
char *tmpStr; char *tmpStr = NULL;
char tmpPalette[SRVBUFSIZE]; char tmpPalette[SRVBUFSIZE];
char *token1; char *token1 = NULL;
char *xrdb_string; char *xrdb_string = NULL;
Widget mainShell; Widget mainShell;
XtAppContext app_context; XtAppContext app_context;
@ -541,7 +541,7 @@ CheckMonitor(
/* cycle through each screen */ /* cycle through each screen */
for(screen_number=0;screen_number != colorSrv.NumOfScreens;screen_number++) for(screen_number=0;screen_number != colorSrv.NumOfScreens;screen_number++)
{ {
sprintf(screenStr,"%d",screen_number); snprintf(screenStr, sizeof(screenStr), "%d", screen_number);
n = 0; n = 0;
XtSetArg(args[n], XmNbackground, XtSetArg(args[n], XmNbackground,
BlackPixelOfScreen(DefaultScreenOfDisplay(dpy))); n++; BlackPixelOfScreen(DefaultScreenOfDisplay(dpy))); n++;
@ -558,8 +558,8 @@ CheckMonitor(
*/ */
XtRealizeWidget(shell[screen_number]); XtRealizeWidget(shell[screen_number]);
snprintf(cust_msg, sizeof(cust_msg), "%s%d",
sprintf(cust_msg,"%s%d", XmSCUSTOMIZE_DATA, screen_number); XmSCUSTOMIZE_DATA, screen_number);
colorSrv.XA_CUSTOMIZE[screen_number] = colorSrv.XA_CUSTOMIZE[screen_number] =
XInternAtom(dpy, cust_msg, FALSE); XInternAtom(dpy, cust_msg, FALSE);
@ -574,11 +574,16 @@ CheckMonitor(
/* /*
* Don't forget to add length for the extra characters. * Don't forget to add length for the extra characters.
*/ */
tmpStr = (char *)SRV_MALLOC(strlen(MSG1) + 25 + 5 + 1 + 1); int len = strlen(MSG1) + 25 + 5 + 1 + 1;
sprintf(tmpStr,"%s colorSrv.XA_CUSTOMIZE[%d].\n", tmpStr = (char *)SRV_MALLOC(len);
if (tmpStr)
{
snprintf(tmpStr, len, "%s colorSrv.XA_CUSTOMIZE[%d].\n",
MSG1, screen_number); MSG1, screen_number);
_DtSimpleError(XmSCOLOR_SRV_NAME, DtWarning, NULL, tmpStr, NULL); _DtSimpleError(XmSCOLOR_SRV_NAME, DtWarning, NULL, tmpStr, NULL);
SRV_FREE(tmpStr); SRV_FREE(tmpStr);
tmpStr = NULL;
}
return(-1); return(-1);
} }
@ -608,11 +613,23 @@ CheckMonitor(
(struct _palette *) SRV_MALLOC( sizeof(struct _palette) + 1 ); (struct _palette *) SRV_MALLOC( sizeof(struct _palette) + 1 );
/* allocate enough space for the name */ /* allocate enough space for the name */
<<<<<<< HEAD
strcpy(tmpPalette, pColorSrvRsrc.MonochromePalette); strcpy(tmpPalette, pColorSrvRsrc.MonochromePalette);
for (token1=tmpPalette; *token1; token1++); for (token1=tmpPalette; *token1; token1++);
while (token1!=tmpPalette && *token1!='.') token1--; while (token1!=tmpPalette && *token1!='.') token1--;
if (!strcmp(token1,PALETTE_SUFFIX)) *token1 = '\0'; if (!strcmp(token1,PALETTE_SUFFIX)) *token1 = '\0';
colorSrv.pCurrentPalette[screen_number]->name = colorSrv.pCurrentPalette[screen_number]->name =
=======
snprintf(tmpPalette, SRVBUFSIZE, "%s",
pColorSrvRsrc.MonochromePalette);
for (token1=tmpPalette; *token1; token1++)
;
while (token1 != tmpPalette && *token1 != '.')
token1--;
if (!strcmp(token1, PALETTE_SUFFIX))
*token1 = '\0';
colorSrv.pCurrentPalette[screen_number]->name =
>>>>>>> master
(char *)SRV_MALLOC(strlen(tmpPalette) + 1); (char *)SRV_MALLOC(strlen(tmpPalette) + 1);
strcpy(colorSrv.pCurrentPalette[screen_number]->name, strcpy(colorSrv.pCurrentPalette[screen_number]->name,
(char *) tmpPalette); (char *) tmpPalette);
@ -627,19 +644,21 @@ CheckMonitor(
/* write out the color or monochrome palette resource for the screen */ /* write out the color or monochrome palette resource for the screen */
xrdb_string = XtMalloc(BUFSIZ); xrdb_string = XtMalloc(BUFSIZ);
if (!xrdb_string)
return -1;
if (colorSrv.TypeOfMonitor[0] == XmCO_HIGH_COLOR || if (colorSrv.TypeOfMonitor[0] == XmCO_HIGH_COLOR ||
colorSrv.TypeOfMonitor[0] == XmCO_MEDIUM_COLOR || colorSrv.TypeOfMonitor[0] == XmCO_MEDIUM_COLOR ||
colorSrv.TypeOfMonitor[0] == XmCO_LOW_COLOR) colorSrv.TypeOfMonitor[0] == XmCO_LOW_COLOR)
{ {
sprintf(xrdb_string, "*%d*ColorPalette: %s%s\n", snprintf(xrdb_string, BUFSIZ, "*%d*ColorPalette: %s%s\n",
screen_number, screen_number,
colorSrv.pCurrentPalette[screen_number]->name, colorSrv.pCurrentPalette[screen_number]->name,
PALETTE_SUFFIX); PALETTE_SUFFIX);
} }
else /* XmCO_BLACK_WHITE */ else /* XmCO_BLACK_WHITE */
{ {
sprintf(xrdb_string, "*%d*MonochromePalette: %s%s\n", snprintf(xrdb_string, BUFSIZ, "*%d*MonochromePalette: %s%s\n",
screen_number, screen_number,
colorSrv.pCurrentPalette[screen_number]->name, colorSrv.pCurrentPalette[screen_number]->name,
PALETTE_SUFFIX); PALETTE_SUFFIX);