+/*
+ * 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
+ */
/*
*+SNOTICE
*
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
+#include <stdint.h>
#include <pwd.h>
#include <X11/Intrinsic.h>
#include <Xm/Text.h>
#include <sys/file.h>
-extern forceUpdate( Widget );
+extern void forceUpdate( Widget );
RoamCmd::RoamCmd
(char *name, char *label, int active, RoamMenuWindow *window)
) : RoamInterruptibleCmd (name, label, active)
{
_menuWindow = window;
+ _open_create_flag = DTM_FALSE;
+ _open_lock_flag = DTM_FALSE;
}
// Parent's execute() ends up calling derived class's doit()
_num_converted = 0;
_num_to_be_converted = 0;
_dialog = NULL;
+ _criteria = NULL;
+ _conv_cb = NULL;
+ _src = NULL;
+ _dest = NULL;
}
void
char * buf = new char[25];
- sprintf(buf, "Converted: %3d%", 0);
+ sprintf(buf, "Converted: %3d%%", 0);
_dialog->post ("Mailer",
buf,
) : NoUndoCmd( name, label, active )
{
_menuwindow = window;
+ _msgno = NULL;
}
void
) : Cmd ( name, label, active )
{
_menuwindow = window;
+ _msgno = NULL;
}
void
this,
parent)
{
+ _only_show_mailboxes = DTM_FALSE;
+
if (! _is_initialized)
{
FORCE_SEGV_DECL(DtMail::Session, m_session);
_menuwindow = window;
_undelFromList = NULL;
_fromList = viaDeleteList;
+ _clientData = NULL;
+ _num_deleted = 0;
}
UndeleteCmd::~UndeleteCmd()
_menuwindow = menu_window;
_copy_button = NULL;
_move_button = NULL;
+ _file_list = NULL;
+ _file_text = NULL;
+ _default_button = NULL;
}
MoveCopyCmd::~MoveCopyCmd()
_copy_button,
XmNhelpCallback,
HelpCB,
- "dtmailViewmainWindowWork-AreapanedWform2RowColumnMoveCopy");
+ (void *)"dtmailViewmainWindowWork-AreapanedWform2RowColumnMoveCopy");
XtAddCallback(
_copy_button,
XmNactivateCallback,
// If a string was successfully extracted, call
// unifiedMailboxSelected to handle the file.
*selected = '\0';
- if (NULL != dname) strcat(selected, dname);
+ if (NULL != dname) snprintf(selected, sizeof(selected), "%s", dname);
strcat(selected, fname);
obj->updateUnifiedData();
obj->unifiedMailboxSelected(
DebugPrintf(1, "%s: printit\n", name());
// Create tmp file.
- sprintf(tmpdir, "%s/%s", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY);
+ snprintf(tmpdir, MAXPATHLEN+1, "%s/%s", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY);
if ((p = tempnam(tmpdir, "dtmail")) == NULL) {
delete [] tmpdir;
return;
parent)
{
_parent = clientData;
+ _name = NULL;
}
SaveAttachCmd::SaveAttachCmd (
parent )
{
_parent = clientData;
+ _name = NULL;
}
SaveAttachCmd::SaveAttachCmd (
parent )
{
_parent = clientData;
+ _name = NULL;
}
void
if (NULL == _roam_menu_window)
{
char *text_buf = _text_editor->get_contents();
- writeText((XtPointer) fd, text_buf);
+ writeText((XtPointer) (intptr_t) fd, text_buf);
XtFree((char*) text_buf);
}
else
// Create temp file.
//
char *tmpdir = new char[MAXPATHLEN+1];
- sprintf(tmpdir, "%s/%s", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY);
+ snprintf(tmpdir, MAXPATHLEN+1, "%s/%s", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY);
if ((tmppath = tempnam(tmpdir, "dtmail")) == NULL) {
- sprintf(buf, GETMSG(DT_catd, 3, 51, "Unable to create %s."), tmpdir);
+ snprintf(buf, sizeof(buf), GETMSG(DT_catd, 3, 51, "Unable to create %s."), tmpdir);
_genDialog->setToErrorDialog(GETMSG(DT_catd, 3, 52, "Mailer"), buf);
helpId = DTMAILHELPNOCREATE;
_genDialog->post_and_return(helpId);
next_msg->display(
visible_headers,
&SaveAsTextCmd::writeText,
- (XtPointer) fd);
- writeText((XtPointer) fd, "\n\n");
+ (XtPointer) (intptr_t) fd);
+ writeText((XtPointer) (intptr_t) fd, "\n\n");
} while ((next_msg = mailbox->nextMessage()) != (DmxMsg *) NULL);
delete mailbox;
renameDialog = aa->getRenameDialog();
- sprintf(buf, GETMSG(DT_catd, 3, 57, "Rename attachment as"));
+ sprintf(buf, "%s", GETMSG(DT_catd, 3, 57, "Rename attachment as"));
message = XmStringCreateLocalized(buf);
int active)
: NoUndoCmd (name, label, active)
{
+ _header = NULL;
}
void
{
char *forwardfile = new char[MAXPATHLEN+1];
- sprintf(forwardfile, "%s/%s", getenv("HOME"), _forwardFile);
+ snprintf(forwardfile, MAXPATHLEN+1, "%s/%s", getenv("HOME"), _forwardFile);
// Remove the current .forward file (it has vacation in it)
// Recover and replace the original backup forward file, if
Boolean retval = FALSE;
char *forwardfile = new char[MAXPATHLEN+1];
- sprintf(forwardfile, "%s/%s", getenv("HOME"), _forwardFile);
+ snprintf(forwardfile, MAXPATHLEN+1, "%s/%s", getenv("HOME"), _forwardFile);
if (SafeAccess(forwardfile, F_OK) != 0) {
delete [] forwardfile;
else
dialog = theRoamApp.genDialog();
- sprintf(error_buf, GETMSG(DT_catd, 1, 102, "You are already using the forwarding facility for\nsomething other than Vacation. While Vacation is\nrunning, Vacation will be appended to this other\nforwarding activity. Is it still OK to start Vacation?\0"));
+ sprintf(error_buf, "%s", GETMSG(DT_catd, 1, 102, "You are already using the forwarding facility for\nsomething other than Vacation. While Vacation is\nrunning, Vacation will be appended to this other\nforwarding activity. Is it still OK to start Vacation?\0"));
dialog->setToQuestionDialog(GETMSG(DT_catd, 1, 103, "Mailer"),
error_buf);
else
dialog = theRoamApp.genDialog();
- sprintf(error_buf, GETMSG(DT_catd, 1, 104, "You are already running the vacation program in your .forward file.\nConsult documentation on how to stop it and remove it from your .forward file.\nTry this command after fixing that problem.\0"));
+ sprintf(error_buf, "%s", GETMSG(DT_catd, 1, 104, "You are already running the vacation program in your .forward file.\nConsult documentation on how to stop it and remove it from your .forward file.\nTry this command after fixing that problem.\0"));
dialog->setToErrorDialog("Error", error_buf);
helpId = DTMAILHELPREMOVEVACATION;
delete [] messagefile;
delete [] error_buf;
delete [] forwardfile;
+ SafeClose(bkup_fd);
SafeClose(fwd_fd);
return 1;
}
strlen(append_buf2)) {
// error
SafeClose(bkup_fd);
+ SafeClose(fwd_fd);
delete [] buf;
delete [] messagefile;
delete [] error_buf;
char *buf = new char[BUFSIZ+1];
int fd;
- sprintf(buf, file);
+ sprintf(buf, "%s", file);
strcat(buf, _backupSuffix);
if (rename(buf, file) < 0) {
return(-1);
}
- if ((fd = SafeOpen(file, O_RDONLY)) == 0) {
+ if ((fd = SafeOpen(file, O_RDONLY)) == -1) {
delete [] buf;
return(-1);
}
struct stat buf;
if (SafeFStat(fd, &buf) < 0) {
- sprintf(dialog_text,
+ sprintf(dialog_text, "%s",
GETMSG(DT_catd, 1, 105, "Cannot open .vacation.msg file -- No write permission."));
dialog->setToQuestionDialog("Mailer", dialog_text);
helpId = DTMAILHELPNOWRITEVACATION;
size_t map_size = (int) (buf.st_size +
(page_size - (buf.st_size % page_size)));
- if (buf.st_size == 0)
+ if (buf.st_size == 0) {
+ SafeClose(fd);
return;
+ }
int free_buf = 0;
mbuf.size = buf.st_size;
-#ifdef __osf__
- mbuf.buffer = (char *)mmap(0, map_size, PROT_READ, MAP_PRIVATE, fd, 0);
-#else
mbuf.buffer = mmap(0, map_size, PROT_READ, MAP_PRIVATE, fd, 0);
-#endif
if (mbuf.buffer == (char *)-1) {
free_buf = 1;
mbuf.buffer = new char[mbuf.size];
}
if (msg_file_exists >= 0 && text_changed) {
- sprintf(dialog_text,
+ sprintf(dialog_text, "%s",
GETMSG(DT_catd, 1, 106, ".vacation.msg file exists. Replace with new text?"));
dialog->setToQuestionDialog("Mailer", dialog_text);
helpId = DTMAILHELPEXISTSVACATION;
fd = SafeOpen(messagefile, O_WRONLY | O_CREAT);
if (fd < 0) {
- sprintf(dialog_text,
+ sprintf(dialog_text, "%s",
GETMSG(DT_catd, 1, 107, "Cannot open .vacation.msg file -- No write permission."));
dialog->setToQuestionDialog("Mailer", dialog_text);
helpId = DTMAILHELPERROR;