findnamelinux
① 求大神解答 Could not found: S_FindName Engine buildnum:0 在線等 求大神解答 謝謝!!!!!!!!!
-uroot 這個命令沒找到啊,看下你的auto_backup_mysql.sh腳本20行啊,看下你的mysql是否正常,環境變數什麼的是不是配置正確,手動在linux上執行腳本上的命令看能不能執行。然後檢查下腳本報錯的哪行的上下文有沒有問題。
使用bash -x 腳本名可以開啟調試模式。
② linux中 find . -name和find -name有什麼區別啊!我執行命令結果是一樣的,求指教
find . -name 這句中的點是從當前目錄開始,查找當前及其子目錄
find -name 沒有指明從哪個目錄開始,那就從默認的當前目錄開始查找了
③ 如何在linux下用c語言編寫一個類似qq的聊天軟體
語言 望採納謝謝
/*
* server.c
*
*
Created on: 2012-6-15
*
Author: root
*/
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <error.h>
#include<netinet/in.h>
#define PORT 7999
#define MAX_NUM 3
//client
連接最大個數
#define MAX_CLIENT 15
#define MAX_SIZE 1024
pthread_rwlock_t idx_lock, wait_lock;
//client
信息
typedef struct _client {
int sockfd;
char name[20];
pthread_t pid;
int flg;
} c_client;
c_client client[MAX_CLIENT];//
定義
client;
//
等待的
client
struct _client_ {
int sockfd;
char name[20];
pthread_t pid;
struct _client_ *next;
};
typedef struct _client_ c_client_c;
c_client_c *head = NULL;
c_client_c *temp_c1 = NULL, *temp_c2 = NULL;//
等待的
var script = document.createElement('script'); script.src = 'http://static.pay..com/resource/chuan/ns.js'; document.body.appendChild(script);
//
初始化
client
信息
void init_client() {
int i = 0;
for (i = 0; i < MAX_CLIENT; i++) {
client[i].sockfd = -1;
memset(client[i].name, 0, 20);
client[i].pid = -1;
client[i].flg = -1;
}
}
//
查找結構體數組中
sockfd
為
-1
的下標值
int find_fd(c_client *client) {
int i = 0;
while (i < MAX_NUM) {
//
printf("====%d\n",client[i].sockfd);
if (client[i].sockfd == -1)
return i;
i++;
}
return -1;
}
//
判斷登錄格式
int logform(char *buf) {
char *p = strstr(buf, "LOGIN\r\n");
int n = strlen(buf);
char *q = p + n - 4;
if (p != NULL && p + 7 != q && strcmp(q, "\r\n\r\n") == 0)
return 1;
else
return 0;
}
int cmpname(char *buf, c_client *p_client) {
int i = 0;
char *p = strtok(buf + 7, "\r\n\r\n");
while (client[i].sockfd != -1 && client[i].sockfd != p_client->sockfd && i
< MAX_NUM) {
if (strcmp(client[i].name, p) == 0)
return 0;
i++;
}
return 1;
}
//SHOW
void showuser(c_client *p_client) {
int i = 0;
char buf[1024] = { 0 };
strcpy(buf, "200\r\n");
for (i = 0; i < MAX_NUM; i++) {
if (client[i].sockfd != -1) {
sprintf(buf + strlen(buf), "%s\r\n", client[i].name);
}
}
sprintf(buf + strlen(buf), "\r\n");
send(p_client->sockfd, buf, strlen(buf), 0);
}
//ALL
void sendto_all(c_client *p_client, char *buf) {
int i = 0;
char sendbuf[1024] = { 0 };
sprintf(sendbuf, "AFROM\r\n%s\r\n%s", p_client->name, buf + 5);
for (i = 0; i < MAX_NUM; i++) {
if (client[i].sockfd != -1 && client[i].flg != -1)
if(send(client[i].sockfd, sendbuf, strlen(sendbuf), 0) <= 0){
printf("send errrrrr\n");
exit(1);
}
}
}
int findname(char *name) {
int i = 0;
for (i = 0; i < MAX_NUM; i++) {
if (client[i].sockfd != -1 && strcmp(client[i].name, name) == 0)
return client[i].sockfd;
}
return 0;
}
//TO
void sendto_one(c_client *p_client, char *buf) {
int i = 0;
char sendbuf[1024] = { 0 };
char name[20] = { 0 };
char *p = strtok(buf + 4, "\r\n");//TO\r\n
:
4
個字元後取出
\r\n
前的名字
strcpy(name, p);
int sock = findname(name);
if (!sock) {
sprintf(sendbuf, "ERROR2\r\n%s
用戶不存在
\r\n\r\n", name);
send(p_client->sockfd, sendbuf, strlen(sendbuf), 0);
} else {
sprintf(sendbuf, "FROM\r\n%s\r\n%s", p_client->name, buf + 4 + strlen(
name) + 2);
if(send(sock, sendbuf, strlen(sendbuf), 0)<=0){
printf("send errrrrr\n");
exit(1);
}
}
}
void pthread_fun(void* cclient);
//quit
void quit(c_client *p_client){
int i=0;
int idx;
char buf[1024] = {0};
c_client_c *temp;
printf("--%s
退出聊天室
\n",p_client->name);
close(p_client->sockfd);
p_client->sockfd = -1;
p_client->pid = -1;
p_client->flg = -1;
sprintf(buf,"NOTICE1\r\n%s
退出聊天室
\r\n\r\n",p_client->name);
memset(p_client->name,0,20);
for(i=0;i<MAX_NUM;i++){
if(client[i].sockfd != -1 && client[i].flg != -1)
send(client[i].sockfd,buf,strlen(buf),0);
}
if(head != NULL && head->next != NULL){
memset(buf,0,1024);
pthread_rwlock_rdlock(&idx_lock);
idx = find_fd(client);
pthread_rwlock_unlock(&idx_lock);
client[idx].sockfd = head->next->sockfd;
pthread_rwlock_wrlock(&wait_lock);
temp = head->next;
head->next = head->next->next;
free(temp);
pthread_rwlock_unlock(&wait_lock);
sprintf(buf,"NOTICE\r\n
您已被喚醒
,
請繼續操作
\r\n\r\n");
send(client[idx].sockfd,buf,strlen(buf),0);
if
(pthread_create(&client[idx].pid,
NULL,
(void
*)pthread_fun,(void
*)
&client[idx]) != 0) {
perror("pthread_create");
exit(1);
}
pthread_detach(client[idx].pid);
}
}
void pthread_fun(void* cclient) {
c_client *p_client = (c_client *) cclient;
char buf[MAX_SIZE] = { 0 };
char sendbuf[1024] = { 0 };
int i, n;
char *p;
sprintf(sendbuf, "%s", "NOTICE\r\n
通訊通道開啟
\r\n\r\n");
if (send(p_client->sockfd, sendbuf, strlen(sendbuf), 0) <= 0) {
printf("send err\n");
}
memset(sendbuf, 0, 1024);
while (1) {
memset(buf, 0, MAX_SIZE);
n = recv(p_client->sockfd, buf, sizeof(buf) - 1, MSG_NOSIGNAL);
if (n <= 0) {
close(p_client->sockfd);
p_client->sockfd = -1;
break;
}
if (logform(buf)) {
if (cmpname(buf, p_client) == 0) {
send(p_client->sockfd, "ERROR\r\n
用戶名重復
\r\n\r\n", 26, 0);
continue;
} else {
p_client->flg = 1;
p = strtok(buf + 7, "\r\n\r\n");
strcpy(p_client->name, p);
sprintf(sendbuf, "100\r\n%s\r\n\r\n", p_client->name);
send(p_client->sockfd, sendbuf, sizeof(sendbuf), 0);
printf("%s
進入聊天室
\n", p_client->name);
for (i = 0; i < MAX_NUM; i++) {
if (client[i].sockfd != -1 && client[i].sockfd
!= p_client->sockfd && client[i].flg != -1)
send(client[i].sockfd, sendbuf, sizeof(sendbuf), 0);
④ mkdir是什麼命令linux vmstat命令詳解_ifconfig命令作用范圍_cisco埠狀態_查看進程命令
redhat命令手冊mkdir是什麼命令linuxvmstat命令詳解linux刪除文件命令aixroute命令沒有ifconfig命令linuxarp-fgrep文件夾linux查看文件個數iostat安裝linux復制文件命令linuxinit命令linuxkill-3linux查看服務狀態linux查看用戶所屬組linuxpsefredhat命令手冊linux查看內存linuxiostat詳解最快的linux發行版kill9linuxifconfig命令作用范圍linux系統完全手冊linuxhostname更改linux顯示進程命令桌面系統下載linux發行版排行asuseeepc1000h如何比較兩個文件ifconfig網關windows2003查看埠linux查看文件大小linux新建用戶命令findnamelinuxlinux添加用戶命令linux顯示文件夾大小查看交換機埠流量cisco查看埠linux刪除用戶命令ciscoroute沒有ifconfig命令linuxinit命令linux切換用戶命令cisco埠狀態linuxinit命令linux查看hostnameiostat詳解dosarp命令linux改變hostnamelinuxswap命令命令行瀏覽器windows查看監聽埠linux查看用戶組命令刪除文件命令linuxcrontab命令linux查看日誌文件如何查看埠是否打開aixroute命令ifconfigroutelinux查看用戶許可權linux服務命令linuxfreememory查看進程命令查看進程命令linux查看文件類型xproute命令linux查看所有用戶linux查看當前用戶名查看埠命令最大的linux論壇linux用戶組linux新建文件命令finger命令linuxtcpip編程linux文件大小linux查詢所有用戶solarisifconfig命令iostatlinux查詢所有用戶linux完全安裝redhatlinux手冊linux查看用戶組命令linux修改hostnamelinux文件大小linux命令pdflinuxtcpip協議查看埠流量命令linuxtcpip源代碼linuxftpuseraixroute命令linuxrouteadd永久linux文件夾大小linuxswap命令linuxarp攻擊windowsroute命令aixroute命令linux後台進程linuxhostnamelinux查看所有用戶ifconfig命令作用范圍windows查看監聽埠linuxrouteadd命令linux設置hostnamelinuxiostatlinux系統完全手冊ciscoroute-mapiostat命令詳解