Ported to System V

This commit is contained in:
ceriel 1987-02-26 17:58:55 +00:00
parent 45bae5569b
commit 474d2fb2c6

View file

@ -46,6 +46,8 @@ char name1[] = "/usr/tmp/f1XXXXXX";
char name2[] = "/usr/tmp/f2XXXXXX"; char name2[] = "/usr/tmp/f2XXXXXX";
char name3[] = "/usr/tmp/f3XXXXXX"; char name3[] = "/usr/tmp/f3XXXXXX";
char *to3dig();
stop() { stop() {
unlink(name1); unlink(name1);
unlink(name2); unlink(name2);
@ -130,9 +132,10 @@ select() {
} }
fprintf(file2, "; %s\n", line); fprintf(file2, "; %s\n", line);
if (fflag) { if (fflag) {
fprintf(file1, ".%03d\n", i); char *s = to3dig(i);
fprintf(file1, " con \"tst%03d\"\n", i); fprintf(file1, ".%s\n", s);
fprintf(file2, " fil .%03d\n", i); fprintf(file1, " con \"tst%s\"\n", s);
fprintf(file2, " fil .%s\n", s);
} }
f = file1; f = file1;
while (getline()) { while (getline()) {
@ -247,3 +250,16 @@ usage() {
nerrors++; nerrors++;
stop(); 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';
}