📄 _changepwd.c
字号:
#include "../include/structs.h"#include "../include/stddef.h"#include <stdio.h>#include <unistd.h>#include "changepwd.h"#include <signal.h>void _changepwd(int p){ SHM shm = SHM.SWAP[p]; USER *user; user = (USER *)sizeof(USER); user = readdb(shm->inta,USER *user); int ptr1; int ptr2; while(1){ ptr1 = strcmp(shm->chara,user->pwd); if(ptr1==0){ while(1){ ptr2 = strcmp(shm->charb,shm->chrc); if(ptr2==0){ //strcpy(user->pwd,shm->charb); strcpy(shm->chard,"the new pwd is changed!"); printf("the new pwd is:%d\n",user->pwd); updatedb(user->name,shm->charb,shm->inta,user->money); sigqueue(shm->cpid,SIGRQST,sig); break; }else{ printf("your inputs is different\n"); strcpy(shm->chard,"your inputs is different!"); sigqueue(shm->cpid,SIGRQST,sig); break; } } break; }else{ printf("the old pwd is wrong"); strcpy(shm->chard,"the old pwd is wrong!"); sigqueue(shm->cpid,SIGRQST,sig); break; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -