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..
 
shells(4)							   File Formats 							 shells(4)

NAME
shells - shell database SYNOPSIS
/etc/shells DESCRIPTION
The shells file contains a list of the shells on the system. Applications use this file to determine whether a shell is valid. See getuser- shell(3C). For each shell a single line should be present, consisting of the shell's path, relative to root. A hash mark (#) indicates the beginning of a comment; subsequent characters up to the end of the line are not interpreted by the routines which search the file. Blank lines are also ignored. The following default shells are used by utilities: /bin/bash, /bin/csh, /bin/jsh, /bin/ksh, /bin/pfcsh, /bin/pfksh, /bin/pfsh, /bin/sh, /bin/tcsh, /bin/zsh, /sbin/jsh, /sbin/sh, /usr/bin/bash, /usr/bin/csh, /usr/bin/jsh, /usr/bin/ksh, /usr/bin/pfcsh, /usr/bin/pfksh, /usr/bin/pfsh, and /usr/bin/sh, /usr/bin/tcsh, /usr/bin/zsh. Note that /etc/shells overrides the default list. Invalid shells in /etc/shells may cause unexpected behavior (such as being unable to log in by way of ftp(1)). FILES
/etc/shells lists shells on system SEE ALSO
vipw(1B), ftpd(1M), sendmail(1M), getusershell(3C), aliases(4) SunOS 5.10 4 Jun 2001 shells(4)
All times are GMT -4. The time now is 08:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy