Changeset f350fc3 for owl.c


Ignore:
Timestamp:
Sep 14, 2009, 9:17:49 AM (12 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
4e4847c
Parents:
799f36c
git-author:
Nelson Elhage <nelhage@mit.edu> (09/13/09 20:18:06)
git-committer:
Nelson Elhage <nelhage@mit.edu> (09/14/09 09:17:49)
Message:
Add equivalent long options for all short options.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    r799f36c rf350fc3  
    99#include <stdio.h>
    1010#include <unistd.h>
     11#include <getopt.h>
    1112#include <stdlib.h>
    1213#include <string.h>
     
    4748/* TODO: free owl_options after init is done? */
    4849void owl_parse_options(int argc, char *argv[], owl_options *opts) /* noproto */ {
     50  static const struct option long_options[] = {
     51    { "no-subs",         0, 0, 'n' },
     52    { "config-file",     1, 0, 'c' },
     53    { "config-dir",      1, 0, 's' },
     54    { "tty",             1, 0, 't' },
     55    { "debug",           0, 0, 'd' },
     56    { "remove-debug",    0, 0, 'D' },
     57    { "version",         0, 0, 'v' },
     58    { "help",            0, 0, 'h' },
     59    { NULL, 0, NULL, 0}
     60  };
    4961  char c;
    5062
    51   while((c = getopt(argc, argv, "nc:t:s:dDvh")) != -1) {
     63  while((c = getopt_long(argc, argv, "nc:t:s:dDvh",
     64                         long_options, NULL)) != -1) {
    5265    switch(c) {
    5366    case 'n':
     
    650663  fprintf(stderr, "Barnowl version %s\n", OWL_VERSION_STRING);
    651664  fprintf(stderr, "Usage: barnowl [-n] [-d] [-D] [-v] [-h] [-c <configfile>] [-s <confdir>] [-t <ttyname>]\n");
    652   fprintf(stderr, "  -n      don't load zephyr subscriptions\n");
    653   fprintf(stderr, "  -d      enable debugging\n");
    654   fprintf(stderr, "  -D      enable debugging and delete previous debug file\n");
    655   fprintf(stderr, "  -v      print the Barnowl version number and exit\n");
    656   fprintf(stderr, "  -h      print this help message\n");
    657   fprintf(stderr, "  -c      specify an alternate config file\n");
    658   fprintf(stderr, "  -s      specify an alternate config dir (default ~/.owl)\n");
    659   fprintf(stderr, "  -t      set the tty name\n");
     665  fprintf(stderr, "  -n,--no-subs        don't load zephyr subscriptions\n");
     666  fprintf(stderr, "  -d,--debug          enable debugging\n");
     667  fprintf(stderr, "  -D,--remove-debug   enable debugging and delete previous debug file\n");
     668  fprintf(stderr, "  -v,--version        print the Barnowl version number and exit\n");
     669  fprintf(stderr, "  -h,--help           print this help message\n");
     670  fprintf(stderr, "  -c,--config-file    specify an alternate config file\n");
     671  fprintf(stderr, "  -s,--config-dir     specify an alternate config dir (default ~/.owl)\n");
     672  fprintf(stderr, "  -t,--tty            set the tty name\n");
    660673}
    661674
Note: See TracChangeset for help on using the changeset viewer.