comparison src/eval.c @ 6225:8f92cf89ed7c

(error): Use doprnt. Make buffer larger as necessary.
author Richard M. Stallman <rms@gnu.org>
date Sun, 06 Mar 1994 20:39:52 +0000
parents ddf57829cf03
children 6a16a95e7ad9
comparison
equal deleted inserted replaced
6224:a27c028e757a 6225:8f92cf89ed7c
1300 1300
1301 /* VARARGS 1 */ 1301 /* VARARGS 1 */
1302 void 1302 void
1303 error (m, a1, a2, a3) 1303 error (m, a1, a2, a3)
1304 char *m; 1304 char *m;
1305 char *a1, *a2, *a3;
1305 { 1306 {
1306 char buf[200]; 1307 char buf[200];
1307 sprintf (buf, m, a1, a2, a3); 1308 int size = 200;
1309 int mlen;
1310 char *buffer = buf;
1311 char *args[3];
1312 int allocated = 0;
1313 Lisp_Object string;
1314
1315 args[0] = a1;
1316 args[1] = a2;
1317 args[2] = a3;
1318
1319 mlen = strlen (m);
1308 1320
1309 while (1) 1321 while (1)
1310 Fsignal (Qerror, Fcons (build_string (buf), Qnil)); 1322 {
1323 int used = doprnt (buf, size, m, m + mlen, 3, args);
1324 if (used < size)
1325 break;
1326 size *= 2;
1327 if (allocated)
1328 buffer = (char *) xrealloc (buffer, size);
1329 buffer = (char *) xmalloc (size);
1330 }
1331
1332 string = build_string (buf);
1333 if (allocated)
1334 free (buffer);
1335
1336 Fsignal (Qerror, Fcons (string, Qnil));
1311 } 1337 }
1312 1338
1313 DEFUN ("commandp", Fcommandp, Scommandp, 1, 1, 0, 1339 DEFUN ("commandp", Fcommandp, Scommandp, 1, 1, 0,
1314 "T if FUNCTION makes provisions for interactive calling.\n\ 1340 "T if FUNCTION makes provisions for interactive calling.\n\
1315 This means it contains a description for how to read arguments to give it.\n\ 1341 This means it contains a description for how to read arguments to give it.\n\