/*******************************************

  Auslesen der Umgebungsvariable SASCOPTS
  und Umwandlung in SASCOPTSTRING

*******************************************/

#include <stdio.h>

void main()
{
  FILE *inp, *outp;
  char s[256] = " ";
  char option[21];
  
  inp = fopen("env:sascopts","r");
  if (!inp)
  {
    printf("Kann Umgebungsvariable \"SASCOPTS\" nicht lesen!\n");
    exit(10);
  }
  
  while (!feof(inp))
  {
    fgets(option,20,inp);
    if (strlen(option) > 1)
    {
      option[strlen(option)-1] = '\0';
      strcat(s,option);
      strcat(s," ");
    }
  }
  
  if (!strchr(s,'L')) strcat(s,"-L ");
  fclose(inp);
  
  outp = fopen("env:sascoptstring","w");
  if (!outp)
  {
    printf("Kann Umgebungsvariable \"SASCOPTSTRING\" nicht schreiben!\n");
    exit(10);
  }
  
  fputs(s,outp);
  fclose(outp);
}
 
