1*956e8222Scf46844 /* 2*956e8222Scf46844 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 3*956e8222Scf46844 * Use is subject to license terms. 4*956e8222Scf46844 */ 5*956e8222Scf46844 67c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 77c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 87c478bd9Sstevel@tonic-gate 97c478bd9Sstevel@tonic-gate 107c478bd9Sstevel@tonic-gate /* 117c478bd9Sstevel@tonic-gate * Copyright (c) 1980 Regents of the University of California. 127c478bd9Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement 137c478bd9Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 147c478bd9Sstevel@tonic-gate */ 157c478bd9Sstevel@tonic-gate 16*956e8222Scf46844 #pragma ident "%Z%%M% %I% %E% SMI" 177c478bd9Sstevel@tonic-gate 187c478bd9Sstevel@tonic-gate #include <stdio.h> 197c478bd9Sstevel@tonic-gate 20*956e8222Scf46844 int 21*956e8222Scf46844 main(int argc, char **argv) 227c478bd9Sstevel@tonic-gate { 23*956e8222Scf46844 char *p1, *p2, *p3; 247c478bd9Sstevel@tonic-gate 257c478bd9Sstevel@tonic-gate if (argc < 2) { 267c478bd9Sstevel@tonic-gate (void)putchar('\n'); 277c478bd9Sstevel@tonic-gate exit(1); 287c478bd9Sstevel@tonic-gate } 297c478bd9Sstevel@tonic-gate p1 = argv[1]; 307c478bd9Sstevel@tonic-gate p2 = p1; 317c478bd9Sstevel@tonic-gate while (*p1) { 327c478bd9Sstevel@tonic-gate if (*p1++ == '/') 337c478bd9Sstevel@tonic-gate p2 = p1; 347c478bd9Sstevel@tonic-gate } 357c478bd9Sstevel@tonic-gate if (argc>2) { 367c478bd9Sstevel@tonic-gate for(p3=argv[2]; *p3; p3++) 377c478bd9Sstevel@tonic-gate ; 387c478bd9Sstevel@tonic-gate while(p3>argv[2]) 397c478bd9Sstevel@tonic-gate if(p1 <= p2 || *--p3 != *--p1) 407c478bd9Sstevel@tonic-gate goto output; 417c478bd9Sstevel@tonic-gate *p1 = '\0'; 427c478bd9Sstevel@tonic-gate } 437c478bd9Sstevel@tonic-gate output: 447c478bd9Sstevel@tonic-gate fputs(p2, stdout); 457c478bd9Sstevel@tonic-gate putc('\n', stdout); 46*956e8222Scf46844 return (0); 477c478bd9Sstevel@tonic-gate } 48