| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: makeshell.c,v 1.1.1.1 2009/12/13 16:55:08 kardel Exp $ */ | | 1 | /* $NetBSD: makeshell.c,v 1.2 2009/12/13 23:25:40 christos Exp $ */ |
2 | | | 2 | |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * Id: 7226344c6486a4eda395f893881080b7d80a2003 | | 5 | * Id: 7226344c6486a4eda395f893881080b7d80a2003 |
6 | * Time-stamp: "2009-11-01 11:52:37 bkorb" | | 6 | * Time-stamp: "2009-11-01 11:52:37 bkorb" |
7 | * | | 7 | * |
8 | * This module will interpret the options set in the tOptions | | 8 | * This module will interpret the options set in the tOptions |
9 | * structure and create a Bourne shell script capable of parsing them. | | 9 | * structure and create a Bourne shell script capable of parsing them. |
10 | * | | 10 | * |
11 | * This file is part of AutoOpts, a companion to AutoGen. | | 11 | * This file is part of AutoOpts, a companion to AutoGen. |
12 | * AutoOpts is free software. | | 12 | * AutoOpts is free software. |
13 | * AutoOpts is copyright (c) 1992-2009 by Bruce Korb - all rights reserved | | 13 | * AutoOpts is copyright (c) 1992-2009 by Bruce Korb - all rights reserved |
14 | * | | 14 | * |
| @@ -607,27 +607,27 @@ emitUsage( tOptions* pOpts ) | | | @@ -607,27 +607,27 @@ emitUsage( tOptions* pOpts ) |
607 | if ((pzLeader == NULL) && (pzShell != NULL)) | | 607 | if ((pzLeader == NULL) && (pzShell != NULL)) |
608 | printf( "#! %s\n", pzShell ); | | 608 | printf( "#! %s\n", pzShell ); |
609 | | | 609 | |
610 | printf( zPreamble, zStartMarker, pzOutName, zTimeBuf ); | | 610 | printf( zPreamble, zStartMarker, pzOutName, zTimeBuf ); |
611 | } | | 611 | } |
612 | | | 612 | |
613 | /* | | 613 | /* |
614 | * Get a copy of the original program name in lower case | | 614 | * Get a copy of the original program name in lower case |
615 | */ | | 615 | */ |
616 | { | | 616 | { |
617 | char* pzPN = zTimeBuf; | | 617 | char* pzPN = zTimeBuf; |
618 | tCC* pz = pOpts->pzPROGNAME; | | 618 | tCC* pz = pOpts->pzPROGNAME; |
619 | for (;;) { | | 619 | for (;;) { |
620 | if ((*pzPN++ = tolower( *pz++ )) == '\0') | | 620 | if ((*pzPN++ = tolower( (unsigned char)*pz++ )) == '\0') |
621 | break; | | 621 | break; |
622 | } | | 622 | } |
623 | } | | 623 | } |
624 | | | 624 | |
625 | printf( zEndPreamble, pOpts->pzPROGNAME ); | | 625 | printf( zEndPreamble, pOpts->pzPROGNAME ); |
626 | | | 626 | |
627 | pOpts->pzProgPath = pOpts->pzProgName = zTimeBuf; | | 627 | pOpts->pzProgPath = pOpts->pzProgName = zTimeBuf; |
628 | textToVariable( pOpts, TT_LONGUSAGE, NULL ); | | 628 | textToVariable( pOpts, TT_LONGUSAGE, NULL ); |
629 | textToVariable( pOpts, TT_USAGE, NULL ); | | 629 | textToVariable( pOpts, TT_USAGE, NULL ); |
630 | | | 630 | |
631 | { | | 631 | { |
632 | tOptDesc* pOptDesc = pOpts->pOptDesc; | | 632 | tOptDesc* pOptDesc = pOpts->pOptDesc; |
633 | int optionCt = pOpts->optCt; | | 633 | int optionCt = pOpts->optCt; |
| @@ -823,40 +823,40 @@ emitMatchExpr( tCC* pzMatchName, tOptDes | | | @@ -823,40 +823,40 @@ emitMatchExpr( tCC* pzMatchName, tOptDes |
823 | */ | | 823 | */ |
824 | if ((pOD == pCurOpt) || SKIP_OPT(pOD)){ | | 824 | if ((pOD == pCurOpt) || SKIP_OPT(pOD)){ |
825 | if (--oCt <= 0) | | 825 | if (--oCt <= 0) |
826 | break; | | 826 | break; |
827 | pOD++; | | 827 | pOD++; |
828 | continue; | | 828 | continue; |
829 | } | | 829 | } |
830 | | | 830 | |
831 | /* | | 831 | /* |
832 | * Check each character of the name case insensitively. | | 832 | * Check each character of the name case insensitively. |
833 | * They must not be the same. They cannot be, because it would | | 833 | * They must not be the same. They cannot be, because it would |
834 | * not compile correctly if they were. | | 834 | * not compile correctly if they were. |
835 | */ | | 835 | */ |
836 | while ( toupper( pOD->pz_Name[matchCt] ) | | 836 | while ( toupper( (unsigned char)pOD->pz_Name[matchCt] ) |
837 | == toupper( pzMatchName[matchCt] )) | | 837 | == toupper( (unsigned char)pzMatchName[matchCt] )) |
838 | matchCt++; | | 838 | matchCt++; |
839 | | | 839 | |
840 | if (matchCt > min) | | 840 | if (matchCt > min) |
841 | min = matchCt; | | 841 | min = matchCt; |
842 | | | 842 | |
843 | /* | | 843 | /* |
844 | * Check the disablement name, too. | | 844 | * Check the disablement name, too. |
845 | */ | | 845 | */ |
846 | if (pOD->pz_DisableName != NULL) { | | 846 | if (pOD->pz_DisableName != NULL) { |
847 | matchCt = 0; | | 847 | matchCt = 0; |
848 | while ( toupper( pOD->pz_DisableName[matchCt] ) | | 848 | while ( toupper( (unsigned char)pOD->pz_DisableName[matchCt] ) |
849 | == toupper( pzMatchName[matchCt] )) | | 849 | == toupper( (unsigned char)pzMatchName[matchCt] )) |
850 | matchCt++; | | 850 | matchCt++; |
851 | if (matchCt > min) | | 851 | if (matchCt > min) |
852 | min = matchCt; | | 852 | min = matchCt; |
853 | } | | 853 | } |
854 | if (--oCt <= 0) | | 854 | if (--oCt <= 0) |
855 | break; | | 855 | break; |
856 | pOD++; | | 856 | pOD++; |
857 | } | | 857 | } |
858 | | | 858 | |
859 | /* | | 859 | /* |
860 | * IF the 'min' is all or one short of the name length, | | 860 | * IF the 'min' is all or one short of the name length, |
861 | * THEN the entire string must be matched. | | 861 | * THEN the entire string must be matched. |
862 | */ | | 862 | */ |
| @@ -1050,27 +1050,27 @@ genshelloptUsage( tOptions* pOpts, int | | | @@ -1050,27 +1050,27 @@ genshelloptUsage( tOptions* pOpts, int |
1050 | wait( &sts ); | | 1050 | wait( &sts ); |
1051 | } | | 1051 | } |
1052 | } | | 1052 | } |
1053 | | | 1053 | |
1054 | /* | | 1054 | /* |
1055 | * Generate the pzProgName, since optionProcess() normally | | 1055 | * Generate the pzProgName, since optionProcess() normally |
1056 | * gets it from the command line | | 1056 | * gets it from the command line |
1057 | */ | | 1057 | */ |
1058 | { | | 1058 | { |
1059 | char* pz; | | 1059 | char* pz; |
1060 | AGDUPSTR( pz, pShellParseOptions->pzPROGNAME, "program name" ); | | 1060 | AGDUPSTR( pz, pShellParseOptions->pzPROGNAME, "program name" ); |
1061 | pShellParseOptions->pzProgName = pz; | | 1061 | pShellParseOptions->pzProgName = pz; |
1062 | while (*pz != NUL) { | | 1062 | while (*pz != NUL) { |
1063 | *pz = tolower( *pz ); | | 1063 | *pz = tolower( (unsigned char)*pz ); |
1064 | pz++; | | 1064 | pz++; |
1065 | } | | 1065 | } |
1066 | } | | 1066 | } |
1067 | | | 1067 | |
1068 | /* | | 1068 | /* |
1069 | * Separate the makeshell usage from the client usage | | 1069 | * Separate the makeshell usage from the client usage |
1070 | */ | | 1070 | */ |
1071 | fprintf( option_usage_fp, zGenshell, pShellParseOptions->pzProgName ); | | 1071 | fprintf( option_usage_fp, zGenshell, pShellParseOptions->pzProgName ); |
1072 | fflush( option_usage_fp ); | | 1072 | fflush( option_usage_fp ); |
1073 | | | 1073 | |
1074 | /* | | 1074 | /* |
1075 | * Now, print the client usage. | | 1075 | * Now, print the client usage. |
1076 | */ | | 1076 | */ |