aboutsummaryrefslogtreecommitdiff
path: root/mkfontscale/mkfontscale.c
diff options
context:
space:
mode:
Diffstat (limited to 'mkfontscale/mkfontscale.c')
-rw-r--r--mkfontscale/mkfontscale.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/mkfontscale/mkfontscale.c b/mkfontscale/mkfontscale.c
index 51dd47d49..ba2f84160 100644
--- a/mkfontscale/mkfontscale.c
+++ b/mkfontscale/mkfontscale.c
@@ -19,8 +19,6 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/* $XdotOrg: xc/programs/mkfontscale/mkfontscale.c,v 1.2 2004/04/23 19:54:36 eich Exp $ */
-/* $XFree86: xc/programs/mkfontscale/mkfontscale.c,v 1.21 2003/12/10 02:58:07 dawes Exp $ */
#include <stdio.h>
#include <stdlib.h>
@@ -48,12 +46,6 @@
#include "data.h"
#include "ident.h"
-#ifdef NEED_SNPRINTF
-#undef SCOPE
-#define SCOPE static
-#include "snprintf.c"
-#endif
-
#define NPREFIX 1024
#ifndef MAXFONTFILENAMELEN
@@ -63,6 +55,11 @@
#define MAXFONTNAMELEN 1024
#endif
+/* Two levels of macro calls are needed so that we stringify the value
+ of MAXFONT... and not the string "MAXFONT..." */
+#define QUOTE(x) #x
+#define STRINGIFY(x) QUOTE(x)
+
static char *encodings_array[] =
{ "ascii-0",
"iso8859-1", "iso8859-2", "iso8859-3", "iso8859-4", "iso8859-5",
@@ -682,11 +679,7 @@ readFontScale(HashTablePtr entries, char *dirname)
char *filename;
FILE *in;
int rc, count, i;
- char file[MAXFONTFILENAMELEN], font[MAXFONTNAMELEN];
- char format[100];
-
- snprintf(format, 100, "%%%ds %%%d[^\n]\n",
- MAXFONTFILENAMELEN, MAXFONTNAMELEN);
+ char file[MAXFONTFILENAMELEN+1], font[MAXFONTNAMELEN+1];
if(dirname[n - 1] == '/')
filename = dsprintf("%sfonts.scale", dirname);
@@ -711,7 +704,10 @@ readFontScale(HashTablePtr entries, char *dirname)
}
for(i = 0; i < count; i++) {
- rc = fscanf(in, format, file, font);
+ rc = fscanf(in,
+ "%" STRINGIFY(MAXFONTFILENAMELEN) "s "
+ "%" STRINGIFY(MAXFONTNAMELEN) "[^\n]\n",
+ file, font);
if(rc != 2)
break;
putHash(entries, font, file, 100);
@@ -982,6 +978,7 @@ doDirectory(char *dirname_given, int numEncodings, ListPtr encodingsToDo)
exit(1);
}
fprintf(encfile, "%d\n", numEncodings);
+ encodingsToDo = sortList(encodingsToDo);
for(lp = encodingsToDo; lp; lp = lp->next) {
fprintf(encfile, "%s\n", lp->value);
}