Hallo,

hier ist das Interface fuer das neue Modul:

/* telnum.c
* (c) 1999 by Leopold Toetsch <[EMAIL PROTECTED]>
*
* telefon number utils
*
* Interface
*
* void initTelNum(void)
* ---------------------
* init the package, call this once on startup
*
* int NormalizeNumber(char *number, TELNUM *num, int flag)
* -------------------------------------------------------
* number is "[provider] [country] [area] [msn]"
* country may be name of country
* spaces or '_' are allowd to separate parts of number
* fills struct TELNUM *num with parts of given number
*  for flag look at telnum.h
* ret 0 .. ok
* ret 1 .. area not found
* ret UNKNOWN .. country not found
*
* Input number e.g.
* 10055 0049 89 1234567
* 100550049891234567
*  1033 Deutschland 89 1234567
*  +49 89 1234567
* 089 1234567
*  1234567
*
* char * formatNumber(char* format, TELNUM* num)
* ----------------------------------------------
* takes a format string
* %Np .. Provider
* %Nc .. country +49
* %NC .. countryname
* %Na .. area 89 or 089 if no country/Provider
* %NA .. areaname
* %Nm .. msn
*  %f .. full +49 89 12356 (Deutschland, Berlin)
* %s .. short +48 89 123456
* %n .. number 004889123456
*
*  N is number of chars to skip in format if part is not present
*  e.g. "%1c %1a %m"
* +4930123 => "+49 39 123"
*  123 => "123" not "  123"
*
*
* char* prefix2provider(int prefix, char* provider, TELNUM *num)
* --------------------------------------------------------------
*  returns formatted provider for prefix
*
* int provider2prefix(char* provider, int*prefix, TELNUM *num)
* ------------------------------------------------------------
* ret len of provider
*
* void clearNum(TELNUM *num)
* --------------------------
* call this if you have a number on stack or want to reuse it
* normalizeNumber calls this for you
*
* void initNum(TELNUM *num)
* inits a number with myarea, mycountry
* you may set the area yourself prior to calling this
*
*/

typedef struct {
  char vbn[TN_MAX_VBN_LEN];
  char provider[TN_MAX_PROVIDER_LEN];
  int nprovider;
  COUNTRY *country;
  int ncountry;
  char area[TN_MAX_AREA_LEN];
  int narea;
  char sarea[TN_MAX_SAREA_LEN];
  char msn[TN_MAX_MSN_LEN];
} TELNUM;


Fuer weitere Anregungen/Kommentare habe ich jederzeit ein offenes Ohrwaschl.

leo



_______________________________________________
Rates4linux-devel mailing list
[EMAIL PROTECTED]
http://lists.SourceForge.net/mailman/listinfo/rates4linux-devel

Antwort per Email an