}
else /* wasn't in form "<host>:/<path>" so use name as is... */
{
- strcpy(fname, fnameIn);
+ snprintf(fname, sizeof(fname), "%s", fnameIn);
}
/*** - if we got a NULL base_name, return FALSE ***/
{
Process_Clear();
Process_Resize();
- strcpy(last_fname, fname);
+ snprintf(last_fname, sizeof(last_fname), "%s", fname);
ChangeTitle();
successFormat = FORMAT_NONE;
return True;
#endif
}
else {
- strcpy(dummy, fname);
- strcat(dummy, "_m");
+ snprintf(dummy, sizeof(dummy), "%s_m", fname);
}
#ifdef DEBUG
if (debug)
mask_ret = 0;
}
- strcpy(last_fname, fname);
+ snprintf(last_fname, sizeof(last_fname), "%s", fname);
ChangeTitle();
#ifdef DEBUG
}
else /* wasn't in form "<host>:/<path>" so use name as is... */
{
- strcpy(fname, fnameIn);
+ snprintf(fname, sizeof(fname), "%s", fnameIn);
}
base_name = (base_name ? base_name + 1 : fname);
}
- strcpy(last_fname, fname);
+ snprintf(last_fname, sizeof(last_fname), "%s", fname);
ChangeTitle();
#ifdef DEBUG
strcat(dummy, suffix);
}
else {
- strcpy(dummy, fname);
- strcat(dummy, "_m");
+ snprintf(dummy, sizeof(dummy), "%s_m", fname);
}
/*** FOURTH, construct XImages for the shape and mask bitmaps ***/
mask_needed = False;
/* prepare to test */
tmp1 = strrchr(strOrig, '.');
- strcat(tmpStr, untitledStr);
- strcat(tmpStr, ".m.pm");
+ snprintf(tmpStr, sizeof(tmpStr), "%s.m.pm", untitledStr);
tst=strcmp(last_fname, tmpStr);
if ( tst==0 ) {/* untitled */
if ( tmp1 ) { /* previous string exists */
- if (currentTitle != SAVE_AS) strcat(newName, strOrig);
- else {
- strcat(newName, untitledStr);
- strcat(newName, ".m.pm");}
+ if (currentTitle != SAVE_AS) {
+ snprintf(newName, sizeof(newName), "%s", strOrig);
+ } else {
+ snprintf(newName, sizeof(newName), "%s.m.pm", untitledStr);
+ }
/* Update the FSB */
XmFileSelectionDoSearch(fileIODialog,(XmString)NULL);
}
else { /* First time arownd */
if (strOrig && strOrig[0]!='\0')
- strcat(newName, strOrig);
+ snprintf(newName, sizeof(newName), "%s", strOrig);
else {
- strcat(newName, untitledStr);
- strcat(newName, ".m.pm");
+ snprintf(newName, sizeof(newName), "%s.m.pm", untitledStr);
}
XSync(dpy, 0);
*/
c = tmp1[1];
tmp2 = strchr(tmp1, c);
- strcpy(newName, tmp2);
+ if(tmp2) {
+ snprintf(newName, sizeof(newName), "%s", tmp2);
+ }
/* make and insert the directory name */
ln = strlen(last_fname) - strlen(tmp1);
if (tmp1) {
c = tmp1[1];
tmp2 = strchr(tmp1, c);
- strcpy(newName, tmp2);
+ if(tmp2) {
+ snprintf(newName, sizeof(newName), "%s", tmp2);
+ }
}
if (strncmp(newName, untitledStr, 8) == 0 || last_fname[0] == '\0') Process_SaveAs();
else
if ( DialogFlag == NEW ) {
strcpy(undo_file, last_fname);
- last_fname[0] = '\0';
SavedOnce = False;
Backup_Icons(); /* for undo */
flag = DO_NOT_SAVE;
Init_Icons(icon_width, icon_height, flag);
if (!untitledStr)
untitledStr = GETSTR(2,20, "UNTITLED");
- strcpy(last_fname, untitledStr);
- strcat(last_fname, ".m.pm");
- last_fname[strlen(last_fname)] = '\0';
+ snprintf(last_fname, sizeof(last_fname), "%s.m.pm", untitledStr);
ChangeTitle();
Repaint_Exposed_Tablet();
Dirty = False;
tmp[0] = '\0';
if ((Boolean)XeIsLocalHostP(host))
{
+ char *slash = NULL;
tmp[0] = ' ';
- return (strdup(strchr(objects, '/')));
+ slash = strchr(objects, '/');
+ if(slash) {
+ return strdup(slash);
+ } else {
+ return NULL;
+ }
}
/* different host... get full path name */
*/
if (transferInfo->dropData->numItems > 0)
{
- strncpy (dropFileName, transferInfo->dropData->data.files[0],
- MAX_FNAME);
+ snprintf(dropFileName, sizeof(dropFileName), "%s", transferInfo->dropData->data.files[0]);
}
else
dropFileName[0] = '\0';
* *
*X11***********************************************************************/
-int
+void
Select_New_Pen(
int n )
{
XmToggleButtonSetState(StaticWid[new_pen], True, False);
else
XmToggleButtonSetState(DynamicWid[new_pen], True, False);
- return 0;
+ return;
}
/*** un-set the previous choice ***/
{
tmpStr = GETSTR(16,24, "Couldn't save session to file");
tmpStr2 = (char *)XtMalloc(strlen(tmpStr) + strlen(path)+ 3);
- sprintf(tmpStr2, "%s: %s\n", tmpStr, path);
+ snprintf(tmpStr2, sizeof(strlen(tmpStr) + strlen(path)+ 3), "%s: %s\n", tmpStr, path);
_DtSimpleErrnoError(progName, DtError, NULL, tmpStr2, NULL);
XtFree(tmpStr2);
XtFree ((char *)path);
XtFree ((char *)path);
XtFree ((char *)name);
+ close(fd);
+
/* Don't exit yet, SM needs time to get the new commandStr.*/
}