No luck compiling..Could it be because of the changed header file? Instead of stdlib.h the previous one used ncursors.h.... Heres the o/p:-
gcc -o new new1.c -lncurses
new1.c: In function `reallyexit':
new1.c:24: too few arguments to function `exit'
new1.c:39:14: warning: multi-line string literals are deprecated
new1.c: In function `main':
new1.c:105: warning: return type of `main' is not `int'
#include <stdlib.h>
#include <curses.h>
#include <string.h>
void cprintw(char text[80],int line)
{
int row;
int col;
getmaxyx(stdscr,row,col);
mvprintw(line,(col-strlen(text))/2,text);
}
void reallyexit()
{
char option;
printw("Are you sure you want to exit Y/N [n]\n");
option = getch();
switch(option)
{
case 'y':
case 'Y':
endwin();
exit();
break;
}
}
void menu()
{
char option;
char url[512];
char command[512]="wget";
cprintw("Wget Interactive Download Script",3);
mvprintw(5,0,"Please select the type of download\n\n
Num Description\n");
printw("1 Download a normal file\n");
printw("2 Mirror Website\n");
printw("3 Mirror Website (2 Levels)\n");
printw("4 Mirror Website (3 Levels)\n");
printw("5 Mirror Website (4 Levels)\n");
printw("6 Download files, specified by *.ext\n");
printw("7 Download files, specified by by *.ext (alternative method)\n");
printw("8 Continue unfinished download\n");
printw("x Exit\n");
option = getch();
scanw(url);
switch (option)
{
case '1':
strcat(command,url);
system(command);
break;
case '2':
strcat(command," -r");
system(command);
break;
case '3':
strcat(command," -r -l2");
strcat(command,url);
system(command);
break;
case '4':
strcat(command," -r -l3");
break;
case '5':
strcat(command,url);
strcat(command," -r -l4");
break;
case '6':
strcat(command,url);
system(command);
break;
case '7':
strcat(command,url);
strcat(command,"-r -l1 --no-parent -A.gif");
break;
case '8':
strcat(command,url);
strcat(command,"wget -nc -r");
break;
case 'x':
reallyexit();
break;
}
printw("press any key to continue");
clear();
}
void main()
{
WINDOW *mywindow;
mywindow = initscr();
noecho();
printw("Press any key to continue");
getch();
clear();
while(1)
menu();
}