Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

cgisetheader(3) [debian man page]

cgiSetHeader(3) 						Programmer's Manual						   cgiSetHeader(3)

NAME
cgiSetHeader - Specify an additional HTTP header SYNOPSYS
#include <cgi.h> int cgiSetHeader (char *name, char *value); DESCRIPTION
With the cgiSetHeader routine you may specify additional HTTP header lines such as Expires: or Pragma:. The order of header lines withing the HTTP header has no significance. You may call this routine multiple times to set multiple headers. They will be printed in the same order as specified, however, after the Content-type: header. This routine will only add the header to the internal stack, not print it. They will be printed by cgiHeader(3). This routine does some syntax checking before accepting a new header. The name of a header must not contain any newline, space or colon, otherwise it will be truncated. The value must not contain any newline, otherwise it will be truncated as well. To set a cookie in your program you'll need to manually add additional header lines. Please take a look at cgitest.c. Basically, you'll need to add the following code: cgiSetHeader ("Set-Cookie", "Version=1; name=value; Path=/"); cgiHeader(); Please read the included file cookies.txt as well. RETURN VALUE
On success 1 is returned, otherwise 0. AUTHOR
This CGI library is written by Martin Schulze <joey@infodrom.org>. If you have additions or improvements please get in touch with him. SEE ALSO
cgiHeader(3), cgiGetCookies(3), cgiGetCookie(3), cgiInit(3). CGI Library 6 April 2008 cgiSetHeader(3)

Check Out this Related Man Page

cgiGetCookie(3) 						Programmer's Manual						   cgiGetCookie(3)

NAME
cgiGetCookie - Return a cookie SYNOPSYS
#include <cgi.h> s_cookie *cgiGetCookie (s_cgi *parms, const char *name); DESCRIPTION
This routine returns a pointer to a s_cookie structure that contains all values for the cookie as referenced by name. The pointer must not be freed. The s_cookie structure is declared as follows: typedef struct cookie_s { char *version, *name, *value, *path, *domain; } s_cookie; Memory allocated by this data structure is automatically freed by the final call to cgiFree(3). To set a cookie in your program you'll need to manually add additional header lines. Please take a look at cgitest.c. Basically, you'll need to add the following code: cgiSetHeader ("Set-Cookie", "Version=1; name=value; Path=/"); cgiHeader(); Please read the included file cookies.txt as well. RETURN VALUE
On success a pointer to a s_cookie structure is returned. If no cookie was set or no cookie with a given name exists NULL is returned. AUTHOR
This CGI library is written by Martin Schulze <joey@infodrom.org>. If you have additions or improvements please get in touch with him. SEE ALSO
cgiGetValue(3), cgiGetVariables(3), cgiGetCookies(3), cgiDebug(3), cgiHeader(3), cgiInit(3), cgiFree(3). CGI Library 6 April 2008 cgiGetCookie(3)
Man Page

13 More Discussions You Might Find Interesting

1. Programming

conio.h

I am aware that there is this header file named conio.h that works with functions like getche() . This header is not included in my linux OS (Redhat 7.0). Is there an equivalent header that does the same thing with the gcc library of headers, or is there a place to obtain a copy of the library... (2 Replies)
Discussion started by: cantcatchme
2 Replies

2. UNIX for Dummies Questions & Answers

How to retain the header information of a file

Hi, I am using Bash shell to create some data and these data would be piped out to a file, let say output.txt. This output.txt I would like to add some extra header information such as comments, descriptions and general information on the text. I would like to know how could I maintain... (0 Replies)
Discussion started by: ahjiefreak
0 Replies

3. Shell Programming and Scripting

Inserting a String in a file header.

Dear all, I have a file created in the name sample.txt in UNIX with header and footer. How to insert a required string (for example "FILE1") in the header part after the file has been created. What kind of command can i use to do the same. Thanks in advance Hari (3 Replies)
Discussion started by: Hari123
3 Replies

4. Shell Programming and Scripting

PERL: add string to multiple lines

Dear all, I am stuck while trying to add a string to multiple lines. Let me try to explain using an example: Input: -------- myExample_send ("MasterSends", n, "Data Type", MPI_INT); correct Output:... (4 Replies)
Discussion started by: bonny
4 Replies

5. UNIX for Dummies Questions & Answers

Add a header to a sort file instruction

Hello, I have a header which I have to add to a sorted file, however if I use cat header sortedfile > newfile, the operation takes 2 minutes as the sorted file is over 400mb. I have noticed that when I sort the 400mb unsorted file, this only takes 14 seconds to create the output. As... (2 Replies)
Discussion started by: clarcombe
2 Replies

6. Shell Programming and Scripting

AIX Korn shell sed -s problem

In a Korn shell script I have, cat ../header | sed -e 's/flag1/$cnumb/g' > header.txt The header is short {{Company flag1}} But the result in header.txt is {{Company $cnumb}} The value of $cnumb is 120. I am trying to get the value of $cnumb into the header. I have tried /'$cnumb'/g,... (10 Replies)
Discussion started by: jcarrott
10 Replies

7. Shell Programming and Scripting

Adding header once every 5 lines

Hi, I need a help in creating a report file. The input file is like this 1 A 2 B 3 V 4 X 5 m 6 O 7 X 8 p 9 a 10 X There is a header which i have to print & save the result as a output file. The header has multiple lines on is like say: New New S.No Name (15 Replies)
Discussion started by: aravindan
15 Replies

8. Shell Programming and Scripting

editing files.

hello, i have a problem. suppose file.txt i want to add lines over those lines in a file if it starts and ends with how and "?" respectively. i want output like output file.txt thanks (4 Replies)
Discussion started by: yashwantkumar
4 Replies

9. Shell Programming and Scripting

adding header in a file

Hi team, In my script i am storing some value in a variable "header". I want to add the header value has header in a file. Please help me on this Thanks in advance, Baski (4 Replies)
Discussion started by: baskivs
4 Replies

10. UNIX for Dummies Questions & Answers

Help with changing header of tsv with 30 million lines

Hi My 30 million line file has a header chr start end strand ref_context repeat_masked s1_smpl_context s1_c_count s1_ct_count s1_non_ct_count s1_m% s1_score s1_snp s1_indels s2_smpl_context s2_c_count s2_ct_count s2_non_ct_count s2_m% s2_score s2_snp s2_indels ... (2 Replies)
Discussion started by: plumb_r
2 Replies

11. Shell Programming and Scripting

Insert a header record (tab delimited) in multiple files

Hi Forum. I'm struggling to find a solution for the following issue. I have multiple files a1.txt, a2.txt, a3.txt, etc. and I would like to insert a tab-delimited header record at the beginning of each of the files. This is my code so far but it's not working as expected. for i in... (2 Replies)
Discussion started by: pchang
2 Replies

12. Shell Programming and Scripting

Add unique header to multiple lines

I have a file of lines with the following format: AACCCGTAGATCCGAACTTGTG ACCCGTAGATCCGAACTTGTG CCGTAGATCCGAACTTGTG CGTAGATCCGAACTTGT I want to give a header to each line, using awk, where the header is equal to the line that follows, like this: >AACCCGTAGATCCGAACTTGTG ... (2 Replies)
Discussion started by: Palgrave
2 Replies

13. Shell Programming and Scripting

Python DictWriter header - not writing in first line of existing file

Hello I am facing a very unique problem and not able to understand why. I have written a function which will check header of the file. If header is present good else it will write the header on top def writeHeaderOutputCSV(fileName): # See if the file exist already try: ... (0 Replies)
Discussion started by: radioactive9
0 Replies