基于socket的一个读取文件内容,发送短信的小功能
包括日志级别设置、功能选择等小结构,闲来无事可以看看。
int main(int argc, char **argv)
{
	DIR * dir;
	struct dirent * ptr;
	int i;
	char filename[100];
	int ch;
	int iPid;
	opterr = 0;
	while((ch = getopt(argc,argv,"d:f:L:l:h:p:"))!= -1){
		switch(ch){
		case 'd':
			workdir = (char *)strdup(optarg);
			break;
		case 'f':
			srcdir = (char *)strdup(optarg);
			break;
		case 'L':
			logdir = (char *)strdup(optarg);
			break;
		case 'l':
			loglevel = atoi(optarg);
			if((loglevelL_ERROR)){
				printf("日志级别设置错误\n");
				return -1;
			}
			break;
		case 'h':
			addr = (char *)strdup(optarg);
			break;
		case 'p':
			port = atoi(optarg);
			break;
		default:
			usage();
			return -1;
		}
	}
                                    
                                    
                                        
                                            1