这篇教程C++ user_path函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中user_path函数的典型用法代码示例。如果您正苦于以下问题:C++ user_path函数的具体用法?C++ user_path怎么用?C++ user_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了user_path函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mainint main(object me, string arg){ string msg, loc; object ridee; if( file_size(user_path(geteuid(me)) + "workroom.c") <= 0 ) return notify_fail("你没有自己的工作室。/n"); if( stringp(msg = me->query("env/msg_home")) ) if (msg != "") message_vision(msg + "/n", me); loc = user_path(geteuid(me)) + "workroom"; if (ridee = me->ride()) ridee->move(loc); me->move(loc); return 1;}
开发者ID:cosin,项目名称:XYJ,代码行数:16,
示例2: cmd_sponsorint cmd_sponsor(string str) { object who; if(!str) { notify_fail("Sponsor whom?/n"); return 0; } who = find_living(str); if(!who) { notify_fail("No "+capitalize(str)+" on the mud./n"); return 0; } if((string)who->query_position() != "new immortal") { notify_fail(capitalize(str)+" is still a mortal!/n"); return 0; } if(!archp(this_player()) && (string)this_player()->query_position() != "mentor") { notify_fail("You are not allowed to sponsor anyone!/n"); return 0; } who->set_level(1); seteuid(UID_ADVANCE); who->set_position("immortal"); seteuid(UID_ARCHSAVE); write_file("/adm/etc/sponsor", str+" ("+(string)this_player()->query_name()+ ":"+ctime(time())+")/n"); seteuid(getuid()); message("info", sprintf("You are now a full immortal!/nYour home " "directory is %s.", user_path(str)), who); message("info", sprintf("%s is now a full immortal!", capitalize(str)), users(), ({ who }));
开发者ID:ehershey,项目名称:pd,代码行数:31,
示例3: cmdmixed cmd(string args) { object player = this_player(); mixed replee = player->GetProperty("reply"); string ret = ""; string *tmp; ret += "Screen: /t/t"+identify(this_player()->GetScreen())+"/n"; ret += "Terminal: /t/t"+this_player()->GetTerminal()+"/n"; ret += "Brief mode: /t/t"+ ( (this_player()->GetBriefMode()) ? "on" : "off" )+"/n"; ret += "Cursefilter: /t/t"+ ( (this_player()->GetParanoia("cursefilter")) ? "on" : "off" )+"/n"; ret += "Channel message colors: "+ ( (this_player()->GetNoChanColors()) ? "off" : "on" )+"/n"; ret += "Playerkiller mode: /t"+ ( (this_player()->GetPK()) ? "on" : "off" )+"/n"; ret += "Mute mode: /t/t"+ GetMuted()+" /n"; ret += "Gag mode: /t/t"+ GetGagged()+" /n"; ret += "Wimpy mode: /t/t"+ ( (this_player()->GetWimpy()) ? "on" : "off" )+"/n";#if efun_defined(compressedp) ret += "MCCP mode: /t/t"+(compressedp(this_player()) ? "on" : "off")+"/n";#endif#if MINIMAP ret += "Minimap mode: /t/t"+ ( this_player()->GetProperty("minimapping") ? "on" : "off" )+"/n";#endif ret += "Annoyblock: /t/t"+ ( (this_player()->GetAnnoyblock()) ? "on" : "off" )+"/n"; ret += "Reprompt mode: /t/t"+ ( this_player()->GetProperty("reprompt") ? "on" : "off" )+"/n"; ret += "Screenlock mode: /t"+ ( this_player()->GetProperty("screenlock") ? "on" : "off" )+"/n"; ret += "Timezone: /t/t"+ ( this_player()->GetProperty("timezone") ? this_player()->GetProperty("timezone") : "None specified" )+"/n";#ifdef __GET_CHAR_IS_BUFFERED__ ret += "Charmode: /t/t"+ //( (query_charmode(player) > 0) ? "on" : "off" )+"/n"; ( (player->GetCharmode()) ? "on" : "off" )+"/n";#endif ret += "Commandecho: /t/t"+ ( this_player()->GetProperty("commandecho") ? this_player()->GetProperty("commandecho") : "off" )+"/n";#ifdef __DSLIB__ ret += "Keepalive mode: /t"+ ( this_player()->GetProperty("keepalive") ? this_player()->GetProperty("keepalive") : "off" )+"/n";#endif if(creatorp(this_player())){ ret += "Homedir: /t/t"+user_path(this_player())+"/n"; if(this_player()->GetParanoia("homeroom")){ ret += "Homeroom: /t/t"+this_player()->GetParanoia("homeroom")+"/n"; } ret += "Debug mode: /t/t"+ ( (this_player()->GetProperty("debug")) ? "on" : "off" )+"/n"; ret += "Godmode: /t/t"+ ( (this_player()->GetGodMode()) ? "on" : "off" )+"/n"; ret += "Wizvision: /t/t"+ ( (this_player()->GetWizVision()) ? "on" : "off" )+"/n";#if GRID ret += "Showgrid: /t/t"+ ( (this_player()->GetVisibleGrid()) ? "on" : "off" )+"/n"; ret += "Wizmap mode: /t/t"+ ( this_player()->GetProperty("wizmapping") ? "on" : "off" )+"/n"; ret += "Noclip mode: /t/t"+ ( this_player()->GetProperty("noclip") ? "on" : "off" )+"/n"; ret += "Anchor: /t/t"+ ( this_player()->GetAnchored() ? "on" : "off" )+"/n";#endif } if(replee){ ret += "Reply target: /t/t"+replee+"/n"; } tmp = sort_array(explode(ret, "/n"),1); ret = implode(tmp, "/n"); write(ret); return 1;}
开发者ID:Elohim,项目名称:FGmud,代码行数:59,
示例4: do_sys_truncatestatic long do_sys_truncate(const char __user *pathname, loff_t length){ struct path path; struct inode *inode; int error; error = -EINVAL; if (length < 0) goto out; error = user_path(pathname, &path); if (error) goto out; inode = path.dentry->d_inode; error = -EISDIR; if (S_ISDIR(inode->i_mode)) goto dput_and_out; error = -EINVAL; if (!S_ISREG(inode->i_mode)) goto dput_and_out; error = mnt_want_write(path.mnt); if (error) goto dput_and_out; error = inode_permission(inode, MAY_WRITE); if (error) goto mnt_drop_write_and_out; error = -EPERM; if (IS_APPEND(inode)) goto mnt_drop_write_and_out; error = get_write_access(inode); if (error) goto mnt_drop_write_and_out; error = break_lease(inode, O_WRONLY); if (error) goto put_write_and_out; error = locks_verify_truncate(inode, NULL, length); if (!error) error = security_path_truncate(&path); if (!error) error = do_truncate(path.dentry, length, 0, NULL);put_write_and_out: put_write_access(inode);mnt_drop_write_and_out: mnt_drop_write(path.mnt);dput_and_out: path_put(&path);out: return error;}
开发者ID:kuzetsa,项目名称:B1RB_htc_msm8974,代码行数:59,
示例5: GoHomemixed GoHome(string str) { object ob, prev; string who, room; prev = environment(this_player()); if( !str || str == "" || !creatorp(this_player())){ who = this_player()->GetKeyName(); } else who = lower_case(str); if(!user_exists(who)) return "There's no such user."; room = PLAYERS_D->GetHomeRoom(who); if(!room || !strsrch(room, "/tmp/")){ str = user_path(who, 1); if(!directory_exists(str)) return "That person has no home dir."; str = user_path(who, 1)+"workroom.c"; arg = str; if(!unguarded((: file_exists(arg) :))) return capitalize(who)+" has no active workroom."; }
开发者ID:Elohim,项目名称:FGmud,代码行数:19,
示例6: SYSCALL_DEFINE4SYSCALL_DEFINE4(getxattr, const char __user *, pathname, const char __user *, name, void __user *, value, size_t, size){ struct path path; ssize_t error; error = user_path(pathname, &path); if (error) return error; error = getxattr(path.dentry, name, value, size); path_put(&path); return error;}
开发者ID:khenam,项目名称:ardrone-kernel,代码行数:13,
示例7: SYSCALL_DEFINE3SYSCALL_DEFINE3(listxattr, const char __user *, pathname, char __user *, list, size_t, size){ struct path path; ssize_t error; error = user_path(pathname, &path); if (error) return error; error = listxattr(path.dentry, list, size); path_put(&path); return error;}
开发者ID:khenam,项目名称:ardrone-kernel,代码行数:13,
示例8: mainint main(object me, string arg){ string dir; if( !arg ) arg = user_path(me->query("id")); dir = resolve_path(me->query("cwd"), arg); if(file_size(dir)!=-2) return notify_fail("没有这个目录。/n"); if(dir[strlen(dir)-1]!='/') dir += "/"; me->set("cwd", dir); write(dir + "/n"); return 1; }
开发者ID:szhowardhuang,项目名称:fs2,代码行数:14,
示例9: sys_statfsasmlinkage long sys_statfs(const char __user *pathname, struct statfs __user * buf){ struct path path; int error; error = user_path(pathname, &path); if (!error) { struct statfs tmp; error = vfs_statfs_native(path.dentry, &tmp); if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) error = -EFAULT; path_put(&path); } return error;}
开发者ID:mpalmer,项目名称:linux-2.6,代码行数:15,
示例10: do_sys_truncatestatic long do_sys_truncate(const char __user *pathname, loff_t length){ struct path path; int error; if (length < 0) /* sorry, but loff_t says... */ return -EINVAL; error = user_path(pathname, &path); if (!error) { error = vfs_truncate(&path, length); path_put(&path); } return error;}
开发者ID:adyjl,项目名称:DORIMANX_LG_STOCK_LP_KERNEL,代码行数:15,
示例11: SYSCALL_DEFINE2SYSCALL_DEFINE2(statfs, const char __user *, pathname, struct statfs __user *, buf){ struct path path; int error; error = user_path(pathname, &path); if (!error) { struct statfs tmp; error = vfs_statfs_native(path.dentry, &tmp); if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) error = -EFAULT; path_put(&path); } return error;}
开发者ID:mikeberkelaar,项目名称:grhardened,代码行数:15,
示例12: SYSCALL_DEFINE3SYSCALL_DEFINE3(statfs64, const char __user *, pathname, size_t, sz, struct statfs64 __user *, buf){ struct path path; long error; if (sz != sizeof(*buf)) return -EINVAL; error = user_path(pathname, &path); if (!error) { struct statfs64 tmp; error = vfs_statfs64(path.dentry, &tmp); if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) error = -EFAULT; path_put(&path); } return error;}
开发者ID:mikeberkelaar,项目名称:grhardened,代码行数:17,
示例13: SYSCALL_DEFINE2SYSCALL_DEFINE2(removexattr, const char __user *, pathname, const char __user *, name){ struct path path; int error; error = user_path(pathname, &path); if (error) return error; error = mnt_want_write(path.mnt); if (!error) { error = removexattr(path.dentry, name); mnt_drop_write(path.mnt); } path_put(&path); return error;}
开发者ID:khenam,项目名称:ardrone-kernel,代码行数:17,
示例14: sys_statfs64asmlinkage long sys_statfs64(const char __user *pathname, size_t sz, struct statfs64 __user *buf){ struct path path; long error; if (sz != sizeof(*buf)) return -EINVAL; error = user_path(pathname, &path); if (!error) { struct statfs64 tmp; error = vfs_statfs64(path.dentry, &tmp); if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) error = -EFAULT; path_put(&path); } return error;}
开发者ID:mpalmer,项目名称:linux-2.6,代码行数:17,
示例15: SYSCALL_DEFINE3SYSCALL_DEFINE3(chown, const char __user *, filename, uid_t, user, gid_t, group){ struct path path; int error; error = user_path(filename, &path); if (error) goto out; error = mnt_want_write(path.mnt); if (error) goto out_release; error = chown_common(&path, user, group); mnt_drop_write(path.mnt);out_release: path_put(&path);out: return error;}
开发者ID:boa19861105,项目名称:Blackout-Monarudo,代码行数:18,
示例16: SYSCALL_DEFINE5SYSCALL_DEFINE5(setxattr, const char __user *, pathname, const char __user *, name, const void __user *, value, size_t, size, int, flags){ struct path path; int error; error = user_path(pathname, &path); if (error) return error; error = mnt_want_write(path.mnt); if (!error) { error = setxattr(path.dentry, name, value, size, flags); mnt_drop_write(path.mnt); } path_put(&path); return error;}
开发者ID:khenam,项目名称:ardrone-kernel,代码行数:18,
示例17: sys_chownasmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group){ struct path path; int error; error = user_path(filename, &path); if (error) goto out; error = mnt_want_write(path.mnt); if (error) goto out_release; error = chown_common(path.dentry, user, group); mnt_drop_write(path.mnt);out_release: path_put(&path);out: return error;}
开发者ID:mpalmer,项目名称:linux-2.6,代码行数:18,
示例18: coda_pioctlstatic int coda_pioctl(struct inode * inode, struct file * filp, unsigned int cmd, unsigned long user_data){ struct path path; int error; struct PioctlData data; struct inode *target_inode = NULL; struct coda_inode_info *cnp; /* get the Pioctl data arguments from user space */ if (copy_from_user(&data, (void __user *)user_data, sizeof(data))) { return -EINVAL; } /* * Look up the pathname. Note that the pathname is in * user memory, and namei takes care of this */ if (data.follow) { error = user_path(data.path, &path); } else { error = user_lpath(data.path, &path); } if ( error ) { return error; } else { target_inode = path.dentry->d_inode; } /* return if it is not a Coda inode */ if ( target_inode->i_sb != inode->i_sb ) { path_put(&path); return -EINVAL; } /* now proceed to make the upcall */ cnp = ITOC(target_inode); error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data); path_put(&path); return error;}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:44,
示例19: SYSCALL_DEFINE3SYSCALL_DEFINE3(chown, const char __user *, filename, uid_t, user, gid_t, group){ struct path path; int error; error = user_path(filename, &path); if (error) goto out;//ASUS_BSP +++ Jimmy,Josh "remove fuse" if(strcmp(path.mnt->mnt_mountpoint->d_iname,"sdcard")==0){ error = -ENOSYS; goto out_release; }//ASUS_BSP --- Jimmy,Josh "remove fuse" error = mnt_want_write(path.mnt); if (error) goto out_release; error = chown_common(&path, user, group); mnt_drop_write(path.mnt);out_release: path_put(&path);out: return error;}
开发者ID:SmokyBob,项目名称:android_kernel_asus_padfone2,代码行数:24,
示例20: do_sys_truncatestatic long do_sys_truncate(const char __user *pathname, loff_t length){ struct path path; struct inode *inode; int error; error = -EINVAL; if (length < 0) /* sorry, but loff_t says... */ goto out; error = user_path(pathname, &path); if (error) goto out; inode = path.dentry->d_inode; /* For directories it's -EISDIR, for other non-regulars - -EINVAL */ error = -EISDIR; if (S_ISDIR(inode->i_mode)) goto dput_and_out; error = -EINVAL; if (!S_ISREG(inode->i_mode)) goto dput_and_out; error = mnt_want_write(path.mnt); if (error) goto dput_and_out; error = inode_permission(inode, MAY_WRITE); if (error) goto mnt_drop_write_and_out; error = -EPERM; if (IS_APPEND(inode)) goto mnt_drop_write_and_out; error = get_write_access(inode); if (error) goto mnt_drop_write_and_out; /* * Make sure that there are no leases. get_write_access() protects * against the truncate racing with a lease-granting setlease(). */ error = break_lease(inode, O_WRONLY); if (error) goto put_write_and_out; error = locks_verify_truncate(inode, NULL, length); if (!error) error = security_path_truncate(&path); if (!error) error = do_truncate(path.dentry, length, 0, NULL);put_write_and_out: put_write_access(inode);mnt_drop_write_and_out: mnt_drop_write(path.mnt);dput_and_out: path_put(&path);out: return error;}
开发者ID:boa19861105,项目名称:Blackout-Monarudo,代码行数:63,
示例21: datafilestring datafile(){ return user_path( geteuid( this_object() ) ) + ".memo";}
开发者ID:ClockworkSoul,项目名称:MortalRemains,代码行数:4,
示例22: cmd_updateint cmd_update(string str){ object ob; string file, res, temp, *obs, logf; int i, deep_up, syslog_siz, mylog_siz; if (!str) str = (string)this_player()->query("cwf"); if (!str) { notify_fail("You have no current working file set./n"); return 0; } if ( (strsrch(str,"/std/user#") != -1 ) || ( strsrch(str, "/std/connection#") != -1 ) ) { write("Updating a user or connection object isn't allowed!/n"); return 1; } if (str) // update the specified file { if(sscanf(str, "-r %s", temp)) { file = temp; deep_up = 1; } else if(sscanf(str, "-R %s", temp)) { file = temp; deep_up = 2; } else if(str == "-r") { file = 0; deep_up = 1; } else if(str == "-R") { file = 0; deep_up = 2; } else file = str; } // if(str) if(!file) { if(!environment(this_player())) { notify_fail("Update: You don't have an environment./n"); return 0; } file = file_name(environment(this_player())); } else file = resolv_path("cwd", file); // Make sure that a ".c" is appended on the filename if(extract(file, strlen(file)-2, strlen(file)-1) != ".c") file += ".c"; this_player()->set("cwf",file); logf = (string) this_player()->query("name"); logf=user_path(logf) + "log"; // assume if can use update, has a name mylog_siz = file_size(logf); syslog_siz = file_size(LOG_DIR + "log"); seteuid(geteuid(previous_object()));/* Beek 091993 - doesn't dest virtual objects now */ if (find_object(file) && virtualp(find_object(file))) { notify_fail("That object is virtual and cannot be updated./n"); return 0; } if(!file_exists(file)) { if(find_object(file)) { destruct(find_object(file)); notify_fail("Update: " + file + " does not exist./n/tLoaded " + "copy of file removed from memory./n"); } else notify_fail("Update: " + file + " does not exist./n"); return 0; } ob = find_object(file); if (!ob) { res = catch(file->apply_load()); if(res) { display_errs(mylog_siz, logf); display_errs(syslog_siz, LOG_DIR + "log"); notify_fail("Failure to load object./n"); return 0; } ob = find_object(file); }
开发者ID:Hobbitron,项目名称:tmi2_fluffos_v3,代码行数:96,
示例23: finger_user//.........这里部分代码省略......... tmp1 = "[Private]"; if (adminp(TP) || body->query("name")==TP->query("name")) { tmp1 = (string)link->query("email")+" "+tmp1; } else { if (body->query("email_visible")) { tmp1 = (string)link->query("email"); } else { tmp1 = "[Private]"; } } if (tmp1) msg += "Email address: " + tmp1 + "/n"; tmp1 = (string)link->query("URL"); if (tmp1) msg += "URL: " + tmp1 + "/n"; hibernate = (int)link->query("hibernate"); if (hibernate && time() < hibernate) msg += "/n/t[In hibernation until " + ctime(hibernate) + "]/n/n"; tmp1 = find_player(who); if (tmp1) { if (!filter_users(tmp1)) tmp1 = 0; } if (!link->query("last_on")) msg += (tmp1 ? "On since: " : "Last on: ") + "Unavailable"; else msg += ((tmp1 && !tmp1->query("npc")) ? "On since: " : "Last on: ") + ctime((int)link->query("last_on")) ; if (wizardp(TP)) msg += ( " from " + (string)link->query("ip") + " /n" ); else msg += "/n"; if (tmp1) { tmp1 = query_idle_string(tmp1, 1); if (strlen(tmp1) > 0) msg += tmp1 + "/n"; } mail_stat = (mapping)MAILBOX_D->mail_status(who); if (mail_stat["unread"]) msg += sprintf("%s has not read %d of their %d piece%s of mail./n", capitalize(who), mail_stat["unread"], mail_stat["total"], (mail_stat["total"] == 1 ? "" : "s")); else { msg += "No unread mail" ; if(this_player()) { if (adminp(getuid(this_player()))) { // msg += " ("+mail_stat["total"]+" pieces)" ; msg += sprintf(" (%d piece%s)", mail_stat["total"], (mail_stat["total"] == 1 ? "" : "s")); } } msg += "./n" ; } if (link->query("wizard")) { tmp1 = user_path(who) + ".project"; if (file_size(tmp1) >= 0) msg += "Project: " + read_file(tmp1); tmp1 = user_path(who) + ".plan"; if (file_size(tmp1) >= 0) { msg += "Plan:/n" + read_file(tmp1); } else { msg += "No Plan./n"; } } else { if (body->query("session")) tmp1 = iwrap("Session: "+body->query("session")); else tmp1 = "No Session./n"; msg += tmp1; } msg += LINE1; if (!find_player(who) || !interactive(find_player(who))) { link->remove(); // Some names like .foo weren't getting away. if(link) destruct(link); if(link) log_file("fingerdest",sprintf("Connection of %s not "+ "dested by finger daemon, on %s./n", link->query("name"), ctime(time()))); if(body) destruct(body); if(body) log_file("fingerdest",sprintf("Connection of %s not "+ "dested by finger daemon, on %s./n", body->query("name"), ctime(time()))); } return "/n" + msg + "/n";}
开发者ID:ClockworkSoul,项目名称:MortalRemains,代码行数:101,
示例24: notify_fail return 0; } if(!archp(this_player()) && (string)this_player()->query_position() != "mentor") { notify_fail("You are not allowed to sponsor anyone!/n"); return 0; } who->set_level(1); seteuid(UID_ADVANCE); who->set_position("immortal"); seteuid(UID_ARCHSAVE); write_file("/adm/etc/sponsor", str+" ("+(string)this_player()->query_name()+ ":"+ctime(time())+")/n"); seteuid(getuid()); message("info", sprintf("You are now a full immortal!/nYour home " "directory is %s.", user_path(str)), who); message("info", sprintf("%s is now a full immortal!", capitalize(str)), users(), ({ who })); seteuid(UID_CRESAVE); mkdir("/wizards/"+lower_case(str)); write_file(user_path(str)+"workroom.c", read_file("/std/obj/workroom.c")); seteuid(getuid()); return 1;}void help() { write("Syntax: <sponsor [player]>/n/n"+ "Mentors and above may use this command to sponsor new immortals/n"+ "from level 20 immortality to level 21, and it makes the directory/n"+ "as well./n");}
开发者ID:ehershey,项目名称:pd,代码行数:30,
注:本文中的user_path函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ user_path_at函数代码示例 C++ user_memcpy函数代码示例 |