~ubuntu-branches/ubuntu/vivid/parted/vivid

« back to all changes in this revision

Viewing changes to lib/argmatch.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-07-21 10:23:16 UTC
  • mfrom: (7.2.32 sid)
  • Revision ID: package-import@ubuntu.com-20140721102316-jsyv3yzmbo8vlde5
Tags: 3.1-3
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* argmatch.c -- find a match for a string in an array
2
2
 
3
 
   Copyright (C) 1990, 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4
 
   2009, 2010 Free Software Foundation, Inc.
 
3
   Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2012 Free Software
 
4
   Foundation, Inc.
5
5
 
6
6
   This program is free software: you can redistribute it and/or modify
7
7
   it under the terms of the GNU General Public License as published by
77
77
   synonyms, i.e., for
78
78
     "yes", "yop" -> 0
79
79
     "no", "nope" -> 1
80
 
   "y" is a valid argument, for `0', and "n" for `1'.  */
 
80
   "y" is a valid argument, for 0, and "n" for 1.  */
81
81
 
82
82
ptrdiff_t
83
83
argmatch (const char *arg, const char *const *arglist,
150
150
 
151
151
  /* We try to put synonyms on the same line.  The assumption is that
152
152
     synonyms follow each other */
153
 
  fprintf (stderr, _("Valid arguments are:"));
 
153
  fputs (_("Valid arguments are:"), stderr);
154
154
  for (i = 0; arglist[i]; i++)
155
155
    if ((i == 0)
156
156
        || memcmp (last_val, vallist + valsize * i, valsize))
157
157
      {
158
 
        fprintf (stderr, "\n  - `%s'", arglist[i]);
 
158
        fprintf (stderr, "\n  - %s", quote (arglist[i]));
159
159
        last_val = vallist + valsize * i;
160
160
      }
161
161
    else
162
162
      {
163
 
        fprintf (stderr, ", `%s'", arglist[i]);
 
163
        fprintf (stderr, ", %s", quote (arglist[i]));
164
164
      }
165
165
  putc ('\n', stderr);
166
166
}
269
269
    backup_type = XARGMATCH (program_name, argv[1],
270
270
                             backup_args, backup_vals);
271
271
 
272
 
  printf ("The version control is `%s'\n",
 
272
  printf ("The version control is '%s'\n",
273
273
          ARGMATCH_TO_ARGUMENT (backup_type, backup_args, backup_vals));
274
274
 
275
275
  return 0;