From 474d2fb2c6edb63c113f72f890fe2f5f1fb7aa63 Mon Sep 17 00:00:00 2001 From: ceriel Date: Thu, 26 Feb 1987 17:58:55 +0000 Subject: [PATCH] Ported to System V --- emtest/select.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/emtest/select.c b/emtest/select.c index 9be038ada..3a785cb5b 100644 --- a/emtest/select.c +++ b/emtest/select.c @@ -46,6 +46,8 @@ char name1[] = "/usr/tmp/f1XXXXXX"; char name2[] = "/usr/tmp/f2XXXXXX"; char name3[] = "/usr/tmp/f3XXXXXX"; +char *to3dig(); + stop() { unlink(name1); unlink(name2); @@ -130,9 +132,10 @@ select() { } fprintf(file2, "; %s\n", line); if (fflag) { - fprintf(file1, ".%03d\n", i); - fprintf(file1, " con \"tst%03d\"\n", i); - fprintf(file2, " fil .%03d\n", i); + char *s = to3dig(i); + fprintf(file1, ".%s\n", s); + fprintf(file1, " con \"tst%s\"\n", s); + fprintf(file2, " fil .%s\n", s); } f = file1; while (getline()) { @@ -247,3 +250,16 @@ usage() { nerrors++; stop(); } + +char * +to3dig(i) + register int i; +{ + static char buf[4]; + register char *s = buf; + + *s++ = (i % 1000) / 100 + '0'; + *s++ = (i % 100) / 10 + '0'; + *s++ = (i % 10) + '0'; + *s = '\0'; +}