#include #include #include #include #include #include using namespace std; int printusage(int,const char *const *argv,const char *message=NULL){ if(message)cout<=0))return 0; vol+=inc; if(vol<0)vol=0; if(vol>100)vol=100; return setvolume(vol); } int interact(bool &m,int &vol){ char c=cin.get(); if(c=='q'||c=='Q'||c=='\n'||c=='\r')return 1; if(c=='0')return incvol(vol,-100); if(c>='0'&&c<='9'){ cout<<' '<'9'){ cout<<'\x07'; c=cin.get(); continue; } if(10*v+c-'0'>100){ v=100; displayslider(m,vol); cout<<" 100\x07"<2)return printusage(argc,argv); if(argc==2){ if(argv[1][0]=='\0')return printusage(argc,argv,"Invalid volume format"); if(strcmp(argv[1],"m")==0){ setmuted(!getmuted()); return 0; } char *endp; const int vol=strtol(argv[1],&endp,10); if(*endp!='\0')return printusage(argc,argv,"Invalid volume format"); if(vol<0||vol>100)return printusage(argc,argv,"Volume argument not in range"); return setvolume(vol); } if(!isatty(1)){ cout<