void setup() { set_light(100); set_short("Small Gods Street outside Temple"); set_long( "You are on Small Gods Street outside the Temple of Small Gods. "+ "A large gateway to the west leads into the Temple. The "+ "street continues north and south.\n"); add_exit("north", ROOM+"smallgod1", "road"); add_exit("south", ROOM+"smallgod3", "road"); add_exit("west", TEMPLE, "gate"); add_item("temple", "It is the Temple of Small Gods. It is covered in small statues.\n"); add_alias("temple of small gods", "temple"); add_item("gateway", "This is a large wrought-iron set of gates which have been open for so many years "+ "that they appear to have rusted permanently open. Various and sundry "+ "religious symbols are situated over the top of the gateway.\n"); add_alias("gate", "gateway"); add_alias("gates", "gateway"); add_item("symbols", "From the look of it the many different symbols are all "+ "collected from the myriad of small obscure gods that are worshipped "+ "in Ankh-Morpork.\n"); add_alias("symbol", "symbols"); set_zone("ankh morpork"); set_monster(NUM, "city"); }
void extra_create() { set_name( "tendrils" ); add_alias( "tendril" ); add_alias( "tendrils" ); set_short( "some writhing black tendrils" ); set_ansi_short ( sprintf( "%ssome writhing black tendrils%s", HIK, NORM ) ); set_long( "These horrible black tendrils writhe and grip about wildly." ); set_alignment( DEMONIC_AL ); set_stat( "str" , 200 ); set_stat( "con" , 300 ); set_stat( "wil" , 300 ); set_stat( "dex" , 130 ); set_skill( "dodge", 65 ); set( NoStealP ); set( NoStunP ); set_natural_ac( 3 ); set_heal_rate( 30 ); set_heal_amount( 6 ); set_max_damage( 10 ); set_aggressive( 1 ); add_combat_message( "grope", "gropes" ); add_combat_message( "slither on", "slither on" ); }
void extra_create() { switch( random( 3 ) ) { case 0 : colorname = "green" ; color = GRN; break; case 1 : colorname = "blue" ; color = BLU; break; case 2 : colorname = "purple" ; color = MAG; break; } set_name( "a slime" ); add_alias( "slime" ); add_alias( sprintf( "%s slime", colorname ) ); set_short( sprintf( "a %s slime", colorname ) ); set_ansi_short ( sprintf( "%sa %s slime", color, colorname ) ); set_long( sprintf( "This slime oozes sloppily through the room absorbing " "bits and pieces off of the mushrooms around it. Inside of its " "%s colored body you can see quite a bit of material. " "Hopefully it doesn't try to digest you!", colorname ) ); set_race( FRACE "slime" ); set_alignment( NEUTRAL_AL ); set_stat( "str" , 200 ); set_stat( "con" , 300 ); set_proficiency( "hands", 150 ); set_skill( "dodge", 65 ); set( NoStealP, 1 ); set( NoStunP, 1 ); set_natural_ac( 10 ); set_heal_rate( 20 ); set_heal_amount( 60 ); set_chat_rate( 30 ); set_chat_chance( 50 ); add_phrase( "#emote squelches along." ); add_phrase( "#emote jiggles wildly." ); set_move_rate( 40 ); set_move_chance( 50 ); set_pick_up_rate( 60 ); set_pick_up_chance( 0 ); set_heart_beat( 30 ); add_special_attack( "mimic", THISO, 30 ); }
void setup_route(string* stops, string colour, string route, string language) { string prettystops = ""; int i; set_short(route + " table"); add_adjective(map(explode(route, " "), (: lower_case($1) :))); add_adjective(colour); add_alias("table"); add_alias("cardboard"); add_adjective(({"piece", "of", colour}));
void setup() { set_dom(DOMAIN); set_light(100); add_exit("drum", "/d/am/am/mendeddrum", "door"); set_short("Common room of "+DOM_TITLE); set_long("Large relaxing chairs addorn the room. The walls are covered "+ "with strange motifs from different lands and the little shelf "+ "above the fireplace is chocker block full of strange figurines "+ "and bits of cloth. It appears to be the common room of "+ DOM_TITLE+" the large red letters on the wall were the " + "give away.\n"); add_alias("chairs", "chair"); add_alias("cloths", "cloth"); add_alias("motifs", "motif"); add_alias("figurines", "figurine"); add_item("chair", "The chairs are lazing around the room relaxing it looks "+ "like they come here after a hard days working in "+ DOM_TITLE+".\n"); add_item("fireplace", "A nice little fire place with a cheery fire burning "+ "in it keeping every one warm.\n"); add_item("figurine", "Small figurines, they look strangely familiar "+ "until you realise they are the members of "+ DOM_TITLE+".\n"); add_item("cloth", "Strange coloured bits of cloth strewn over the "+ "mantlepice for no readily apparent reason.\n"); add_item("motif", "The motifs on close inspection look like stylised "+ "signatures of all the members of "+DOM_TITLE+ ". Some of them are very strange, in fact there "+ "seem to be more than there are members of the house. "+ "perhaps it is the members of the future.\n"); add_item("shelf", "A nice normal sort of shelf thing. It is like all "+ "those ones you see in houses all over the place, "+ "execpt... the way it has been burnt... hmm it does "+ "not look like the fire did it.\n"); add_item("fire", "There is a fire happily burning away in the fireplace "+ "spluttering and crackling to itself. The flames almost "+ "seem afraid of something. Looking closer you notice a "+ "picture tacked to the side of the fire place.\n"); add_item("picture", "Tacked to the inside wall of the fire thingy, you "+ "know the hole bit at the bottom, is a small picture "+ "it looks like it was taken with the best of demon "+ "photography. It is a picture of a person holding "+ "a small staff, you think it might be "+LORD+ " but you are not sure as the fire light sparkles "+ "in your eyes.\n"); board = clone_object("/obj/misc/board"); board->set_datafile(DOMAIN); board->move(this_object()); }
int check_builtin(char *cmd) { /* Arguments: cmd = program to run Purpose: this function checks to see if the cmd specified is a built in command (in this case only "cd" is built-in) Returns: 0 -- if the cmd is built in -1 -- if the cmd is NOT built in */ if(!strcmp(cmd,"cd")) { //command was "cd" which is a builtin, so //lets handle it add_nav_history(fullPath); chdir(args[1]); //change directory to first argument get_path(); } else if(cmd[0] == '!') { //theyre requesting some sort of history exec_history(cmd); //execute the argument number } else if(cmd[0] == '@') { //requesting nav history exec_nav_history(cmd); get_path(); } else if(!strcmp(cmd,"history")) { print_history(); } else if(!strcmp(cmd, "navhist")) { print_nav_history(); } else if(!strcmp(cmd,"alias")) { //trying to set an alias if(args[1] == NULL) { //no argument, so just print all print_aliases(); } else { add_alias(args[1]); } } else if(!strcmp(cmd,"unalias")) { //trying to remove an alias (args[1] is what is being removed) remove_alias(args[1]); } else if(!strcmp(cmd,"cinterp")) { //want to use the C interpreter //quit raw mode first (will make the cinterp easier) quit_raw_mode(); cinterp(); tty_raw_mode(); //reenter raw mode } else { return -1; } return 0; }
void setup() { set_name("blue demon"); set_long("A blue small demon with a large green note book. He is a demon "+ "with a purpose. He scrutinises everyone who passes by looking "+ "for that special person. He is on a mission from a frog.\n"); add_alias("blue"); add_adjective(({ "small", "blue" }));
int poclidek__add_aliases(struct poclidek_ctx *cctx, tn_hash *htcnf) { tn_array *keys; int i, n = 0; keys = n_hash_keys(htcnf); for (i=0; i < n_array_size(keys); i++) { const char *name, *cmdline; name = n_array_nth(keys, i); if (*name == '_') /* config macro */ continue; if ((cmdline = poldek_conf_get(htcnf, name, NULL))) if (add_alias(cctx, name, cmdline)) n++; } n_array_free(keys); if (n) find_aliased_commands(cctx); return n; }
/****************************************************************************** * * * Function: load_aliases * * * * Purpose: load aliases from configuration * * * * Parameters: lines - aliase entries from configuration file * * * * Comments: calls add_alias() for each entry * * * ******************************************************************************/ void load_aliases(char **lines) { char **pline, *r, *c; for (pline = lines; NULL != *pline; pline++) { r = *pline; if (SUCCEED != parse_key(&r) || ':' != *r) { zabbix_log(LOG_LEVEL_CRIT, "cannot add alias \"%s\": invalid character at position %ld", *pline, (r - *pline) + 1); exit(EXIT_FAILURE); } c = r++; if (SUCCEED != parse_key(&r) || '\0' != *r) { zabbix_log(LOG_LEVEL_CRIT, "cannot add alias \"%s\": invalid character at position %ld", *pline, (r - *pline) + 1); exit(EXIT_FAILURE); } *c++ = '\0'; add_alias(*pline, c); *--c = ':'; } }
int rotz_add_alias(rotz_t ctx, rtz_vtx_t v, const char *alias) { size_t aliaz = strlen(alias); const_buf_t al; rtz_vtxkey_t akey; rtz_vtx_t tmp; /* first check if V is already there, if not get an id and add that */ if ((tmp = get_vertex(ctx, alias, aliaz)) && tmp != v) { /* alias points to a different vertex already * we return -2 here to indicate this, so that callers that * meant to combine 2 tags can use rotz_combine() */ return -2; } else if (UNLIKELY(tmp)) { /* ah, tmp == v, don't bother putting it in again */ ; } else if (UNLIKELY(put_vertex(ctx, alias, aliaz, v) < 0)) { return -1; } /* check aliases */ if ((al = get_aliases(ctx, akey = rtz_vtxkey(v))).d != NULL && UNLIKELY(find_in_buf(al, alias, aliaz) != NULL)) { /* alias is already in the list */ return 0; } else if (UNLIKELY(add_alias(ctx, akey, alias, aliaz) < 0)) { return -1; } return 1; }
void setup() { // string *doms, com; // int i; set_light(100); set_short("domain-control room"); add_property("determinate", "the "); set_long("You float in nothingness, before a vast turtle, its shell pocked " "by asteroid craters. In all directions stars twinkle in the black " "curtain of space.\n" "Available commands:\n" " list : list all domains.\n" " list <domain> : list members of a domain.\n" " create <domain> : create a domain (you are lord).\n" " create <domain> <lord> : create a domain for someone else.\n" " add <creator> <domain> : add a creator to a domain you own.\n" " delete <creator> <domain> : remove a creator from a domain you own.\n" " project <cre> <dom> <proj> : Set the creators project.\n" " deputy <cre> <dom> : Appoint creator as a deputy.\n" " undeputy <cre> <dom> : Remove creator as a deputy.\n" ); add_item("turtle", "On its back you can see four elephants, and they bear " + "the weight of the disc upon their wide backs.\n"); add_item("elephants", "The four great elephants labour endlessly in the " + "task of turning the disc upon their backs.\n"); add_item("disc", "The whole discworld, from hub to rim, rides upon the " + "elephant's backs.\n"); add_alias("elephant", "elephants"); add_exit("north", ROOM+"development", "corridor"); add_exit("south", ROOM+"site_control", "corridor"); add_exit("west", ROOM+"access_control", "corridor"); seteuid("Admin"); } /* setup() */
void extra_create() { set_name( "a beholder" ); add_alias( "beholder" ); set_short( "a beholder" ); set_long( "This is a beholder. It is essentially a floating head " "with one single, cyclops-like eye surrounded by ten smaller eye " "stalks. Its massive, gaping maw is set in a permanent grin. " "It looks like a sphere covered in eyes, with extra eyes " "growing out of it. Little eye sprouts if you will." ); set_gender( "unknown" ); set_race( MON "beholder_race" ); //set_guild() //set_specialization set_skill( "dodge", 50 ); set_alignment( -4000 ); set_stat( "str", random( 5000 ) ); set_stat( "con", random( 5000 ) ); set_proficiency( "hands", 50 ); set_move_rate( 60 ); set_move_chance( 50 ); set_aggressive( 3 ); add_combat_message( "smack", "smacks" ); add_combat_message( "slup", "slurps" ); add_combat_message( "grab", "grabs" ); set_type( "blunt" ); set_hit_bonus( 2 ); //So many eyes. set_heal_rate( 30 ); set_heal_amount( random( THISO->query_max_hp() ) - random( 300 ) ); set_natural_ac( 5 ); set( "loot", 1 ); add_money( random( 1000 ) ); add_special_attack( "blastem", THISO, 10 ); }
void extra_create() { set_name("pamela"); add_alias("pam"); set_short(SHORT); set("sdesc", SHORT); set_long("DOH! What you are looking at probably has to " "be the finest specimen of human anatomy ever " "created. Everything is in the right proportion " "and she knows how to use it. The fact that she is " "naked almost drives you crazy, and you feel a " "sudden urge to stare at her.\n"); set_race("human"); set_gender("female"); set_stat("str",120); set_stat("int",20); set_stat("wil",100); set_stat("con",250); set_stat("dex",100); set_stat("chr",300); set_proficiency("hands", 10 + random(5)); set_aggressive(0); set_alignment("neutral"); set_natural_ac(2); //Silicone implants set(MonsterP, 1); set_chat_chance(95); set_chat_rate(random(10)+60); add_phrase("Pamela giggles.\n"); add_phrase("Pamela wonders where the beach is.\n"); add_phrase("Pamela looks at you.\n"); }
void setup() { set_short("Xrazzicaz' Boot Camp"); add_property("determinate", ""); set_light( 75 ); add_property("no teleport", 1); set_long("This is a small training room, designed to help the new " "adventurer get off to a good start on Discworld. The air is " "stale with the combined stench of sweat, beer, and old " "warriors. Off to one side is a rather unusual training " "dummy above which is a small plaque.\n"); add_item( "face", "As you stare at it, squinting and turning your head " "side to side, you realise it looks rather like your old maths " "teacher!\n"); add_item( "floor", "The floor is made of flagstones, cemented together " "with centuries of accumulated muck.\n"); add_item( "wall", "The walls are marked with mysterious stains that may or " "may not be blood. But surely training dummies don't bleed.\n"); add_item( "ceiling", "The ceiling appears to be dingy patches of plaster " "stuck between old oak rafters that have turned black with " "age.\n"); /* Make it so you cannot godmother out of here */ add_property("no godmother", 1); add_exit( "combat", PATH + "combat", "door" ); add_alias( "southeast", "foyer"); }/*setup*/
void extra_create() { set_name("ivy"); add_alias("ivy"); set_short("The Archive"); set_long("some generic long"); set_race("human"); set_alignment("good"); set_stat("str",15); set_stat("dex",15); set_stat("con",45+random(15)); set_stat("int",275); set_stat("chr",15); set_stat("wil",15); set_skill("dodge", 15); set_percent_bonus_exp(10); set_max_damage(8); set_natural_ac(2); set_chat_chance(30); set_chat_rate(1); add_phrase("The ice around The Archive sweats.\n"); }
void extra_create() { set_name( "The Great Pumpkin" ); add_alias( "pumpkin" ); add_alias( "great" ); add_alias( "great pumpkin" ); add_alias( "the great pumpkin" ); add_alias( "great pumpkin" ); set_short( "The Great Pumpkin" ); set_ansi_short( YEL "The Great Pumpkin" ); set_long( "Great might be an understatement. This " "pumpkin is gargantuan. Its face is comprised of " "two oddly spaced eyes and a row of very sharp teeth. " "Its legs are a mass of green tendrils. Amongst the tendrils " "you can make out a mess of wires. Someone has rebuilt this " "creature. They had the technology. They had the capability " "to build the world's first bionic pumpkin. Better than it " "was before. Better, stronger, faster." ); set_gender( "unknown" ); set_race( RACE ); set_alignment( NEUTRAL_AL ); set_percent_bonus_exp( -50 ); //12mil xp was pretty excessive. set_stat( "str", 5000 ); set_stat( "con", 5000 ); set_proficiency( "hands", 150 ); set_skill( "dodge", 200 ); set( NoStealP, 1 ); set( NoStunP, 1 ); set_natural_ac( 10 ); set_heal_rate( 30 ); set_heal_amount( 1000 ); set_move_rate( 60 ); set_move_chance( 50 ); set_wander_dir( ({ "/zone/null/eternal/", "/zone/guild/" }) );
void setup() { set_name("purple demon"); set_long("A small purple demon with a large note book. He is looking "+ "furtively around the room. He seems in somewhat of a hurry.\n"); add_alias("demon"); set_short("Purple demon"); set_level(-2); add_adjective(({ "purple", "short" }));
void extra_create() { object ob; set_name( "Paula Spleen" ); add_alias( "paula" ); add_alias( "spleen" ); add_alias( "paula spleen" ); add_alias( "Paula Spleen" ); set_short( "Paula Spleen" ); set_long( "This here be Paula. She is famous round these parts fer " "being the best durn cook this side-a the mississipper. " "She sure must love herself some butter, cuz she's five " "hunred pounds if shesa ounce yessireeee yeeehawwww." ); set_race( "pig" ); set_gender( "female" ); set_alignment( 250 ); set_stat( "str", 500 ); set_stat( "int", 1 ); set_stat( "wil", 800 ); set_stat( "con", 500 ); set_stat( "dex", 300 ); set_stat( "chr", 1500 ); set_max_fatigue( 25000 ); set_natural_ac ( 10 ); set_proficiency( "pig-fu", 6 ); set_skill( "dodge", 100 ); set_percent_bonus_exp( -15 ); add_special_attack( "chuck_butter", THISO, 10 ); ob = clone_object( ZOBJ "wig" ); move_object( ob, THISO ); ob = clone_object( ZOBJ "muumuu" ); move_object( ob, THISO ); ob = clone_object( ZOBJ "diabetes" ); if( !ob ) ob = clone_object( ZOBJ "butter" ); move_object( ob, THISO ); call_out( "gear_up", 2 ); }
void extra_create() { set_name( "a horror" ); add_alias( "creature" ); add_alias( "horror" ); add_alias( "indescribable horror" ); set_short( "an indescribable horror" ); set_ansi_short( "an indescribable horror", HIK ); set_long( "Parts, parts, and more parts! This thing has tentacles, " "it has arms, legs, and many mouths. You notice it is missing " "eyes. It is coated in a thick gelatinous black slime. The tentacles " "writhe around its back and its mouths chomp. It flicks its tongues " "out into the air." ); set_gender( "other" ); set_damage_bonus( 2 ); set_alignment( EVIL_AL ); set_stat( "str" , 100 ); set_stat( "con" , 50 ); set_stat( "wil" , 500 ); set_stat( "dex" , 200 ); set_proficiency( "hands", 75 ); set_skill( "dodge", 65 ); set_type( "pyschic" ); set( NoStunP, 1 ); set_aggressive( 4 ); set_natural_ac( 3 ); set_chat_rate( 20 ); set_chat_chance( 20 ); add_phrase( "#say Ack'cthun." ); add_phrase( "#say Masr'snaff. ct'oon." ); add_phrase( "#say Snaral d'fan ar'marak" ); }
void ft_alias(char **tab) { if (tab[1] && tab[2]) { g_alias = del_alias(g_alias, tab[1]); g_alias = add_alias(g_alias, tab[1], tab[2]); } else show_alias(g_alias); }
void extra_create() { object ob; set_name( "Chester" ); add_alias( "chester" ); add_alias( "uncle chester" ); add_alias( "uncle" ); add_alias( "master of arms" ); add_alias( "hill wizard master of arms" ); set_short( "Uncle Chester, Hill Wizard Master of Arms" ); set_long( "Remember that jovial old man who helps teach young boys " "how to properly use and care for their weapons on every " "TV show ever? Well, that's Uncle Chester. He's a kind " "middle aged man with time to spare. He also happens to " "know a whole lot about weaponry! And by that, I mean " "even moreso than your average hillbilly." ); set_race( "human" ); set_gender( "male" ); set_alignment( 500 ); set_stat( "str", 800 ); set_stat( "int", 250 ); set_stat( "wil", 1000 ); set_stat( "con", 1000 ); set_stat( "dex", 400 ); set_stat( "chr", 250 ); set_skill( "dodge", 100 ); set_proficiency( "hands", 50 ); set_max_fatigue( 25000 ); set_natural_ac ( 10 ); set_percent_bonus_exp( -25 ); ob = clone_object( "/zone/present/hillbilly/obj/armor/overalls.c" ); move_object( ob, THISO ); call_out( "gear_up", 1 ); }
void setup() { set_weight(10); set_value(5); set_name("shell"); add_adjective("sea"); add_alias("seashell"); set_short("sea shell"); set_long("A large conch shell. It looks like it has been hollowed "+ "out so that it can be played. Perhaps if you blew into "+ "it it might work.\n"); }
void update_alias(t_info *info, char *init, char *replace) { t_alias *alias; if ((alias = search_alias(info, init))) { free(alias->replace); alias->replace = ft_strdup(replace); } else add_alias(info, ft_strdup(init), ft_strdup(replace)); }
/* Fonction qui est appelée lors de la création d'un alias */ int alias(int argc, char **argv) { char *p; alias_ll *tmp; tmp = liste_alias; /* Manque d'arguments */ if (argc != 2) { fprintf(stderr, "philsh : Usage : alias [-L|name=\"command\"\n"); return ERR_ARG; } /* L'option -p permet d'afficher les alias de la session en cours */ if (!strcmp(argv[1], "-L")) { while(tmp != NULL) { printf("%s aliased to '%s'\n", tmp->name, tmp->cmd); tmp = tmp->next; } return 0; } /* Si la commande n'est pas de la forme alias machin=truc alors * c'est qu'on cherche à afficher un alias */ if (NULL == (p = strchr(argv[1], '='))) { if(NULL == (p = search_alias(liste_alias, argv[1]))) { fprintf(stderr,"philsh: %s is not a valid alias\n", argv[1]); return 1; } return printf("%s aliased to '%s'\n", argv[1], p); } /* On coupe la chaine au =, ainsi argv[1] = machin et p+1 = truc */ *p = '\0'; /* On teste si l'alias n'existe pas déjà */ while(tmp != NULL) { if (!strcmp(tmp->name, argv[1])) { /* Si l'alias existe, on le modifie à sa nouvelle valeur */ free(tmp->cmd); tmp->cmd = malloc(sizeof(char) * (1+strlen(p+1))); strcpy(tmp->cmd, p+1); return 0; } tmp = tmp->next; } /* L'alias n'existe pas ---> on le crée */ liste_alias = add_alias(liste_alias, argv[1], p+1); /* On rajoute l'alias dans la completion */ command_completion = add_file_completion(argv[1], 0, command_completion); return 0; }
void setup() { set_name( "note" ); set_short( "Test note" ) ; set_long( "This note is probably broken, please contact a " "creator. :)\n" ); reset_get(); add_alias( "table" ); } /* setup() */
void extra_create() { set_name( "the ghost of Rifrad" ); add_alias( "rifrad" ); add_alias( "ghost" ); add_alias( "doctor" ); add_alias( "ghost of rifrad" ); set_short( "the ghost of Rifrad" ); set_ansi_short( sprintf( "%sthe ghost of Rifrad", HIK ) ); set_long( "Where there was once a being, there is now a fluctuating " "darkness. A cold ghastly presence. All that remains of Rifrad " "is his incorporal form." ); set_gender( "male" ); set_alignment( NEUTRAL_AL ); set_stat( "str" , 200 ); set_stat( "con" , 200 ); set_stat( "wil" , 500 ); set_stat( "dex" , 200 ); set_proficiency( "hands", 75 ); set_skill( "dodge", 65 ); set_type( "psychic" ); set( NoStunP, 1 ); set( UndeadP, 1 ); set_aggressive( 1 ); set_natural_ac( 3 ); call_out( "hello", 1 ); add_special_attack( "soulwell", THISO, 8 ); }
void create() { do_setup++; object::create(); armour_logic::create(); wearable::create(); add_alias( "armour" ); add_plural( "armours" ); add_help_file("armour"); if ( !query_property( "shop type" ) ) add_property( "shop type", "armoury" ); do_setup--; if ( !do_setup ) this_object()->setup(); } /* create() */
void foreach(u_char *command, u_char *args, u_char *subargs) { u_char *struc = NULL, *ptr, *body = NULL, *var = NULL; u_char **sublist; int total; int i; int slen; if ((ptr = new_next_arg(args, &args)) == NULL) { yell("FOREACH: missing structure expression"); return; } malloc_strcpy(&struc, ptr); malloc_strcat(&struc, UP(".")); upper(struc); if ((var = next_arg(args, &args)) == NULL) { new_free(&struc); yell("FOREACH: missing variable"); return; } while (isspace(*args)) args++; if ((body = next_expr(&args, '{')) == NULL) /* } */ { new_free(&struc); yell("FOREACH: missing statement"); return; } sublist = match_alias(struc, &total, VAR_ALIAS); slen = my_strlen(struc); for (i = 0; i < total; i++) { unsigned display; display = set_display_off(); add_alias(VAR_ALIAS, var, sublist[i]+slen); set_display(display); parse_line(NULL, body, subargs ? subargs : empty_string(), 0, 0, 0); new_free(&sublist[i]); } new_free(&sublist); new_free(&struc); }
/** * Parse a single line of the configuration file. Returns 0 on success or * anything else if an error occurred, it will be rare since most fatal errors * will quit the program with an error message anyways. */ int process_config_line(wchar_t *line, int linenum) { int len; wchar_t *keyword, *name, *value; /* Strip trailing whitespace */ for (len = wcslen(line) - 1; len > 0; len--) { if (wcschr(WHITESPACE, line[len]) == NULL) break; line[len] = '\0'; } /* Get the keyword. (Each line is supposed to begin with a keyword). */ if ((keyword = strdelim(&line)) == NULL) return 0; /* Ignore leading whitespace. */ if (*keyword == '\0') keyword = strdelim(&line); if (keyword == NULL || !*keyword || *keyword == '\n' || *keyword == '#') return 0; /* set varname value */ if (wcscmp(keyword, L"set") == 0) { if ((name = strdelim(&line)) == NULL) { fatal("prwdrc: set without variable name on line %d.\n", linenum); return -1; } value = strdelim(&line); set_variable(name, value, linenum); /* alias short long */ } else if (wcscmp(keyword, L"alias") == 0) { if ((name = strdelim(&line)) == NULL) { fatal("prwdrc: alias without name on line %d.\n", linenum); return -1; } value = strdelim(&line); add_alias(name, value, linenum); /* Unknown operation... God help us. */ } else { fatal("prwdrc: unknown command on line %d.\n", linenum); return -1; } return 0; }
/* * Add alias to the list * Returns 1 on success or 0 if alias with that name already exist */ int add_alias_from_config(char *line) { char *name = NULL, *value = NULL; name = line; value = strchr(line,':'); if(NULL == value) return FAIL; *value = '\0'; value++; return add_alias(name, value); }