playing.cshout_toolsのplaylist.cと同様にコンパイルして、playing.cgiを作ります。/* ==[ playing.c ]====================================================== */ /* */ /* a part of the icecast shout_tools package by nathan strom */ /* */ /* contact e-mail: nstrom@andrew.cmu.edu */ /* url: http://www.andrew.cmu.edu/~nstrom/ */ /* */ /* ====================================================================== */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /* */ /* ====================================================================== */ /* last updated: 07-01-2001 */ /* ====================================================================== */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define PLAYING_C_VERSION "0.01.0001" #define MAX_LINE_LEN 255 /* modify the next line to point to your default playlist file */ #define PLAYING_FILE "/var/shout/shout.playlist" int main() { FILE *in_file; char s[MAX_LINE_LEN]; int i = 0; /* cgi header */ printf("Content-Type: text/html\n\n"); /* enter your own html header here, if desired. */ printf("<html><hea><title>Now Playling</title></head>"); printf("<META http-equiv=Content-Type ;"); printf(" content=text/html;"); printf(" charset=UTF-8>"); printf("<body bgcolor=#ffffff>"); printf("<hr WIDTH=100%><br>\n"); printf("Click on the number next to a song to remove it.<br><pre>"); in_file = fopen(PLAYING_FILE, "r"); while(fgets(s, MAX_LINE_LEN, in_file) != NULL) { i++; s[strlen(s)-1] = '\0'; printf("<a style='text-decoration:none;' href=/cgi-bin/remove.cgi?id=%i>%4i</a>%s\n", i, i, s); } fclose(in_file); /* change the next line if you want to insert a custom html footer */ printf("</pre><hr>"); printf("<A HREF='cue.cgi'>What's now playing</a> "); printf("<A HREF='playlist.cgi'>Playlist</a><br>"); printf("</body></html>"); return(0); } 一応、Mekefileも作りました。 CCC = gcc CCFLAGS = -O2 all: playing playing: ${CCC} ${CCFLAGS} -o playing.cgi playing.c clean: rm -f *.o playing.cgi |