Converted index() into strchr() which is no Linuxism anymore and also
[infodrom/dtaus] / dtaus.c
diff --git a/dtaus.c b/dtaus.c
index e19732d..e8f935e 100644 (file)
--- a/dtaus.c
+++ b/dtaus.c
@@ -148,7 +148,7 @@ dtaus_record recE[] = {
 
 size_t dtaus_nextrec (void **buf, FILE *f)
 {
 
 size_t dtaus_nextrec (void **buf, FILE *f)
 {
-  bzero (buf, 128);
+  memset (buf, 0, 128);
   return fread(buf, 128, 1, f);
 }
 
   return fread(buf, 128, 1, f);
 }
 
@@ -366,8 +366,8 @@ char *extract_ident (char *line)
   static char word[30];
 
   if (strlen(line) > 0) {
   static char word[30];
 
   if (strlen(line) > 0) {
-    x = index (line, ' ');
-    y = index (line, '\t');
+    x = strchr (line, ' ');
+    y = strchr (line, '\t');
 
     if (!x && !y) {
         strncpy(word, line, 29);
 
     if (!x && !y) {
         strncpy(word, line, 29);
@@ -440,8 +440,8 @@ size_t control_nextline (void **buf, int len, FILE *f)
   char *cp;
   int i;
 
   char *cp;
   int i;
 
-  bzero (line, sizeof(line));
-  bzero (buf, len);
+  memset (line, 0, sizeof(line));
+  memset (buf, 0, len);
   cp = line;
 
   while (!strlen(line) && (cp = fgets(line, 100, f))) {
   cp = line;
 
   while (!strlen(line) && (cp = fgets(line, 100, f))) {
@@ -494,7 +494,7 @@ void dtaus_prepareA (char *buf)
   struct tm *loctime;
   char tmp[10];
 
   struct tm *loctime;
   char tmp[10];
 
-  bzero (buf, 129);
+  memset (buf, 0, 129);
   timer = time ( NULL );
   loctime = localtime(&timer);
 
   timer = time ( NULL );
   loctime = localtime(&timer);
 
@@ -528,7 +528,7 @@ void dtaus_prepareC (char *buf, int normaltext, int maxtext)
   int i;
   int appendix = 0;
 
   int i;
   int appendix = 0;
 
-  bzero (buf, 257);
+  memset (buf, 0, 257);
 
   if (normaltext)
     appendix = 1;
 
   if (normaltext)
     appendix = 1;
@@ -576,7 +576,7 @@ void dtaus_prepareE (char *buf)
 {
   int i;
 
 {
   int i;
 
-  bzero (buf, 129);
+  memset (buf, 0, 129);
   buf[0] = '0';
   buf[1] = '1';
   buf[2] = '2';
   buf[0] = '0';
   buf[1] = '1';
   buf[2] = '2';
@@ -897,7 +897,7 @@ void dtaus2control (char *cdtaus, char *ccontrol)
        }
       }
       if (dtaus_nextrec(buf, fdtaus) != 1)
        }
       }
       if (dtaus_nextrec(buf, fdtaus) != 1)
-       bzero (buf, sizeof(buf));
+       memset (buf, 0, sizeof(buf));
 
       /*
        * Are there extension records that we have to check?
 
       /*
        * Are there extension records that we have to check?
@@ -916,7 +916,7 @@ void dtaus2control (char *cdtaus, char *ccontrol)
          }
        }
        if (dtaus_nextrec(buf, fdtaus) != 1)
          }
        }
        if (dtaus_nextrec(buf, fdtaus) != 1)
-         bzero (buf, sizeof(buf));
+         memset (buf, 0, sizeof(buf));
        extC--;
       }
       fprintf(fcontrol, "}\n");
        extC--;
       }
       fprintf(fcontrol, "}\n");
@@ -1021,7 +1021,7 @@ int control2dtaus (char *ccontrol, char *cdtaus, char *cbeleg, char *ccheck)
   /* 
    * Record A lesen
    */
   /* 
    * Record A lesen
    */
-  bzero(valA, sizeof(valA));
+  memset (valA, 0, sizeof(valA));
   control_nextline ((void *)line, 100, fcontrol);
   ident = extract_ident(line);
   if (!strcmp(ident, "begin") && (line[0] == '{')) {
   control_nextline ((void *)line, 100, fcontrol);
   ident = extract_ident(line);
   if (!strcmp(ident, "begin") && (line[0] == '{')) {
@@ -1102,7 +1102,7 @@ int control2dtaus (char *ccontrol, char *cdtaus, char *cbeleg, char *ccheck)
   sum_val = bigint_int(0);
   sum_blz = bigint_int(0);
   sum_kto = bigint_int(0);
   sum_val = bigint_int(0);
   sum_blz = bigint_int(0);
   sum_kto = bigint_int(0);
-  bzero(valC, sizeof(valC));
+  memset (valC, 0, sizeof(valC));
   control_nextline ((void *)line, 100, fcontrol);
   if (line[0] == '{') {
     while (strlen(line) && line[0] == '{') {
   control_nextline ((void *)line, 100, fcontrol);
   if (line[0] == '{') {
     while (strlen(line) && line[0] == '{') {
@@ -1158,7 +1158,7 @@ int control2dtaus (char *ccontrol, char *cdtaus, char *cbeleg, char *ccheck)
       for (recindex=0; recindex<C_LEN; recindex++)
        if (valC[recindex])
          free(valC[recindex]);
       for (recindex=0; recindex<C_LEN; recindex++)
        if (valC[recindex])
          free(valC[recindex]);
-      bzero(valC, sizeof(valC));
+      memset (valC, 0, sizeof(valC));
       control_nextline ((void *)line, 100, fcontrol);
     }
   } else {
       control_nextline ((void *)line, 100, fcontrol);
     }
   } else {