栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

操作系统实验

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

操作系统实验

主要是模仿了linux的风格,还比较好写
本来应该先画图再写,但是画图似乎比编程本身还要繁琐
于是不经意间就写完了

大概是符合要求了

//cyc
#include
using namespace std;
typedef pair pii;

const int maxn = 1e5+5;
map usr_privilege;
map usr_password;
string password,username,current_location;
int privilege=-2;
int step_num=2;
map file_location_phi;
vector file_tree[maxn];
map isdir;
map privilege_required;
map file_contain;
bool login_module()
{
    cout<<"enter your username:";
    cin>>username;
    if(!usr_password.count(username))
    {
        cout<<"the user doesn't exist"<>password;
    if(password!=usr_password[username])
    {
        cout<<"wrong password"<>cmd;
        if(cmd == "exit")
        {
            goto JUMP1;
        }
        if(cmd=="ls")
        {
            int phi_location=file_location_phi[current_location];
            for(string it:file_tree[phi_location])
            {
                cout<>to_location;
            if(to_location[0]!='/')
            {
                to_location=current_location+"/"+to_location;
            }
            if(!file_location_phi.count(to_location))
            {
                cout<<"No such file or directory"<>new_filename;
            string abs_filename=current_location+"/"+new_filename;
            if(file_location_phi.count(abs_filename)){
                cout<<"file already exists"<>new_pathname;
            string abs_pathname=current_location+"/"+new_pathname;
            if(file_location_phi.count(abs_pathname)){
                cout<<"path already exists"<>filename;
            int phi_location;
            phi_location=file_location_phi[filename];
            if(filename[0]!='/')
            {
                filename=current_location+"/"+filename;
            }
            if(!file_location_phi.count(filename))
            {
                cout<<"No such file or directory"<>filename;
            int phi_location;
            phi_location=file_location_phi[filename];
            if(filename[0]!='/')
            {
                filename=current_location+"/"+filename;
            }
            if(!file_location_phi.count(filename))
            {
                cout<<"No such file or directory"<>overwrite;
                file_contain[phi_location]=overwrite;
            }
        }
        //only for the admin who can reset the privilege
        else if(cmd=="protect")
        {
            string filepath;
            cin>>filepath;
            if(filepath[0]!='/')filepath=current_location+"/"+filepath;
            if(!file_location_phi.count(filepath))
            {
                cout<<"path doesn't exist"<>name>>psw>>privi;
            usr_privilege[name]=privi;
            usr_password[name]=psw;
            cout<
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/599344.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号