dos33fsprogs/basic/appleiibot/make_boxes.c

37 lines
571 B
C
Raw Normal View History

2020-10-16 20:53:20 +00:00
#include <stdio.h>
2021-05-25 20:24:29 +00:00
#include <stdlib.h>
2020-10-16 20:53:20 +00:00
int main(int argc, char **argv) {
char buffer[1024];
char *ptr;
int color,x1,x2,y1,y2;
char output[1024];
int out_ptr=0;
2021-05-25 20:24:29 +00:00
int add=' ';
if (argc>1) {
add=atoi(argv[1]);
}
2020-10-16 20:53:20 +00:00
while(1) {
ptr=fgets(buffer,1024,stdin);
if (ptr==NULL) break;
sscanf(buffer,"%d %d %d %d %d",
&color,&x1,&x2,&y1,&y2);
2021-05-25 20:24:29 +00:00
output[out_ptr]=color+add;
output[out_ptr+1]=x1+add;
output[out_ptr+2]=x2+add;
output[out_ptr+3]=y1+add;
output[out_ptr+4]=y2+add;
2020-10-16 20:53:20 +00:00
out_ptr+=5;
}
output[out_ptr]=0;
printf("%s\n",output);
return 0;
}