Syntax: | int qDecoder(void); |
Function: | Interprets encoded query strings and stores them in the linked-list. COOKIE, GET, POST(including multipart/form-data encoding) are supported. |
Return: | In case of success, returns the number of received arguments. In case of failure, return -1. |
Note: | The parsing sequence is (1)COOKIE (2)GET (3)POST. Thus if same query names (which are sent by different method) exist, qValue() will return the value of COOKIE. This function, qDecoder(), is called automatically when you use qValue() or related functions, so you do not need to call directly. In case of multipart/form-data encoding(used for file uploading), the variables of "variable_name.length", "variable_name.contenttype" and "variable_name.name" are automatically inserted. The number of bytes of data is stored in "variable_name.length", and the content type of data is stored in "variable_name.contenttype" and the file names(file name itself, path information will be removed) transmitted by users are stored in "variable_name.name". (/reference/In%20case%20of%20"C:Data/reference/a.gif", only "/reference/a.gif" is stored.) In counter of return values, a total of 4 lists are stored but since the 4 lists are for one data, they are regarded as 1 list. |
Example: |
Syntax: | char *qValue(char *format, …); |
Function: | Finds out the value (COOKIE, GET, POST) for variable names at the linked-list and hands over the pointers. |
Return: | The pointer of the variable value if a variable name exists. NULL if there is no variable name. |
Note: | qValue() returns only the pointers of query index created by qDecoder().Accordingly, you should not free() the pointers received at qValue. The deallocation of allocated memory should be performed through the qFree() function (generally before the program is shut down). Internally calls qDecoder if qDecoder() has not been called before. |
Example: |
Syntax: | int qiValue(char *format, …); |
Function: | Same as that of qValue(). But this returns the value(numeric character string) after converting it into integers. |
Return: | In case of success, returns the integer value for the variable value (numericcharacter string). If a variable name does not exist or cannot be converted, returns 0. |
Example: |
Syntax: | char *qValueDefault(char *defstr, char *format, …); |
Function: | This is a simple function of qValue() used for setting up a primary argument when there is no query. |
Return: | Same as that of qValue(). But this returns the pointer of defstr when there is no query. |
Example: |
Syntax: | char *qValueNotEmpty(char *errmsg, char *format, …); |
Function: | Displays specified error messages by using the qError() function when there is no query or blank character strings ("") are returned. |
Return: | Same as qValue except that it has "error handling" within for NULL. |
Example: |
Syntax: | char *qValueReplace(char *mode, char *name, char *tokstr, char *word); |
Function: | Transposes tokens and character strings for the linked-list character strings. |
Return: | Transposed character-string pointers. |
Note: | Basically, qValueReplace() is the wrapping function of qStrReplace(). The difference is that the source character string is the query value (the value of the linked-list for names) in it, and the conversion can be directly done to the linked-list itself. Accordingly, the usage of arguments of qValueReplace() is basically the same as that of qStrReplace(). The ‘name’ argument is the query name of the linked-list to be used as source character strings. And it is the source character string to be used when the corresponding value is transposed. The ‘mode’ argument is a character string made up of two separate characters like "sr". The first character defines the transposition method. ‘t’ or ‘s’ can be located in its place. ‘t’ stands for [t]oken. It compares the source character strings (the value character string of the linked-list for given names) using each character of the tokstr character string as a token and transposes the matching characters into a word character string. ‘s’ stands for [s]tring. It transposes into a word character string the tokstr matching character strings appearing inside the source string using the tokstr string itself as a token. The second character stands for the recording type of the transposed character string. Eigher ‘n’ or ‘r’ can be used for it. ‘n’ stands for [n]ew. It makes the corresponding pointer returned by storing the transposed result character string in a new memory space. Accordingly, the source string linked-list should be maintained in its original state, and the pertinent memory needs to be free() from the user’s aspect. ‘r’ stands for [r]eplace and means overwriting the transposition results on the linked-list itself. This is accomplished through the internal reallocation of memory. As a result, there are 4 possible occasions in which the ‘mode’ argument can be assembled. Mode "tn" : [t]oken transposition & stores results in a [n]ew space and returns Mode "tr" : [t]oken transposition & [r]eplaces the linked-list itself Mode "sn" : [s]tring transposition & stores results in a [n]ew space and returns Mode "sr" : [s]tring transposition & [r]eplaces the linked-list itself |
Example: |
Syntax: | Q_Entry *qGetFirstEntry(void); |
Function: | Returns the first Q_Entry pointer of the linked-list. |
Return: | If there is stored data in linked-list, return Q_Entry first pointer. Or return NULL. |
Note: | This is used to acquire a root pointer when the linked-list used by qDecoder() is to be directly manipulated. |
Example: |
Syntax: | char *qValueFirst(char *format, …); |
Function: | Used for patching the arguments having an identical variable name inregular sequence. |
Return: | In case of success, returns the first variable-value pointer for the arguments having an identical variable name. If there is no variable name, returns NULL. |
Example: | n”, list); } |
Syntax: | char *qValueNext(void); |
Function: | Continues to find out with qValueFirst(). |
Return: | In case of success, returns the pointer of the variable value. If there is no more identical variable name, returns NULL. |
Example: | n”, list); } |
Syntax: | char *qValueAdd(char *name, char *format, …); |
Function: | Force to add given name and value to linked list. |
Return: | String pointer of added entry in linked-list. |
Note: | If same name exists, it’ll be replaced. |
Example: |
Syntax: | void qValueRemove(char *format, …); |
Function: | Remove entry from linked list. |
Example: |
Syntax: | char qValueType(char *format, …); |
Function: | Returns type(Cookie, GET, POST) of query. |
Return: | Cookie `C`, Get method `G`, Post method `P`, New data(qValueAdd) `N`, Not found `-`. |
Example: |
Syntax: | void qCookieSet(char *name, char *value, int exp_days, char *path, char *domain, char *secure); |
Function: | Sets up those cookies that correspond to name=value. |
Note: | When cookies are set up through qCookieSet(), the point of time when values are handed over through qValue() is when the next program is called. In some implementations, however, cookies need to be set up for the simplicity of logic while, at the same time, this needs to be applied to other routines. In this case, qValueAdd() can prevent the alteration of logic and the waste of additional codes by adding values to the cookie linked-list. But with regard to qCookieSet(), setting up cookies at clients (browsers) does not succeed always. Thus, users should be careful when using qValueAdd(). This should be used before qContentType() is called. |
Example: |
Syntax: | void qCookieRemove(char *name, char *path, char *domain, char *secure); |
Function: | Remove cookie from client(browser). |
Note: | The arguments(path, domain, secure) must be exactly same as the arguments of qCookieSet(). When cookies are removed through qCookieRemove(), the point of time when values in linked-list removed is when the next program is called. In some implementations, however, cookies need to be removed for the simplicity of logic while, at the same time, this needs to be applied to other routines. In this case, qValueRemove() can prevent the alteration of logic and the waste of additional codes by removing values to the linked-list. But with regard to qCookieRemove(), removing cookies at clients (browsers) does not succeed always. Thus, users should be careful when using qValueRemove(). |
Example: |
Syntax: | char *qCookieValue(char *format, …); |
Function: | Return cookie value. |
Return: | The pointer of the cookie value if a cookie name exists. NULL if there is no cookie name. |
Example: |
Syntax: | int qPrint(void); |
Function: | Displays all the arguments transmitted for the purpose of debugging programs. |
Return: | The number of arguments. |
Example: |
Syntax: | void qValueAdd(char *name, char *value); |
Function: | Deallocates the allocated memory by qDecoder(). |
Note: | Please refer qFreeAll() too. |
Example: |
Syntax: | int qSession(char *repository); |
Function: | Start Session. |
Return: | New session 1, else 0. |
Note: | To use session, you must call qSession() at the start. qSession() stores 32 bytes session id to client using cookie, then stores session data to server side. By default, session data will be expired in 1800 seconds since last access. You can adjust this period by using qSessionSetTimeout(). To use session on clients which does not support cookie such like WAP phone. add QSESSIONID into your link below. http://domain/application?QSESSIONID=ab77bbb49dd61cd510db121a948ab4d9&other;=arguments qSession() will store default session values below. _Q_SESSIONID : Session ID (ex: ab77bbb49dd61cd510db121a948ab4d9) _Q_CREATED-GMT : Created GMT Time (ex: Thu, 19-Jul-2001 21:50:19 GMT) _Q_CREATED : Created Time (ex: 995579419) _Q_CONNECTIONS : Connection Count (ex: 15) _Q_INTERVAL : Expire Period/Seconds (ex: 1800) Session data is stored in filesystem(unix: "/tmp", win32: "C:WindowsTemp"). You can change storage path using argument ‘repository’ when you call qSession(). qSession() generates "qsession-" prefixed files in session storage and manage automatically. (In case of WIN32 environment, the session files in repository are not managed automatically, so you would better to clean periodically repository) Session data will be stored when qSessionFree(), qSessionSave() or qFreeAll() is called. |
Example: |
Syntax: | char *qSessionAdd(char *name, char *format, …); |
Function: | Add session value. |
Return: | Stored String pointer of value. |
Example: |
Syntax: | int qSessionAddInteger(char *name, int valueint); |
Function: | Add session value of integer type. |
Return: | Stored integer value. |
Example: |
Syntax: | int qSessionUpdateInteger(char *name, int plusint); |
Function: | Update session value of integer type. |
Return: | Updated integer value. |
Syntax: | char *qSessionValue(char *format, …); |
Function: | Return session value. |
Return: | Success pointer of value string, Fail NULL. |
Example: |
Syntax: | int qSessionValueInteger(char *format, …); |
Function: | Return session value of integer type. |
Return: | Success integer of value, Fail 0. |
Example: |
Syntax: | void qSessionRemove(char *format, …); |
Function: | Remove session variable. |
Example: |
Syntax: | char *qSessionGetID(void); |
Function: | Return current session id. |
Return: | String pointer of session id(32bytes). |
Example: |
Syntax: | time_t qSessionGetCreated(void); |
Function: | Return session created time in seconds. |
Return: | Value of created time in seconds since 0 hours, 0 minutes, 0 seconds, January 1, 1970. |
Example: |
Syntax: | void qSessionSetTimeout(time_t seconds); |
Function: | Change current session expiration period. |
Return: | New expiration period. |
Note: | By default, expiration period is 1800 seconds. |
Example: |
Syntax: | int qSessionPrint(void); |
Function: | Displays all the session variables for the purpose of debugging programs. |
Return: | The number of variables. |
Example: |
Syntax: | void qSessionSave(void); |
Function: | Save session data immediately. |
Note: | qSessionSave() will be automatically called, when you callqSessionFree() at the end of program. If program can be quitted before qSessionFree(), you can use qSessionSave() directly to protect session data. |
Example: |
Syntax: | void qSessionFree(void); |
Function: | Save session data and deallocate memories. |
Example: |
Syntax: | void qSessionDestroy(void); |
Function: | Destroy current session. |
Example: |
Syntax: | Q_Entry *qfDecoder(char *filename); |
Function: | Reads file and stores in the linked-list. (no limitations to the line length of files) |
Return: | The first record pointer of the linked-list, NULL in case of failure. |
Note: | Reads the file of the following format and stores them in the linked-list. —- test.conf —- # this is comment. name = Seung-young Kim age = 30 addr = Korea ——————- Regarded as explanatory notes, those lines starting with sharps(#) are not interpreted. |
Example: |
Syntax: | char *qfValue(Q_Entry *first, char *format, …); |
Function: | Acquires the variable value of variable names. |
Return: | In case of success, returns the pointer of the variable value. In case of failure, returns NULL. |
Example: |
Syntax: | int qfiValue(Q_Entry *first, char *format, …); |
Function: | Converts the variable values into integers and hands them over. |
Return: | In case of success, reurns the integer value for the variable value (numericcharacter strings). When a variable name does not exist or the pertinent value cannot be convertedinto integers, returns 0. |
Example: |
Syntax: | char *qfValueFirst(Q_Entry *first, char *format, …); |
Function: | Used for patching the arguments having an identical variable name inregular sequence. |
Return: | In case of success, returns the first variable-value pointer for the arguments having an identical variable name. If there is no variable name, returns NULL. |
Example: | n”, list); } |
Syntax: | char *qfValueNext(void); |
Function: | Continues to find out with qfValueFirst(). |
Return: | In case of success, returns the pointer of the variable value. If there is no more identical variable name, returns NULL. |
Example: | n”, list); } |
Syntax: | int qfPrint(Q_Entry *first); |
Function: | Displays all the interpreted arguments for debugging programs. |
Return: | The number of arguments. |
Example: |
Syntax: | void qfFree(Q_Entry *first); |
Function: | Deallocates allocated memory. |
Example: |
Syntax: | Q_Entry *qsDecoder(char *str); |
Function: | Reads string and stores in the linked-list. (no limitations to the line length of files) |
Return: | The first record pointer of the linked-list, NULL in case of failure. |
Note: | Reads the file of the following format and stores them in the linked-list. —- test.conf —- # this is comment. name = Seung-young Kim age = 30 addr = Korea ——————- Regarded as explanatory notes, those lines starting with sharps(#) are not interpreted. |
Example: |
Syntax: | char *qsValue(Q_Entry *first, char *format, …); |
Function: | Acquires the variable value of variable names. |
Return: | In case of success, returns the pointer of the variable value. In case of failure, returns NULL. |
Example: |
Syntax: | int qsiValue(Q_Entry *first, char *format, …); |
Function: | Converts the variable values into integers and hands them over. |
Return: | In case of success, reurns the integer value for the variable value (numericcharacter strings). When a variable name does not exist or the pertinent value cannot be convertedinto integers, returns 0. |
Example: |
Syntax: | char *qsValueFirst(Q_Entry *first, char *format, …); |
Function: | Used for patching the arguments having an identical variable name inregular sequence. |
Return: | In case of success, returns the first variable-value pointer for the arguments having an identical variable name. If there is no variable name, returns NULL. |
Example: | n”, list); } |
Syntax: | char *qsValueNext(void); |
Function: | Continues to find out with qfValueFirst(). |
Return: | In case of success, returns the pointer of the variable value. If there is no more identical variable name, returns NULL. |
Example: | n”, list); } |
Syntax: | int qsPrint(Q_Entry *first); |
Function: | Displays all the interpreted arguments for debugging programs. |
Return: | The number of arguments. |
Example: |
Syntax: | void qsFree(Q_Entry *first); |
Function: | Deallocates allocated memory. |
Example: |
Syntax: | Q_Entry *qSedArgAdd(Q_Entry *first, char *name, char *format, …); |
Function: | Add a variable to argument list for use of qSedFile() and qSedStr(). |
Return: | Pointer of argument list. |
Example: |
Syntax: | Q_Entry *qSedArgAddDirect(Q_Entry *first, char *name, char *value); |
Function: | Add a variable with huge data to argument list for use of qSedFile() and qSedStr(). |
Return: | First pointer of argument list. |
Note: | This function is same as qSedArg() except the value string is not formatted. So you can use value string which size is bigger than 1024-1 bytes. |
Example: |
Syntax: | int qSedArgPrint(Q_Entry *first); |
Function: | Displays all the variables for debugging programs. |
Return: | The number of arguments. |
Example: |
Syntax: | void qSedArgFree(Q_Entry *first); |
Function: | Deallocates allocated memory by qSedArgAdd(). |
Example: |
Syntax: | int qSedFile(Q_Entry *first, char *filename, FILE *fpout); |
Function: | Replaces specified symbols with defined character strings in files and displays them. And supports part of the SSI grammar. |
Return: | In case of success, returns 1. When files cannot be opened, returns 0. |
Note: | Plays a similar function to the SED command of UNIX systems. —- ex) streamedit.html.in —- <!–#include file="streamedit-header.html.in"–> <p>Hi <b>${NAME}</b>. <p>You got a really cool hobby. <br>I’m sure that your hobby, <b>${HOBBY}</b>, can make your life more compatible. <p>Bye 🙂 <!–#include file="streamedit-tailer.html.in"–> ——————— By utilizing qSedFile, CGI programming can be performed even without including HTML codes in the programs. Thus, UI-related debugging time can be reduced to a great extent, and the design and development works can be separately performed. Package products can be easily customized by users. filename is an input(target) file while fpout stands for output streams. When you wish to display the results in files, open files in "w" and then, hand over the corresponding file pointers. And if you wish to display them on-screen, just specify stdout. It interprets the SSI grammar. (Currently, only [an error occurred while processing this directive] is supported.) If there is the following lines in a document, the corresponding document is included in the display. And the replacement and SSI functions are valid for the included document. (Cascading) <!–#include file="streamedit-header.html.in"–> Note) The included file can be marked by relative paths on the basis of the location where CGI is executed. Or it may be marked by system absolute paths. If you wish to use the SSI function only without replacing character strings, transmit the NULL value using the arg argument as follows: ex) qSedFile(NULL, "streamedit.html.in", stdout); |
Example: |
Syntax: | int qSedStr(Q_Entry *first, char *srcstr, FILE *fpout); |
Function: | Plays same functions as qSedFile(), but input is done in character strings. |
Return: | Same as that of qSedFile(). |
Example: |
Syntax: | int qAwkOpen(char *filename, char separator); |
Function: | Opens files and sets up delimiters. |
Return: | In case of success, returns 1. When files cannot be opened, return 0. |
Note: | Plays a similar function to the AWK command of UNIX systems. —- ex) /etc/passwd —- shpark:x:1008:1000:Sang-hyun Park:/home/shpark:/bin/csh teamwork:x:1011:1000:Seung-young Kim:/home/teamwork:/bin/csh kikuchi:x:1015:2000:KIKUCHI:/home/kikuchi:/bin/csh ————————- |
Example: |
Syntax: | int qAwkNext(char array[][1024]); |
Function: | Reads a line and stores it in an array given as a argument. |
Return: | In case of success, returns the number of fields. The end of files, -1. |
Note: | There is no limitation to the length of lines. But each field should not exceed 1024-1 bytes. |
Example: |
Syntax: | Q_BOOL qAwkClose(FILE *fp); |
Function: | Closes open files. |
Return: | Success Q_TRUE. Otherwise Q_FALSE. |
Example: |
Syntax: | int qAwkStr(char array[][1024], char *str, char delim); |
Function: | Reads a string and stores it in an array given as a argument. |
Return: | returns the number of fields. |
Note: | There is no limitation to the length of lines. But each field should not exceed 1024-1 bytes. |
Example: |
Syntax: | int qArgMake(char *str, char **qlist); |
Function: | Divides queries into tokens. The delimiters are generally space characters. And the redundant spaces between tokens and the spaces before and after queries are disregarded. |
Return: | The number of divided tokens. |
Note: | A group of functions related to search words classifies query character strings on the basis of spaces and double quotation marks(") and then, stores them in the lists. And it provides a group of functions connected with the matching tests and display of target character strings. —- Example —- Query Input: I am a "pretty girl" —————– | | V V —- qArgMake() —- qlist[0] = I qlist[1] = am qlist[2] = a qlist[3] = pretty girl qlist[4] = NULL Return: 4 (4 Tokens) ——————– | | V V —- qArgPrint() —- ‘I’ (1 bytes) ‘am’ (2 bytes) ‘a’ (1 bytes) ‘pretty girl’ (11 bytes) ——————— | | V V —- qArgMatch() —- Target String: Hi, I’m a pretty boy. Are you pretty girl? = = = = =========== 0 0 2 2 3 Return: 3 (3 matches: qlist[0], qlist[2], qlist[3]) ——————— | | V V —- qArgEmprint() —- Target String..: Hi, I’m a pretty boy. Are you pretty girl? Result………: Hi, I’m a pretty boy. Are you pretty girl? = = = = =========== 1 2 3 4 5 Return: 5 (5 matches) ———————– |
Example: |
Syntax: | int qArgMatch(char *str, char **qlist); |
Function: | Performs token-matching tests without distinguishing lowercase/uppercase letters. |
Return: | Returns the number of tokens found in a specific character string. |
Note: | Counts only once the same tokens even if they are matched repeatedly. Refer to the return value of qArgemprint() for the total matching counts in a character string including repeated matchings. Being divided into a hundred parts by the total number of the tokens acquired at qArgMake(), these values can be used for calculating the search accuracy. |
Example: |
Syntax: | int qArgEmprint(int mode, char *str, char **qlist); |
Function: | Bold-prints the parts matched with tokens in a character string. This does not distinguish lowercase/uppercase letters. |
Return: | Returns the number of tokens found in a character string. And unlike qArgMatch(), this returns all the matching counts including repeated matchings. |
Note: | The mode value is same as that of qPrintf(). For a general purpose, 1 can be generally used. |
Example: |
Syntax: | int qArgPrint(char **qlist); |
Function: | Displays all the tokens interpreted for debugging programs. |
Example: |
Syntax: | void qArgFree(char **qlist); |
Function: | Deallocates qlist which memory is allocated to. |
Example: |
Syntax: | void qContentType(char *mimetype); |
Function: | Prints MimeType. |
Note: | Executed only once even if it is called many times. |
Example: |
Syntax: | int qGetContentFlag(void); |
Function: | Check execution of qContentType(). |
Return: | If qContentType() is executed before, returns 1. Or returns 0. |
Example: |
Syntax: | void qResetContentFlag(void); |
Function: | Sets the internal flag of qContentType() to the initial status. |
Note: | qContentType() is executed only once even if it is called many times. When you need to forcibly display it again, call qContentType() after executing qResetContentFlag(). |
Example: |
Syntax: | void qRedirect(char *url); |
Function: | Jumps to a specific page using the Location: headers of HTTP. |
Note: | Since qRedirect uses the HTTP headers, qConteneType() should be the only command that streams out in the corresponding process. |
Example: |
Syntax: | void qJavaScript(char *format, …); |
Function: | Print out some JavaScript code. |
Note: | It will print out below codes. <script language="JavaScript"> YOUR CODES HERE </script> |
Example: |
Syntax: | char *qURLencode(char *str); |
Function: | Encodes character strings in URL. |
Return: | The character strings encoded in URL are returned with memory allocation. Deallocation(free) needs to be done by users. |
Note: | It does not encode ‘@’, ‘.’, ‘/’, ”, ‘-‘, ‘_’, ‘:’ characters. |
Example: |
Syntax: | char *qURLdecode(char *str); |
Function: | Decodes the character string that is URL-encoded into %xx. |
Return: | Decoded string pointer. |
Note: | It stores decoded string into str directly. |
Example: |
Syntax: | char *qMD5Str(char *string); |
Function: | Calculate a message-digest fingerprint (checksum) for a string. |
Return: | String pointer of 32 bytes fingerprint. |
Note: | The return string pointer is declared as static inside the functions instead of being returned with memory allocation. This is to remove the inconvenience that users have to free() memory every tiem. Accordingly, it should be noted that the previous value is deleted whenever the functions are performed. And you should not modify or free() it directly. |
Example: |
Syntax: | char *qMD5File(char *string); |
Function: | Calculate a message-digest fingerprint (checksum) for a file. |
Return: | String pointer of 32 bytes fingerprint. |
Note: | The return string pointer is declared as static inside the functions instead of being returned with memory allocation. This is to remove the inconvenience that users have to free() memory every tiem. Accordingly, it should be noted that the previous value is deleted whenever the functions are performed. And you should not modify or free() it directly. |
Example: |
Syntax: | unsigned int qFnv32Hash(char *str, unsigned int max); |
Function: | This function will be released at 8.1R |
Syntax: | void qPuts(int mode, char *buf); |
Function: | Same as that of qPrintf() except that arguments cannot be transmitted by formats. |
Note: | since the given argument of buf is modified, constant character strings(ex: str = "character string") or the variables that need to be used again should not be displayed in qPuts(). The reason why qPuts() exists is that there is no limitation to the length of argument strings unlike in qPrintf() and that the speed is a bit faster because the strdup() function is not used. The character strings transmitted to arguments are transformed. Accordingly if a constant character string like qPuts(mode, "character string"); is used, errors occur. In this case, copy the arguments as example. |
Example: |
Syntax: | char *qRemoveSpace(char *str); |
Function: | Removes white spaces(including CR, LF) before and after character strings. |
Return: | In case of success, returns the pointer of character strings. In case of failure, returns NULL. |
Note: | If this is used like qRemoveSpace("character string");, errors may occur. In this case, copy the arguments as example. |
Example: |
Syntax: | char *qRemoveTailSpace(char *str); |
Function: | This function will be released at 8.1R |
Syntax: | char *qStrReplace(char *mode, char *srcstr, char *tokstr, char *word); |
Function: | Transposes character strings and tokens for character strings. |
Return: | Transposed string pointers. |
Note: | The ‘mode’ argument is a character string consisting of two separate characters like "sr". The first character defines the transposition method, and ‘t’ or ‘s’ can be located in its place. ‘t’ stands for [t]oken. It compares the source character string of srcstr using each character of the tokstr character string as tokens and transposes matching characters into the word character strings. ‘s’ stands for [s]tring. Using the tokstr string itself as the token, it transposes into the word character string the tokstr matching character strings appearing inside the source strings. The second character represents the record type of transposed character strings, and ‘n’ and ‘r’ can be used in its place. ‘n’ stands for [n]ew. It makes the corresponding pointers returned by storing the transposed result character strings in a new memory space. Accordingly, the source string should maintain its original state, and the corresponding memory should be free() from the user aspect. ‘r’ stands for [r]eplace and means overwriting the transposition results on srcstr. Here, srcstr is assumed to allow some leeway (it’s not reallocatied for convenience sake). This should be noted when the [r]eplace mode is to be used. As a result, the ‘mode’ argument has 4 possible occasions of assembly as follows: Mode "tn" : [t]oken transposition & stores results in a [n]ew space and returns Mode "tr" : [t]oken transposition & [r]eplaces the string itself Mode "sn" : [s]tring transposition & stores results in a [n]ew space and returns Mode "sr" : [s]tring transposition & [r]eplaces the string itself |
Example: |
Syntax: | int qStr09AZaz(char *str); |
Function: | Checks to see if character strings consist of 0-9, A-Z, a-z. |
Return: | If the condition is satisfied, return 1. If not, return 0. |
Example: |
Syntax: | char *qStrupr(char *str); |
Function: | Converts into uppercase letters the character strings given in arguments. |
Return: | The pointer of the pertinent characher string. |
Example: |
Syntax: | char *qStrlwr(char *str); |
Function: | Converts into lowercase letters the character strings given in arguments. |
Return: | The pointer of the pertinent characher string. |
Example: |
Syntax: | char *qStristr(char *big, char *small); |
Function: | Same as that of the strstr() function. But makes a comparison without distinguishing lowercase/uppercase letters. |
Return: | Same as that of strstr(). |
Example: |
Syntax: | int qStricmp(char *s1, char *s2); |
Function: | Same as that of the strcmp() function. But this does not distinguish lowercase/uppercase letters. |
Return: | Same as that of strcmp(). |
Example: |
Syntax: | int qStrincmp(char *s1, char *s2, size_t len); |
Function: | Same as that of the strncmp() function. But this does not distinguish lowercase/uppercase letters. |
Return: | Same as that of strncmp(). |
Example: |
Syntax: | char *qitocomma(int value); |
Function: | Converts numeric characters into comma character strings. |
Return: | The string pointer converted into characters. |
Note: | The return string pointer is declared as static inside the functions instead of being returned with memory allocation. This is to remove the inconvenience that users have to free() memory every tiem. Accordingly, qitocomma() comes to return the same string pointer every time. And it should be noted that the previous value is deleted whenever the functions are performed. |
Example: |
Syntax: | char *qStrcat(char str, char *format, …); |
Function: | This function will be released at 8.1R |
Syntax: | char *qStrdupBetween(char *str, char *start, char *end); |
Function: | This function will be released at 8.1R |
Syntax: | FILE *qfopen(char *path, char *mode); |
Function: | Open file with file lock. |
Return: | Same as fopen(). |
Note: | A file which is opened by qfopen() must be closed by qfclose(). |
Example: |
Syntax: | int qfclose(FILE *stream); |
Function: | Close the file stream which is opened by qfopen(). |
Return: | Same as fclose(). |
Syntax: | int qCheckFile(char *format, …); |
Function: | Identifies the existence of files. |
Return: | If files exist, return 1. If not, return 0. |
Note: | When files cannot be accessed due to "permission", it judges that there is no file. |
Example: |
Syntax: | int qCatFile(char *format, …); |
Function: | Displays the contents of files. |
Return: | In normal cases, the number of displayed characters. In case of errors, returns -1. |
Example: |
Syntax: | char *qReadFile(char *filename, int *size); |
Function: | Returns pointers after it reads files and stores them in memory. |
Return: | In normal cases, returns string pointers. In case of errors, returns NULL. |
Note: | When memory is allocated to qReadFile, additional 1 byte needs to be allocated (1 byte more than the actual file size) for string termination character ‘ |