Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

suckless unix tools

Name: Anonymous 2015-04-02 21:41

Name: Anonymous 2015-04-29 17:15

>>146
step_6:
//i inits with length of argument 1(directory) = last letter of dirname
//if (current letter of dirname is not NULL(superfluous) and is '/'(slash separator ) decrement i at end of loop
for(i=strlen(argv[1])-1;argv[1][i]&&argv[1][i]=='/';i--)
//set current letter to NULL(0) truncating the string
argv[1][i]=0;
if(argv[1][0])//if first letter isn't NULL
printf("%s\n",argv[1]);//print dirname
else
single_slash: printf("/\n");

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List