_changepwd.c

来自「多用户银行系统」· C语言 代码 · 共 42 行

C
42
字号
#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 + =
减小字号Ctrl + -
显示快捷键?