Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
c4224377
Kaydet (Commit)
c4224377
authored
Kas 28, 2014
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Clean up
Change-Id: Idc8aa334dd784b7d55f092b0a0e353bb2f9b38d1
üst
ac28e1c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
136 deletions
+30
-136
pagein.c
desktop/unx/source/pagein.c
+24
-103
pagein.h
desktop/unx/source/pagein.h
+1
-1
start.c
desktop/unx/source/start.c
+5
-32
No files found.
desktop/unx/source/pagein.c
Dosyayı görüntüle @
c4224377
...
...
@@ -26,128 +26,49 @@
#include <string.h>
/* do_pagein */
static
int
do_pagein
(
const
char
*
filename
,
size_t
*
siz
e
)
static
void
do_pagein
(
const
char
*
filenam
e
)
{
int
result
;
file_image
image
=
FILE_IMAGE_INITIALIZER
;
if
(
(
result
=
file_image_open
(
&
image
,
filename
)
)
!=
0
)
return
(
result
)
;
if
(
file_image_open
(
&
image
,
filename
)
!=
0
)
return
;
if
((
result
=
file_image_pagein
(
&
image
))
!=
0
)
{
fprintf
(
stderr
,
"file_image_pagein %s: %s
\n
"
,
filename
,
strerror
(
result
));
goto
cleanup_and_leave
;
}
if
(
size
)
{
*
size
=
image
.
m_size
;
}
cleanup_and_leave:
file_image_close
(
&
image
);
return
(
result
);
}
/* main */
int
pagein_execute
(
int
argc
,
char
**
argv
)
void
pagein_execute
(
char
const
*
path
,
char
const
*
file
)
{
int
i
,
v
=
0
;
size_t
nfiles
=
0
,
nbytes
=
0
;
if
(
argc
<
2
)
char
fullpath
[
4096
];
char
*
p
=
NULL
;
FILE
*
fp
=
0
;
memset
(
fullpath
,
0
,
sizeof
(
fullpath
));
strncpy
(
fullpath
,
path
,
3000
);
if
(
!
(
p
=
strrchr
(
fullpath
,
'/'
)))
p
=
fullpath
;
else
p
++
;
strncpy
(
p
,
file
,
1024
);
p
[
strlen
(
p
)]
=
'\0'
;
if
((
fp
=
fopen
(
fullpath
,
"r"
))
==
0
)
{
fprintf
(
stderr
,
"%s: Usage: pagein [-v[v]] [-L<path>] [@]<filename> ...
\n
"
,
argv
[
0
]);
return
(
1
);
}
for
(
i
=
1
;
i
<
argc
;
i
++
)
fprintf
(
stderr
,
"fopen %s: %s
\n
"
,
fullpath
,
strerror
(
errno
));
return
;
}
while
(
fgets
(
p
,
1024
,
fp
)
!=
0
)
{
FILE
*
fp
=
0
;
size_t
k
=
0
;
if
(
argv
[
i
][
0
]
==
'-'
)
{
/* option */
int
j
=
1
;
switch
(
argv
[
i
][
j
])
{
case
'v'
:
/* verbosity level */
for
(
v
+=
1
,
j
+=
1
;
argv
[
i
][
j
];
j
++
)
v
+=
(
argv
[
i
][
j
]
==
'v'
);
break
;
case
'L'
:
/* search path */
if
(
chdir
(
&
(
argv
[
i
][
2
]))
==
-
1
)
fprintf
(
stderr
,
"chdir %s: %s
\n
"
,
&
(
argv
[
i
][
2
]),
strerror
(
errno
));
break
;
default:
/* ignored */
break
;
}
p
[
strlen
(
p
)
-
1
]
=
'\0'
;
/* next argv */
continue
;
}
if
((
argv
[
i
][
0
]
==
'@'
)
&&
((
fp
=
fopen
(
argv
[
i
],
"r"
))
==
0
))
{
char
fullpath
[
4096
];
char
*
path
=
NULL
;
memset
(
fullpath
,
0
,
sizeof
(
fullpath
));
strncpy
(
fullpath
,
argv
[
i
]
+
1
,
3000
);
if
(
!
(
path
=
strrchr
(
fullpath
,
'/'
)))
path
=
fullpath
;
else
path
++
;
if
((
fp
=
fopen
(
&
(
argv
[
i
][
1
]),
"r"
))
==
0
)
{
fprintf
(
stderr
,
"fopen %s: %s
\n
"
,
&
(
argv
[
i
][
1
]),
strerror
(
errno
));
continue
;
}
while
(
fgets
(
path
,
1024
,
fp
)
!=
0
)
{
path
[
strlen
(
path
)
-
1
]
=
'\0'
,
k
=
0
;
/* paths relative to the location of the pagein file */
if
(
do_pagein
(
fullpath
,
&
k
)
==
0
)
{
/* accumulate total size */
nbytes
+=
k
;
}
if
(
v
>=
2
)
fprintf
(
stderr
,
"pagein(
\"
%s
\"
) = %d bytes
\n
"
,
path
,
(
int
)
k
);
nfiles
+=
1
;
}
fclose
(
fp
);
}
else
{
if
(
fp
!=
0
)
fclose
(
fp
);
if
(
do_pagein
(
argv
[
i
],
&
k
)
==
0
)
{
/* accumulate total size */
nbytes
+=
k
;
}
if
(
v
>=
2
)
fprintf
(
stderr
,
"pagein(
\"
%s
\"
) = %d bytes
\n
"
,
argv
[
i
],
(
int
)
k
);
nfiles
+=
1
;
}
/* paths relative to the location of the pagein file */
do_pagein
(
fullpath
);
}
if
(
v
>=
1
)
fprintf
(
stderr
,
"Total: %d files (%d bytes)
\n
"
,
(
int
)
nfiles
,
(
int
)
nbytes
);
return
(
0
);
fclose
(
fp
);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
desktop/unx/source/pagein.h
Dosyayı görüntüle @
c4224377
...
...
@@ -22,7 +22,7 @@
#include <sal/config.h>
int
pagein_execute
(
int
argc
,
char
**
argv
);
void
pagein_execute
(
char
const
*
path
,
char
const
*
file
);
#endif
...
...
desktop/unx/source/start.c
Dosyayı görüntüle @
c4224377
...
...
@@ -599,42 +599,15 @@ system_checks( void )
#endif
}
static
char
*
build_pagein_path
(
Args
*
args
,
const
char
*
pagein_name
)
{
char
*
path
;
rtl_String
*
app_path
;
app_path
=
ustr_to_str
(
args
->
pAppPath
);
path
=
malloc
(
RTL_CONSTASCII_LENGTH
(
"@"
)
+
app_path
->
length
+
strlen
(
pagein_name
)
+
1
);
strcpy
(
path
,
"@"
);
strcpy
(
path
+
1
,
rtl_string_getStr
(
app_path
));
strcat
(
path
,
pagein_name
);
rtl_string_release
(
app_path
);
return
path
;
}
void
exec_pagein
(
Args
*
args
)
{
char
*
argv
[
3
];
/* don't use -L - since that does a chdir that breaks relative paths */
argv
[
0
]
=
"dummy-pagein"
;
argv
[
1
]
=
build_pagein_path
(
args
,
"pagein-common"
);
rtl_String
*
path
=
ustr_to_str
(
args
->
pAppPath
);
pagein_execute
(
rtl_string_getStr
(
path
),
"pagein-common"
);
if
(
args
->
pPageinType
)
{
argv
[
2
]
=
build_pagein_path
(
args
,
args
->
pPageinType
);
}
else
argv
[
2
]
=
NULL
;
pagein_execute
(
args
->
pPageinType
?
3
:
2
,
argv
);
if
(
argv
[
2
])
free
(
argv
[
2
]);
free
(
argv
[
1
]);
pagein_execute
(
rtl_string_getStr
(
path
),
args
->
pPageinType
);
}
rtl_string_release
(
path
);
}
#if HAVE_FEATURE_JAVA
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment