// ******************************************************************* // (C) Copyright 2013 Leiden Institute of Advanced Computer Science // Universiteit Leiden // All Rights Reserved // ******************************************************************* // Dou Shou Qi (interface) // ******************************************************************* // FILE INFORMATION: // File: options.h // Author: Jonathan K. Vis // Revision: 1.01a // Date: 2013/05/07 // ******************************************************************* // DESCRIPTION: // Parse options from the command line. // ******************************************************************* #if !defined(__options_h__) #define __options_h__ static char const PREFIX = '-'; static inline char const* get_option(int const argc, char const* const argv[], char const option) { for (int i = 1; i < argc; ++i) { if (argv[i][0] == PREFIX && argv[i][1] == option) { if (i + 1 < argc && argv[i + 1][0] != PREFIX) { return argv[i + 1]; } // if return argv[i] + 1; } // if } // for return 0; } // get_option #endif