~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_getopt.c

  • Committer: Brian Aker
  • Date: 2008-07-15 06:45:16 UTC
  • Revision ID: brian@tangent.org-20080715064516-fnbq7kowh7w57bxj
Merge Monty's code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
254
254
                  case OPT_DISABLE: /* fall through */
255
255
                    /*
256
256
                      double negation is actually enable again,
257
 
                      for example: --skip-option=0 -> option = TRUE
 
257
                      for example: --skip-option=0 -> option = true
258
258
                    */
259
259
                    optend= (optend && *optend == '0' && !(*(optend + 1))) ?
260
260
                      (char*) "1" : disabled_my_option;
793
793
                               bool *fix)
794
794
{
795
795
  int64_t old= num;
796
 
  bool adjusted= FALSE;
 
796
  bool adjusted= false;
797
797
  char buf1[255], buf2[255];
798
798
  uint64_t block_size= (optp->block_size ? (uint64_t) optp->block_size : 1L);
799
799
 
801
801
      optp->max_value) /* if max value is not set -> no upper limit */
802
802
  {
803
803
    num= (uint64_t) optp->max_value;
804
 
    adjusted= TRUE;
 
804
    adjusted= true;
805
805
  }
806
806
 
807
807
  switch ((optp->var_type & GET_TYPE_MASK)) {
809
809
    if (num > (int64_t) INT_MAX)
810
810
    {
811
811
      num= ((int64_t) INT_MAX);
812
 
      adjusted= TRUE;
 
812
      adjusted= true;
813
813
    }
814
814
    break;
815
815
  case GET_LONG:
817
817
    if (num > (int64_t) LONG_MAX)
818
818
    {
819
819
      num= ((int64_t) LONG_MAX);
820
 
      adjusted= TRUE;
 
820
      adjusted= true;
821
821
    }
822
822
#endif
823
823
    break;
832
832
  if (num < optp->min_value)
833
833
  {
834
834
    num= optp->min_value;
835
 
    adjusted= TRUE;
 
835
    adjusted= true;
836
836
  }
837
837
 
838
838
  if (fix)
861
861
uint64_t getopt_ull_limit_value(uint64_t num, const struct my_option *optp,
862
862
                                 bool *fix)
863
863
{
864
 
  bool adjusted= FALSE;
 
864
  bool adjusted= false;
865
865
  uint64_t old= num;
866
866
  char buf1[255], buf2[255];
867
867
 
869
869
      optp->max_value) /* if max value is not set -> no upper limit */
870
870
  {
871
871
    num= (uint64_t) optp->max_value;
872
 
    adjusted= TRUE;
 
872
    adjusted= true;
873
873
  }
874
874
 
875
875
  switch ((optp->var_type & GET_TYPE_MASK)) {
877
877
    if (num > (uint64_t) UINT_MAX)
878
878
    {
879
879
      num= ((uint64_t) UINT_MAX);
880
 
      adjusted= TRUE;
 
880
      adjusted= true;
881
881
    }
882
882
    break;
883
883
  case GET_ULONG:
885
885
    if (num > (uint64_t) ULONG_MAX)
886
886
    {
887
887
      num= ((uint64_t) ULONG_MAX);
888
 
      adjusted= TRUE;
 
888
      adjusted= true;
889
889
    }
890
890
#endif
891
891
    break;
903
903
  if (num < (uint64_t) optp->min_value)
904
904
  {
905
905
    num= (uint64_t) optp->min_value;
906
 
    adjusted= TRUE;
 
906
    adjusted= true;
907
907
  }
908
908
 
909
909
  if (fix)
1187
1187
  const struct my_option *optp;
1188
1188
 
1189
1189
  printf("\nVariables (--variable-name=value)\n");
1190
 
  printf("and boolean options {FALSE|TRUE}  Value (after reading options)\n");
 
1190
  printf("and boolean options {false|true}  Value (after reading options)\n");
1191
1191
  printf("--------------------------------- -----------------------------\n");
1192
1192
  for (optp= options; optp->id; optp++)
1193
1193
  {
1221
1221
               "(No default value)");
1222
1222
        break;
1223
1223
      case GET_BOOL:
1224
 
        printf("%s\n", *((bool*) value) ? "TRUE" : "FALSE");
 
1224
        printf("%s\n", *((bool*) value) ? "true" : "false");
1225
1225
        break;
1226
1226
      case GET_INT:
1227
1227
        printf("%d\n", *((int*) value));