+/*
+ * 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 librararies and programs; if not, write
+ * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301 USA
+ */
/*
* COMPONENT_NAME: austext
*
#include <signal.h>
#include <sys/stat.h>
#include <locale.h>
+#include <stdlib.h>
#define PRINT_MESSAGES \
{ puts (DtSearchGetMessages()); DtSearchFreeMessages(); }
return FALSE;
/* If browsing, tell user his options */
- fprintf (aa_stderr, catgets(dtsearch_catd, MS_tomita, 5,
+ fprintf (aa_stderr, "%s", catgets(dtsearch_catd, MS_tomita, 5,
"Available choices are:") );
for (db = usrblk.dblist; db != NULL; db = db->link)
fprintf (aa_stderr, " '%s'", db->name);
return FALSE;
}
- strcpy (parsed_dbname, ptr);
+ snprintf(parsed_dbname, sizeof(parsed_dbname), "%s", ptr);
parsed_dblk = usrblk.dblk;
/* Hop over to beginning of 2nd token */
continue;
default:
- printf (catgets(dtsearch_catd, MS_tomita, 16, "...what?\n"));
+ printf ("%s", catgets(dtsearch_catd, MS_tomita, 16, "...what?\n"));
continue;
} /* end switch */
if (pausing && *ptr == '\n') {
if (++pause_counter >= PAUSE_ROWS) {
/* Msg 21 is used in two places */
- printf ( catgets(dtsearch_catd, MS_tomita, 21,
+ printf ( "%s", catgets(dtsearch_catd, MS_tomita, 21,
"\n...push ENTER to continue... ") );
*userbuf = '\0';
- fgets (userbuf, sizeof (userbuf), stdin);
+ if(NULL == fgets (userbuf, sizeof (userbuf), stdin)) {
+ fprintf(stderr, "Failed to read from stdin\n");
+ exit(EXIT_FAILURE);
+ }
if (strlen(userbuf) && userbuf[strlen(userbuf)-1] == '\n')
userbuf[strlen(userbuf)-1] = '\0';
if (pausing && *ptr == '\n')
if (++pause_counter >= PAUSE_ROWS) {
/* Msg 21 is used in two places */
- printf ( catgets(dtsearch_catd, MS_tomita, 21,
+ printf ( "%s", catgets(dtsearch_catd, MS_tomita, 21,
"\n...push ENTER to continue... ") );
*userbuf = '\0';
- fgets (userbuf, sizeof (userbuf), stdin);
- if (strlen(userbuf) &&
+ if(NULL == fgets (userbuf, sizeof (userbuf), stdin)) {
+ fprintf(stderr, "Failed to read from stdin 2\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (strlen(userbuf) &&
userbuf[strlen(userbuf)-1] == '\n')
userbuf[strlen(userbuf)-1] = '\0';
"If you are sure you are ready to start deleting, enter 'y' now... ") ,
infname, OE_prodname);
- fgets (buf, sizeof(buf)-1, stdin);
+ if(NULL == fgets (buf, sizeof(buf)-1, stdin)) {
+ fprintf(stderr, "no input\n");
+ return;
+ }
if (tolower (*buf) != 'y')
return;
}
signal (SIGQUIT, kill_delete);
signal (SIGTRAP, kill_delete);
signal (SIGTERM, kill_delete);
+#ifdef SIGPWR
signal (SIGPWR, kill_delete);
+#endif
#ifdef _AIX
signal (SIGXCPU, kill_delete); /* cpu time limit exceeded */
signal (SIGDANGER, kill_delete); /* imminent paging space
usrblk.request = OE_SHUTDOWN;
Opera_Engine ();
- printf ( catgets(dtsearch_catd, MS_tomita, 36,
+ printf ( "%s", catgets(dtsearch_catd, MS_tomita, 36,
"Normal engine shutdown.\n") );
DtSearchExit (0);
} /* main() */