ccutil/getopt.h File Reference

#include "host.h"
#include "notdll.h"

Go to the source code of this file.

Functions

Variables


Function Documentation

int getopt ( INT32  argc,
char *  argv[],
const char *  arglist 
)

Parse command line args

Definition at line 34 of file getopt.cpp.

References NULL, optarg, and optind.

Referenced by ParseArguments().

00038   {
00039   char *arg;                     //arg char
00040 
00041   if (optind == 0)
00042     optind = 1;
00043   if (optind < argc && argv[optind][0] == '-') {
00044     arg = strchr (arglist, argv[optind][1]);
00045     if (arg == NULL || *arg == ':')
00046       return '?';                //dud option
00047     optind++;
00048     optarg = argv[optind];
00049     if (arg[1] == ':') {
00050       if (argv[optind - 1][2] != '\0')
00051                                  //immediately after
00052         optarg = argv[optind - 1] + 2;
00053       else
00054         optind++;
00055     }
00056     return *arg;
00057   }
00058   else
00059     return EOF;
00060 }


Variable Documentation

char* optarg

Definition at line 27 of file getopt.cpp.

int optind

Note:
File: getopt.cpp
Re-implementation of the unix code.
Author:
Ray Smith
Date:
Tue Nov 28 05:52:50 MST 1995
 * (C) Copyright 1995, Hewlett-Packard Co.
 ** Licensed under the Apache License, Version 2.0 (the "License");
 ** you may not use this file except in compliance with the License.
 ** You may obtain a copy of the License at
 ** http://www.apache.org/licenses/LICENSE-2.0
 ** Unless required by applicable law or agreed to in writing, software
 ** distributed under the License is distributed on an "AS IS" BASIS,
 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 ** See the License for the specific language governing permissions and
 ** limitations under the License.

Definition at line 26 of file getopt.cpp.


Generated on Wed Feb 28 19:49:16 2007 for Tesseract by  doxygen 1.5.1