1#ifndef _PROFILE_H_ 2#define _PROFILE_H_ 3 4#include <stdio.h> 5 6#ifndef OK 7#define OK 0 8#endif 9 10typedef char Char128[128]; 11 12#define MAX_ITEM_LEN 24 13extern FILE *ifp; 14 15typedef struct multi_items { 16 char key[MAX_ITEM_LEN]; 17 char *value; 18 int flag; 19} multi_items; 20 21/* single attribute access routines */ 22int PRO_GetInt(char *sect, char *key, int *val, FILE *fp); 23int PRO_GetStr(char *sect, char *key, char *val, int size, FILE* fp); 24int PRO_GetStrLen(char *sect, char *key, FILE* fp); 25int PRO_GetLong(char *sect, char *key, long *val, FILE *fp); 26 27int PRO_SetInt(char *sect, char *key, int val, char *fname); 28int PRO_SetStr(char *sect, char *key, char *val, char *fname); 29int PRO_SetStr1(char *sect, char *key, char *val, char *fname); 30 31int PRO_DelSect(char *sect,char *fname); 32int PRO_RenSect(char *old_sect, char *new_sect, char *fname); 33int PRO_SetMultiItemStr(char *sect, multi_items *val,int itemnum, char *fname); 34int PRO_DelKey(char *sect, char *key,char *fn); 35int GetLineFromFile(char **lbuf,FILE *fp); 36/* batch access routines */ 37/* returns a temp file pointer */ 38FILE *PRO_uopen(char *fn); 39 40/* for ctrl of u_to_sect() */ 41#define PRO_NWSEC 0 42#define PRO_WRSEC 1 43 44/* If you need to change the section name, set ctrl to PRO_NWSEC */ 45/* PRO_WRSEC will keep the same section name. If ctrl is set to */ 46/* PRO_WRSEC and the section does not exist, the section will be created.*/ 47int PRO_u2sect(char *sect, int ctrl); 48 49/* for ctrl of u_close() */ 50#define PRO_WRIRST 1 51#define PRO_GIVEUP 2 52#define PRO_GOWRIRST 3 53 54/* PRO_GIVEUP-give up the update. PRO_GOWRIRST-give up original */ 55/* section info and write the rest lines that are not read. */ 56/* PRO_WRIRST-write the rest lines that are not read. */ 57int PRO_uclose(char *fn, int mode, int ctrl); 58 59int PRO_2sect(char *sect, FILE *fp); 60 61/* message routines */ 62int PRO_GetMsgByIndex(char *sect, int start, int num, Char128 *msg, char *fn); 63 64void DBCS_CAP2SJIS(char *str,int bs2); // transfer 3 bytes -> 2 bytes 65void DBCS_SJIS2CAP(char *str,int bs2); // transfer 2 bytes -> 3 bytes 66int DBCS_CheckFileName(char *str); 67int DBCS_AnyDBCSInStr(char *str); 68void DBCS_SpecialChar(char *old, char *new,char *str); 69 70void code_transfer(unsigned char *input,int flag); 71#endif 72