#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <fcntl.h>
+#include <unistd.h>
#include <Dt/Icon.h>
#include "dtcreate.h"
#include "cmnrtns.h"
#include "fileio.h"
+#include "parser.h"
+#include "ErrorDialog.h"
#define COMMENT_CHAR '#'
#define MAX_KEY 10000
char *ptr;
char *msgPtr, *fmtPtr, *errPtr;
+ if (!pszFile)
+ return 1;
+
/***************************************************************************/
/* Open action and filetypes definition file for writing. */
/***************************************************************************/
}
}
SetCookie(fp);
- if (fp) fclose(fp);
+ if (fp)
+ fclose(fp);
+
chmod(pszFile, 0644);
+
return(0);
}
/***************************************************************************/
/* Open action file for writing. */
/***************************************************************************/
- if (pszFile && (fp = fopen(pszFile, "w")) == NULL) {
+ if (pszFile == NULL || (fp = fopen(pszFile, "w")) == NULL) {
#ifdef DEBUG
printf("Can not open file.\n"); /* debug */
#endif
fprintf(fp, "echo \"Common Desktop Environment Dt action\"\n");
fprintf(fp, "\n");
- if (fp) fclose(fp);
+ fclose(fp);
chmod(pszFile, 0755);
return(0);
}
{
FILE *fp = (FILE *)NULL;
- int rc;
+ int rc = 1;
char *msgPtr, *fmtPtr, *errPtr;
/***************************************************************************/
sprintf(errPtr, fmtPtr, msgPtr, pszFile);
display_error_message(CreateActionAppShell, errPtr);
XtFree(errPtr);
+ fclose(fp);
return(1);
}
}
- if (fp) fclose(fp);
+ fclose(fp);
return(rc);
}
case Medium_Icon :
strcpy(pszSize, MEDIUM_EXT);
break;
+ case Small_Icon :
+ strcpy(pszSize, SMALL_EXT);
+ break;
case Tiny_Icon :
strcpy(pszSize, TINY_EXT);
break;
+ case None_Selected :
+ pszSize[0] = 0;
}
if (bIsMask) {
strcat(pszSize, "_m");