aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/eco.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-16 16:47:29 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-16 16:47:29 +0100
commit264e027baf9ed811215e234a2d3357cd50f005dc (patch)
tree7f5d0e0645ec9d464eb39a1094ca61fb32c6578c /FICS/eco.c
parent27389b683a200493f54a1c01eb89a2522acc779b (diff)
Reformatted LONG_init()
Diffstat (limited to 'FICS/eco.c')
-rw-r--r--FICS/eco.c89
1 files changed, 52 insertions, 37 deletions
diff --git a/FICS/eco.c b/FICS/eco.c
index b17afd9..ef35f46 100644
--- a/FICS/eco.c
+++ b/FICS/eco.c
@@ -228,44 +228,59 @@ void NIC_init()
NIC_entries = i;
}
-void LONG_init()
+void
+LONG_init()
{
- FILE *fp;
- char tmp[1024];
- char *ptmp= tmp;
- char FENpos[73], LONG[256], onMove[2];
- char filename[1024];
- int i=0;
-
- sprintf(filename, "%s/long999.idx", book_dir);
- fp= fopen(filename, "r");
- if (!fp) {
- fprintf(stderr, "Could not open LONG file\n");
- exit(1);
- }
- while (!feof(fp)) {
- strcpy(ptmp, "");
- fgets(ptmp, 1024, fp);
- if (feof(fp)) continue;
- sscanf(ptmp, "%[\x21-z] %s", FENpos, onMove);
- sprintf(FENpos, "%s %s", FENpos, onMove);
- strcpy(ptmp, "");
- fgets(ptmp, 1024, fp);
- if (feof(fp)) continue;
- sscanf(ptmp, "%[^*\n]", LONG);
- LONG_book[i]= (LONG_entry *) malloc(sizeof(LONG_entry));
- if (LONG_book[i]==NULL) {
- fprintf(stderr, "Cound not alloc mem for LONG entry %d.\n", i);
- exit(1);
- }
- strcpy(LONG_book[i]->LONG, LONG);
- strcpy(LONG_book[i]->FENpos, FENpos);
- ++i;
- }
- fclose(fp);
- LONG_book[i]=NULL;
- fprintf(stderr, "%d entries in LONG book\n", i);
- LONG_entries = i;
+ FILE *fp;
+ char FENpos[73];
+ char LONG[256];
+ char filename[1024];
+ char onMove[2];
+ char tmp[1024];
+ char *ptmp = tmp;
+ int i = 0;
+
+ sprintf(filename, "%s/long999.idx", book_dir);
+
+ if ((fp = fopen(filename, "r")) == NULL) {
+ fprintf(stderr, "Could not open LONG file\n");
+ exit(1);
+ }
+
+ while (!feof(fp)) {
+ strcpy(ptmp, "");
+ fgets(ptmp, 1024, fp);
+
+ if (feof(fp))
+ continue;
+
+ sscanf(ptmp, "%[\x21-z] %s", FENpos, onMove);
+ sprintf(FENpos, "%s %s", FENpos, onMove);
+
+ strcpy(ptmp, "");
+ fgets(ptmp, 1024, fp);
+ if (feof(fp))
+ continue;
+ sscanf(ptmp, "%[^*\n]", LONG);
+
+ LONG_book[i] = malloc(sizeof(LONG_entry));
+ if (LONG_book[i] == NULL) {
+ fprintf(stderr, "Cound not alloc mem for "
+ "LONG entry %d.\n", i);
+ exit(1);
+ }
+
+ strcpy(LONG_book[i]->LONG, LONG);
+ strcpy(LONG_book[i]->FENpos, FENpos);
+
+ ++i;
+ }
+
+ fclose(fp);
+ LONG_book[i] = NULL;
+
+ fprintf(stderr, "%d entries in LONG book\n", i);
+ LONG_entries = i;
}
void BookInit()