X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;ds=sidebyside;f=cde%2Fprograms%2Fdtfile%2FMain.c;h=4943a5f65305fbdabea037933158644df5fc5f62;hb=aa1bfc0ab33ff7b8863a3623c599c015263bf1d2;hp=95c9722feda04f00977fdcc4bd84ea445f30f86c;hpb=0ecef859cfacb5118ef489be5b09b2cde7a70195;p=oweals%2Fcde.git diff --git a/cde/programs/dtfile/Main.c b/cde/programs/dtfile/Main.c index 95c9722f..4943a5f6 100644 --- a/cde/programs/dtfile/Main.c +++ b/cde/programs/dtfile/Main.c @@ -16,7 +16,7 @@ * details. * * You should have received a copy of the GNU Lesser General Public - * License along with these librararies and programs; if not, write + * 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 */ @@ -112,12 +112,13 @@ #include #include +#include #include #include -#ifdef __osf__ +#if defined(CSRG_BASED) #include -#endif /* __osf__ */ +#endif /* CSRG_BASED */ #include #include @@ -137,6 +138,7 @@ #include #include +#include #include
#include
#include
@@ -150,11 +152,11 @@ #include #include #include -#include #ifdef HAVE_EDITRES #include #endif #include
+#include
#include
#include
#include
@@ -167,6 +169,7 @@ #include
#include
#include
+#include
#include "Encaps.h" #include "SharedProcs.h" @@ -184,6 +187,24 @@ #include "Find.h" #include "ModAttr.h" +/* From Command.c */ +extern void MoveCopyLinkHandler(Tt_message ttMsg, int opType); + +/* From Desktop.c */ +extern void PutOnWorkspaceHandler(Tt_message ttMsg); + +/* From Filter.c */ +extern void UpdateFilterAfterDBReread (DialogData * dialog_data); + +/* From ToolTalk.c */ +extern int InitializeToolTalkSession( Widget topLevel, int ttFd ); +extern Tt_status InitializeToolTalkProcid( int *ttFd, Widget topLevel, Boolean sendStarted ); +extern void FinalizeToolTalkSession(); +/* From Trash.c */ +void CloseTrash(Widget w, XtPointer client_data, XtPointer call_data) ; + + + /* When openDir resource is set to NEW File Manager will use this prefix to find for a different icon to display. @@ -954,13 +975,13 @@ XtActionsRec actionTable[] = { extern XtInputId ProcessToolTalkInputId; -#ifdef __osf__ +#if defined(CSRG_BASED) extern void sigchld_handler(int); -#endif /* __osf__ */ +#endif /* CSRG_BASED */ -void +int main( - unsigned int argc, + int argc, char **argv ) { #ifdef DT_PERFORMANCE @@ -970,14 +991,13 @@ main( struct timeval update_time_fs; #endif struct passwd * pw; - char current_directory[MAX_PATH]; + char current_directory[MAX_PATH] = {0}; struct passwd * pwInfo; char * homeDir; XEvent event; XtInputMask pending; Boolean eventDebugging; int offset; - KeySym keysym; int displayHeight; int displayWidth; Arg args[10]; @@ -999,9 +1019,9 @@ main( Tt_pattern requests2Handle; Tt_message msg; Tt_status status; -#ifdef __osf__ +#if defined(CSRG_BASED) struct sigaction sa, osa; -#endif /* __osf__ */ +#endif /* CSRG_BASED */ int session_flag = 0; #ifdef DT_PERFORMANCE @@ -1011,7 +1031,7 @@ main( (void) signal (SIGINT, (void (*)())Stop); /* We don't want any zombie children, do we? */ -#ifdef __osf__ +#if defined(CSRG_BASED) sa.sa_handler = sigchld_handler; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; @@ -1021,7 +1041,7 @@ main( ; #else (void) signal (SIGCHLD, SIG_IGN); -#endif /* __osf__ */ +#endif /* CSRG_BASED */ XtSetLanguageProc( NULL, NULL, NULL ); #ifdef DT_PERFORMANCE @@ -1049,12 +1069,6 @@ _DtPerfChkpntMsgSend("Begin XtInitialize"); option_list, XtNumber(option_list), (int *)&argc, argv); -/* MERGE START: May not need -#ifdef __osf__ - _XmColorObjCreate ( toplevel, NULL, NULL ); -#endif -*/ - #ifdef DT_PERFORMANCE gettimeofday(&update_time_f, NULL); if (update_time_s.tv_usec > update_time_f.tv_usec) { @@ -1319,7 +1333,7 @@ _DtPerfChkpntMsgSend("Begin XtInitialize"); /* Default action: Open up pwd or home dir */ GetPWD(current_directory); - if (current_directory[0] != NULL) + if (current_directory[0] != '\0') { msg = tttk_message_create( 0, TT_REQUEST, TT_SESSION, 0, "DtFolder_Show", @@ -1471,7 +1485,7 @@ _DtPerfChkpntMsgSend("Begin XtInitialize"); /* Get users pwd so we can set the restricted dir to it */ GetPWD(current_directory); - if (current_directory[0] != NULL) + if (current_directory[0] != '\0') special_restricted = XtNewString(current_directory); else special_restricted = XtNewString("~"); @@ -1625,7 +1639,7 @@ _DtPerfChkpntMsgSend("Begin XtInitialize"); mod_attr_dialog = _DtInstallDialog (modAttrClass, True, True); help_dialog = _DtInstallDialog (helpClass, False, False); - if(special_view == True && special_restricted != NULL); + if(special_view == True && special_restricted != NULL) { if(strncmp(special_restricted, "~", 1) == 0) { char *ptr, *ptr1; @@ -1633,9 +1647,10 @@ _DtPerfChkpntMsgSend("Begin XtInitialize"); special_restricted = _DtChangeTildeToHome(special_restricted); ptr = strrchr(special_restricted, '/'); ptr1 = ptr + 1; - if(ptr1[0] == NULL) + if(ptr1[0] == '\0') *ptr = '\0'; } + } /* Setup the settings file if any to setup */ RestoreSettingsFile(); @@ -1683,7 +1698,7 @@ _DtPerfChkpntMsgSend("Begin XtInitialize"); /* go build 10 desktop windows */ desktop_data = NULL; InitializeDesktopWindows(10, display); - InitializeDesktopGrid(); + InitializeDesktopGrid(displayWidth, displayHeight); LoadDesktopInfo(application_args.session); @@ -1755,7 +1770,7 @@ _DtPerfChkpntMsgSend("Begin XtInitialize"); /* Get users pwd so we can create a fileviewer window of it */ GetPWD(current_directory); - if (current_directory[0] != NULL) + if (current_directory[0] != '\0') { if (!GetNewView (home_host_name, current_directory, NULL, NULL, 0)) ViewHomeDirectoryHandler (0); @@ -1804,6 +1819,8 @@ _DtPerfChkpntMsgSend("Begin XtInitialize"); if (event.type != 0) XtDispatchEvent(&event); } + + return EXIT_SUCCESS; } @@ -1922,7 +1939,7 @@ Usage( template = (GETMESSAGE(18,23, message_string1)); fprintf (stderr, template, argv[0]); template = (GETMESSAGE(18,24, message_string2)); - fprintf (stderr, template); + fprintf (stderr, "%s", template); exit (0); } @@ -2013,7 +2030,7 @@ RestoreSettingsFile( void ) else { XtFree(dtPath); - return; /* we are comming up in a system mode (e.g. default) */ + return; /* we are coming up in a system mode (e.g. default) */ } @@ -2561,9 +2578,9 @@ SaveSession( { static char * name_list[] = { DTFILE_CLASS_NAME, NULL, NULL, NULL, NULL, NULL}; - char view_number[5]; + char view_number[11]; char number[5]; - char workspaceNumber[5]; + char workspaceNumber[11]; int fd; Atom * ws_presence = NULL; char * workspace_name=NULL; @@ -2968,8 +2985,8 @@ RestoreSession( char * full_path = NULL; Boolean status=False; char * temp = NULL; - char wsNum[5]; - char dialogNum[5]; + char wsNum[11]; + char dialogNum[11]; int num_sec_help_dialogs; int i; int j; @@ -2985,7 +3002,7 @@ RestoreSession( status = DtSessionRestorePath(toplevel, &full_path, path); if (!status) - return; + return(-1); if (stat(full_path, &stat_buf) != 0) { @@ -3018,7 +3035,7 @@ RestoreSession( /* first find out if it should show the file system */ xrm_name [0] = XrmStringToQuark (DTFILE_CLASS_NAME); xrm_name [1] = XrmStringToQuark ("showFilesystem"); - xrm_name [2] = NULL; + xrm_name [2] = 0; if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)) { if ((temp = (char *) value.addr) != NULL && @@ -3035,7 +3052,7 @@ RestoreSession( /* find out if it should be in restricted mode */ xrm_name [0] = XrmStringToQuark (DTFILE_CLASS_NAME); xrm_name [1] = XrmStringToQuark ("restrictMode"); - xrm_name [2] = NULL; + xrm_name [2] = 0; if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)) { if ((temp = (char *) value.addr) != NULL && @@ -3052,7 +3069,7 @@ RestoreSession( /* find out openFolder mode */ xrm_name [0] = XrmStringToQuark (DTFILE_CLASS_NAME); xrm_name [1] = XrmStringToQuark ("openFolder"); - xrm_name [2] = NULL; + xrm_name [2] = 0; if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)) { if ((temp = (char *) value.addr) != NULL && @@ -3069,7 +3086,7 @@ RestoreSession( xrm_name [0] = XrmStringToQuark (DTFILE_CLASS_NAME); xrm_name [1] = XrmStringToQuark ("view_count"); - xrm_name [2] = NULL; + xrm_name [2] = 0; /* Load standard dtfile views */ if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)) @@ -3089,7 +3106,7 @@ RestoreSession( xrm_name [1] = XrmStringToQuark (WS_LOAD_RES_HEADER); xrm_name [2] = XrmStringToQuark (wsNum); xrm_name [3] = XrmStringToQuark (SEC_LOAD_HELP_RES_HEADER); - xrm_name [4] = NULL; + xrm_name [4] = 0; /* Load standard dtfile views */ if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)) @@ -3203,7 +3220,7 @@ LoadViews ( XrmRepresentation rep_type; XrmValue value; static char * name_list[] = { DTFILE_CLASS_NAME, NULL, NULL }; - char view_number[5]; + char view_number[11]; DialogData * dialog_data; FileMgrData * file_mgr_data; char * workspaces; @@ -3318,7 +3335,7 @@ LoadViews ( /* and set the property for the view just created */ xrm_name [2] = XrmStringToQuark ("workspace"); - xrm_name [3] = NULL; + xrm_name [3] = 0; if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)) { @@ -3334,7 +3351,7 @@ LoadViews ( /* Get and set whether the view is iconic */ xrm_name [2] = XrmStringToQuark ("iconify"); - xrm_name [3] = NULL; + xrm_name [3] = 0; if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)) { @@ -3397,17 +3414,16 @@ static void GetPWD( char current_directory[] ) { - FILE * pwd_file; - register int i; + FILE * pwd_file = NULL; + int i = 0; /* Open a pwd process and read the current working directory */ /* from it. If the open fails or a read fails, then display */ /* the users home directory. */ pwd_file = popen ("pwd", "r"); - i = 0; - if (pwd_file != NULL) + if (pwd_file) { while (1) { @@ -3426,9 +3442,11 @@ GetPWD( i++; } } - (void) pclose (pwd_file); - current_directory[i] = NULL; + if (pwd_file) + pclose (pwd_file); + + current_directory[i] = '\0'; } /************************************************************************ @@ -3457,7 +3475,7 @@ OpenDirectories( { separator = DtStrchr (directory_set, ','); if (separator != NULL) - *separator = NULL; + *separator = '\0'; _DtPathFromInput(directory_set, NULL, &host, &path); @@ -3902,8 +3920,8 @@ void CloseView( DialogData *dialog_data ) { - register int i; - register int j; + int i; + int j; FileMgrData * file_mgr_data; DialogData * tmpDialog_data; FileMgrRec * file_mgr_rec; @@ -4162,7 +4180,7 @@ ViewSessionHandler( char current_directory[MAX_PATH]; GetPWD(current_directory); - if (current_directory[0] != NULL) + if (current_directory[0] != '\0') { if (!GetNewView (home_host_name, current_directory, NULL, NULL, 0)) @@ -4390,7 +4408,7 @@ ViewDirectoryProc( XtFree(errTitle); XtFree(errMsg); XtFree(dmsg); - return; + return NULL; } } } @@ -4451,7 +4469,7 @@ static void ViewHomeDirectoryHandler( Tt_message msg) { - register int i, j, k; + int i, j, k; struct passwd * pwInfo; char * homeDir; char * tmp_path; @@ -4629,7 +4647,7 @@ static void ViewToolsDirectoryHandler( Tt_message msg) { - register int i; + int i; char * tmp_path = NULL; char * tool_dir = NULL; char * msgFile = NULL; @@ -5121,7 +5139,7 @@ CleanUp ( XRectangle textExtent; Position x, y; - if ((int) client_data == FM_POPUP) + if ((int)(XtArgVal) client_data == FM_POPUP) mbar = XtParent(w); else mbar = XmGetPostedFromWidget(XtParent(w)); @@ -5415,9 +5433,8 @@ static unsigned char unsigned char **ppchNext) { unsigned char *pchR = pchIn; - register int i; -#ifdef MULTIBYTE - register int chlen; + int i; + int chlen; for (i = 0; ((chlen = mblen ((char *)pchIn, MB_CUR_MAX)) > 0); i++) /* find end of word: requires singlebyte whitespace terminator */ @@ -5429,19 +5446,8 @@ static unsigned char pchIn += chlen; } -#else - for (i = 0; *pchIn && !isspace (*pchIn); i++, pchIn++) - /* find end of word */ - { - } -#endif - /* skip to next word */ -#ifdef MULTIBYTE while (pchIn && (mblen ((char *)pchIn, MB_CUR_MAX) == 1) && isspace (*pchIn)) -#else - while (pchIn && isspace (*pchIn)) -#endif { *pchIn++; } @@ -5989,9 +5995,9 @@ ForceMyIconClosed ( char * host_name, char * directory_name) { - register int i; - register int j; - register int k; + int i; + int j; + int k; Arg args[1]; FileViewData * file_view_data = NULL; DialogData *dialog_data; @@ -6269,7 +6275,7 @@ FinalizeToolTalkSession(); exit (1); } -#ifdef __osf__ +#if defined(CSRG_BASED) extern void sigchld_handler(int signo) /* Do not use the arg signo at the moment */ { @@ -6284,4 +6290,4 @@ sigchld_handler(int signo) /* Do not use the arg signo at the moment */ pid = waitpid(-1, &stat_loc, WNOHANG); /* Child exit handling code follows, if any */ } -#endif /* __osf__ */ +#endif /* CSRG_BASED */