"SfR Fresh" - the SfR Freeware/Shareware Archive

Member "eas3pkg/eas3pkg/eas3/rl_getstr.c" of archive eas3pkg_v1.6.3.tar.gz:


As a special service "SfR Fresh" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
    1 /*-------------------------------------------------------------------------------------------------------*/
    2 /* EAS3 License                                                                                          */
    3 /*                                                                                                       */
    4 /* Copyright (c) 2006 Institut fuer Aerodynamik und Gasdynamik, Universitaet Stuttgart                   */
    5 /*                                                                                                       */
    6 /* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and     */
    7 /* associated documentation files (the "Software"), to deal in the Software without restriction,         */
    8 /* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, */
    9 /* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, */
   10 /* subject to the following conditions:                                                                  */
   11 /*                                                                                                       */
   12 /* The above copyright notice and this permission notice shall be included in all copies or substantial  */
   13 /* portions of the Software.										 */
   14 /*                                                                                                       */
   15 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT */
   16 /* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   */
   17 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER          */
   18 /* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */
   19 /* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                                       */
   20 /*-------------------------------------------------------------------------------------------------------*/
   21 /* **************************************************************** */
   22 /*								    */
   23 /* Readline Anbindung an Fortran                                    */
   24 /*								    */
   25 /* **************************************************************** */
   26 
   27 #ifdef READLINE_LIBRARY
   28 
   29 #include <stdio.h>
   30 #include <sys/types.h>
   31 
   32 #include "readline.h"
   33 #include "history.h"
   34 
   35 /* diese Definition muss immer mit EAS3 zusammenpassen */
   36 #define INPUTLINELENGTH 2048
   37 
   38 /* Anpassung an verschiedene Plattformen */
   39 
   40 #if defined(SX4EW8)
   41 
   42 #define RETURNVALUE long long
   43 
   44 #else
   45 
   46 #define RETURNVALUE int
   47 
   48 #endif
   49 
   50 
   51 #ifdef T3E
   52 
   53 #define C_RL_GETSTR C_RL_GETSTR
   54 
   55 #else
   56 
   57 #define C_RL_GETSTR c_rl_getstr_
   58 
   59 #endif
   60 
   61 
   62 /*===================================================================
   63 Command completion in EAS3, according to readline definition.
   64 ===================================================================*/
   65 
   66 char *command_generator __P((const char *, int));
   67 char *option_generator __P((const char *, int));
   68 char **eas3_completion __P((const char *, int, int));
   69 
   70 
   71 /*list of commands for readline ato complete*/
   72 char* commands[]= {
   73  "ABLEITEN," ,
   74  "ABS" ,
   75  "ATAN" ,
   76  "AUSFUEHREN" ,
   77  "CLIP," ,
   78  "CONVERT," ,
   79  "COVISE," ,
   80  "DRUCKEN," ,
   81  "ECHO," ,
   82  "EDITATTR," ,
   83  "ENDE" ,
   84  "EXP" ,
   85  "F2PT," ,
   86  "F2PZ," ,
   87  "FENSTER," ,
   88  "FILES,",
   89  "FMITTELUNG," ,
   90  "FT2PHYS," ,
   91  "FTINFO," ,
   92  "FTFTZHK2MODPH" ,
   93  "FTREAL2FTFTZHK," ,
   94  "FTREAL2MODPH," ,
   95  "FT_ADIM," ,
   96  "FT_CORRELATION," ,
   97  "FT_DREHE_S," ,
   98  "FT_DREHEFELD," ,
   99  "FT_LAMBDA2," ,
  100  "FT_SCALERE," ,
  101  "FT_SCALEGEO," ,
  102  "FT_VERKN_GRUND," ,
  103  "GCUT,",
  104  "GEOM," ,
  105  "GLOBALVARS" ,
  106  "INFILE," ,
  107  "INTEGRIEREN," ,
  108  "INTPOL," ,
  109  "INTERAKTIV," ,
  110  "KENNSATZ," ,
  111  "KOPIEREN," ,
  112  "KSSCHREIB," ,
  113  "LN," ,
  114  "LOG," ,
  115  "MITTELUNG," ,
  116  "MISCHEN," ,
  117  "NFILES," ,
  118  "OUTFILE," ,
  119  "P2FT," ,
  120  "PAR2D_PAR3D," ,
  121  "PAR3D_PAR2D" ,
  122  "PARAMETER," ,
  123  "PHASGLATT," ,
  124  "PHYS2FT," ,
  125  "POW10" ,
  126  "REDUCE," ,
  127  "SCALETRANS," ,
  128  "SCHREIBFORMAT," ,
  129  "SQR" ,
  130  "SQRT" ,
  131  "TECPLOT," ,
  132  "UMORDNEN," ,
  133  "VERKETTEN," ,
  134  "VERKNUEPFEN," ,
  135  "VOLUME" ,
  136  "WERTEBEREICH," ,
  137  "WINDOW," ,
  138  "ZEITINDEX," ,
  139  "ZEITSCHRITT," ,
  140  (char *)NULL
  141 };
  142 
  143 
  144 /*options: ein/aus*/
  145 char* optlist_EINAUS[]= {
  146  "EIN" ,
  147  "AUS" ,
  148  (char *)NULL
  149 };
  150 
  151 /*options for ableiten, part 1*/
  152 char* optlist_ABLEITEN1[]= {
  153  "D1_FT," ,
  154  "D2_FT," ,
  155  "D3_FT," ,
  156  "D4_FT," ,
  157  "D1_S_O4," ,
  158  "D2_S_O4," ,
  159  "D4_S_O4," ,
  160  (char *)NULL
  161 };
  162 
  163 /*options for ableiten, part 2*/
  164 char* optlist_ABLEITEN2[]= {
  165  "ZS" ,
  166  "PAR" ,
  167  "DIM1" ,
  168  "DIM2" ,
  169  "DIM3" ,
  170  (char *)NULL
  171 };
  172 
  173 /*options for convert, part 1*/
  174 char* optlist_CONVERT[]= {
  175  "EAS2" ,
  176  "EAS3" ,
  177  "TECPLTSV" ,
  178  "TECPLTMV" ,
  179  "TECPLTCRV" ,
  180  "ASCII2EAS" ,
  181  "COVISE" ,
  182  "EAS2ASCII" ,
  183  (char *)NULL
  184 };
  185 
  186 /*options for covise*/
  187 char* optlist_COVISE[]= {
  188  "nogrid" ,
  189  "vector" ,
  190  "DIM1," ,
  191  "DIM2," ,
  192  "DIM3," ,
  193  "nox0shift," ,
  194  "shift," ,
  195  (char *)NULL
  196 };
  197 
  198 /*options for covise (nox0shift)*/
  199 char* optlist_COVISE_nox0shift[]= {
  200  "DIM1" ,
  201  "DIM2" ,
  202  "DIM3" ,
  203  "ALL" ,
  204  (char *)NULL
  205 };
  206 
  207 /*options for covise (shift)*/
  208 char* optlist_COVISE_shift[]= {
  209  "DIM1," ,
  210  "DIM2," ,
  211  "DIM3," ,
  212  (char *)NULL
  213 };
  214 
  215 /*options for EDITATTR*/
  216 char* optlist_EDITATTR[]= {
  217  "ZS," ,
  218  "PAR," ,
  219  "DIM1," ,
  220  "DIM2," ,
  221  "DIM3," ,
  222  "UDEF," ,
  223  "END",
  224  (char *)NULL
  225 };
  226 
  227 /*options for F2PT part2*/
  228 char* optlist_F2PT_2[]= {
  229  "first" ,
  230  "last" ,
  231  (char *)NULL
  232 };
  233 
  234 /*options for F2PZ*/
  235 char* optlist_F2PZ[]= {
  236  "SITRA," ,
  237  "COTRA," ,
  238  "FUTRA," ,
  239  (char *)NULL
  240 };
  241 
  242 /*options for FMITTELUNG part 1*/
  243 char* optlist_FMITTELUNG_1[]= {
  244  "TAVG," ,
  245  "RMS," ,
  246  (char *)NULL
  247 };
  248 
  249 /*options for FMITTELUNG part 2*/
  250 char* optlist_FMITTELUNG_2[]= {
  251  "SITRA," ,
  252  "COTRA," ,
  253  (char *)NULL
  254 };
  255 
  256 /*options for FMITTELUNG part 3*/
  257 char* optlist_FMITTELUNG_3[]= {
  258  "K0," ,
  259  "NOK0," ,
  260  (char *)NULL
  261 };
  262 
  263 /*options for FT_DREHE_S*/
  264 char* optlist_FT_DREHE_S[]= {
  265  "X_S" ,
  266  "Z_S" ,
  267  (char *)NULL
  268 };
  269 
  270 /*options for FT_ADIM part 1*/
  271 char* optlist_FT_ADIM_1[]= {
  272  "ZS," ,
  273  "PAR," ,
  274  "DIM1," ,
  275  "DIM2," ,
  276  "DIM3," ,
  277  "ALLD_G," ,
  278  "DATA," ,
  279  "ALL," ,
  280  (char *)NULL
  281 };
  282 
  283 /*options for FT_ADIM part 2*/
  284 char* optlist_FT_ADIM_2[]= {
  285  "FT_ABS" ,
  286  "FT_REL" ,
  287  "ADIM" ,
  288  "DIM" ,
  289  "WALLCOOR" ,
  290  (char *)NULL
  291 };
  292 
  293 /*options for FT_CORRELATION*/
  294 char* optlist_FT_CORRELATION[]= {
  295  "DIM1" ,
  296  "DIM2" ,
  297  "DIM3" ,
  298  (char *)NULL
  299 };
  300 
  301 /*options for FTINFO part 1*/
  302 char* optlist_FTINFO_1[]= {
  303  "LAUFNAME," ,
  304  "VARNAME," ,
  305  "COORNAME_ZS," ,
  306  "COORNAME_PAR," ,
  307  "COORNAME_DIM1," ,
  308  "COORNAME_DIM2," ,
  309  "COORNAME_DIM3," ,
  310  "U_UNEND," ,
  311  "W_UNEND," ,
  312  "RE_NUM," ,
  313  "NU," ,
  314  "ALPHA_ZS," ,
  315  "ALPHA_PAR," ,
  316  "ALPHA_DIM1," ,
  317  "ALPHA_DIM2," ,
  318  "ALPHA_DIM3," ,
  319  "COORTYPE_ZS," ,
  320  "COORTYPE_PAR," ,
  321  "COORTYPE_DIM1," ,
  322  "COORTYPE_DIM2," ,
  323  "COORTYPE_DIM3," ,
  324  "FTSYM_ZS," ,
  325  "FTSYM_PAR," ,
  326  "FTSYM_DIM1," ,
  327  "FTSYM_DIM2," ,
  328  "FTSYM_DIM3," ,
  329  "FTRAUM_ZS," ,
  330  "FTRAUM_PAR," ,
  331  "FTRAUM_DIM1," ,
  332  "FTRAUM_DIM2" ,
  333  "FTRAUM_DIM3," ,
  334  "FTFORM," ,
  335  "FTKOEF," ,
  336  (char *)NULL
  337 };
  338 
  339 /*options for FTINFO part 2_1*/
  340 char* optlist_FTINFO_2_1[]= {
  341  "FT_ABS" ,
  342  "FT_REL" ,
  343  (char *)NULL
  344 };
  345 
  346 /*options for FTINFO part 2_2*/
  347 char* optlist_FTINFO_2_2[]= {
  348  "FT_SYM" ,
  349  "FT_ANTI" ,
  350  "FT_ASYM" ,
  351  (char *)NULL
  352 };
  353 
  354 /*options for FTINFO part 2_3*/
  355 char* optlist_FTINFO_2_3[]= {
  356  "FT_PHYS" ,
  357  "FT_FOUR" ,
  358  (char *)NULL
  359 };
  360 
  361 /*options for FTINFO part 2_4*/
  362 char* optlist_FTINFO_2_4[]= {
  363  "FT_REAL" ,
  364  (char *)NULL
  365 };
  366 
  367 /*options for FTINFO part 2_5*/
  368 char* optlist_FTINFO_2_5[]= {
  369  "FT_REIM" ,
  370  "FT_MODMATH" ,
  371  "FT_MODPHYS" ,
  372  "FT_PHASE" ,
  373  (char *)NULL
  374 };
  375 
  376 /*options for FT_SCALEGEO*/
  377 char* optlist_FT_SCALEGEO[]= {
  378  "ZS," ,
  379  "PAR," ,
  380  "DIM1," ,
  381  "DIM2," ,
  382  "DIM3," ,
  383  (char *)NULL
  384 };
  385 
  386 /*options for FT_SCALERE*/
  387 char* optlist_FT_SCALERE[]= {
  388  "1/RE" ,
  389  "RE" ,
  390  "SQRT(1/RE)" ,
  391  "SQRT(RE)" ,
  392  (char *)NULL
  393 };
  394 
  395 /*options for FT_VERKN_GRUND*/
  396 char* optlist_FT_VERKN_GRUND[]= {
  397  "ADD" ,
  398  "SUB" ,
  399  "DIV_Y_REF" ,
  400  (char *)NULL
  401 };
  402 
  403 /*options for FT2PHYS*/
  404 char* optlist_FT2PHYS[]= {
  405  "ZS," ,
  406  "PAR," ,
  407  (char *)NULL
  408 };
  409 
  410 /*options for FTREAL2MODPH*/
  411 char* optlist_FTREAL2MODPH[]= {
  412  "MODMATH" ,
  413  "MODPHYS" ,
  414  "PHASE" ,
  415  "REPART" ,
  416  "IMPART" ,
  417  (char *)NULL
  418 };
  419 
  420 /*options for GCUT part 1*/
  421 char* optlist_GCUT_1[]= {
  422  "ZS," ,
  423  "PAR," ,
  424  "DIM1," ,
  425  "DIM2," ,
  426  "DIM3," ,
  427  "END" ,
  428  (char *)NULL
  429 };
  430 
  431 /*options for GCUT part 2*/
  432 char* optlist_GCUT_2[]= {
  433  "TOP," ,
  434  "TAIL," ,
  435  "RANGE," ,
  436  (char *)NULL
  437 };
  438 
  439 /*options for GEOM part 1*/
  440 char* optlist_GEOM_1[]= {
  441  "SET," ,
  442  "SCTR," ,
  443  (char *)NULL
  444 };
  445 
  446 /*options for GEOM part 2*/
  447 char* optlist_GEOM_2[]= {
  448  "ZS," ,
  449  "PAR," ,
  450  "DIM1," ,
  451  "DIM2," ,
  452  "DIM3," ,
  453  (char *)NULL
  454 };
  455 
  456 /*options for INTEGRIEREN part 1*/
  457 char* optlist_INTEGRIEREN_1[]= {
  458  "DIM1," ,
  459  "DIM2," ,
  460  "DIM3," ,
  461  (char *)NULL
  462 };
  463 
  464 /*options for INTEGRIEREN part 3*/
  465 char* optlist_INTEGRIEREN_3[]= {
  466  "AUF," ,
  467  "AB," ,
  468  (char *)NULL
  469 };
  470 
  471 /*options for INTEGRIEREN part 4*/
  472 char* optlist_INTEGRIEREN_4[]= {
  473  "F" ,
  474  "D1" ,
  475  "D2" ,
  476  "D3" ,
  477  "D2_ABS" ,
  478  "D3_ABS" ,
  479  "B10" ,
  480  "BEXP" ,
  481  (char *)NULL
  482 };
  483 
  484 /*options for INTPOL part 1*/
  485 char* optlist_INTPOL_1[]= {
  486  "DIM1," ,
  487  "DIM2," ,
  488  "DIM3," ,
  489  "INGRID," ,
  490  "OUTGRID," ,
  491  (char *)NULL
  492 };
  493 
  494 /*options for INTPOL part 2*/
  495 char* optlist_INTPOL_2[]= {
  496  "O2" ,
  497  "O4" ,
  498  "O6" ,
  499  (char *)NULL
  500 };
  501 
  502 /*options for INTPOL INGRID*/
  503 char* optlist_INTPOL_INGRID[]= {
  504  "X0," ,
  505  "DX," ,
  506  "MIX," ,
  507  (char *)NULL
  508 };
  509 
  510 /*options for INTPOL OUTGRID*/
  511 char* optlist_INTPOL_OUTGRID[]= {
  512  "NPTS," ,
  513  "XMIN," ,
  514  "XMAX," ,
  515  "MIX," ,
  516  "FILE," ,
  517  (char *)NULL
  518 };
  519 
  520 /*options for INTPOL OUTGRID part 3*/
  521 char* optlist_INTPOL_OUTGRID_3[]= {
  522  "GEO," ,
  523  "DAT," ,
  524  (char *)NULL
  525 };
  526 
  527 /*options for INTPOL OUTGRID part 4*/
  528 char* optlist_INTPOL_OUTGRID_4[]= {
  529  "ZS" ,
  530  "PAR" ,
  531  "DIM1" ,
  532  "DIM2" ,
  533  "DIM3" ,
  534  (char *)NULL
  535 };
  536 
  537 /*options for KENNSATZ part 2*/
  538 char* optlist_KENNSATZ_2[]= {
  539  "KURZ" ,
  540  "ZS" ,
  541  "PAR" ,
  542  "DIM" ,
  543  "GEO" ,
  544  "UDEF" ,
  545  "MIX" ,
  546  "X0XE" ,
  547  (char *)NULL
  548 };
  549 
  550 /*options for MISCHEN*/
  551 char* optlist_MISCHEN[]= {
  552  "Z" ,
  553  "P" ,
  554  "X" ,
  555  "Y" ,
  556  (char *)NULL
  557 };
  558 
  559 /*options for MITTELUNG*/
  560 char* optlist_MITTELUNG[]= {
  561  "TAVG" ,
  562  "RMS" ,
  563  "PAVG," ,
  564  "SAVG" ,
  565  (char *)NULL
  566 };
  567 
  568 /*options for P2FT part 2*/
  569 char* optlist_P2FT_2[]= {
  570  "first," ,
  571  "last," ,
  572  (char *)NULL
  573 };
  574 
  575 /*options for P2FT part 3*/
  576 char* optlist_P2FT_3[]= {
  577  "nowin" ,
  578  "welch" ,
  579  "hanning" ,
  580  (char *)NULL
  581 };
  582 
  583 /*options for PHASGLATT part 1*/
  584 char* optlist_PHASGLATT_1[]= {
  585  "DIM1," ,
  586  "DIM2," ,
  587  "DIM3," ,
  588  (char *)NULL
  589 };
  590 
  591 /*options for PHYS2FT*/
  592 char* optlist_PHYS2FT[]= {
  593  "ZS," ,
  594  "PAR," ,
  595  "DIM1," ,
  596  "DIM2," ,
  597  "DIM3," ,
  598  (char *)NULL
  599 };
  600 
  601 /*options for REDUCE part 1*/
  602 char* optlist_REDUCE_1[]= {
  603  "ZS," ,
  604  "PAR," ,
  605  "DIM1," ,
  606  "DIM2," ,
  607  "DIM3," ,
  608  (char *)NULL
  609 };
  610 
  611 /*options for REDUCE part 2*/
  612 char* optlist_REDUCE_2[]= {
  613  "MAX" ,
  614  "MIN" ,
  615  "MAXABS" ,
  616  "MINABS" ,
  617  "MAXL10" ,
  618  "SUM" ,
  619  "SRMSFT" ,
  620  "MEANVAL" ,
  621  (char *)NULL
  622 };
  623 
  624 /*options for SCHREIBFORMAT*/
  625 char* optlist_SCHREIBFORMAT[]= {
  626  "IEEES" ,
  627  "IEEED" ,
  628  "IEEEQ" ,
  629  (char *)NULL
  630 };
  631 
  632 /*options for TECPLOT part 1*/
  633 char* optlist_TECPLOT_1[]= {
  634  "titel," ,
  635  "DIM1," ,
  636  "DIM2," ,
  637  "DIM3," ,
  638  "vars," ,
  639  "zones," ,
  640  "TECPLTCRV_USE_OFFSET" ,
  641  (char *)NULL
  642 };
  643 
  644 /*options for TECPLOT part 2*/
  645 char* optlist_TECPLOT_2[]= {
  646  "GEO" ,
  647  "ATTR" ,
  648  (char *)NULL
  649 };
  650 
  651 /*options for UMORDNEN part 1*/
  652 char* optlist_UMORDNEN_1[]= {
  653  "ZS," ,
  654  "PAR," ,
  655  "DIM1," ,
  656  "DIM2," ,
  657  "DIM3," ,
  658  (char *)NULL
  659 };
  660 
  661 /*options for UMORDNEN part 2*/
  662 char* optlist_UMORDNEN_2[]= {
  663  "ZS" ,
  664  "PAR" ,
  665  "DIM1" ,
  666  "DIM2" ,
  667  "DIM3" ,
  668  (char *)NULL
  669 };
  670 
  671 /*options for VERKETTEN*/
  672 char* optlist_VERKETTEN[]= {
  673  "ZS" ,
  674  "PAR" ,
  675  "DIM1" ,
  676  "DIM2" ,
  677  "DIM3" ,
  678  (char *)NULL
  679 };
  680 
  681 /*options for VERKNUEPFEN*/
  682 char* optlist_VERKNUEPFEN[]= {
  683  "ADD," ,
  684  "SUB," ,
  685  "MUL," ,
  686  "DIV," ,
  687  (char *)NULL
  688 };
  689 
  690 /*options for WINDOW part 1*/
  691 char* optlist_WINDOW_1[]= {
  692  "HANNING," ,
  693  "HANNING_SCALE," ,
  694  "WELCH," ,
  695  (char *)NULL
  696 };
  697 
  698 /*options for WINDOW part 2*/
  699 char* optlist_WINDOW_2[]= {
  700  "ZS" ,
  701  "PAR" ,
  702  "DIM1" ,
  703  "DIM2" ,
  704  "DIM3" ,
  705  (char *)NULL
  706 };
  707 
  708 
  709 
  710 
  711 /*initialization of readline improvements:
  712   --------------------------------------*/
  713 initialize_readline_ ()
  714 {
  715   /* Allow conditional parsing of the ~/.inputrc file. */
  716   rl_readline_name = "EAS3";
  717 
  718   /* Tell the completer that we want a crack first. */
  719   rl_attempted_completion_function = eas3_completion;
  720 }
  721 
  722 
  723 /*duplicate string:
  724   ---------------*/
  725   char * dupstr (s)
  726   char *s;
  727 {
  728   char *r;
  729   /*dopplet so gro�er Speicher allokiert, wegen IA64, besser mit sizeof(char) statt 2*/
  730   /*r = xmalloc (strlen(s) + 1);*/
  731   r = malloc (strlen (s) *2+ 2);
  732   if(r==NULL) return ((char*)NULL);
  733   strcpy (r, s);
  734   return (r);
  735 }
  736 
  737 /*global variables:
  738   ---------------*/
  739   static char command_match[128];
  740   static char option_one[128];
  741   static char option_two[128];
  742   static int start_global;
  743   static int option_count;
  744 
  745 
  746 /*Vervollstaendigung der EAS3 commandos:
  747   ------------------------------------*/
  748 char ** eas3_completion (text, start, end)
  749   const char *text;
  750   int start, end;
  751 {
  752   char **matches;
  753   int commandnumber;
  754   int i;
  755   int laenge_1;
  756   int laenge_2;
  757   matches = (char **)NULL;
  758   start_global = start;
  759   if (start == 0)
  760       {
  761       sprintf(option_one,"");
  762       sprintf(option_two,"");
  763       matches = rl_completion_matches (text, command_generator);
  764       option_count=0;
  765       if( (matches!=NULL) )
  766          {
  767 	 sprintf(command_match,"%s",matches[0]);
  768 	 }
  769       }
  770   else
  771       {
  772       matches = rl_completion_matches (text, option_generator);
  773       laenge_1=strlen(option_one);
  774       laenge_2=strlen(option_two);
  775       if( (matches!=NULL) )
  776 	 {
  777 	 /*determine option no 1*/
  778 	 if(laenge_1 == 0)
  779 	    {
  780 	    sprintf(option_one,"%s",matches[0]);
  781 	    }
  782 	 else if(option_one[laenge_1-1]!=',')
  783             {
  784 	    sprintf(option_one,"%s",matches[0]);
  785 	    }
  786 
  787 	 /*determine option no 2*/
  788 	 else if(laenge_2 == 0)
  789 	    {
  790 	    sprintf(option_two,"%s",matches[0]);
  791 	    }
  792 	 else if(option_two[laenge_2-1]!=',')
  793             {
  794 	     sprintf(option_two,"%s",matches[0]);
  795 	    }
  796 
  797 	 /*increase option counter*/
  798 	 if(matches[1]==NULL)
  799 	    {
  800 	    option_count=option_count+1;
  801 	    }
  802 	 }
  803       }
  804   return (matches);
  805 }
  806 
  807 
  808 /* Generator function for command completion.  STATE lets us
  809    know whether to start from scratch; without any state
  810    (i.e. STATE == 0), then we start at the top of the list.
  811   -----------------------------------------------*/
  812 char * command_generator (text, state)
  813   const char *text;
  814   int state;
  815 {
  816   static int list_index, len;
  817   char *name;
  818 
  819   /* If this is a new word to complete, initialize now.  This
  820      includes saving the length of TEXT for efficiency, and
  821      initializing the index variable to 0. */
  822   if (!state)
  823     {
  824       list_index = 0;
  825       len = strlen (text);
  826     }
  827 
  828   /* Return the next name which partially matches from the command list. */
  829   while (name = commands[list_index])
  830     {
  831       list_index++;
  832 
  833       if (strncasecmp (name, text, len) == 0)
  834         {
  835         return (dupstr(name));
  836 	}
  837     }
  838 
  839   /* If no names matched, then return NULL. */
  840   return ((char *)NULL);
  841 }
  842 
  843 /* Options generator:
  844    ----------------*/
  845 char * option_generator (text, state)
  846   const char *text;
  847   int state;
  848 {
  849   static int list_index, len;
  850   char *name;
  851   char **pointer;
  852 
  853   /*printf("start_global %i\n",start_global);*/
  854 
  855   /*ABLEITEN part 1:
  856     --------------*/
  857   if(!strcasecmp(command_match,"ABLEITEN,") && start_global == 10 )
  858      {
  859      pointer = optlist_ABLEITEN1;
  860      }
  861   /*ABLEITEN part 2:
  862     --------------*/
  863   else if(!strcasecmp(command_match,"ABLEITEN,") && option_count == 1 )
  864      {
  865      pointer = optlist_ABLEITEN2;
  866      }
  867   /*CONVERT:
  868     ------*/
  869   else if(!strcasecmp(command_match,"CONVERT,") && start_global ==9 )
  870      {
  871      pointer = optlist_CONVERT;
  872      }
  873   /*COVISE part 1:
  874     ------------*/
  875   else if(!strcasecmp(command_match,"COVISE,") && start_global ==8 )
  876      {
  877      pointer = optlist_COVISE;
  878      }
  879   /*COVISE part 2 (nox0shift):
  880     ------------------------*/
  881   else if(!strcasecmp(command_match,"COVISE,") && !strcasecmp(option_one,"nox0shift,") && option_count == 1 )
  882      {
  883      pointer = optlist_COVISE_nox0shift;
  884      }
  885   /*COVISE part 2 (shift):
  886     ------------------------*/
  887   else if(!strcasecmp(command_match,"COVISE,") && !strcasecmp(option_one,"shift,")  && option_count == 1 )
  888      {
  889      pointer = optlist_COVISE_shift;
  890      }
  891   /*COVISE part 3 (shift):
  892     ------------------------*/
  893   else if(!strcasecmp(command_match,"COVISE,") && !strcasecmp(option_one,"shift,")  && option_count == 2 )
  894      {
  895      option_count = 3;
  896      printf("\n stepsize dx (real number)\n");
  897      return ((char *)NULL);
  898      }
  899   /*COVISE part 2 (DIM1,DIM2,DIM3):
  900     -------------------*/
  901   else if(!strcasecmp(command_match,"COVISE,") && (!strcasecmp(option_one,"DIM1,")||!strcasecmp(option_one,"DIM2,")||!strcasecmp(option_one,"DIM3,"))  && option_count == 1 )
  902      {
  903      option_count = 2;
  904      printf("\n initial coordinate x0 (real number)\n");
  905      return ((char *)NULL);
  906      }
  907   /*COVISE part 3 (DIM1):
  908     -------------------*/
  909   else if(!strcasecmp(command_match,"COVISE,") && (!strcasecmp(option_one,"DIM1,")||!strcasecmp(option_one,"DIM2,")||!strcasecmp(option_one,"DIM3,"))  && option_count == 2 )
  910      {
  911      option_count = 3;
  912      printf("\n stepsize dx (real number)\n");
  913      return ((char *)NULL);
  914      }
  915   /*ECHO:
  916     ---*/
  917   else if(!strcasecmp(command_match,"ECHO,") && start_global ==6 )
  918      {
  919      pointer = optlist_EINAUS;
  920      }
  921   /*EDITATTR:
  922     -------*/
  923   else if(!strcasecmp(command_match,"EDITATTR,") && start_global ==10 )
  924      {
  925      pointer = optlist_EDITATTR;
  926      }
  927   /*F2PT part 1:
  928     -----------*/
  929   else if(!strcasecmp(command_match,"F2PT,") && start_global ==6)
  930      {
  931      option_count = 1;
  932      printf("\n number of timesteps per period\n");
  933      return ((char *)NULL);
  934      }
  935   /*F2PT part 2:
  936     -----------*/
  937   else if(!strcasecmp(command_match,"F2PT,") && option_count==1)
  938      {
  939      pointer = optlist_F2PT_2;
  940      }
  941   /*F2PZ part 1:
  942     ----------*/
  943   else if(!strcasecmp(command_match,"F2PZ,") && start_global ==6 )
  944      {
  945      pointer = optlist_F2PZ;
  946      }
  947   /*F2PZ part 2:
  948     ----------*/
  949   else if(!strcasecmp(command_match,"F2PZ,") && option_count==1)
  950      {
  951      option_count = 2;
  952      printf("\n points per two periods in z-direction\n");
  953      return ((char *)NULL);
  954      }
  955   /*F2PZ part 3:
  956     ----------*/
  957   else if(!strcasecmp(command_match,"F2PZ,") && option_count==2)
  958      {
  959      option_count = 3;
  960      printf("\n index intervals\n");
  961      return ((char *)NULL);
  962      }
  963   /*FENSTER:
  964     ------*/
  965   else if(!strcasecmp(command_match,"FENSTER,") && start_global ==9 )
  966      {
  967      printf("\n index interval, e.g. 1-*/1, 1-*/1, 1-*/1\n");
  968      return ((char *)NULL);
  969      }
  970   /*FILES:
  971     ----*/
  972   else if(!strcasecmp(command_match,"FILES,") && start_global ==7 )
  973      {
  974      printf("\n specify filenames, e.g. \"file1.eas\", \"file2.eas\"\n");
  975      return ((char *)NULL);
  976      }
  977   /*FMITTELUNG part 1:
  978     ----------------*/
  979   else if(!strcasecmp(command_match,"FMITTELUNG,") && start_global ==12 )
  980      {
  981      pointer = optlist_FMITTELUNG_1;
  982      }
  983   /*FMITTELUNG part 2:
  984     ----------------*/
  985   else if(!strcasecmp(command_match,"FMITTELUNG,") && start_global >12 && start_global <24 )
  986      {
  987      pointer = optlist_FMITTELUNG_2;
  988      }
  989   /*FMITTELUNG part 3:
  990     ----------------*/
  991   else if(!strcasecmp(command_match,"FMITTELUNG,") && option_count==2 )
  992      {
  993     if(!strcasecmp(option_two,"SITRA,"))
  994         {
  995 	pointer = optlist_FMITTELUNG_3;
  996 	}
  997      else
  998         {
  999         printf("\n zpts2per = points per two periods in z-direction\n");
 1000         option_count=3;
 1001 	return ((char *)NULL);
 1002         }
 1003      }
 1004   /*FMITTELUNG part 4:
 1005     ----------------*/
 1006   else if(!strcasecmp(command_match,"FMITTELUNG,") && option_count==3 )
 1007      {
 1008      if(!strcasecmp(option_two,"SITRA,"))
 1009         {
 1010 	printf("\n zpts2per = points per two periods in z-direction\n");
 1011         option_count=4;
 1012         return ((char *)NULL);
 1013 	}
 1014      else
 1015         {
 1016         printf("\n zrange   = index intervals\n");
 1017         option_count=4;
 1018         return ((char *)NULL);
 1019         }
 1020      }
 1021   /*FMITTELUNG part 5:
 1022     ----------------*/
 1023   else if(!strcasecmp(command_match,"FMITTELUNG,") && option_count==4 )
 1024      {
 1025      if(!strcasecmp(option_two,"SITRA,"))
 1026         {
 1027         printf("\n zrange   = index intervals\n");
 1028         option_count=5;
 1029 	}
 1030      return ((char *)NULL);
 1031      }
 1032   /*FT_DREHEFELD part 1:
 1033     ------------------*/
 1034   else if(!strcasecmp(command_match,"FT_DREHEFELD,") && start_global ==14 )
 1035      {
 1036      printf("\n reference point X0\n");
 1037      option_count=1;
 1038      return ((char *)NULL);
 1039      }
 1040   /*FT_DREHEFELD part 2:
 1041     ------------------*/
 1042   else if(!strcasecmp(command_match,"FT_DREHEFELD,") && option_count==1 )
 1043      {
 1044      printf("\n reference point Z0\n");
 1045      option_count=2;
 1046      return ((char *)NULL);
 1047      }
 1048   /*FT_DREHEFELD part 3:
 1049     ------------------*/
 1050   else if(!strcasecmp(command_match,"FT_DREHEFELD,") && option_count==2 )
 1051      {
 1052      printf("\n angle in degree\n");
 1053      option_count=3;
 1054      return ((char *)NULL);
 1055      }
 1056   /*FT_DREHEFELD part 4:
 1057     ------------------*/
 1058   else if(!strcasecmp(command_match,"FT_DREHEFELD,") && option_count==3 )
 1059      {
 1060      printf("\n x coordinate of last point XXLEN\n");
 1061      option_count=4;
 1062      return ((char *)NULL);
 1063      }
 1064   /*FT_DREHEFELD part 5:
 1065     ------------------*/
 1066   else if(!strcasecmp(command_match,"FT_DREHEFELD,") && option_count==4 )
 1067      {
 1068      printf("\n z coordinate of last point ZZLEN\n");
 1069      option_count=5;
 1070      return ((char *)NULL);
 1071      }
 1072   /*FT_DREHEFELD part 6:
 1073     ------------------*/
 1074   else if(!strcasecmp(command_match,"FT_DREHEFELD,") && option_count==5 )
 1075      {
 1