1a35a7e76SEric Melville.\" $NetBSD: getopt_long.3,v 1.8 2002/06/03 12:01:43 wiz Exp $ 2a35a7e76SEric Melville.\" 3a35a7e76SEric Melville.\" Copyright (c) 1988, 1991, 1993 4a35a7e76SEric Melville.\" The Regents of the University of California. All rights reserved. 5a35a7e76SEric Melville.\" 6a35a7e76SEric Melville.\" Redistribution and use in source and binary forms, with or without 7a35a7e76SEric Melville.\" modification, are permitted provided that the following conditions 8a35a7e76SEric Melville.\" are met: 9a35a7e76SEric Melville.\" 1. Redistributions of source code must retain the above copyright 10a35a7e76SEric Melville.\" notice, this list of conditions and the following disclaimer. 11a35a7e76SEric Melville.\" 2. Redistributions in binary form must reproduce the above copyright 12a35a7e76SEric Melville.\" notice, this list of conditions and the following disclaimer in the 13a35a7e76SEric Melville.\" documentation and/or other materials provided with the distribution. 14a35a7e76SEric Melville.\" 3. All advertising materials mentioning features or use of this software 15a35a7e76SEric Melville.\" must display the following acknowledgement: 16a35a7e76SEric Melville.\" This product includes software developed by the University of 17a35a7e76SEric Melville.\" California, Berkeley and its contributors. 18a35a7e76SEric Melville.\" 4. Neither the name of the University nor the names of its contributors 19a35a7e76SEric Melville.\" may be used to endorse or promote products derived from this software 20a35a7e76SEric Melville.\" without specific prior written permission. 21a35a7e76SEric Melville.\" 22a35a7e76SEric Melville.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23a35a7e76SEric Melville.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24a35a7e76SEric Melville.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25a35a7e76SEric Melville.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26a35a7e76SEric Melville.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27a35a7e76SEric Melville.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28a35a7e76SEric Melville.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29a35a7e76SEric Melville.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30a35a7e76SEric Melville.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31a35a7e76SEric Melville.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32a35a7e76SEric Melville.\" SUCH DAMAGE. 33a35a7e76SEric Melville.\" 34a35a7e76SEric Melville.\" @(#)getopt.3 8.5 (Berkeley) 4/27/95 35*187f61dfSRuslan Ermilov.\" $FreeBSD$ 36a35a7e76SEric Melville.\" 37a35a7e76SEric Melville.Dd April 1, 2000 38a35a7e76SEric Melville.Dt GETOPT_LONG 3 39a35a7e76SEric Melville.Os 40a35a7e76SEric Melville.Sh NAME 41a35a7e76SEric Melville.Nm getopt_long 42a35a7e76SEric Melville.Nd get long options from command line argument list 43a35a7e76SEric Melville.Sh LIBRARY 44a35a7e76SEric Melville.Lb libc 45a35a7e76SEric Melville.Sh SYNOPSIS 46*187f61dfSRuslan Ermilov.In getopt.h 47a35a7e76SEric Melville.Ft int 48*187f61dfSRuslan Ermilov.Fo getopt_long 49*187f61dfSRuslan Ermilov.Fa "int argc" "char * const *argv" "const char *optstring" 50*187f61dfSRuslan Ermilov.Fa "struct option *long options" "int *index" 51*187f61dfSRuslan Ermilov.Fc 52a35a7e76SEric Melville.Sh DESCRIPTION 53a35a7e76SEric MelvilleThe 54a35a7e76SEric Melville.Fn getopt_long 55a35a7e76SEric Melvillefunction is similar to 56a35a7e76SEric Melville.Xr getopt 3 57*187f61dfSRuslan Ermilovbut it accepts options in two forms: words and characters. 58*187f61dfSRuslan ErmilovThe 59a35a7e76SEric Melville.Fn getopt_long 60*187f61dfSRuslan Ermilovfunction provides a superset of the functionality of 61a35a7e76SEric Melville.Xr getopt 3 . 62a35a7e76SEric Melville.Fn getopt_long 63*187f61dfSRuslan Ermilovcan be used in two ways. 64*187f61dfSRuslan ErmilovIn the first way, every long option understood 65a35a7e76SEric Melvilleby the program has a corresponding short option, and the option 66a35a7e76SEric Melvillestructure is only used to translate from long options to short 67*187f61dfSRuslan Ermilovoptions. 68*187f61dfSRuslan ErmilovWhen used in this fashion, 69a35a7e76SEric Melville.Fn getopt_long 70a35a7e76SEric Melvillebehaves identically to 71a35a7e76SEric Melville.Xr getopt 3 . 72a35a7e76SEric MelvilleThis is a good way to add long option processing to an existing program 73a35a7e76SEric Melvillewith the minimum of rewriting. 74a35a7e76SEric Melville.Pp 75a35a7e76SEric MelvilleIn the second mechanism, a long option sets a flag in the 76*187f61dfSRuslan Ermilov.Vt option 77a35a7e76SEric Melvillestructure passed, or will store a pointer to the command line argument 78a35a7e76SEric Melvillein the 79*187f61dfSRuslan Ermilov.Vt option 80*187f61dfSRuslan Ermilovstructure passed to it for options that take arguments. 81*187f61dfSRuslan ErmilovAdditionally, 82a35a7e76SEric Melvillethe long option's argument may be specified as a single argument with 83*187f61dfSRuslan Ermilovan equal sign, e.g., 84a35a7e76SEric Melville.Pp 85*187f61dfSRuslan Ermilov.Dl "myprogram --myoption=somevalue" 86*187f61dfSRuslan Ermilov.Pp 87*187f61dfSRuslan ErmilovWhen a long option is processed, the call to 88a35a7e76SEric Melville.Fn getopt_long 89*187f61dfSRuslan Ermilovwill return 0. 90*187f61dfSRuslan ErmilovFor this reason, long option processing without 91a35a7e76SEric Melvilleshortcuts is not backwards compatible with 92a35a7e76SEric Melville.Xr getopt 3 . 93a35a7e76SEric Melville.Pp 94a35a7e76SEric MelvilleIt is possible to combine these methods, providing for long options 95*187f61dfSRuslan Ermilovprocessing with short option equivalents for some options. 96*187f61dfSRuslan ErmilovLess 97a35a7e76SEric Melvillefrequently used options would be processed as long options only. 98a35a7e76SEric Melville.Pp 99a35a7e76SEric MelvilleThe 100a35a7e76SEric Melville.Fn getopt_long 101a35a7e76SEric Melvillecall requires a structure to be initialized describing the long 102*187f61dfSRuslan Ermilovoptions. 103*187f61dfSRuslan ErmilovThe structure is: 104*187f61dfSRuslan Ermilov.Bd -literal -offset indent 105a35a7e76SEric Melvillestruct option { 106a35a7e76SEric Melville char *name; 107a35a7e76SEric Melville int has_arg; 108a35a7e76SEric Melville int *flag; 109a35a7e76SEric Melville int val; 110a35a7e76SEric Melville}; 111a35a7e76SEric Melville.Ed 112a35a7e76SEric Melville.Pp 113a35a7e76SEric MelvilleThe 114*187f61dfSRuslan Ermilov.Va name 115a35a7e76SEric Melvillefield should contain the option name without the leading double dash. 116a35a7e76SEric Melville.Pp 117a35a7e76SEric MelvilleThe 118*187f61dfSRuslan Ermilov.Va has_arg 119a35a7e76SEric Melvillefield should be one of: 120*187f61dfSRuslan Ermilov.Pp 121*187f61dfSRuslan Ermilov.Bl -tag -width ".Dv optional_argument" -offset indent -compact 122*187f61dfSRuslan Ermilov.It Dv no_argument 123*187f61dfSRuslan Ermilovno argument to the option is expect 124*187f61dfSRuslan Ermilov.It Dv required_argument 125*187f61dfSRuslan Ermilovan argument to the option is required 126a35a7e76SEric Melville.It Li optional_argument 127a35a7e76SEric Melvillean argument to the option may be presented. 128a35a7e76SEric Melville.El 129a35a7e76SEric Melville.Pp 130a35a7e76SEric MelvilleIf 131*187f61dfSRuslan Ermilov.Va flag 132*187f61dfSRuslan Ermilovis not 133*187f61dfSRuslan Ermilov.Dv NULL , 134*187f61dfSRuslan Ermilovthen the integer pointed to by it will be set to the 135a35a7e76SEric Melvillevalue in the 136*187f61dfSRuslan Ermilov.Va val 137*187f61dfSRuslan Ermilovfield. 138*187f61dfSRuslan ErmilovIf the 139*187f61dfSRuslan Ermilov.Va flag 140*187f61dfSRuslan Ermilovfield is 141*187f61dfSRuslan Ermilov.Dv NULL , 142*187f61dfSRuslan Ermilovthen the 143*187f61dfSRuslan Ermilov.Va val 144*187f61dfSRuslan Ermilovfield will be returned. 145*187f61dfSRuslan ErmilovSetting 146*187f61dfSRuslan Ermilov.Va flag 147*187f61dfSRuslan Ermilovto 148*187f61dfSRuslan Ermilov.Dv NULL 149*187f61dfSRuslan Ermilovand setting 150*187f61dfSRuslan Ermilov.Va val 151a35a7e76SEric Melvilleto the corresponding short option will make this function act just 152a35a7e76SEric Melvillelike 153a35a7e76SEric Melville.Xr getopt 3 . 154a35a7e76SEric Melville.Sh EXAMPLES 155a35a7e76SEric Melville.Bd -literal -compact 156a35a7e76SEric Melvilleextern char *optarg; 157a35a7e76SEric Melvilleextern int optind; 158a35a7e76SEric Melvilleint bflag, ch, fd; 159a35a7e76SEric Melvilleint daggerset; 160a35a7e76SEric Melville 161a35a7e76SEric Melville/* options descriptor */ 162a35a7e76SEric Melvillestatic struct option longopts[] = { 163a35a7e76SEric Melville { "buffy", no_argument, 0, 'b' }, 164a35a7e76SEric Melville { "floride", required_argument, 0, 'f' }, 165a35a7e76SEric Melville { "daggerset", no_argument, \*[Am]daggerset, 1 }, 166a35a7e76SEric Melville { 0, 0, 0, 0 } 167a35a7e76SEric Melville}; 168a35a7e76SEric Melville 169a35a7e76SEric Melvillebflag = 0; 170a35a7e76SEric Melvillewhile ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1) 171a35a7e76SEric Melville switch(ch) { 172a35a7e76SEric Melville case 'b': 173a35a7e76SEric Melville bflag = 1; 174a35a7e76SEric Melville break; 175a35a7e76SEric Melville case 'f': 176a35a7e76SEric Melville if ((fd = open(optarg, O_RDONLY, 0)) \*[Lt] 0) { 177a35a7e76SEric Melville (void)fprintf(stderr, 178a35a7e76SEric Melville "myname: %s: %s\en", optarg, strerror(errno)); 179a35a7e76SEric Melville exit(1); 180a35a7e76SEric Melville } 181a35a7e76SEric Melville break; 182a35a7e76SEric Melville case 0: 183a35a7e76SEric Melville if(daggerset) { 184a35a7e76SEric Melville fprintf(stderr,"Buffy will use her dagger to " 185a35a7e76SEric Melville "apply floride to dracula's teeth\en"); 186a35a7e76SEric Melville } 187a35a7e76SEric Melville break; 188a35a7e76SEric Melville case '?': 189a35a7e76SEric Melville default: 190a35a7e76SEric Melville usage(); 191a35a7e76SEric Melville} 192a35a7e76SEric Melvilleargc -= optind; 193a35a7e76SEric Melvilleargv += optind; 194a35a7e76SEric Melville.Ed 195a35a7e76SEric Melville.Sh IMPLEMENTATION DIFFERENCES 196*187f61dfSRuslan ErmilovThis section describes differences to the 197*187f61dfSRuslan Ermilov.Tn GNU 198*187f61dfSRuslan Ermilovimplementation 199a35a7e76SEric Melvillefound in glibc-2.1.3: 200*187f61dfSRuslan Ermilov.Bl -bullet 201*187f61dfSRuslan Ermilov.It 202*187f61dfSRuslan ErmilovHandling of 203*187f61dfSRuslan Ermilov.Ql - 204*187f61dfSRuslan Ermilovas first char of option string in presence of 205*187f61dfSRuslan Ermilovenvironment variable 206*187f61dfSRuslan Ermilov.Ev POSIXLY_CORRECT : 207*187f61dfSRuslan Ermilov.Bl -tag -width ".Nx" 208*187f61dfSRuslan Ermilov.It Tn GNU 209*187f61dfSRuslan Ermilovignores 210*187f61dfSRuslan Ermilov.Ev POSIXLY_CORRECT 211*187f61dfSRuslan Ermilovand returns non-options as 212a35a7e76SEric Melvillearguments to option '\e1'. 213*187f61dfSRuslan Ermilov.It Nx 214*187f61dfSRuslan Ermilovhonors 215*187f61dfSRuslan Ermilov.Ev POSIXLY_CORRECT 216*187f61dfSRuslan Ermilovand stops at the first non-option. 217a35a7e76SEric Melville.El 218*187f61dfSRuslan Ermilov.It 219*187f61dfSRuslan ErmilovHandling of 220*187f61dfSRuslan Ermilov.Ql :: 221*187f61dfSRuslan Ermilovin options string in presence of 222*187f61dfSRuslan Ermilov.Ev POSIXLY_CORRECT : 223*187f61dfSRuslan Ermilov.Bl -tag -width ".Nx" 224*187f61dfSRuslan Ermilov.It Both 225*187f61dfSRuslan Ermilov.Tn GNU 226*187f61dfSRuslan Ermilovand 227*187f61dfSRuslan Ermilov.Nx 228*187f61dfSRuslan Ermilovignore 229*187f61dfSRuslan Ermilov.Ev POSIXLY_CORRECT 230*187f61dfSRuslan Ermilovhere and take 231*187f61dfSRuslan Ermilov.Ql :: 232*187f61dfSRuslan Ermilovto 233a35a7e76SEric Melvillemean the preceding option takes an optional argument. 234a35a7e76SEric Melville.El 235*187f61dfSRuslan Ermilov.It 236*187f61dfSRuslan ErmilovReturn value in case of missing argument if first character 237*187f61dfSRuslan Ermilov(after 238*187f61dfSRuslan Ermilov.Ql + 239*187f61dfSRuslan Ermilovor 240*187f61dfSRuslan Ermilov.Ql - ) 241*187f61dfSRuslan Ermilovin option string is not 242*187f61dfSRuslan Ermilov.Ql \&: : 243*187f61dfSRuslan Ermilov.Bl -tag -width ".Nx" 244*187f61dfSRuslan Ermilov.It Tn GNU 245*187f61dfSRuslan Ermilovreturns 246*187f61dfSRuslan Ermilov.Ql \&? 247*187f61dfSRuslan Ermilov.It Nx 248*187f61dfSRuslan Ermilovreturns 249*187f61dfSRuslan Ermilov.Ql \&: 250*187f61dfSRuslan Ermilov(since 251*187f61dfSRuslan Ermilov.Nx Ns 's 252*187f61dfSRuslan Ermilov.Fn getopt 253*187f61dfSRuslan Ermilovdoes). 254a35a7e76SEric Melville.El 255*187f61dfSRuslan Ermilov.It 256*187f61dfSRuslan ErmilovHandling of 257*187f61dfSRuslan Ermilov.Ql --a 258*187f61dfSRuslan Ermilovin getopt: 259*187f61dfSRuslan Ermilov.Bl -tag -width ".Nx" 260*187f61dfSRuslan Ermilov.It Tn GNU 261*187f61dfSRuslan Ermilovparses this as option 262*187f61dfSRuslan Ermilov.Ql - , 263*187f61dfSRuslan Ermilovoption 264*187f61dfSRuslan Ermilov.Ql a . 265*187f61dfSRuslan Ermilov.It Nx 266*187f61dfSRuslan Ermilovparses this as 267*187f61dfSRuslan Ermilov.Ql -- , 268*187f61dfSRuslan Ermilovand returns \-1 (ignoring the 269*187f61dfSRuslan Ermilov.Ql a ) . 270*187f61dfSRuslan Ermilov(Because the original 271*187f61dfSRuslan Ermilov.Fn getopt 272*187f61dfSRuslan Ermilovdoes.) 273a35a7e76SEric Melville.El 274*187f61dfSRuslan Ermilov.It 275*187f61dfSRuslan ErmilovSetting of 276*187f61dfSRuslan Ermilov.Va optopt 277*187f61dfSRuslan Ermilovfor long options with 278*187f61dfSRuslan Ermilov.Va flag 279*187f61dfSRuslan Ermilov!= 280*187f61dfSRuslan Ermilov.Dv NULL : 281*187f61dfSRuslan Ermilov.Bl -tag -width ".Nx" 282*187f61dfSRuslan Ermilov.It Tn GNU 283*187f61dfSRuslan Ermilovsets 284*187f61dfSRuslan Ermilov.Va optopt 285*187f61dfSRuslan Ermilovto 286*187f61dfSRuslan Ermilov.Va val . 287*187f61dfSRuslan Ermilov.It Nx 288*187f61dfSRuslan Ermilovsets 289*187f61dfSRuslan Ermilov.Va optopt 290*187f61dfSRuslan Ermilovto 0 (since 291*187f61dfSRuslan Ermilov.Va val 292*187f61dfSRuslan Ermilovwould never be returned). 293a35a7e76SEric Melville.El 294*187f61dfSRuslan Ermilov.It 295*187f61dfSRuslan ErmilovHandling of 296*187f61dfSRuslan Ermilov.Ql -W 297*187f61dfSRuslan Ermilovwith 298*187f61dfSRuslan Ermilov.Ql W ; 299*187f61dfSRuslan Ermilovin option string in 300*187f61dfSRuslan Ermilov.Fn getopt 301*187f61dfSRuslan Ermilov(not 302*187f61dfSRuslan Ermilov.Fn getopt_long ) : 303*187f61dfSRuslan Ermilov.Bl -tag -width ".Nx" 304*187f61dfSRuslan Ermilov.It Tn GNU 305a35a7e76SEric Melvillecauses a segfault. 306*187f61dfSRuslan Ermilov.It Nx 307*187f61dfSRuslan Ermilovreturns \-1, with 308*187f61dfSRuslan Ermilov.Va optind 309*187f61dfSRuslan Ermilovpointing past the argument of 310*187f61dfSRuslan Ermilov.Ql -W 311*187f61dfSRuslan Ermilov(as if 312*187f61dfSRuslan Ermilov.Ql "-W arg" 313*187f61dfSRuslan Ermilovwere 314*187f61dfSRuslan Ermilov.Ql --arg , 315*187f61dfSRuslan Ermilovand thus 316*187f61dfSRuslan Ermilov.Ql -- 317*187f61dfSRuslan Ermilovhad been found). 318a35a7e76SEric Melville.\" How should we treat W; in the option string when called via 319a35a7e76SEric Melville.\" getopt? Ignore the ';' or treat it as a ':'? Issue a warning? 320a35a7e76SEric Melville.El 321*187f61dfSRuslan Ermilov.It 322*187f61dfSRuslan ErmilovSetting of 323*187f61dfSRuslan Ermilov.Va optarg 324*187f61dfSRuslan Ermilovfor long options without an argument that are 325*187f61dfSRuslan Ermilovinvoked via 326*187f61dfSRuslan Ermilov.Ql -W 327*187f61dfSRuslan Ermilov.Ql ( W ; 328*187f61dfSRuslan Ermilovin option string): 329*187f61dfSRuslan Ermilov.Bl -tag -width ".Nx" 330*187f61dfSRuslan Ermilov.It Tn GNU 331*187f61dfSRuslan Ermilovsets 332*187f61dfSRuslan Ermilov.Va optarg 333*187f61dfSRuslan Ermilovto the option name (the argument of 334*187f61dfSRuslan Ermilov.Ql -W ) . 335*187f61dfSRuslan Ermilov.It Nx 336*187f61dfSRuslan Ermilovsets 337*187f61dfSRuslan Ermilov.Va optarg 338*187f61dfSRuslan Ermilovto 339*187f61dfSRuslan Ermilov.Dv NULL 340*187f61dfSRuslan Ermilov(the argument of the long option). 341a35a7e76SEric Melville.El 342*187f61dfSRuslan Ermilov.It 343*187f61dfSRuslan ErmilovHandling of 344*187f61dfSRuslan Ermilov.Ql -W 345*187f61dfSRuslan Ermilovwith an argument that is not (a prefix to) a known 346*187f61dfSRuslan Ermilovlong option 347*187f61dfSRuslan Ermilov.Ql ( W ; 348*187f61dfSRuslan Ermilovin option string): 349*187f61dfSRuslan Ermilov.Bl -tag -width ".Nx" 350*187f61dfSRuslan Ermilov.It Tn GNU 351*187f61dfSRuslan Ermilovreturns 352*187f61dfSRuslan Ermilov.Ql -W 353*187f61dfSRuslan Ermilovwith 354*187f61dfSRuslan Ermilov.Va optarg 355*187f61dfSRuslan Ermilovset to the unknown option. 356*187f61dfSRuslan Ermilov.It Nx 357*187f61dfSRuslan Ermilovtreats this as an error (unknown option) and returns 358*187f61dfSRuslan Ermilov.Ql \&? 359*187f61dfSRuslan Ermilovwith 360*187f61dfSRuslan Ermilov.Va optopt 361*187f61dfSRuslan Ermilovset to 0 and 362*187f61dfSRuslan Ermilov.Va optarg 363*187f61dfSRuslan Ermilovset to 364*187f61dfSRuslan Ermilov.Dv NULL 365*187f61dfSRuslan Ermilov(as 366*187f61dfSRuslan Ermilov.Tn GNU Ns 's 367*187f61dfSRuslan Ermilovman page documents). 368a35a7e76SEric Melville.El 369*187f61dfSRuslan Ermilov.It 370a35a7e76SEric MelvilleThe error messages are different. 371*187f61dfSRuslan Ermilov.It 372*187f61dfSRuslan Ermilov.Nx 373*187f61dfSRuslan Ermilovdoes not permute the argument vector at the same points in 374*187f61dfSRuslan Ermilovthe calling sequence as 375*187f61dfSRuslan Ermilov.Tn GNU 376*187f61dfSRuslan Ermilovdoes. 377*187f61dfSRuslan ErmilovThe aspects normally used by 378*187f61dfSRuslan Ermilovthe caller (ordering after \-1 is returned, value of 379*187f61dfSRuslan Ermilov.Va optind 380*187f61dfSRuslan Ermilovrelative 381*187f61dfSRuslan Ermilovto current positions) are the same, though. 382*187f61dfSRuslan Ermilov(We do fewer variable swaps.) 383a35a7e76SEric Melville.El 384a35a7e76SEric Melville.Sh SEE ALSO 385a35a7e76SEric Melville.Xr getopt 3 386a35a7e76SEric Melville.Sh HISTORY 387a35a7e76SEric MelvilleThe 388a35a7e76SEric Melville.Fn getopt_long 389*187f61dfSRuslan Ermilovfunction first appeared in 390*187f61dfSRuslan Ermilov.Tn GNU 391*187f61dfSRuslan Ermilovlibiberty. 392*187f61dfSRuslan ErmilovThe first 393a35a7e76SEric Melville.Nx 394a35a7e76SEric Melvilleimplementation appeared in 1.5. 395a35a7e76SEric Melville.Sh BUGS 396*187f61dfSRuslan ErmilovThe implementation can completely replace 397a35a7e76SEric Melville.Xr getopt 3 , 398a35a7e76SEric Melvillebut right now we are using separate code. 399