Sponsored Content
Full Discussion: Need some help with this...
Top Forums Programming Need some help with this... Post 302138455 by Legend986 on Monday 1st of October 2007 04:58:58 PM
Old 10-01-2007
For some reason, the array paths is getting destroyed after alias does its job. Atleast thats what I observed.. My alias code is something like this:

Code:
if(aliasoption == 1)  {
            strcpy(buff, "csh -c \"alias ");
            strcat(buff, command);
            strcat(buff, wordclose);
            /*printf("%s",final);*/
            fp = popen(buff,"r");
            if(fp == NULL)
            {
                  printf("Handle Error");
            }
            /*else printf("Opened\n");
            printf("You asked for an alias\n");*/
            printf("alias %s= ",command);
            while(fgets(buff,sizeof(buff),fp) != NULL)
                  printf("%s",buff);
            pclose(fp);
            printf("\nNew Line");
        }

Edit: I tried defining paths[] as a Global Variable but no luck...

Last edited by Legend986; 10-01-2007 at 06:16 PM..
 
profil(2)							System Calls Manual							 profil(2)

NAME
profil - execution time profile SYNOPSIS
DESCRIPTION
controls profiling, by which the system maintains estimates of the amount of time the calling program spends executing at various places in its address space. The buff argument must point to an area of memory whose length (in bytes) is given by bufsiz. When profiling is on, the process's program counter (pc) is examined each clock tick times per second), offset is subtracted from the pc value, and the result is multiplied by scale. If the resulting number corresponds to an element inside the array of to which buff points, that element is incremented. The number of samples per second for a given implementation is given by which is defined in The scale is interpreted as an unsigned, sixteen bit, fixed-point fraction with binary point at the left: 0177777 (octal) gives a one-to- one mapping of pc's to words in buff; 077777 (octal) maps each pair of instruction words together. 02(octal) maps all instructions onto the beginning of buff (producing a non-interrupting core clock). Profiling is turned off by giving a scale of 0 or 1. It is rendered ineffective by giving a bufsiz of 0. Profiling is turned off when one of the functions is executed, but remains on in child and parent both after a Profiling is turned off if an update in buff would cause a memory fault. RETURN VALUE
No value is returned. SEE ALSO
prof(1), monitor(3C). STANDARDS CONFORMANCE
profil(2)
All times are GMT -4. The time now is 07:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy