Changeset 7d7bf8f for examples


Ignore:
Timestamp:
Apr 23, 2016, 8:49:06 PM (9 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
dff2ded
Parents:
e22356e
Message:

examples/parse_args.h: check in config.h if getopt.h was found

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/parse_args.h

    re22356e r7d7bf8f  
    1818
    1919*/
     20
     21#include "config.h"
     22
     23#ifdef HAVE_GETOPT_H
     24#include <getopt.h>
     25#endif
    2026
    2127extern int verbose;
     
    6470void usage (FILE * stream, int exit_code)
    6571{
     72#ifdef HAVE_GETOPT_H
    6673  fprintf (stream, "usage: %s [ options ] \n", prog_name);
    6774  fprintf (stream,
     
    107114      "       -h      --help             display this message\n"
    108115      );
     116#else /* HAVE_GETOPT_H */
     117  fprintf (stream, "warning: compiled with getopt.h, no argument parsing\n");
     118  fprintf (stream, "usage: %s <filename> \n", prog_name);
     119#endif /* HAVE_GETOPT_H */
    109120  exit (exit_code);
    110121}
     
    113124parse_args (int argc, char **argv)
    114125{
     126#ifdef HAVE_GETOPT_H
    115127  const char *options = "hv"
    116128    "i:r:B:H:"
     
    158170    {NULL,                    0, NULL, 0}
    159171  };
     172#endif /* HAVE_GETOPT_H */
    160173  prog_name = argv[0];
    161174  if (argc < 1) {
     
    163176    return -1;
    164177  }
     178#ifdef HAVE_GETOPT_H
    165179  do {
    166180    next_option = getopt_long (argc, argv, options, long_options, NULL);
     
    236250  }
    237251  while (next_option != -1);
     252#endif /* HAVE_GETOPT_H */
    238253
    239254  // if unique, use the non option argument as the source
Note: See TracChangeset for help on using the changeset viewer.