File: snprintf

package info (click to toggle)
xtel 3.3.0-32
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,172 kB
  • sloc: ansic: 15,773; sh: 224; makefile: 29
file content (35 lines) | stat: -rw-r--r-- 944 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
diff --git a/Config.tmpl b/Config.tmpl
index d20da21..758aed8 100644
--- a/Config.tmpl
+++ b/Config.tmpl
@@ -55,3 +55,6 @@
 /* Ne pas dfinir pour utiliser mktemp() au lieu de mkstemp() */
 #define HAS_MKSTEMP
 
+/* Pour viter les dpassements de capacit des buffers si l'OS le permet */
+#define HAS_SNPRINTF
+
diff --git a/imprime.c b/imprime.c
index 59e6bc1..59a2ff1 100644
--- a/imprime.c
+++ b/imprime.c
@@ -52,11 +52,19 @@ int mode;
     else {
 	if (mode == VIDEOTEX) {
 	    videotexDumpScreen (ecran_minitel, fp);
+#ifdef HAS_SNPRINTF
+	    snprintf (cmd, sizeof(cmd), rsc_xtel.commandeImpression, n);
+#else
 	    sprintf (cmd, rsc_xtel.commandeImpression, n);
+#endif
 	}
 	else { /* ASCII */
 	    videotexConversionAscii (ecran_minitel, fp);
+#ifdef HAS_SNPRINTF
+	    snprintf (cmd, sizeof(cmd), rsc_xtel.commandeImpressionAscii, n);
+#else
 	    sprintf (cmd, rsc_xtel.commandeImpressionAscii, n);
+#endif
 	}
 
 	fclose (fp);