+/*
+ * CDE - Common Desktop Environment
+ *
+ * Copyright (c) 1993-2012, The Open Group. All rights reserved.
+ *
+ * These libraries and programs are free software; you can
+ * redistribute them and/or modify them under the terms of the GNU
+ * Lesser General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * These libraries and programs are distributed in the hope that
+ * they will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with these libraries and programs; if not, write
+ * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301 USA
+ */
/* $TOG: FileMgr.c /main/19 1998/01/27 12:19:54 mgreess $ */
/************************************<+>*************************************
****************************************************************************
#include <sys/types.h>
#include <pwd.h>
#include <string.h>
+#include <stdint.h>
#include <sys/stat.h>
+#include <ctype.h>
#include <Xm/XmP.h>
#include <Xm/CascadeB.h>
#include <X11/ShellP.h>
#include <X11/Shell.h>
#include <X11/Xatom.h>
-#include <X11/keysymdef.h>
#include <Xm/Protocols.h>
#include <Dt/HourGlass.h>
#include <Dt/DtNlUtils.h>
#include <Dt/Dts.h>
+#include <Dt/SharedProcs.h>
+#include <Dt/Wsm.h>
#include <Xm/DragIcon.h>
#include <Xm/DragC.h>
#include "Prefs.h"
#include "SharedMsgs.h"
#include "IconicPath.h"
+#include "DtSvcInternal.h"
/* Dialog classes installed by Main.c */
:<Key>osfPageUp:FMInput(@)\n\
:<Key>F1:DrawingAreaInput() ManagerGadgetHelp()\n\
s c a <Key>c: ActivateClist(@)\n\
-~s ~m ~a <Key>Return:DrawingAreaInput() ManagerParentActivate()\n\
-<Key>Return:DrawingAreaInput() ManagerGadgetSelect()\n\
+~s ~m ~a <Key>Return:DrawingAreaInput() ManagerParentActivate() ManagerGadgetSelect()\n\
<Key>space:DrawingAreaInput() ManagerGadgetSelect()\n\
:<Key>plus:DrawingAreaInput() ManagerGadgetSelect()\n\
:<Key>minus:DrawingAreaInput() ManagerGadgetSelect()\n\
static Boolean first = True;
FileMgrRec * file_mgr_rec;
Widget shell;
- Widget main;
+ Widget mainWidget;
Widget menu;
Widget header_frame;
Widget header_separator;
XmAddWMProtocolCallback (shell, delete_window, (XtCallbackProc)SystemClose,
(XtPointer)file_mgr_rec);
- file_mgr_rec->main = main = XmCreateMainWindow (shell, "main", args, 1);
- XtManageChild (main);
- XtAddCallback(main, XmNhelpCallback, (XtCallbackProc)HelpRequestCB,
+ file_mgr_rec->main = mainWidget = XmCreateMainWindow (shell, "main", args, 1);
+ XtManageChild (mainWidget);
+ XtAddCallback(mainWidget, XmNhelpCallback, (XtCallbackProc)HelpRequestCB,
HELP_FILE_MANAGER_VIEW_STR);
XtSetArg (args[0], XmNbackground, &background);
XtSetArg (args[1], XmNcolormap, &colormap);
- XtGetValues (main, args, 2);
+ XtGetValues (mainWidget, args, 2);
- XmGetColors (XtScreen (main), colormap, background,
+ XmGetColors (XtScreen (mainWidget), colormap, background,
&foreground, &top_shadow, &bottom_shadow, &select);
/* Create the menu. */
if(TrashView)
{
- file_mgr_rec->menuStates = NULL;
- file_mgr_rec->menu = menu = CreateTrashMenu (main, file_mgr_rec);
+ file_mgr_rec->menuStates = 0;
+ file_mgr_rec->menu = menu = CreateTrashMenu (mainWidget, file_mgr_rec);
}
else
{
CLEAN_UP | MOVE_UP |
HOME | CHANGE_DIR | TERMINAL);
- file_mgr_rec->menu = menu = CreateMenu (main, file_mgr_rec);
+ file_mgr_rec->menu = menu = CreateMenu (mainWidget, file_mgr_rec);
}
/* Create the work area frame. */
XtSetArg (args[1], XmNshadowType, XmSHADOW_OUT);
XtSetArg (args[2], XmNmarginWidth, 5);
XtSetArg (args[3], XmNmarginHeight, 5);
- work_frame = XmCreateFrame (main, "work_frame", args, 4);
+ work_frame = XmCreateFrame (mainWidget, "work_frame", args, 4);
XtManageChild (work_frame);
XtSetArg (args[n], XmNmarginHeight, 1); n++;
XtSetArg (args[n], XmNtextTranslations, trans_table); n++;
file_mgr_rec->header_frame = header_frame =
- XmCreateForm (main, "header_frame", args, n);
+ XmCreateForm (mainWidget, "header_frame", args, n);
XtAddCallback(header_frame, XmNhelpCallback,
(XtCallbackProc)HelpRequestCB,
XtSetArg (args[n], XmNshadowType, XmSHADOW_OUT); n++;
XtSetArg (args[n], XmNmarginWidth, 5); n++;
XtSetArg (args[n], XmNmarginHeight, 1); n++;
- status_form = XmCreateForm (main, "status_form", args, n);
+ status_form = XmCreateForm (mainWidget, "status_form", args, n);
XtManageChild (status_form);
n = 0;
/* Associate the menu and frames with the appropriate */
/* areas of the main windows. */
- XmMainWindowSetAreas (main, menu, file_mgr_rec->header_frame,
+ XmMainWindowSetAreas (mainWidget, menu, file_mgr_rec->header_frame,
NULL, NULL, work_frame);
XtSetArg (args[0], XmNmessageWindow, status_form);
- XtSetValues(main, args, 1);
+ XtSetValues(mainWidget, args, 1);
/* Create the Scrolled Window for the file display area and */
/* set the scrollbars colors correctly. */
XtSetValues (file_mgr_rec->vertical_scroll_bar, args, 2);
- /* Add an event handler to catch resizes occuring on the scrolled */
+ /* Add an event handler to catch resizes occurring on the scrolled */
/* window, in order to force a relayout of the icons. */
XtAddEventHandler (file_mgr_rec->scroll_window, StructureNotifyMask,
/* Set the return values for the dialog widget and dialog instance. */
- *return_widget = (Widget) main;
+ *return_widget = (Widget) mainWidget;
*dialog = (XtPointer) file_mgr_rec;
}
{
/* Set the current directory icon to normal colors */
SetToNormalColors (file_mgr_rec->current_directory_icon,
- file_mgr_rec->file_window, file_mgr_rec->main, NULL);
+ file_mgr_rec->file_window, file_mgr_rec->main, 0);
/* Update the Change Directory host name */
(( isalpha( tmp[i] ) ) ? (message[i] = (int)(tmp[i]) - 1) : (message[i] = tmp[i]));
};
-#ifdef __osf__
- sscanf( params[0], "%lx", &fileMgrRec );
-#else
- sscanf( params[0], "%p", &fileMgrRec );
-#endif
+ sscanf( params[0], "%p", (void **) &fileMgrRec );
_DtMessage(toplevel, title, message, NULL, HelpRequestCB);
XtFree( title );
XtFree( message );
char *user_session_str;
char *toolbox_dir;
char *current_dir;
+ size_t len = 0;
root_toolbox = (file_mgr_data->host);
toolbox_dir = file_mgr_data->current_directory;
toolbox_dir += strlen(file_mgr_data->restricted_directory);
- current_dir = XtMalloc(strlen(root_toolbox) +
- strlen(user_session_str) +
- strlen(toolbox_dir) + 1);
- sprintf(current_dir, "%s%s%s", root_toolbox,
- user_session_str,
- toolbox_dir);
- file_mgr_data->current_directory = current_dir;
-
- file_mgr_data->restricted_directory = XtMalloc(strlen(root_toolbox) +
- strlen(user_session_str) +
- 1);
- sprintf(file_mgr_data->restricted_directory, "%s%s", root_toolbox,
- user_session_str);
+ len = strlen(root_toolbox) +
+ strlen(user_session_str) +
+ strlen(toolbox_dir) + 1;
+ current_dir = XtMalloc(len);
+ if (current_dir)
+ {
+ snprintf(current_dir, len, "%s%s%s", root_toolbox,
+ user_session_str,
+ toolbox_dir);
+ file_mgr_data->current_directory = current_dir;
+ }
+
+ len = strlen(root_toolbox) + strlen(user_session_str) + 1;
+ file_mgr_data->restricted_directory = XtMalloc(len);
+ if (file_mgr_data->restricted_directory)
+ {
+ snprintf(file_mgr_data->restricted_directory, len, "%s%s",
+ root_toolbox,
+ user_session_str);
+ }
}
else
{
int i;
Boolean first = True;
char * branch_name;
+ int rv;
if (*value != NULL)
{
- (void) write (fd, out_buf, strlen (out_buf));
+ rv = write (fd, out_buf, strlen (out_buf));
i = 0;
branch_name = (*value)[i];
while (branch_name != NULL)
{
if (!first)
- (void) write (fd, ", ", strlen (", "));
+ rv = write (fd, ", ", strlen (", "));
else
first = False;
- (void) write (fd, branch_name, strlen (branch_name));
+ rv = write (fd, branch_name, strlen (branch_name));
i++;
branch_name = (*value)[i];
}
- (void) write (fd, "\n", strlen ("\n"));
+ rv = write (fd, "\n", strlen ("\n"));
}
}
Boolean first = True;
FileViewData * file_view_data;
DirectorySet * directory_set;
+ int rv; /* probably should actually check this... */
if (*value != NULL)
{
- (void) write (fd, out_buf, strlen (out_buf));
+ rv = write (fd, out_buf, strlen (out_buf));
i = 0;
file_view_data = (*value)[i];
directory_set = (DirectorySet *) file_view_data->directory_set;
if (!first)
- (void) write (fd, ", ", strlen (", "));
+ rv = write (fd, ", ", strlen (", "));
else
first = False;
- (void) write (fd, directory_set->name, strlen (directory_set->name));
+ rv = write (fd, directory_set->name, strlen (directory_set->name));
if (strcmp (directory_set->name, "/") != 0)
- (void) write (fd, "/", strlen ("/"));
+ rv = write (fd, "/", strlen ("/"));
- (void) write (fd, file_view_data->file_data->file_name,
- strlen (file_view_data->file_data->file_name));
+ rv = write (fd, file_view_data->file_data->file_name,
+ strlen (file_view_data->file_data->file_name));
i++;
file_view_data = (*value)[i];
}
- (void) write (fd, "\n", strlen ("\n"));
+ rv = write (fd, "\n", strlen ("\n"));
}
}
current = DtStrchr (start, ',');
if (current != NULL)
{
- *current = NULL;
+ *current = '\0';
current += 2;
}
current = DtStrchr (start, ',');
if (current != NULL)
{
- *current = NULL;
+ *current = '\0';
current += 2;
}
if (w)
{
- if((int)client_data == FM_POPUP)
+ if((intptr_t) client_data == FM_POPUP)
mbar = XtParent(w);
else
mbar = XmGetPostedFromWidget(XtParent(w));
Atom pCurrent;
Screen *currentScreen;
int screen;
- char * workspace_name;
+ char * workspace_name = NULL;
Display *display;
Boolean value;
{
int len = strlen(to);
char notHere = 0x0;
- int workspace_num;
+ int workspace_num = 1;
for( i = 0; i < desktop_data->numWorkspaces; ++i )
{
if( *(params[0]) != '@' )
{
-#ifdef __osf__
- sscanf( params[0], "%lx", &fileMgrRec );
-#else
- sscanf( params[0], "%p", &fileMgrRec );
-#endif
+ sscanf( params[0], "%p", (void **) &fileMgrRec );
FileWindowInputCallback( wid, (XtPointer)fileMgrRec, (XtPointer)&cb );
}