- Timestamp:
- 05/08/08 15:42:37 (17 years ago)
- Branches:
- master, help
- Children:
- 40358d2
- Parents:
- adb4c8d
- git-author:
- obrebski <obrebski@…> (05/08/08 15:42:37)
- git-committer:
- obrebski <obrebski@…> (05/08/08 15:42:37)
- Location:
- app/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
app/src/common/common.cc
r25ae32e r0e3df7e 15 15 bool one_field=false; 16 16 bool one_line=false; 17 char output_field_prefix[ 32];18 char input_field_prefix[ 32];17 char output_field_prefix[FIELD_PREFIX_MAXLEN]; 18 char input_field_prefix[FIELD_PREFIX_MAXLEN]; 19 19 20 20 extern int argc; … … 32 32 } 33 33 34 35 36 37 /*38 parameters:39 -name - field name, long or short40 +prefix - field name with ':' appended if long name41 return value:42 1 if correct field name, 0 otherwise43 examples:44 name prefix r.v.45 lem lem: 146 @ @ 147 :: 'undef' 048 a,b 'undef' 049 */50 int fieldprefix(char *name, char *prefix)51 {52 if (ispunct(name[0]) && name[1]=='\0') // correct short name53 {54 strcpy(prefix, name); return 1;55 }56 57 int i=0;58 while(name[i]!='\0' && isalnum(name[i])) ++i;59 60 if(name[i]=='\0' && i>0) // correct long name61 {62 sprintf(prefix,"%s:",name); return 1;63 }64 65 // incorrect66 return 0;67 }68 34 69 35 -
app/src/common/common.h
ra7b254c r0e3df7e 24 24 #define MAXAUX 16 25 25 #define FIELD_SEP " \t\n" 26 #define FIELD_PREFIX_MAXLEN 32 26 27 27 28 … … 67 68 extern int expand_path(char* inpath, char* outpath); 68 69 69 extern int fieldprefix(char *name, char *prefix);70 71 72 70 /************************************************** 73 71 * problems with casing */ 74 72 // sprawdzenie wielkosci liter 75 // warto ¶æzwracana:76 // 0 - wszystkie ma ³e litery73 // warto¶Ê zwracana: 74 // 0 - wszystkie ma³e litery 77 75 // 1 - pierwsza wielka, reszta male 78 76 // 2 - wszystkie wielkie … … 105 103 106 104 // przepisuje s do d 107 // nadajac wielko ¶æ liter zgodnie z warto¶ci± casing108 // casing - warto ¶æzwracana przez casing()109 // je ¶li casing==3 przepisuje bez zmian (za ma³o informacji)105 // nadajac wielko¶Ê liter zgodnie z warto¶ci± casing 106 // casing - warto¶Ê zwracana przez casing() 107 // je¶li casing==3 przepisuje bez zmian (za ma³o informacji) 110 108 inline void restorecasing(char *s, char *d, int casing) 111 109 { … … 186 184 187 185 186 /* 187 parameters: 188 -name - field name, long or short 189 +prefix - field name with ':' appended if long name 190 return value: 191 1 if correct field name, 0 otherwise 192 examples: 193 name prefix r.v. 194 lem lem: 1 195 @ @ 1 196 :: 'undef' 0 197 a,b 'undef' 0 198 */ 199 inline 200 int fieldprefix(char *name, char *prefix) 201 { 202 if (ispunct(name[0]) && name[1]=='\0') // correct short name 203 { 204 strcpy(prefix, name); return 1; 205 } 206 207 int i=0; 208 while(name[i]!='\0' && isalnum(name[i])) ++i; 209 210 if(name[i]=='\0' && i>0) // correct long name 211 { 212 sprintf(prefix,"%s:",name); return 1; 213 } 214 215 // incorrect 216 return 0; 217 } 218 188 219 inline 189 220 bool process_seg(char* seg, gengetopt_args_info& args) 190 221 { 191 222 char buf[256]; 223 char pref[FIELD_PREFIX_MAXLEN]; 192 224 bool ret = !args.process_given; 193 225 if(args.process_given) … … 205 237 206 238 for(int i=0; i<args.select_given; ++i) 207 if(! getfield(seg,args.select_arg[i],buf)) 208 return false; 239 { 240 fieldprefix(args.select_arg[i],pref); // !!! ÅATKA - ZOPTYMALIZOWAÄ !!! 241 if(! getfield(seg,pref,buf)) 242 return false; 243 } 209 244 for(int i=0; i<args.ignore_given; ++i) 210 if(getfield(seg,args.ignore_arg[i],buf)) 211 return false; 245 { 246 fieldprefix(args.ignore_arg[i],pref); // !!! ÅATKA - ZOPTYMALIZOWAÄ !!! 247 if(getfield(seg,pref,buf)) 248 return false; 249 } 212 250 213 251 if(args.input_field_given & !getfield(seg,input_field_prefix,buf)) -
app/src/lem/main.cc
r13a8a67 r0e3df7e 51 51 tab.clear(); 52 52 getfield(line,input_field_prefix,form); 53 53 54 if (form==NULL) continue;//BZDURA 54 55
Note: See TracChangeset
for help on using the changeset viewer.