pTemp = pCacheListHead;
/* Search our Cache List for the closed help dialog */
- while ((pTemp->helpDialog != helpDialog) && (pTemp != NULL))
+ while ((pTemp != NULL) && (pTemp->helpDialog != helpDialog))
pTemp = pTemp->pNext;
*/
if (NULL != bitmap && *bitmap != '/')
{
- strcpy (bitmapName, family_name);
+ snprintf(bitmapName, sizeof(bitmapName), "%s", family_name);
ptr = strrchr (bitmapName, '/');
if (ptr)
{
ptr++;
*ptr = '\0';
- strcat (bitmapName, bitmap);
+ snprintf(bitmapName, sizeof(bitmapName), "%s%s", bitmapName, bitmap);
bitmap = bitmapName;
}
else
if (pDir == NULL)
return;
- strcpy (fullName, directory);
- strcat (fullName, SlashString);
+ snprintf(fullName, sizeof(fullName), "%s%s", directory, SlashString);
ptr = fullName + strlen (fullName);
/*
myName, errno);
exit (1);
}
- strcat (baseName, "/");
- strcat (baseName, App_args.dir);
+ snprintf(baseName, sizeof(baseName), "%s/%s", baseName, App_args.dir);
}
else
- strcpy (baseName, App_args.dir);
+ snprintf(baseName, sizeof(baseName), "%s", App_args.dir);
/*
* make sure the directory exists
exit (1);
}
- (void) strcpy (tmpVolume, ptr);
+ snprintf(tmpVolume, sizeof(tmpVolume), "%s", ptr);
if (tmpVolume[strlen (tmpVolume) - 1] != '/')
- strcat(tmpVolume, SlashString);
+ snprintf(tmpVolume, sizeof(tmpVolume), "%s", SlashString);
free (ptr);
* remember the rest of the string (including the slash)
* and strip the trailing slash from the directory path.
*/
- strcpy (tmpVolume2, endDir);
+ snprintf(tmpVolume2, sizeof(tmpVolume2), "%s", endDir);
*endDir = '\0';
/*
ptr = _DtHelpCeTracePathName(tmpVolume);
if (ptr != NULL)
{
- strcpy (tmpVolume, ptr);
+ snprintf(tmpVolume, sizeof(tmpVolume), "%s", ptr);
free (ptr);
}
/*
* get temporary files for the volume and topic file.
*/
- (void) strcat (tmpVolume, App_args.file);
+ snprintf(tmpVolume, sizeof(tmpVolume), "%s%s", tmpVolume, App_args.file);
(void) strcpy (tmpHeader, tmpVolume);
(void) strcpy (tmpTopic, tmpVolume);
- (void) strcat (tmpVolume, Ext_Hv);
+ snprintf(tmpVolume, sizeof(tmpVolume), "%s%s", tmpVolume, Ext_Hv);
(void) strcat (tmpHeader, "00.ht");
(void) strcat (tmpTopic , "01.ht");
int i;
/* build printer resource name and class */
- strcpy(name_prefix, appname); /* e.g. dthelpprint */
- strcat(name_prefix, RN_printer); /* e.g. dthelpprint.printer */
-
- strcpy(class_prefix, appclass); /* e.g. Dthelpprint */
- strcat(class_prefix, RC_printer); /* e.g. Dthelpprint.Printer */
+ snprintf(name_prefix, sizeof(name_prefix), "%s%s", appname, RN_printer); /* e.g. dthelpprint.printer */
+ snprintf(class_prefix, sizeof(class_prefix), "%s%s", appclass, RC_printer); /* e.g. Dthelpprint.Printer */
/********************/
/* Get printer name */
/********************/
- strcpy(resource_name, name_prefix); /* e.g. dthelpprint.printer */
- strcat(resource_name, RN_rsrcname); /* e.g. dthelpprint.printer.name */
- strcpy(resource_class, class_prefix); /* e.g. Dthelpprint.Printer */
- strcat(resource_class, RC_rsrcname); /* e.g. Dthelpprint.Printer.Name */
+ snprintf(resource_name, sizeof(resource_name), "%s%s", name_prefix, RN_rsrcname); /* e.g. dthelpprint.printer.name */
+ snprintf(resource_class, sizeof(resource_class), "%s%s", class_prefix, RC_rsrcname); /* e.g. Dthelpprint.Printer.Name */
if (XrmGetResource(appDB, resource_name, resource_class,
str_type, &value) == True)
name = value.addr;
else name = EMPTY_STR;
if (name[0] != EOS)
{
- strcat(name_prefix, DOT_STR);
- strcat(name_prefix, name); /* e.g. dthelpprint.printer.<name> */
- strcat(class_prefix, DOT_STR);
- strcat(class_prefix, name); /* e.g. Dthelpprint.Printer.<name> */
+ snprintf(name_prefix, sizeof(name_prefix), "%s%s%s", name_prefix, DOT_STR, name); /* e.g. dthelpprint.printer.<name> */
+ snprintf(class_prefix, sizeof(class_prefix), "%s%s%s", class_prefix, DOT_STR, name); /* e.g. Dthelpprint.Printer.<name> */
}
/**************************/
cnt > 0;
cnt--, rsrc++ )
{
- strcpy(resource_name, name_prefix);
- strcat(resource_name, rsrc->resource_name);
- strcpy(resource_class, class_prefix);
- strcat(resource_class, rsrc->resource_class);
+ snprintf(resource_name, sizeof(resource_name), "%s%s", name_prefix, rsrc->resource_name);
+ snprintf(resource_class, sizeof(resource_class), "%s%s", class_prefix, rsrc->resource_class);
if (XrmGetResource(db, resource_name,
resource_class, str_type, &value) == True)
*XtRefOffset(options,rsrc->resource_offset) = value.addr;
fputs(ndif, dtd) ;
}
SUBONE
+
+ free(mapbysref);
}
/* Output one element block in a template */
thisnodelevel = 2;
sprintf(id, "%s%s", sdlReservedName, glossary_string);
mb_starthelpnode("_GLOSSARY", id, thisnodelevel);
- strcpy(chapstring, string) ;
- if (strlen(chapstring) + 1 > sizeof(chapstring)) {
+ if (strlen(string) + 1 > sizeof(chapstring)) {
m_error("Program error: exceeded chapstring") ;
m_exit(TRUE) ;
}
+ sprintf(chapstring, sizeof(chapstring), "%s", string) ;
fputs("\nGlossary\n", stderr) ;
glossary = TRUE ;
fprintf(outfile, "<HEAD SSI=\"CHAPHEAD\">%s</HEAD>\n", string);
if (! newtransit || (loading && ! newdlm))
{
trysize = NUMDELIM + 1;
+ free(newtransit);
newtransit = (int *) calloc(NUMCON * trysize, sizeof(int));
- if (loading) newdlm = (char **) calloc(trysize, sizeof(M_WCHAR *));
+ if (loading)
+ {
+ free(newdlm);
+ newdlm = (char **) calloc(trysize, sizeof(M_WCHAR *));
+ }
}
if (! newtransit || (loading && ! newdlm))
{
ret = system(pcmd);
ret = snprintf(pcmd, slen, "touch %s",pfile2);
ret = system(pcmd);
+ free(pcmd);
}
int nextchar(file, data)
fprintf(stderr, "**** Specify interface file ****\n") ;
exit(TRUE) ;
}
- strncpy(iffile, argv[1], IFLEN) ;
+ snprintf(iffile, IFLEN, "%s", argv[1]) ;
initialize() ;
while (TRUE) {
m_token = scan() ;
else
{
/* not fully specified, check each component of path for ourself */
- strcpy(patbuf, getenv("PATH"));
+ snprintf(patbuf, sizeof(patbuf), "%s", getenv("PATH"));
path = patbuf;
cp = path;
switch (lastlist->lastlist->order)
{
case UROMAN:
- strcpy(orderString, ROMAN100[count / 100]);
- strcat(orderString, ROMAN10[(count / 10) % 10]);
- strcat(orderString, ROMAN0[count % 10]);
+ snprintf(orderString, sizeof(orderString), "%s%s%s", ROMAN100[count / 100], ROMAN10[(count / 10) % 10], ROMAN0[count % 10]);
type = romanString;
break;
case UALPHA:
type = arabicString;
break;
case LROMAN:
- strcpy(orderString, roman100[count / 100]);
- strcat(orderString, roman10[(count / 10) % 10]);
- strcat(orderString, roman0[count % 10]);
+ snprintf(orderString, sizeof(orderString), "%s%s%s", roman100[count / 100], roman10[(count / 10) % 10], roman0[count % 10]);
type = romanString;
break;
case LALPHA:
int compVer;
int isStd;
-strcpy(myLocale, pLang);
+snprintf(myLocale, sizeof(myLocale), "%s", pLang);
if (*pCharset)
{
- strcat(myLocale, ".");
- strcat(myLocale, pCharset);
+ snprintf(myLocale, sizeof(myLocale), "%s.%s", myLocale, pCharset);
}
if ((_DtLcxOpenAllDbs(&myDb) != 0) ||
else
strcpy(pLang, cString);
- if (*charset)
+ if ( *charset)
{
strcpy(pCharset, charset);
- mb_free(&charset);
}
else
strcpy(pCharset, isoString);
}
+ mb_free(&charset);
_DtLcxCloseDb(&myDb);
free(charset);
if (dotPtr)
*dotPtr = '\0';
-strcpy(stdLang, locale);
+snprintf(stdLang, sizeof(stdLang), "%s", locale);
if (charset)
- strcpy(stdCharset, charset);
+ snprintf(stdCharset, sizeof(stdCharset), "%s", charset);
SetStdLocale(stdLang, stdCharset);
if (*stdCharset)
}
icon = GetDefaultHeaderString(iconFile, M_SYSTEM, "");
-if (*icon)
+if (icon && *icon)
{
char id[32];
fputs("CLASS=\"ICON\" SSI=\"NCW-ICON\">", outfile);
fputs("</REFITEM>\n</SNREF></HEAD>\n", outfile);
AddToSNB(id, icon);
- m_free(icon, "icon name");
}
+m_free(icon, "icon name");
}
}
if (try != pathbuf) mb_free(&try);
+mb_free(&mb_inputname);
}
/* Below is a modified version of m_cyclent() that returns a pointer
thisnodelevel = 2;
sprintf(id, "%s%s", sdlReservedName, glossary_string);
mb_starthelpnode("_GLOSSARY", id, thisnodelevel);
- strcpy(chapstring, string) ;
- if (strlen(chapstring) + 1 > sizeof(chapstring)) {
+ if (strlen(string) + 1 > sizeof(chapstring)) {
m_error("Program error: exceeded chapstring") ;
m_exit(TRUE) ;
}
+ snprintf(chapstring, sizeof(chapstring), "%s", string) ;
fputs("\nGlossary\n", stderr) ;
glossary = TRUE ;
fprintf(outfile, "<HEAD SSI=\"CHAPHEAD\">%s</HEAD>\n", string);
exLineNum++;
if (special[index])
{
- strcpy(exbuff, special[index]);
+ snprintf(exbuff, sizeof(exbuff), "%s", special[index]);
bufflen = strlen(exbuff);
}
}
index = (unsigned char) imbuff[0];
if (special[index])
{
- strcpy(imbuff, special[index]);
+ snprintf(imbuff, sizeof(imbuff), "%s", special[index]);
bufflen = strlen(imbuff);
}
mb_strcode(imbuff, outfile);
int nameindex ;
LOGICAL start ;
- strncpy(efilename, fname, ENTFILENAME) ;
- strncpy(&efilename[strlen(efilename)], ".h", 2) ;
+ snprintf(efilename, sizeof(efilename), "%s.h", fname) ;
m_openchk(&entfile, efilename, "w") ;
fprintf(entfile, "#include \"entdef.h\"\n") ;
char *mb_entcontent;
mb_entcontent = MakeMByteString(entcontent);
-if (!mb_entcontent || !*mb_entcontent) return NULL; /* null file name, don't open a directory */
+if (!mb_entcontent || !*mb_entcontent) {
+ m_free(mb_entcontent, "multi-byte string");
+ return NULL; /* null file name, don't open a directory */
+}
open = fopen(mb_entcontent, "r");
if (open)