============================================================================== ------------[ BFi numero 8, anno 3 - 30/04/2000 - file 27 di 28 ]------------- ============================================================================== -[ MiSCELLANE0US ]------------------------------------------------------------ ---[ C0FFEE-WARE -----[ pIGpEN > Cos'e' il COFFEE-WARE ? Il COFFE-WARE e' una derivazione del BEER-WARE di Poul-Henning Kamp celebre sviluppatore di FreeBSD... > A cosa serve ? Principalmente e' una protesta contro la Natura stessa che ci ha dato una piantina cosi' nociva per il pancreas ed il fegato, ma nello stesso tempo cosi' indispensabile a stimolare e ad aggiornare la tabella di routing del nostro sistema nervoso... > Si ti capisco ... E allora partecipa pure tu al COFFEE-WARE utilizzando questo header nei tuoi sorgenti... <-| coffee.c |-> /* * Name: Coffee Beta 1 * Date: Mon Jan 31 19:05:04 2000 * Author: pIGpEN [pigpen@s0ftpj.org, deadhead@sikurezza.org] * * SoftProject Digital Security for Y2K (www.s0ftpj.org) * Sikurezza.org Italian Security MailingList (www.sikurezza.org) * * COFFEE-WARE LICENSE - This source code is like "THE BEER-WARE LICENSE" by * Poul-Henning Kamp but you can give me in return a coffee. * * Tested on: FreeBSD 4.0-19990705-CURRENT FreeBSD 4.0-19990705-CURRENT #6 i386 */ #include #include #include #define YES_SYSTEM #define COFFEE_WARE \ "COFFEE-WARE LICENSE - This source code is like \"THE BEER-WARE LICENSE\" by\n * Poul-Henning Kamp but you can give me in return a coffee." #define AUTHOR \ "Dino Sauro [dinosauro@caffeinomane.it]" #define SPOT \ "Dino Sauro Protezione Animali Antichi Srl" #define SPOT_1 \ "Associazione Recupero Organi" #define BUFFER 500 int main(int count, char **arg) { FILE *origin, *dest; char date[60], name[60]; #ifdef YES_SYSTEM struct utsname mysys; #endif time_t now = time(NULL); char buffer[BUFFER]; int i; if(count!=3) { printf("COFFEE-WARE (c) pIGpEN\n\n"); printf("Usage: %s \n", arg[0]); exit(0); } if( !(origin = fopen(arg[1], "r")) ) { printf("Source File Not Found\n"); exit(-1); } if( !(dest = fopen(arg[2], "w")) ) { printf("Destination file not Found\n"); exit(-1); } strftime(date, 60, "%a %h %d %H:%M:%S %G", localtime(&now)); printf("Name: "); for(i=0; i<60; i++) { name[i] = (unsigned char) getchar(); if(name[i] == '\n') break; } name[i] = '\0'; fprintf(dest,"/*\n"); fprintf(dest," * Name: %s\n", name); fprintf(dest," * Date: %s\n", date); fprintf(dest," * Author: %s\n", AUTHOR); fprintf(dest," *\n"); fprintf(dest," * %s\n", SPOT); fprintf(dest," * %s\n", SPOT_1); fprintf(dest," *\n"); fprintf(dest," * %s\n", COFFEE_WARE); fprintf(dest," *\n"); #ifdef YES_SYSTEM uname(&mysys); fprintf(dest," * Tested on: %s %s %s %s\n", mysys.sysname, mysys.release, mysys.version, mysys.machine); #endif fprintf(dest," */\n\n\n"); while(fgets(buffer, sizeof(buffer), origin)) { fputs(buffer, dest); } fclose(origin); fclose(dest); return (0); } <-X-> > Come si usa ? Devi modificare AUTHOR, SPOT, SPOT_1 con i tuoi dati... Fatto cio' la sintassi e' semplice... Es: coffee utmp.c utmpedit.c Name: An utmp editor E automaticamente ti genera l'header con i dati della tua macchina e l'ora corrente ... > E cosa capisco dalla vita ? Principalmente capisci che ci sono altri che soffrono della tua stessa dipendenza... avrai diritto ad una tazza di caffe' se chi usa il sorgente vorra' pagartela... bye pIGpEN ============================================================================== --------------------------------[ EOF 27/28 ]--------------------------------- ==============================================================================